URL
https://opencores.org/ocsvn/riscompatible/riscompatible/trunk
[/] [riscompatible/] [trunk/] [rtl/] [registerbank.vhd] - Blame information for rev 2
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
2 |
borin |
-------------------------------------------------------------------------------------------------------------------
|
2 |
|
|
library ieee;
|
3 |
|
|
use ieee.std_logic_1164.all;
|
4 |
|
|
use ieee.numeric_std.all;
|
5 |
|
|
use work.riscompatible_package.all;
|
6 |
|
|
-------------------------------------------------------------------------------------------------------------------
|
7 |
|
|
entity RegisterBank is
|
8 |
|
|
generic
|
9 |
|
|
(
|
10 |
|
|
NumBitsAddr : natural:=4;
|
11 |
|
|
DataWidth : natural:=32
|
12 |
|
|
);
|
13 |
|
|
port
|
14 |
|
|
(
|
15 |
|
|
Clk_I : in std_logic;
|
16 |
|
|
Enable_I : in std_logic;
|
17 |
|
|
Write_I : in std_logic;
|
18 |
|
|
RegisterW_I : in std_logic_vector(NumBitsAddr-1 downto 0);
|
19 |
|
|
Register1_I : in std_logic_vector(NumBitsAddr-1 downto 0);
|
20 |
|
|
Register2_I : in std_logic_vector(NumBitsAddr-1 downto 0);
|
21 |
|
|
InputData_I : in std_logic_vector(DataWidth-1 downto 0);
|
22 |
|
|
FT1OutputData_O : out std_logic_vector(DataWidth-1 downto 0);
|
23 |
|
|
FT2OutputData_O : out std_logic_vector(DataWidth-1 downto 0)
|
24 |
|
|
);
|
25 |
|
|
end RegisterBank;
|
26 |
|
|
-------------------------------------------------------------------------------------------------------------------
|
27 |
|
|
architecture behavioral of RegisterBank is
|
28 |
|
|
type TMemory is array (natural range <> ) of TRiscoWord;
|
29 |
|
|
signal Memory : TMemory (2**NumBitsAddr-1 downto 0):=(others=>(others=>'0'));
|
30 |
|
|
begin
|
31 |
|
|
|
32 |
|
|
process (Clk_I,Enable_I,Write_I,RegisterW_I,Register1_I,Register2_I,InputData_I,Memory)
|
33 |
|
|
begin
|
34 |
|
|
if rising_edge(Clk_I) then
|
35 |
|
|
if (Enable_I = '1') then
|
36 |
|
|
if (Write_I = '1') then
|
37 |
|
|
if to_integer(unsigned(RegisterW_I))/=0 then -- Never write to R00!
|
38 |
|
|
Memory(to_integer(unsigned(RegisterW_I))) <= InputData_I;
|
39 |
|
|
end if;
|
40 |
|
|
end if;
|
41 |
|
|
end if;
|
42 |
|
|
end if;
|
43 |
|
|
FT1OutputData_O <= Memory(to_integer(unsigned(Register1_I)));
|
44 |
|
|
FT2OutputData_O <= Memory(to_integer(unsigned(Register2_I)));
|
45 |
|
|
end process;
|
46 |
|
|
end behavioral;
|
47 |
|
|
-------------------------------------------------------------------------------------------------------------------
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.