Last active
March 30, 2020 07:09
-
-
Save APadierna/e89c790b03d03d8366f2426e2c301a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library ieee; | |
use ieee.std_logic_1164.all; | |
entity BancoRegistros is | |
generic( | |
nbits : integer : = 16 | |
); | |
port( | |
clk : in std_logic; | |
wr : in std_logic; | |
AddrA, AddrB, WAddr : in std_logic_vector(2 downto 0); | |
WData : in std_logic_vector(nbits-1 downto 0); | |
DataA, DataB : out std_logic_vector(nbits-1 downto 0) | |
); | |
end BancoRegistros; | |
architecture rtl of BancoRegistros is | |
begin | |
process(clk) | |
begin | |
if (clk'event and clk='1') then | |
if wr='1' then | |
reg(to_integer(unsigned(WAddr))) <= WData; | |
end if; | |
reg(0) <= (others=>'0'); | |
DataA <= reg(to_integer(unsigned(AddrA))); | |
DataB <= reg(to_integer(unsigned(AddrB))); | |
end if; | |
end process ; | |
end rtl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment