hithesh123
Full Member level 6
I tried to execute the vhdl code for clocked SRAM. When I simulate 'data' is unknown. output enable is low and chip select is also low.
It's declared as inout.
Code is same as pg. 144 in Mark zwolinski's book except for the clock.
Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
It's declared as inout.
Code is same as pg. 144 in Mark zwolinski's book except for the clock.
Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
Code:
Entity Sram64 is
Port (address : in integer range 0 to 63;
we, oe, cs, clk : in std_logic;
data: inout std_logic_vector ( 7 downto 0)
);
end entity sram64;
Architecture aone of Sram64 is
Begin
process(clk, address, we, oe, cs)
type ram_array is array (0 to 63) of std_logic_vector (7 downto 0);
variable mem : ram_array;
Begin
--data <= (others =>'0');
If rising_edge(clk) then
If ( cs = '0') then -- chip is selected
If (oe='0') then -- Read operation (output enabled)
data <= mem(address);
elsif (we='0') then -- write operation
mem(address):=data;
end if;
end if;
end if;
end process;
end architecture aone;