Program enable added and verified

This commit is contained in:
Florian Reitz 2019-02-14 23:58:48 +01:00
parent 91d54ddd9c
commit 02d9e608e1
5 changed files with 474 additions and 447 deletions

View File

@ -39,7 +39,8 @@ entity AddressDecoder is
NIO_SEL : in std_logic; -- $Cs00 - $CsFF, EEPROM bank 0 NIO_SEL : in std_logic; -- $Cs00 - $CsFF, EEPROM bank 0
NIO_STB : in std_logic; -- $C800 - $CFFF, EEPROM banks 1 to 7 NIO_STB : in std_logic; -- $C800 - $CFFF, EEPROM banks 1 to 7
NRESET : in std_logic; NRESET : in std_logic;
DATA_EN : out std_logic; -- to CPLD DATA_EN : out std_logic; -- to CPLD
PGM_EN : in std_logic; -- from CPLD;
NG : out std_logic; -- to bus transceiver NG : out std_logic; -- to bus transceiver
NOE : out std_logic; -- to EEPROM NOE : out std_logic; -- to EEPROM
NWE : out std_logic); -- to EEPROM NWE : out std_logic); -- to EEPROM
@ -84,7 +85,8 @@ begin
NWE <= RNW NWE <= RNW
or (not NIO_SEL and not NIO_STB) or (not NIO_SEL and not NIO_STB)
or (NIO_SEL and NIO_STB) or (NIO_SEL and NIO_STB)
or (NIO_SEL and ncs); or (NIO_SEL and ncs)
or not PGM_EN;
cfxx <= a_int(8) and a_int(9) and a_int(10) and not nio_stb_int; cfxx <= a_int(8) and a_int(9) and a_int(10) and not nio_stb_int;

View File

@ -50,7 +50,8 @@ ARCHITECTURE behavior OF AddressDecoder_Test IS
NIO_SEL : IN std_logic; NIO_SEL : IN std_logic;
NIO_STB : IN std_logic; NIO_STB : IN std_logic;
NRESET : IN std_logic; NRESET : IN std_logic;
DATA_EN : OUT std_logic; DATA_EN : OUT std_logic;
PGM_EN : IN std_logic;
NG : OUT std_logic; NG : OUT std_logic;
NOE : OUT std_logic; NOE : OUT std_logic;
NWE : OUT std_logic NWE : OUT std_logic
@ -66,7 +67,8 @@ ARCHITECTURE behavior OF AddressDecoder_Test IS
signal NIO_STB : std_logic := '1'; signal NIO_STB : std_logic := '1';
signal NRESET : std_logic := '1'; signal NRESET : std_logic := '1';
signal CLK : std_logic := '0'; signal CLK : std_logic := '0';
signal PHI0 : std_logic := '1'; signal PHI0 : std_logic := '1';
signal PGM_EN : std_logic := '1';
--Outputs --Outputs
signal B : std_logic_vector(10 downto 8); signal B : std_logic_vector(10 downto 8);
@ -91,7 +93,8 @@ BEGIN
NIO_SEL => NIO_SEL, NIO_SEL => NIO_SEL,
NIO_STB => NIO_STB, NIO_STB => NIO_STB,
NRESET => NRESET, NRESET => NRESET,
DATA_EN => DATA_EN, DATA_EN => DATA_EN,
PGM_EN => PGM_EN,
NG => NG, NG => NG,
NOE => NOE, NOE => NOE,
NWE => NWE NWE => NWE
@ -173,13 +176,27 @@ BEGIN
NIO_SEL <= '0'; NIO_SEL <= '0';
wait until falling_edge(PHI0); wait until falling_edge(PHI0);
NIO_SEL <= '1'; NIO_SEL <= '1';
wait until rising_edge(PHI0);
-- CnXX access, write, select, no PGM_EN
-- NG must be '0'
-- NOE must be '1'
-- NWE must be '1'
RNW <= '0';
PGM_EN <= '0';
A <= "0100"; -- must become "000"
wait until rising_edge(PHI0);
NIO_SEL <= '0';
wait until falling_edge(PHI0);
NIO_SEL <= '1';
wait until rising_edge(PHI0); wait until rising_edge(PHI0);
-- C8xx access, selected -- C8xx access, selected
-- NG must be '0' -- NG must be '0'
-- NOE must be '0' -- NOE must be '0'
-- NWE must be '1' -- NWE must be '1'
RNW <= '1'; RNW <= '1';
PGM_EN <= '1';
A <= "1000"; -- must become "001" A <= "1000"; -- must become "001"
wait until rising_edge(PHI0); wait until rising_edge(PHI0);
NIO_STB <= '0'; NIO_STB <= '0';

File diff suppressed because it is too large Load Diff

View File

@ -70,6 +70,7 @@ architecture Behavioral of AppleIISd is
signal addr_low_int : std_logic_vector (1 downto 0); signal addr_low_int : std_logic_vector (1 downto 0);
signal data_en : std_logic; signal data_en : std_logic;
signal pgm_en : std_logic;
component SpiController is component SpiController is
Port ( Port (
@ -87,7 +88,8 @@ Port (
nsel : out std_logic; nsel : out std_logic;
wp : in std_logic; wp : in std_logic;
card : in std_logic; card : in std_logic;
led : out std_logic led : out std_logic;
pgm_en : out std_logic
); );
end component; end component;
@ -103,6 +105,7 @@ Port (
NIO_STB : in std_logic; NIO_STB : in std_logic;
NRESET : in std_logic; NRESET : in std_logic;
DATA_EN : out std_logic; DATA_EN : out std_logic;
PGM_EN : in std_logic;
NG : out std_logic; NG : out std_logic;
NOE : out std_logic; NOE : out std_logic;
NWE : out std_logic NWE : out std_logic
@ -126,7 +129,8 @@ begin
nsel => NSEL, nsel => NSEL,
wp => WP, wp => WP,
card => CARD, card => CARD,
led => LED led => LED,
pgm_en => pgm_en
); );
addDec: AddressDecoder port map( addDec: AddressDecoder port map(
@ -140,6 +144,7 @@ begin
NIO_STB => NIO_STB, NIO_STB => NIO_STB,
NRESET => NRESET, NRESET => NRESET,
DATA_EN => data_en, DATA_EN => data_en,
PGM_EN => pgm_en,
NOE => NOE, NOE => NOE,
NWE => NWE, NWE => NWE,
NG => NG NG => NG

View File

@ -24,7 +24,8 @@ Port (
sclk : out STD_LOGIC; sclk : out STD_LOGIC;
nsel : out STD_LOGIC; nsel : out STD_LOGIC;
wp : in STD_LOGIC; wp : in STD_LOGIC;
card : in STD_LOGIC; card : in STD_LOGIC;
pgm_en : out STD_LOGIC;
led : out STD_LOGIC led : out STD_LOGIC
); );
@ -39,7 +40,8 @@ architecture Behavioral of SpiController is
signal spidatain: std_logic_vector (7 downto 0); signal spidatain: std_logic_vector (7 downto 0);
signal spidataout: std_logic_vector (7 downto 0); signal spidataout: std_logic_vector (7 downto 0);
signal sdhc: std_logic; -- is SDHC card signal sdhc: std_logic; -- is SDHC card
signal inited: std_logic; -- card initialized signal inited: std_logic; -- card initialized
signal pgmen: std_logic; -- enable EEPROM programming
-- spi register flags -- spi register flags
signal tc: std_logic; -- transmission complete; cleared on spi data read signal tc: std_logic; -- transmission complete; cleared on spi data read
@ -66,7 +68,6 @@ architecture Behavioral of SpiController is
signal shiftclk : std_logic; signal shiftclk : std_logic;
begin begin
--led <= not (inited);
led <= not (bsy or not slavesel); led <= not (bsy or not slavesel);
bsy <= start_shifting or shifting2; bsy <= start_shifting or shifting2;
@ -193,7 +194,8 @@ begin
int_miso <= (miso and not slavesel); int_miso <= (miso and not slavesel);
-- outputs -- outputs
nsel <= slavesel; nsel <= slavesel;
pgm_en <= pgmen;
tc_proc: process (ndev_sel, shiftdone) tc_proc: process (ndev_sel, shiftdone)
begin begin
@ -207,14 +209,14 @@ begin
-------------------------- --------------------------
-- cpu register section -- cpu register section
-- cpu read -- cpu read
cpu_read: process(addr, spidatain, tc, bsy, frx, cpu_read: process(addr, spidatain, tc, bsy, frx, pgmen,
ece, divisor, slavesel, wp, card, sdhc, inited) ece, divisor, slavesel, wp, card, sdhc, inited)
begin begin
case addr is case addr is
when "00" => -- read SPI data in when "00" => -- read SPI data in
data_out <= spidatain; data_out <= spidatain;
when "01" => -- read status register when "01" => -- read status register
data_out(0) <= '0'; data_out(0) <= pgmen;
data_out(1) <= '0'; data_out(1) <= '0';
data_out(2) <= ece; data_out(2) <= ece;
data_out(3) <= '0'; data_out(3) <= '0';
@ -247,7 +249,8 @@ begin
divisor <= (others => '0'); divisor <= (others => '0');
spidataout <= (others => '1'); spidataout <= (others => '1');
sdhc <= '0'; sdhc <= '0';
inited <= '0'; inited <= '0';
pgmen <= '0';
elsif (card = '1') then elsif (card = '1') then
sdhc <= '0'; sdhc <= '0';
inited <= '0'; inited <= '0';
@ -255,7 +258,8 @@ begin
case addr is case addr is
when "00" => -- write SPI data out (see other process above) when "00" => -- write SPI data out (see other process above)
spidataout <= data_in; spidataout <= data_in;
when "01" => -- write status register when "01" => -- write status register
pgmen <= data_in(0);
ece <= data_in(2); ece <= data_in(2);
frx <= data_in(4); frx <= data_in(4);
-- no bit 5 - 7 -- no bit 5 - 7
@ -273,4 +277,3 @@ begin
end process; end process;
end Behavioral; end Behavioral;