|
Revision 8216, 1.2 KB
(checked in by mcarrick, 5 years ago)
|
|
initial check in of CLA
|
| Line | |
|---|
| 1 | -- test bench for CLA |
|---|
| 2 | |
|---|
| 3 | library ieee; |
|---|
| 4 | use ieee.std_logic_1164.all; |
|---|
| 5 | |
|---|
| 6 | entity test_CLA is |
|---|
| 7 | end entity test_CLA; |
|---|
| 8 | |
|---|
| 9 | architecture test_CLA_tb of test_CLA is |
|---|
| 10 | |
|---|
| 11 | component carry_lookahead_adder is |
|---|
| 12 | generic ( numBits : integer := 4 |
|---|
| 13 | ); |
|---|
| 14 | port ( a : in std_logic_vector(numBits-1 downto 0); |
|---|
| 15 | b : in std_logic_vector(numBits-1 downto 0); |
|---|
| 16 | cIn : in std_logic; |
|---|
| 17 | s : out std_logic_vector(numBits-1 downto 0); |
|---|
| 18 | cOut : out std_logic |
|---|
| 19 | ); |
|---|
| 20 | end component carry_lookahead_adder; |
|---|
| 21 | |
|---|
| 22 | signal A, B, S : std_logic_vector(3 downto 0); |
|---|
| 23 | signal CIN, COUT : std_logic; |
|---|
| 24 | |
|---|
| 25 | begin |
|---|
| 26 | |
|---|
| 27 | CLA_inst : carry_lookahead_adder |
|---|
| 28 | generic map ( numBits => 4 |
|---|
| 29 | ) |
|---|
| 30 | port map ( a => A, |
|---|
| 31 | b => B, |
|---|
| 32 | cIn => CIN, |
|---|
| 33 | s => S, |
|---|
| 34 | cOut => COUT |
|---|
| 35 | ); |
|---|
| 36 | |
|---|
| 37 | enter_inputs : process |
|---|
| 38 | begin |
|---|
| 39 | |
|---|
| 40 | A <= x"0"; |
|---|
| 41 | B <= x"0"; |
|---|
| 42 | CIN <= '0'; |
|---|
| 43 | |
|---|
| 44 | wait for 5 ns; |
|---|
| 45 | A <= x"0"; |
|---|
| 46 | B <= x"1"; |
|---|
| 47 | CIN <= '1'; |
|---|
| 48 | |
|---|
| 49 | wait for 5 ns; |
|---|
| 50 | A <= x"2"; |
|---|
| 51 | B <= x"2"; |
|---|
| 52 | CIN <= '0'; |
|---|
| 53 | |
|---|
| 54 | wait for 5 ns; |
|---|
| 55 | A <= x"F"; |
|---|
| 56 | B <= x"1"; |
|---|
| 57 | CIN <= '0'; |
|---|
| 58 | |
|---|
| 59 | wait for 5 ns; |
|---|
| 60 | A <= x"F"; |
|---|
| 61 | B <= x"F"; |
|---|
| 62 | CIN <= '1'; |
|---|
| 63 | |
|---|
| 64 | wait for 5 ns; |
|---|
| 65 | A <= x"A"; |
|---|
| 66 | B <= x"5"; |
|---|
| 67 | CIN <= '1'; |
|---|
| 68 | |
|---|
| 69 | wait for 5 ns; |
|---|
| 70 | |
|---|
| 71 | end process enter_inputs; |
|---|
| 72 | |
|---|
| 73 | end architecture test_CLA_tb; |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|