www.pudn.com > uart_v11.zip > Par_Gen.tdf
%////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // PROJECT: Parameterized Parity Generator. // // Keith Willis // // Copyright © 1998. All Rights Reserved. // // // // You may use or distribute this module freely, provided you do not remove this // // copyright notice or modify the contents of this file. // // If you have questions or comments, feel free to contact me by email at // // kcwillis@mech.eng.usyd.edu.au // // // // AUTHOR: Keith Willis // // // // MODULE: Par_Gen.tdf // // // // DESCRIPTION: AHDL File for Parameterized Parity Checker. // // // // VERSION: 1.0 // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////% TITLE "Parameterized Parity Checker"; %////////////////// // INCLUDE FILES // //////////////////% INCLUDE "lpm_dff.inc"; INCLUDE "lpm_add_sub.inc"; INCLUDE "lpm_compare.inc"; INCLUDE "lpm_constant.inc"; %//////////////////////////// // USER-DEFINED PARAMETERS // ////////////////////////////% PARAMETERS ( WIDTH=1 ); %///////////////////// // INPUTS & OUTPUTS // /////////////////////% SUBDESIGN Par_Gen ( D[WIDTH-1..0] : INPUT; ODD/EVEN : OUTPUT; ) %///////////////////////// // VARIABLE DEFINITIONS // /////////////////////////% VARIABLE OUT[WIDTH-1..0] : NODE; %////////////////// // LOGIC SECTION // //////////////////% BEGIN ASSERT (WIDTH > 0) REPORT "Value of WIDTH parameter must be greater than 0" SEVERITY ERROR; OUT[0] = D[0]; FOR i IN 1 TO WIDTH-1 GENERATE OUT[i] = OUT[i-1] $ D[i]; END GENERATE; ODD/EVEN=OUT[WIDTH-1]; END;