DIVYA SUDHA
Newbie level 2
- Joined
- Feb 25, 2012
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Kakinada, A.P
- Activity points
- 1,312
hi friends ....I Have problem in executing the following 32bit register file code in VHDL. So anyone suggest me the coorections in the following code plz
end if;
end process;
end Behavioral;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity regfile is Port ( Ra : in std_logic_vector(4 downto 0); Rb : in std_logic_vector(4 downto 0); Rw : in std_logic_vector(4 downto 0); RegWr : in std_logic; clk : in std_logic; busW:in std_logic_vector(31 downto 0); busA : out std_logic_vector(31 downto 0); busB : out std_logic_vector(31 downto 0)); end regfile; architecture Behavioral of regfile is type reg_file is array (31 downto 0) of std_logic_vector(31 downto 0); signal regarray:reg_file(0 to 31):=(x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000",x"00000000"); begin process(Ra,Rb,Rw,RegWr,clk,busW) variable addr_a,addr_b,addr_w:integer; begin addr_a:=CONV_INTEGER(Ra); addr_b:=CONV_INTEGER(Rb); addr_w:=CONV_INTEGER(Rw); busA<=regarray(addr_a);--Read R[Ra] busB<=regarray(addr_b);--Read R[Rb] if (clk'event and clk='1') then ----wait for active clock edge if (Regwr='1') then --—see if write signal is active regarray(addr_w)<=busW;--write the data end if;
end if;
end process;
end Behavioral;
Last edited by a moderator: