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

Subversion Repositories tinycpu

[/] [tinycpu/] [trunk/] [src/] [registerfile.vhd] - Diff between revs 19 and 27

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 19 Rev 27
--registerfile module
--registerfile module
--16 registers, read/write port for all registers. 
--16 registers, read/write port for all registers. 
--8 bit registers
--8 bit registers
 
 
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.NUMERIC_STD.ALL;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
use work.tinycpu.all;
use work.tinycpu.all;
 
 
entity registerfile is
entity registerfile is
 
 
port(
port(
  WriteEnable: in regwritetype;
  WriteEnable: in regwritetype;
  DataIn: in regdatatype;
  DataIn: in regdatatype;
  Clock: in std_logic;
  Clock: in std_logic;
  DataOut: out regdatatype
  DataOut: out regdatatype
);
);
end registerfile;
end registerfile;
 
 
architecture Behavioral of registerfile is
architecture Behavioral of registerfile is
  type registerstype is array(0 to 15) of std_logic_vector(7 downto 0);
  type registerstype is array(0 to 15) of std_logic_vector(7 downto 0);
  signal registers: registerstype;
  signal registers: registerstype;
  --attribute ram_style : string;
  --attribute ram_style : string;
  --attribute ram_style of registers: signal is "distributed";
  --attribute ram_style of registers: signal is "distributed";
begin
begin
  regs: for I in 0 to 15 generate
  regs: for I in 0 to 15 generate
    process(WriteEnable(I), DataIn(I), Clock)
    process(WriteEnable(I), DataIn(I), Clock)
    begin
    begin
      if rising_edge(Clock) then
      if falling_edge(Clock) then --I really hope this one falling_edge component doesn't bite me in the ass later
        if(WriteEnable(I) = '1') then
        if(WriteEnable(I) = '1') then
          registers(I) <= DataIn(I);
          registers(I) <= DataIn(I);
        end if;
        end if;
      end if;
      end if;
    end process;
    end process;
    DataOut(I) <= registers(I);
    DataOut(I) <= registers(I);
  end generate regs;
  end generate regs;
 
 

powered by: WebSVN 2.1.0

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