-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSNC_TB.vhd
89 lines (68 loc) · 1.82 KB
/
SNC_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
library ieee;
use ieee.std_logic_1164.ALL;
entity SNC_TB is
end SNC_TB;
architecture behavior of SNC_TB is
-- Component Declaration for the Unit Under Test (UUT)
component SNC
port(
PINF : in std_logic;
NINF : in std_logic;
NAN : in std_logic;
SIGN : in std_logic;
EXP : in std_logic_vector(7 downto 0);
MAN : in std_logic_vector(22 downto 0);
Z : out std_logic_vector(31 downto 0)
);
end component;
--Inputs
signal PINF : std_logic := '0';
signal NINF : std_logic := '0';
signal NAN : std_logic := '0';
signal SIGN : std_logic := '0';
signal EXP : std_logic_vector(7 downto 0) := (others => '0');
signal MAN : std_logic_vector(22 downto 0) := (others => '0');
--Outputs
signal Z : std_logic_vector(31 downto 0);
-- No clocks detected in port list. Replace <clock> below with
-- appropriate port name
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: SNC PORT MAP (
PINF => PINF,
NINF => NINF,
NAN => NAN,
SIGN => SIGN,
EXP => EXP,
MAN => MAN,
Z => Z
);
process
begin
wait for 100 ns;
PINF <= '1'; -- there's an infinity
NINF <= '0';
NAN <= '0';
SIGN <= '1';
EXP <= "10101111";
MAN <= "00000101011111001010010";
-- output should be
wait for 30 ns;
PINF <= '1';
NINF <= '0';
NAN <= '1';
SIGN <= '1';
EXP <= "10111111";
MAN <= "00000101011111001010010";
-- output should be NaN
wait for 30 ns;
PINF <= '0';
NINF <= '0';
NAN <= '0';
SIGN <= '0';
EXP <= "11111111";
MAN <= "00000101011111001010010";
-- output should be inf
wait;
end process;
end;