-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCONTROL_tb.vhdl
101 lines (83 loc) · 2 KB
/
CONTROL_tb.vhdl
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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.env.all;
entity CONTROL_tb is
end entity;
architecture testbench of CONTROL_tb is
-- Component declaration
component CONTROL
port (
CLK : in std_logic;
RESET : in std_logic;
OPCODE : out std_logic_vector(6 downto 0);
CONTROL_WORD : out std_logic_vector(19 downto 0)
);
end component;
-- Signals for test bench
signal CLK : std_logic;
signal RESET : std_logic;
signal OPCODE : std_logic_vector(6 downto 0);
signal CONTROL_WORD : std_logic_vector(19 downto 0);
begin
-- Instantiate the design under test
uut : CONTROL
port map(
CLK => CLK,
RESET => RESET,
OPCODE => OPCODE,
CONTROL_WORD => CONTROL_WORD
);
-- Stimulus process
clk_process : process
begin
-- Initialize clock signal
while now < 1000 ns loop
CLK <= '1';
wait for 5 ns;
CLK <= '0';
wait for 5 ns;
end loop;
wait;
end process;
counter_process : process
begin
RESET <= '1';
wait for 10 ns;
RESET <= '0';
wait for 10 ns;
-- initialize register 0
-- 0000000000000011
-- initialize register 1
-- 0010000000000011
-- initialize register 2
-- 0100000000000011
-- initialize register 3
-- 0110000000000011
-- initialize register 4
-- CONTROL_WORD <= "1000000000000011";
-- DATA_IP <= "00000100";
-- wait for 10 ns;
-- -- initialize register 5
-- CONTROL_WORD <= "1010000000000011";
-- DATA_IP <= "00000101";
-- wait for 10 ns;
-- -- initialize register 6
-- CONTROL_WORD <= "1100000000000011";
-- DATA_IP <= "00000110";
-- wait for 10 ns;
-- -- initialize register 7
-- CONTROL_WORD <= "1110000000000011";
-- DATA_IP <= "00000111";
-- wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
wait for 10 ns;
stop(0);
end process;
end architecture;