-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtb_parity.vhd
54 lines (49 loc) · 1.18 KB
/
tb_parity.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
-- parity calculation testbench
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity tb_parity is
end tb_parity;
architecture bhv of tb_parity is
signal a : std_logic_vector(7 downto 0) := (others => '0');
signal t, p : std_logic;
begin
uut : entity work.parity(rtl)
port map( a => a, t => t, p => p);
process
begin
-- testing for even parity
t <= '0';
a <= (others => '0');
wait for 10 ns;
a <= "01000000";
wait for 10 ns;
a <= "00000001";
wait for 10 ns;
a <= "01000100";
wait for 10 ns;
a <= "01010010";
wait for 10 ns;
a <= "01010011";
wait for 10 ns;
a <= "11111111";
wait for 30 ns;
-- testing for odd parity
t <= '1';
a <= (others => '0');
wait for 10 ns;
a <= "01000000";
wait for 10 ns;
a <= "00000001";
wait for 10 ns;
a <= "01000100";
wait for 10 ns;
a <= "01010010";
wait for 10 ns;
a <= "01010011";
wait for 10 ns;
a <= "11111111";
wait for 10 ns;
wait;
end process;
end bhv;