-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathripple_carry_adder_tb.vhd
52 lines (41 loc) · 1.2 KB
/
ripple_carry_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
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use std.env.finish;
entity ripple_carry_adder_tb is
end;
architecture behave of ripple_carry_adder_tb is
signal r_a, r_b : std_logic_vector(7 downto 0) := (others => '0');
signal w_sum: std_logic_vector(7 downto 0) := (others => '0');
signal w_carry: std_logic := '0';
begin
UUT: entity work.ripple_carry_adder
port map (
a => r_a,
b => r_b,
o_sum => w_sum,
o_carry => w_carry
);
process is
begin
r_a <= X"AA";
r_b <= X"10";
wait until (r_a = X"AA" and r_b = X"10");
wait for 25ns;
assert(w_sum = X"BA" and w_carry = '0')
report "ERROR w_sum is no equal to BA"
severity error;
r_a <= X"FF";
r_b <= X"01";
wait until (r_a = X"FF" and r_b = X"01");
wait for 25ns;
assert(w_sum = X"00" and w_carry = '1')
report "ERROR w_sum is no equal to 00"
severity error;
r_a <= X"FF";
r_b <= X"FF";
wait until (r_a = X"FF" and r_b = X"FF");
wait for 25ns;
finish;
end process;
end behave ; -- behave