-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_tb.vhd
64 lines (57 loc) · 1.32 KB
/
control_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
use WORK.all;
library ieee;
use IEEE.std_logic_1164.all;
entity CONTROL_TEST_BENCH is
end CONTROL_TEST_BENCH;
architecture TEST of CONTROL_TEST_BENCH is
signal IorD, MemWrite, MemRead,
MemtoReg, IRWrite, PCSource,
RegDst, RegWrite, ALUSrcA,
PCSel : std_logic;
signal clk : std_logic := '0';
signal rst, Z : std_logic;
signal Op : std_logic_vector(5 downto 0);
signal ALUOp, ALUSrcB : std_logic_vector(1 downto 0);
begin
control : entity work.control(behave)
port map (
clk => clk,
rst => rst,
Z => Z,
Op => Op,
IorD => IorD,
MemWrite => MemWrite,
MemRead => MemRead,
MemtoReg => MemtoReg,
IRWrite => IRWrite,
PCSource => PCSource,
RegDst => RegDst,
RegWrite => RegWrite,
ALUSrcA => ALUSrcA,
PCSel => PCSel,
ALUOp => ALUOp,
ALUSrcB => ALUSrcB
);
process(clk) begin
clk <= not clk after 1 ns;
end process;
-- run for 52 ns
process begin
wait for 1 ns;
rst <= '1';
wait for 1 ns;
rst <= '0';
Op <= "100011";
Z <= '0';
wait for 10 ns; -- 5 clk pulses - max
Op <= "101011";
wait for 10 ns;
Op <= "000000";
wait for 10 ns;
Op <= "000100";
wait for 10 ns;
rst <= '1';
wait for 10 ns;
wait;
end process;
end TEST;