--File : pc_cpu.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
use IEEE.STD_LOGIC_ARITH.all;
entity gc_cpu is
port(
SCLK: in std_logic; --50M--
QCLK: in std_logic; --133M--
ext_reset : in STD_LOGIC; --not (HRESET and SRESET) active high
CPU_GE_CS : in STD_LOGIC;
CPU_PORTX_A : in STD_LOGIC_VECTOR(21 downto 0);
CPU_PORTX_OE : in STD_LOGIC;
CPU_PORTX_WE : in STD_LOGIC;
CPU_PORTX_D : inout STD_LOGIC_VECTOR(7 downto 0);
CPU_PORTX_INT13 : out STD_LOGIC
);
end gc_cpu;
architecture gc_cpu of gc_cpu is
type array_8bit is array (21 downto 0) of std_logic_vector(7 downto 0);
signal ram : array_8bit;
signal cs : std_logic;
signal oe : std_logic;
signal we : std_logic;
signal addr_in: std_logic_vector(21 downto 0);
signal data_in, data_out: std_logic_vector(7 downto 0);
begin
cs <= CPU_GE_CS;
oe <= CPU_PORTX_OE;
we <= CPU_PORTX_WE;
addr_in <= CPU_PORTX_A;
--write
process(QCLK)
begin
if QCLK'event and QCLK = '1' then
if we = '0' and cs = '0' then
ram(conv_integer(addr_in)) <= data_in;
end if;
end if;
end process;
--read
process(QCLK, ext_reset)
begin
if ext_reset = '1' then
data_out <= (o