Altera_Forum
Honored Contributor
16 years agoVHDL code for a sram
hi I am looking for a VHDL code for a sram with something unusual which is an Upper- and a Lower- Byte control. I do not know how to handle this! i have already written this part of code but it is not finished yet
entity sram is port (clk : in std_logic; ce : in std_logic; oe : in std_logic; we : in std_logic; LB : in std_logic; UB : in std_logic; addr : in std_logic_vector(17 downto 0); data_in : in std_logic_vector(15 downto 0); data_out : out std_logic_vector(15 downto 0)); end sram; architecture syn of sram is type ram_type is array (143 downto 0) of std_logic_vector (15 downto 0); signal RAM: ram_type; signal temp: STD_LOGIC_VECTOR (15 downto 0); begin process (clk) begin if clk'event and clk = '1' then if en = '0' then if oe = '1' and we='1' then report "Mauvaise valeur des signaux" severity warning; elsif we='0' then if UB='1' and LB='0' then temp <= "00000000"&data_in[7]&data_in[6]&data_in[5]&data_in[4]&data_in[3]&data_in[2]&data_in[1]&data_in[0]; data_in <= temp; RAM(conv_integer(addr)) <= data_in; elsif UB='0' and LB='1' then temp <= data_in[15]&data_in[14]&data_in[13]&data_in[12]&data_in[11]&data_in[10]&data_in[9]&data_in[8]&"00000000"; data_in <= temp; RAM(conv_integer(addr)) <= data_in; elsif UB='0' and LB='0' then RAM(conv_integer(addr)) <= data_in; end if; elsif oe='0' then if we='0' then report "Mauvaise valeur des signaux" severity warning; elsif we='1' then if LB='0' and UB='1 ' then ?????????????????????????????? data_out <= RAM(conv_integer(addr)) ; end if; end if; end if; end process; end syn; thnak you