M
Moikel
Guest
Hey all,
We're doing a project in college where we have to simulate a small
Motorolla 68K system which includes a RAM (HM6116P), in VHDL. However,
although the read operation is working correctly, we cannot seem to
write to the RAM. The data bus is bidirectional, and we suspect this
may have something to do with it. Here's our code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity HM6116P is
Port ( ADDR : in std_logic_vector(7 downto 0);
DATA : inout std_logic_vector(7 downto 0);
OE : in std_logic;
WE : in std_logic;
CS : in std_logic);
end HM6116P;
architecture Behavioral of HM6116P is
subtype byte is std_logic_vector( 7 downto 0 );
type mem_matrix is array (0 to 256) of byte;
shared variable matrix:mem_matrix;
shared variable data_var: std_logic_vector (7 downto 0):="00000000";
begin
readrocess (CS,OE) is
begin
if (CS ='1') then
data_var := "ZZZZZZZZ";
else
if OE = '0' then
data_var := matrix(conv_integer(ADDR));
end if;
end if;
DATA <= data_var;
end process;
writerocess (CS,WE) is
begin
if (CS='0') then
if WE = '0' then
matrix (conv_integer(ADDR)):= DATA;
end if;
end if;
data_var:= DATA;
end process;
DATA <= data_var;
end Behavioral;
------------------------------------------------
OE , WE and CS are all active low and ADDR and DATA are the address and
data buses respectively. If somebody could help, it would be great as
our deadline is looming!
Thanks a lot,
Mike
We're doing a project in college where we have to simulate a small
Motorolla 68K system which includes a RAM (HM6116P), in VHDL. However,
although the read operation is working correctly, we cannot seem to
write to the RAM. The data bus is bidirectional, and we suspect this
may have something to do with it. Here's our code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity HM6116P is
Port ( ADDR : in std_logic_vector(7 downto 0);
DATA : inout std_logic_vector(7 downto 0);
OE : in std_logic;
WE : in std_logic;
CS : in std_logic);
end HM6116P;
architecture Behavioral of HM6116P is
subtype byte is std_logic_vector( 7 downto 0 );
type mem_matrix is array (0 to 256) of byte;
shared variable matrix:mem_matrix;
shared variable data_var: std_logic_vector (7 downto 0):="00000000";
begin
readrocess (CS,OE) is
begin
if (CS ='1') then
data_var := "ZZZZZZZZ";
else
if OE = '0' then
data_var := matrix(conv_integer(ADDR));
end if;
end if;
DATA <= data_var;
end process;
writerocess (CS,WE) is
begin
if (CS='0') then
if WE = '0' then
matrix (conv_integer(ADDR)):= DATA;
end if;
end if;
data_var:= DATA;
end process;
DATA <= data_var;
end Behavioral;
------------------------------------------------
OE , WE and CS are all active low and ADDR and DATA are the address and
data buses respectively. If somebody could help, it would be great as
our deadline is looming!
Thanks a lot,
Mike