URL
https://opencores.org/ocsvn/tinycpu/tinycpu/trunk
[/] [tinycpu/] [trunk/] [src/] [registerfile.vhd] - Blame information for rev 2
Go to most recent revision |
Details |
Compare with Previous |
View Log
| Line No. |
Rev |
Author |
Line |
| 1 |
2 |
earlz |
library IEEE;
|
| 2 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
| 3 |
|
|
use IEEE.NUMERIC_STD.ALL;
|
| 4 |
|
|
use ieee.std_logic_unsigned.all;
|
| 5 |
|
|
|
| 6 |
|
|
entity registerfile is
|
| 7 |
|
|
port(
|
| 8 |
|
|
Write:in std_logic_vector(7 downto 0); --what should be put into the write register
|
| 9 |
|
|
SelRead:in std_logic_vector(2 downto 0); --select which register to read
|
| 10 |
|
|
SelWrite:in std_logic_vector(2 downto 0); --select which register to write
|
| 11 |
|
|
UseWrite:in std_logic; --if the register should actually be written to
|
| 12 |
|
|
Clock:in std_logic;
|
| 13 |
|
|
Read:out std_logic_vector(7 downto 0) --register to be read output
|
| 14 |
|
|
);
|
| 15 |
|
|
end registerfile;
|
| 16 |
|
|
|
| 17 |
|
|
architecture Behavioral of registerfile is
|
| 18 |
|
|
type registerstype is array(0 to 7) of std_logic_vector(7 downto 0);
|
| 19 |
|
|
signal registers: registerstype;
|
| 20 |
|
|
begin
|
| 21 |
|
|
writereg: process(Write, SelWrite, UseWrite, Clock)
|
| 22 |
|
|
begin
|
| 23 |
|
|
if(UseWrite='1') then
|
| 24 |
|
|
if(rising_edge(clock)) then
|
| 25 |
|
|
registers(conv_integer(SelWrite)) <= Write;
|
| 26 |
|
|
end if;
|
| 27 |
|
|
end if;
|
| 28 |
|
|
end process;
|
| 29 |
|
|
Read <= registers(conv_integer(SelRead));
|
| 30 |
|
|
end Behavioral;
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.