-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRCA_TB.vhd
69 lines (51 loc) · 1.3 KB
/
RCA_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
library ieee;
use ieee.std_logic_1164.ALL;
entity RCA_TB is
end RCA_TB;
architecture behavior of RCA_TB is
component RCA
generic(width: integer); -- using a 8 bit RCA
port(
X : in std_logic_vector(7 downto 0);
Y : in std_logic_vector(7 downto 0);
CIN : in std_logic;
S : out std_logic_vector(7 downto 0);
COUT : out std_logic
);
end component;
--Inputs
signal X : std_logic_vector(7 downto 0);
signal Y : std_logic_vector(7 downto 0);
signal CIN : std_logic;
--Outputs
signal S : std_logic_vector(7 downto 0);
signal COUT : std_logic;
begin
-- Instantiate the Unit Under Test (UUT)
UUT: RCA
generic map (width => 8)
port map (
X => X,
Y => Y,
CIN => CIN,
S => S,
COUT => COUT
);
process
begin
X <= "00000000";
Y <= "00000000";
CIN <= '0';
wait for 100 ns;
X <= "00000001";
Y <= "00000001";
CIN <= '1';
-- output should be 00000011
wait for 20 ns;
X <= "01010101";
Y <= "10101010";
CIN <= '0';
-- output should be 11111111
wait;
end process;
end;