-
Notifications
You must be signed in to change notification settings - Fork 0
/
tb_IF_ID.vhd
94 lines (73 loc) · 2.64 KB
/
tb_IF_ID.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
-- Testbench automatically generated online
-- at http://vhdl.lapinoo.net
-- Generation date : 29.3.2019 19:41:54 GMT
library ieee;
use ieee.std_logic_1164.all;
entity tb_IF_ID is
end tb_IF_ID;
architecture tb of tb_IF_ID is
component IF_ID
port (Clock : in std_logic;
Reset : in std_logic;
IFIDStall : in std_logic;
IFIDFlush : in std_logic;
PCIn : in std_logic_vector (31 downto 0);
InstructionIn : in std_logic_vector (31 downto 0);
PCOut : out std_logic_vector (31 downto 0);
InstructionOut : out std_logic_vector (31 downto 0));
end component;
signal Clock : std_logic;
signal Reset : std_logic;
signal IFIDStall : std_logic;
signal IFIDFlush : std_logic;
signal PCIn : std_logic_vector (31 downto 0);
signal InstructionIn : std_logic_vector (31 downto 0);
signal PCOut : std_logic_vector (31 downto 0);
signal InstructionOut : std_logic_vector (31 downto 0);
constant TbPeriod : time := 1000 ns; -- EDIT Put right period here
signal TbClock : std_logic := '0';
signal TbSimEnded : std_logic := '0';
begin
dut : IF_ID
port map (Clock => Clock,
Reset => Reset,
IFIDStall => IFIDStall,
IFIDFlush => IFIDFlush,
PCIn => PCIn,
InstructionIn => InstructionIn,
PCOut => PCOut,
InstructionOut => InstructionOut);
-- Clock generation
TbClock <= not TbClock after TbPeriod/2 when TbSimEnded /= '1' else '0';
-- EDIT: Check that Clock is really your main clock signal
Clock <= TbClock;
stimuli : process
begin
-- EDIT Adapt initialization as needed
Reset <= '0';
IFIDStall <= '0';
IFIDFlush <= '0';
PCIn <= (others => '0');
InstructionIn <= (others => '0');
-- EDIT Add stimuli here
wait for 2.5 * TbPeriod;
PCIn <= x"0000ffff";
InstructionIn <= x"00110011";
wait for 2 * TbPeriod;
IFIDStall <= '1';
PCIn <= x"ffff0000";
InstructionIn <= x"11001100";
wait for 1 * TbPeriod;
IFIDStall <= '0';
IFIDFlush <= '1';
wait for 1 * TbPeriod;
-- Stop the clock and hence terminate the simulation
TbSimEnded <= '1';
wait;
end process;
end tb;
-- Configuration block below is required by some simulators. Usually no need to edit.
configuration cfg_tb_IF_ID of tb_IF_ID is
for tb
end for;
end cfg_tb_IF_ID;