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

Subversion Repositories tinycpu

[/] [tinycpu/] [trunk/] [src/] [registerfile.vhd] - Blame information for rev 27

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

Line No. Rev Author Line
1 6 earlz
--registerfile module
2 12 earlz
--16 registers, read/write port for all registers. 
3 6 earlz
--8 bit registers
4
 
5 2 earlz
library IEEE;
6
use IEEE.STD_LOGIC_1164.ALL;
7
use IEEE.NUMERIC_STD.ALL;
8
use ieee.std_logic_unsigned.all;
9 12 earlz
use work.tinycpu.all;
10 2 earlz
 
11
entity registerfile is
12 19 earlz
 
13
port(
14
  WriteEnable: in regwritetype;
15
  DataIn: in regdatatype;
16
  Clock: in std_logic;
17
  DataOut: out regdatatype
18
);
19 2 earlz
end registerfile;
20
 
21
architecture Behavioral of registerfile is
22 5 earlz
  type registerstype is array(0 to 15) of std_logic_vector(7 downto 0);
23 2 earlz
  signal registers: registerstype;
24 12 earlz
  --attribute ram_style : string;
25
  --attribute ram_style of registers: signal is "distributed";
26 2 earlz
begin
27 19 earlz
  regs: for I in 0 to 15 generate
28 12 earlz
    process(WriteEnable(I), DataIn(I), Clock)
29 19 earlz
    begin
30 27 earlz
      if falling_edge(Clock) then --I really hope this one falling_edge component doesn't bite me in the ass later
31 19 earlz
        if(WriteEnable(I) = '1') then
32
          registers(I) <= DataIn(I);
33
        end if;
34
      end if;
35
    end process;
36
    DataOut(I) <= registers(I);
37 12 earlz
  end generate regs;
38 2 earlz
end Behavioral;

powered by: WebSVN 2.1.0

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