










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Assignment; Class: Microprocessor Systems; Subject: Electrical & Computer Engr; University: Purdue University-Calumet Campus; Term: Spring 2009;
Typology: Assignments
1 / 18
This page cannot be seen from the preview
Don't miss anything!
ECE 371: Microprocessor Systems Department of Electrical and Computer EngineeringSchool of Engineering, Mathematics, and Science
Purdue University – Calumet
ENTITY <entity_name>
IS GENERIC
( generic declarations … ); PORT ( port declarations … ); END ENTITY
<entity_name>;
label :
IF (Boolean expression)
GENERATE
--concurrent (dataflow) statements--component instantiations--for-generate statements--if-generate statements--selected/conditional assignments END GENERATE
label;
LIBRARY
IEEE; USE^ IEEE.STD_LOGIC_1164.
ALL ;
ENTITY andGate_nbit
IS GENERIC
( N :^ POSITIVE
:= 4 );
PORT ( A, B
:^ IN STD_LOGIC_VECTOR
(N-1^ DOWNTO
0);
F^ :^ OUT^ STD_LOGIC_VECTOR
(N-^1 DOWNTO
F^ :^ OUT^ STD_LOGIC_VECTOR
(N-^1 DOWNTO
END ENTITY
andGate_nbit; ARCHITECTURE
dataflow
OF^ andGate_nbit
IS
BEGIN^ The_AND_Gates :^ FOR
index IN^^0 TO^ N- GENERATE
F(index) <= A(index)
AND^ B(index);
END GENERATE
The_AND_Gates; END ARCHITECTURE
dataflow;
OF^ andGate_nbit
IS
COMPONENT
andGate_nbit
IS GENERIC ( N :
POSITIVE
:= 4 ); PORT ( A, B
:^ IN^ STD_LOGIC_VECTOR
(N-1^ DOWNTO
0);
F^ :^ OUT STD_LOGIC_VECTOR
(N-1^ DOWNTO
END COMPONENT
andGate_nbit; --declare a constant named TWELVE with a value of 12 CONSTANT^
TWELVE :^
POSITIVE^
:= 12;
SIGNAL^ Q, R, S :
STD_LOGIC_VECTOR
(3^ DOWNTO
0);
SIGNAL^ Q, R, S :
STD_LOGIC_VECTOR
(3^ DOWNTO
0);
SIGNAL^ X, Y, Z :
STD_LOGIC_VECTOR
(11^ DOWNTO
0);
BEGIN^ ----------------------------------------------------------------------------^ --since this is a 4-bit AND gate and the default value for parameter N is 4,--a GENERIC MAP is not required.
However, IT IS HIGHLY RECOMMENDED!
---------------------------------------------------------------------------- AND_Gate_4bits : andGate_nbit
PORT MAP
( A => Q, B => R, F => S );
------------------------------------------------------------------------------since this is a 12-bit AND gate and the default value for parameter N is 4,--a GENERIC MAP is required. must provide N with a value of 12----------------------------------------------------------------------------- AND_Gate_12bits : andGate_nbit
GENERIC MAP
( N => TWELVE )
PORT MAP (A => X, B => Y, F=>Z ); END ARCHITECTURE
structure;