------------------------------------------------------------------------------- -- EE762 - Project Assignment #1 -- -- NAME: -- --============================================================================= -- Generic Function Unit Entity ------------------------------------------------------------------------------- ENTITY generic_function IS PORT (A,B,G3,G2,G1,G0 : IN BIT; R : OUT BIT); END generic_function; ------------------------------------------------------------------------------- -- Enter your architecture for the generic function unit here ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- The Test Bench Entity for testing of the generic function block ------------------------------------------------------------------------------- ENTITY p1tb IS END p1tb; ------------------------------------------------------------------------------- -- The Test Bench Architecture - (pr_step1_testbench) ------------------------------------------------------------------------------- ARCHITECTURE test OF p1tb IS TYPE operations IS (opZERO,opNOR,opAbarB,opNOTA,opABbar,opNOTB,opXOR,opNAND, opAND,opXNOR,opB,opABARorB,opA,opAorBbar,opOR,opONE); TYPE oper_type IS ARRAY (0 to 15) of operations; CONSTANT oper_tbl : oper_type := (opZERO,opNOR,opAbarB,opNOTA, opABbar,opNOTB,opXOR,opNAND,opAND,opXNOR,opB,opABARorB,opA, opAorBbar,opOR,opONE); SIGNAL oper : operations; TYPE gval_tbl_type IS ARRAY (0 to 15) of bit_vector (3 downto 0); CONSTANT gval_tbl : gval_tbl_type := ("0000","0001","0010","0011","0100","0101","0110","0111", "1000","1001","1010","1011","1100","1101","1110","1111"); SIGNAL gval : bit_vector (3 downto 0); SIGNAL A,B,R : bit; -- component declaration and configuration **** you must enter -- the architecture name in the FOR ALL statment for ARCH_NAME COMPONENT generic_function PORT (A,B,G3,G2,G1,G0 : IN BIT; R : OUT BIT); END COMPONENT; FOR ALL : generic_function USE ENTITY WORK.generic_function(ARCH_NAME); BEGIN -- test g0 : generic_function PORT MAP(A,B,gval(3),gval(2),gval(1),gval(0),R); applytests : PROCESS BEGIN -- PROCESS applytests outter: FOR i IN 0 TO 15 LOOP oper <= oper_tbl(i); gval <= gval_tbl(i); A <= '0'; B <= '0'; WAIT FOR 25 ns; A <= '0'; B <= '1'; WAIT FOR 25 ns; A <= '1'; B <= '0'; WAIT FOR 25 ns; A <= '1'; B <= '1'; WAIT FOR 25 ns; END LOOP outter; WAIT; END PROCESS applytests; END test;