-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_right_shifter_extender.vhd
110 lines (76 loc) · 2.45 KB
/
test_right_shifter_extender.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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.all;
entity test_right_shifter_extender is
end test_right_shifter_extender;
architecture test of test_right_shifter_extender is
component right_shifter_extender
port (
-- Input vector
x : in std_logic_vector(11 downto 0);
-- Number of bits to shift
count : in std_logic_vector(3 downto 0);
-- Output vector right-shifted count bits which keeps sticky bits to the right
y : out std_logic_vector(14 downto 0)
);
end component;
signal x : std_logic_vector(11 downto 0);
signal count : std_logic_vector(3 downto 0);
signal y : std_logic_vector(14 downto 0);
begin
DUT: right_shifter_extender
port map(
x => x,
count => count,
y => y
);
process
begin
x <= "000001110011";
count <= "0000";
wait for 1 ns;
assert(y = "000001110011000")
report "000001110011 and count 0 wrong"
severity error;
----------
x <= "010001110011";
count <= "1111";
wait for 1 ns;
assert(y = "000000000000001")
report "010001110011 and count 15 wrong"
severity error;
----------
x <= "100001110011";
count <= "1100";
wait for 1 ns;
assert(y = "000000000000101")
report "010001110011 and count 12 wrong"
severity error;
----------
x <= "100001110011";
count <= "0111";
wait for 1 ns;
assert(y = "000000010000111")
report "100001110011 and count 7 wrong"
severity error;
----------
x <= "100001110011";
count <= "0001";
wait for 1 ns;
assert(y = "010000111001100")
report "100001110011 and count 1 wrong"
severity error;
----------
x <= "100001110011";
count <= "0010";
wait for 1 ns;
assert(y = "001000011100110")
report "100001110011 and count 2 wrong"
severity error;
wait for 1 ns;
assert(false)
report "END OF TEST"
severity failure;
end process;
end test;