-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRF8_16TB.vhd
60 lines (52 loc) · 1.92 KB
/
RF8_16TB.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
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use work.all;
entity test_rf is
end test_rf;
architecture behavioural of test_rf is
component register_file
port(rst : in std_logic; clk: in std_logic;
rd_index1, rd_index2: in std_logic_vector(2 downto 0);
rd_data1, rd_data2: out std_logic_vector(15 downto 0);
wr_index: in std_logic_vector(2 downto 0);
wr_data: in std_logic_vector(15 downto 0); wr_enable: in std_logic);
end component;
signal rst, clk, wr_enable : std_logic;
signal rd_index1, rd_index2, wr_index : std_logic_vector(2 downto 0);
signal rd_data1, rd_data2, wr_data : std_logic_vector(15 downto 0);
begin
u0 : register_file port map(
rst,
clk,
rd_index1,
rd_index2,
rd_data1,
rd_data2,
wr_index,
wr_data,
wr_enable
);
process begin
clk <= '0'; wait for 50 ns;
clk<='1'; wait for 50 ns;
end process;
process begin
rst <= '1'; rd_index1 <= "000"; rd_index2 <= "000"; wr_enable <= '0'; wr_index <= "000";
wr_data <= X"0000";
wait until (clk='0' and clk'event); wait until (clk='1' and clk'event); wait until (clk='1' and clk'event);
rst <= '0';
wait until (clk='1' and clk'event); wr_enable <= '1'; wr_data <= X"200a";
wait until (clk='1' and clk'event); wr_index <= "001"; wr_data <= X"0037";
wait until (clk='1' and clk'event); wr_index <= "010"; wr_data <= X"8b00";
wait until (clk='1' and clk'event); wr_index <= "101"; wr_data <= X"f00d";
wait until (clk='1' and clk'event); wr_index <= "110"; wr_data <= X"00fd";
wait until (clk='1' and clk'event); wr_index <= "111"; wr_data <= X"fd00";
wait until (clk='1' and clk'event); wr_enable <= '0';
wait until (clk='1' and clk'event); rd_index2 <= "001";
wait until (clk='1' and clk'event); rd_index1 <= "010";
wait until (clk='1' and clk'event); rd_index2 <= "101";
wait until (clk='1' and clk'event); rd_index1 <= "110";
rd_index2 <= "111"; wait;
end process;
end behavioural;