C
Cazed
Guest
Hi,
I'm trying to interface my fpga with a 8051-uC using the external memory
feature. My problem is that according to my simulations the bus does not
output anything back to aLow (aLow multiplexes low eight address bits and
bidirectional data) when I try to read...Writing data seems to be working
fine though...
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity interface is
port(
aHigh : in std_logic; --Address MSB only one bit needed
aLow : inout std_logic_vector(7 downto 0); --Address LSB
ALE : in std_logic; --adress latch
WE : in std_logic; --Write enable
RD : in std_logic; --Read data
--Internal registers
RAMctrl : buffer std_logic_vector(1 downto 0);
RAMaddress : buffer std_logic_vector(5 downto 0);
RAMdata : buffer std_logic_vector(12 downto 0));
end interface;
architecture behave of interface is
signal address : std_logic_vector(8 downto 0);
begin
--latch in address
process(aHigh, aLow, ALE)
begin
if falling_edge(ALE) then --Latch in address
address(8) <= aHigh;
address(7 downto 0) <= aLow;
end if;
end process;
process(address, WE)
begin
if rising_edge(WE) then --write to register
case address is
when "100000000" => NULL; --STATUS
when "110000001" => RAMdata(7 downto 0) <= aLow;
--CRDLSB
when "110000010" => RAMdata(12 downto 8) <=aLow(4 downto
0);--CRDMSB
when "110000011" => RAMaddress <= aLow(5 downto 0);
--CRADDRESS
when "110000000" => RAMctrl <= aLow(1 downto 0);
--CRCONTROL
when OTHERS => NULL;
end case;
end if;
end process;
process(address, RD)
begin
if falling_edge(RD) then
case address is
when "100000000" => NULL; --STATUS
when "110000001" => aLow <= RAMdata(7 downto 0);
--CRDLSB
when "110000010" => aLow(4 downto 0) <= RAMdata(12 downto
8);--CRDMSB
when "110000011" => aLow(5 downto 0) <= RAMaddress;
when "110000000" => aLow(1 downto 0) <= RAMctrl;
when OTHERS => NULL;
end case;
end if;
if rising_edge(RD) then
aLow <= "ZZZZZZZZ";
end if;
end process;
end behave;
Does the simulated input be anything special to allow the readprocess to
output data on aLow?
Regards
/Ĺke "Cazed" Forslund
I'm trying to interface my fpga with a 8051-uC using the external memory
feature. My problem is that according to my simulations the bus does not
output anything back to aLow (aLow multiplexes low eight address bits and
bidirectional data) when I try to read...Writing data seems to be working
fine though...
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity interface is
port(
aHigh : in std_logic; --Address MSB only one bit needed
aLow : inout std_logic_vector(7 downto 0); --Address LSB
ALE : in std_logic; --adress latch
WE : in std_logic; --Write enable
RD : in std_logic; --Read data
--Internal registers
RAMctrl : buffer std_logic_vector(1 downto 0);
RAMaddress : buffer std_logic_vector(5 downto 0);
RAMdata : buffer std_logic_vector(12 downto 0));
end interface;
architecture behave of interface is
signal address : std_logic_vector(8 downto 0);
begin
--latch in address
process(aHigh, aLow, ALE)
begin
if falling_edge(ALE) then --Latch in address
address(8) <= aHigh;
address(7 downto 0) <= aLow;
end if;
end process;
process(address, WE)
begin
if rising_edge(WE) then --write to register
case address is
when "100000000" => NULL; --STATUS
when "110000001" => RAMdata(7 downto 0) <= aLow;
--CRDLSB
when "110000010" => RAMdata(12 downto 8) <=aLow(4 downto
0);--CRDMSB
when "110000011" => RAMaddress <= aLow(5 downto 0);
--CRADDRESS
when "110000000" => RAMctrl <= aLow(1 downto 0);
--CRCONTROL
when OTHERS => NULL;
end case;
end if;
end process;
process(address, RD)
begin
if falling_edge(RD) then
case address is
when "100000000" => NULL; --STATUS
when "110000001" => aLow <= RAMdata(7 downto 0);
--CRDLSB
when "110000010" => aLow(4 downto 0) <= RAMdata(12 downto
8);--CRDMSB
when "110000011" => aLow(5 downto 0) <= RAMaddress;
when "110000000" => aLow(1 downto 0) <= RAMctrl;
when OTHERS => NULL;
end case;
end if;
if rising_edge(RD) then
aLow <= "ZZZZZZZZ";
end if;
end process;
end behave;
Does the simulated input be anything special to allow the readprocess to
output data on aLow?
Regards
/Ĺke "Cazed" Forslund