-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadder_tb.vhd
112 lines (99 loc) · 2.2 KB
/
adder_tb.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 06/06/2018 02:11:26 PM
-- Design Name:
-- Module Name: adder_tb - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity adder_2bit_tb is
-- Port ( );
end adder_2bit_tb;
architecture Behavioral of adder_2bit_tb is
signal A, B : std_logic_vector(1 downto 0);
signal sum : std_logic_vector(2 downto 0);
component adder_2bit_wrapper is
port (
A : in STD_LOGIC_VECTOR ( 1 downto 0 );
B : in STD_LOGIC_VECTOR ( 1 downto 0 );
sum : out STD_LOGIC_VECTOR ( 2 downto 0 )
);
end component adder_2bit_wrapper;
begin
design_1_i: adder_2bit_wrapper
port map (
A => A,
B => B,
sum => sum
);
simulation : process begin --altered to cover all input combinations
A <= "00";
B <= "00";
wait for 10 ns;
A <= "00";
B <= "01";
wait for 10 ns;
A <= "00";
B <= "10";
wait for 10 ns;
A <= "00";
B <= "11";
wait for 10 ns;
A <= "01";
B <= "00";
wait for 10 ns;
A <= "01";
B <= "01";
wait for 10 ns;
A <= "01";
B <= "10";
wait for 10 ns;
A <= "01";
B <= "11";
wait for 10 ns;
A <= "10";
B <= "00";
wait for 10 ns;
A <= "10";
B <= "01";
wait for 10 ns;
A <= "10";
B <= "10";
wait for 10 ns;
A <= "10";
B <= "11";
wait for 10 ns;
A <= "11";
B <= "00";
wait for 10 ns;
A <= "11";
B <= "01";
wait for 10 ns;
A <= "11";
B <= "10";
wait for 10 ns;
A <= "11";
B <= "11";
wait for 10 ns;
end process;
end Behavioral;