-
Notifications
You must be signed in to change notification settings - Fork 1
/
DENORMALIZED_SUM_TB.vhd
83 lines (57 loc) · 1.66 KB
/
DENORMALIZED_SUM_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
library ieee;
use ieee.std_logic_1164.ALL;
entity DENORMALIZED_SUM_TB is
end DENORMALIZED_SUM_TB;
architecture behavior of DENORMALIZED_SUM_TB is
-- Component Declaration for the Unit Under Test (UUT)
component DENORMALIZED_SUM is
port(
X : in std_logic_vector(24 downto 0);
Y : in std_logic_vector(24 downto 0);
M : out std_logic_vector(23 downto 0);
SIGN : out std_logic;
INCR : out std_logic
);
end component;
--Inputs
signal X : std_logic_vector(24 downto 0);
signal Y : std_logic_vector(24 downto 0);
--Outputs
signal M : std_logic_vector(23 downto 0);
signal SIGN : std_logic;
signal INCR : std_logic;
begin
-- Instantiate the Unit Under Test (UUT)
UUT: DENORMALIZED_SUM
port map (
X => X,
Y => Y,
M => M,
SIGN => SIGN,
INCR => INCR
);
-- Stimulus process
process
begin
X <= "0000000000000000000000000";
Y <= "0000000000000000000000000";
wait for 100 ns;
X <= "0000000000000011011010001"; -- 1745
Y <= "1111111111111110011011111"; -- -801
wait for 20 ns;
X <= "1111111111111100100101110"; -- -1745 (1's complement)
Y <= "1111111111111110011011111"; -- -801
wait for 20 ns;
X <= "0110110100010000000000000"; -- 1745
Y <= "0011001000010000000000000"; -- 801
wait for 20 ns;
X <= "1111111111111100100101110"; -- -1745 (1's complement)
Y <= "0000000000000001100100001"; -- 801
wait for 20 ns;
X <= "1001001011110000000000000"; -- 1745
Y <= "1100110111110000000000000"; -- 801
-- SIGN should be 1
-- INCR should be 1
wait;
end process;
end;