-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRAW_Handler_TB.vhd
More file actions
144 lines (127 loc) · 3.54 KB
/
RAW_Handler_TB.vhd
File metadata and controls
144 lines (127 loc) · 3.54 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 19:30:28 03/30/2018
-- Design Name:
-- Module Name: C:/Users/lymacasm/CENG450_Project/RAW_Handler_TB.vhd
-- Project Name: RegFile_ALU
-- Target Device:
-- Tool versions:
-- Description:
--
-- VHDL Test Bench Created by ISE for module: RAW_Handler
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes:
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- that these types always be used for the top-level I/O of a design in order
-- to guarantee that the testbench will bind correctly to the post-implementation
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--USE ieee.numeric_std.ALL;
ENTITY RAW_Handler_TB IS
END RAW_Handler_TB;
ARCHITECTURE behavior OF RAW_Handler_TB IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT RAW_Handler
PORT(
rst : IN std_logic;
clk : IN std_logic;
wr_en : IN std_logic;
wr_idx : IN std_logic_vector(2 downto 0);
rd_idx1 : IN std_logic_vector(2 downto 0);
rd_idx2 : IN std_logic_vector(2 downto 0);
raw_1 : OUT std_logic_vector(1 downto 0);
raw_2 : OUT std_logic_vector(1 downto 0)
);
END COMPONENT;
--Inputs
signal rst : std_logic := '0';
signal clk : std_logic := '0';
signal wr_en : std_logic := '0';
signal wr_idx : std_logic_vector(2 downto 0) := (others => '0');
signal rd_idx1 : std_logic_vector(2 downto 0) := (others => '0');
signal rd_idx2 : std_logic_vector(2 downto 0) := (others => '0');
--Outputs
signal raw_1 : std_logic_vector(1 downto 0);
signal raw_2 : std_logic_vector(1 downto 0);
-- Clock period definitions
constant clk_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: RAW_Handler PORT MAP (
rst => rst,
clk => clk,
wr_en => wr_en,
wr_idx => wr_idx,
rd_idx1 => rd_idx1,
rd_idx2 => rd_idx2,
raw_1 => raw_1,
raw_2 => raw_2
);
-- Clock process definitions
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
rst <= '1';
wait for 100 ns;
wait for clk_period/2;
rst <= '0';
wait for clk_period;
-- RAW 1 should be 0
-- RAW 2 should be 0
wr_en <= '1';
wr_idx <= "101";
rd_idx1 <= "001";
rd_idx2 <= "011";
wait for clk_period;
-- RAW 1 should be 3
-- RAW 2 should be 0
wr_en <= '1';
wr_idx <= "011";
rd_idx1 <= "101";
rd_idx2 <= "011";
wait for clk_period;
-- RAW 1 should be 2
-- RAW 2 should be 3
wr_en <= '1';
wr_idx <= "100";
rd_idx1 <= "101";
rd_idx2 <= "011";
wait for clk_period;
-- RAW 1 should be 3
-- RAW 2 should be 1
wr_en <= '1';
wr_idx <= "100";
rd_idx1 <= "100";
rd_idx2 <= "101";
wait for clk_period;
-- RAW 1 should be 0
-- RAW 2 should be 1
wr_en <= '1';
wr_idx <= "100";
rd_idx1 <= "101";
rd_idx2 <= "011";
-- insert stimulus here
wait;
end process;
END;