OpenCores
URL https://opencores.org/ocsvn/rise/rise/trunk

Subversion Repositories rise

[/] [rise/] [trunk/] [vhdl/] [tb_register_file.vhd] - Blame information for rev 150

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 cwalter
-- File: tb_register_file.vhd
2
-- Author: Jakob Lechner, Urban Stadler, Harald Trinkl, Christian Walter
3
-- Created: 2006-11-29
4
-- Last updated: 2006-11-29
5
 
6
-- Description:
7
-- Execute stage
8
-------------------------------------------------------------------------------
9
 
10
library ieee;
11
use ieee.std_logic_1164.all;
12
use ieee.std_logic_unsigned.all;
13
use ieee.numeric_std.all;
14 71 jlechner
use work.RISE_PACK.all;
15
use work.RISE_PACK_SPECIFIC.all;
16 35 cwalter
 
17
entity tb_register_file_vhd is
18
end tb_register_file_vhd;
19
 
20
architecture behavior of tb_register_file_vhd is
21
 
22
  -- Component Declaration for the Unit Under Test (UUT)
23
  component register_file
24
    port(
25
      clk         : in  std_logic;
26
      reset       : in  std_logic;
27
      rx_addr     : in  std_logic_vector(3 downto 0);
28
      ry_addr     : in  std_logic_vector(3 downto 0);
29
      rz_addr     : in  std_logic_vector(3 downto 0);
30
      dreg_addr   : in  std_logic_vector(3 downto 0);
31
      dreg_write  : in  std_logic_vector(15 downto 0);
32
      dreg_enable : in  std_logic;
33
      sr_write    : in  std_logic_vector(15 downto 0);
34
      sr_enable   : in  std_logic;
35
      lr_write    : in  std_logic_vector(15 downto 0);
36
      lr_enable   : in  std_logic;
37
      pc_write    : in  std_logic_vector(15 downto 0);
38
      rx_read     : out std_logic_vector(15 downto 0);
39
      ry_read     : out std_logic_vector(15 downto 0);
40
      rz_read     : out std_logic_vector(15 downto 0);
41
      sr_read     : out std_logic_vector(15 downto 0);
42
      pc_read     : out std_logic_vector(15 downto 0)
43
      );
44
  end component;
45
 
46
  --Inputs
47
  signal clk         : std_logic                     := '0';
48
  signal reset       : std_logic                     := '0';
49
  signal rx_addr     : std_logic_vector(3 downto 0)  := (others => '0');
50
  signal ry_addr     : std_logic_vector(3 downto 0)  := (others => '0');
51
  signal rz_addr     : std_logic_vector(3 downto 0)  := (others => '0');
52
  signal dreg_addr   : std_logic_vector(3 downto 0)  := (others => '0');
53
  signal dreg_write  : std_logic_vector(15 downto 0) := (others => '0');
54
  signal dreg_enable : std_logic;
55
  signal sr_write    : std_logic_vector(15 downto 0) := (others => '0');
56
  signal sr_enable   : std_logic;
57
  signal lr_write    : std_logic_vector(15 downto 0) := (others => '0');
58
  signal lr_enable   : std_logic;
59
  signal pc_write    : std_logic_vector(15 downto 0) := (others => '0');
60
 
61
  --Outputs
62
  signal rx_read : std_logic_vector(15 downto 0);
63
  signal ry_read : std_logic_vector(15 downto 0);
64
  signal rz_read : std_logic_vector(15 downto 0);
65
  signal sr_read : std_logic_vector(15 downto 0);
66
  signal pc_read : std_logic_vector(15 downto 0);
67
 
68
begin
69
 
70
  -- Instantiate the Unit Under Test (UUT)
71
  uut : register_file port map(
72
    clk         => clk,
73
    reset       => reset,
74
    rx_addr     => rx_addr,
75
    ry_addr     => ry_addr,
76
    rz_addr     => rz_addr,
77
    dreg_addr   => dreg_addr,
78
    dreg_write  => dreg_write,
79
    dreg_enable => dreg_enable,
80
    rx_read     => rx_read,
81
    ry_read     => ry_read,
82
    rz_read     => rz_read,
83
    sr_write    => sr_write,
84
    sr_enable   => sr_enable,
85
    lr_write    => lr_write,
86
    lr_enable   => lr_enable,
87
    pc_write    => pc_write,
88
    sr_read     => sr_read,
89
    pc_read     => pc_read
90
    );
91
 
92
  process                               -- clock process for CLK,
93
  begin
94
    CLOCK_LOOP : loop
95
      clk <= transport '0';
96
      wait for 10 ns;
97
      clk <= transport '1';
98
      wait for 10 ns;
99
 
100
    end loop CLOCK_LOOP;
101
  end process;
102
 
103
 
104
  process
105
  begin
106
 
107
    reset       <= '0';
108
    dreg_enable <= '0';
109
    sr_enable   <= '0';
110
    lr_enable   <= '0';
111
    wait for 50 ns;
112
    dreg_enable <= '1';
113
    reset       <= '1';
114
    wait for 10 ns;
115
 
116
    dreg_addr  <= "0101";
117
    dreg_write <= "1111111111111111";
118
 
119
    rx_addr <= "0101";
120
 
121
    wait for 40 ns;
122
    dreg_addr  <= "0001";
123
    dreg_write <= "1111111100000000";
124
 
125
    rx_addr <= "0101";
126
 
127
    wait for 40 ns;
128
    dreg_enable <= '0';
129
    wait for 5 ns;
130
    dreg_addr   <= "0000";
131
    dreg_write  <= "0000000011111111";
132
 
133
    wait for 40 ns;
134
    dreg_enable <= '1';
135
    wait for 5 ns;
136
    dreg_addr   <= "0010";
137
    dreg_write  <= "1010101010101010";
138
 
139
 
140
    wait for 30 ns;
141
 
142
    rx_addr <= "0010";
143
    ry_addr <= "0001";
144
    rz_addr <= "0000";
145
 
146
    dreg_addr  <= "0010";
147
    dreg_write <= "1111111111111111";
148
 
149
    wait for 20 ns;
150
 
151
    dreg_addr  <= "1110";
152
    dreg_write <= "1111111100000000";
153
    pc_write   <= "1010101010101010";
154
 
155
    wait for 20 ns;
156
 
157
    dreg_addr  <= "1111";
158
    dreg_write <= "1111111100000000";
159
 
160
    sr_enable <= '1';
161
    sr_write  <= "1010101010101010";
162
 
163
    --wait for
164
 
165
    wait;
166
 
167
  end process;
168
 
169
 
170
end;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.