Advertisement
Randune1

FileRegs

Jan 12th, 2023 (edited)
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.77 KB | Source Code | 0 0
  1. entity File_Regs is
  2.     Port ( Clk : in  STD_LOGIC;
  3.            WrEn : in  STD_LOGIC;
  4.            RdReg1 : in  STD_LOGIC_VECTOR (3 downto 0);
  5.            RdReg2 : in  STD_LOGIC_VECTOR (3 downto 0);
  6.            WrReg : in  STD_LOGIC_VECTOR (3 downto 0);
  7.            WRData : in  STD_LOGIC_VECTOR (15 downto 0);
  8.            RdData1 : out  STD_LOGIC_VECTOR (15 downto 0);
  9.            RdData2 : out  STD_LOGIC_VECTOR (15 downto 0));
  10. end File_Regs;
  11.  
  12. architecture Behavioral of File_Regs is
  13.  
  14.     type tRegs is array(0 to 15) of std_logic_vector(15 downto 0);
  15.     signal s16Regs16: tRegs;
  16. begin
  17.     RdData1 <= s16Regs16(conv_integer(RdReg1));
  18.     RdData2 <= s16Regs16(conv_integer(RdReg2));
  19.    
  20.     s16Regs16(conv_integer(WrReg)) <= WRData when rising_edge(Clk) and WrEn = '1';
  21. end Behavioral;
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement