Fixed Z"-Firmwarebug: fast accelerators fetched the IDE-Information too fast I buffered the databus and hold the datat longer during a read

This commit is contained in:
MHeinrichs
2022-03-06 00:12:14 +01:00
parent 61a36e326f
commit dc65757a8a
16 changed files with 18829 additions and 14595 deletions
+93 -62
View File
@@ -103,6 +103,8 @@ architecture Behavioral of LAN_IDE_CP is
signal Dout1:STD_LOGIC_VECTOR(3 downto 0);
signal AUTO_CONFIG_DONE:STD_LOGIC_VECTOR(1 downto 0);
signal AUTO_CONFIG_DONE_CYCLE:STD_LOGIC_VECTOR(1 downto 0);
signal D_IN:STD_LOGIC_VECTOR(15 downto 0);
signal D_OUT:STD_LOGIC_VECTOR(15 downto 0);
signal SHUT_UP:STD_LOGIC_VECTOR(2 downto 0);
signal IDE_BASEADR:STD_LOGIC_VECTOR(7 downto 0);
signal LAN_BASEADR:STD_LOGIC_VECTOR(7 downto 0);
@@ -120,6 +122,7 @@ architecture Behavioral of LAN_IDE_CP is
signal LAN_INT_D0: std_logic;
signal DS: std_logic;
signal DS_D: std_logic;
signal AS_D: std_logic;
signal LAN_RD_S: std_logic;
signal LAN_WRH_S: std_logic;
signal LAN_WRL_S: std_logic;
@@ -149,6 +152,13 @@ begin
DECODE_RESET <= BERR and reset;
DS <= UDS and LDS;
AS_DELAY: process(CLK_EXT)
begin
if(rising_edge(AMIGA_CLK))then
AS_D <= AS;
end if;
end process;
clock_init: process(CLK_EXT)
begin
@@ -214,7 +224,7 @@ begin
lan_adr_sw <= '0';
cp <= '0';
lancp <= '0';
if(A(23 downto 16) = x"E8" and AUTO_CONFIG_DONE < "11" and CFIN='0')then
if(A(23 downto 16) = x"E8" and AUTO_CONFIG_DONE > "00" and CFIN='0')then
autoconfig <= '1';
end if;
if(A(23 downto 16) = LAN_BASEADR and SHUT_UP(0)='0' )then
@@ -259,9 +269,9 @@ begin
end process lan_int_proc;
--lan signal generation: all Signals are HIGH active!
lan_rw_gen: process (AMIGA_CLK,AS)
lan_rw_gen: process (AMIGA_CLK,reset)
begin
if(AS ='1') then
if(reset ='0') then
LAN_RD_S <= '0';
LAN_WRH_S <= '0';
LAN_WRL_S <= '0';
@@ -315,9 +325,9 @@ begin
end if;
end process ide_enable_gen;
ide_rw_gen: process (AS,AMIGA_CLK)
ide_rw_gen: process (AMIGA_CLK,reset)
begin
if (AS = '1') then
if (reset ='0') then
IDE_R_S <= '1';
IDE_W_S <= '1';
ROM_OE_S <= '1';
@@ -325,7 +335,7 @@ begin
IDE_TERM <= '1';
elsif falling_edge(AMIGA_CLK) then
if(ide='1')then
if(ide='1' and AS ='0')then
if(RW='0')then
--the write goes to the hdd!
IDE_W_S <= '0';
@@ -363,14 +373,14 @@ begin
begin
if reset = '0' then
-- reset active ...
AUTO_CONFIG_DONE_CYCLE <="00";
AUTO_CONFIG_DONE_CYCLE <="11";
Dout1<="1111";
--Dout2<="1111";
SHUT_UP <="111";
IDE_BASEADR<=x"FF";
LAN_BASEADR<=x"FF";
CP_BASEADR<=x"FF";
AUTO_CONFIG_DONE <="00";
AUTO_CONFIG_DONE <="11";
elsif falling_edge(AMIGA_CLK) then -- no reset, so wait for rising edge of the clock
DS_D <= DS;
if(AS='1')then
@@ -378,41 +388,41 @@ begin
elsif(autoconfig= '1' and DS='0') then
case A(6 downto 1) is
when "000000" =>
if(AUTO_CONFIG_DONE < 2)then
if(AUTO_CONFIG_DONE > 1)then
Dout1 <= "1100" ; --ZII, No-System-Memory, no ROM
else
Dout1 <= "1101" ; --ZII, no System-Memory, ROM
end if;
when "000001" => Dout1 <= "0001" ; --one Card, 64KB =001
when "000010" =>
if(AUTO_CONFIG_DONE < 2)then
if(AUTO_CONFIG_DONE > 1)then
Dout1 <= "1000" ; --ProductID high nibble : 7->1000
else
Dout1 <= "1111" ; --ProductID high nibble : 0->1111
end if;
when "000011" =>
if(AUTO_CONFIG_DONE = 0)then
if(AUTO_CONFIG_DONE = 3)then
Dout1 <= "0100" ; --ProductID low nibble: B->0100
elsif(AUTO_CONFIG_DONE = 1)then
elsif(AUTO_CONFIG_DONE = 2)then
Dout1 <= "0011" ; --ProductID low nibble: C->0011
else
Dout1 <= "1001" ; --ProductID low nibble: 6->1001
end if;
when "001000" => Dout1 <= "1111" ; --Ventor ID 0
--when "001000" => Dout1 <= "1111" ; --Ventor ID 0
when "001001" =>
if(AUTO_CONFIG_DONE < 2)then
if(AUTO_CONFIG_DONE > 1)then
Dout1 <= "0101" ; --Ventor ID 1
else
Dout1 <= "0111" ; --Ventor ID 1
end if;
when "001010" =>
if(AUTO_CONFIG_DONE < 2)then
if(AUTO_CONFIG_DONE > 1)then
Dout1 <= "1110" ; --Ventor ID 2
else
Dout1 <= "1101" ; --Ventor ID 2
end if;
when "001011" =>
if(AUTO_CONFIG_DONE < 2)then
if(AUTO_CONFIG_DONE > 1)then
Dout1 <= "0011" ; --Ventor ID 3 : $0A1C: A1K.org
else
Dout1 <= "0011" ; --Ventor ID 3 : $082C: BSC
@@ -421,56 +431,84 @@ begin
when "001101" => Dout1 <= "1110" ; --Serial byte 0 (msb) low nibble
when "001110" => Dout1 <= "1001" ; --Serial byte 1 high nibble
when "001111" => Dout1 <= "0100" ; --Serial byte 1 low nibble
when "010000" => Dout1 <= "1111" ; --Serial byte 2 high nibble
when "010001" => Dout1 <= "1111" ; --Serial byte 2 low nibble
--when "010000" => Dout1 <= "1111" ; --Serial byte 2 high nibble
--when "010001" => Dout1 <= "1111" ; --Serial byte 2 low nibble
when "010010" => Dout1 <= "0100" ; --Serial byte 3 (lsb) high nibble
when "010011" => Dout1 <= "1010" ; --Serial byte 3 (lsb) low nibble: B16B00B5
--when "010100" => Dout1 <= "1111" ; --Rom vector high byte high nibble
--when "010101" => Dout1 <= "1111" ; --Rom vector high byte low nibble
--when "010110" => Dout1 <= "1111" ; --Rom vector low byte high nibble
when "010111" =>
if(AUTO_CONFIG_DONE = 2)then
Dout1 <= "1110" ; --Rom vector low byte low nibble
else
Dout1 <= "1111" ; --Rom vector low byte low nibble
end if;
when "010111" => Dout1 <= "1110" ; --Rom vector low byte low nibble ;
when "100000" => Dout1 <= "0000" ; --Interrupt config: all zero
when "100001" => Dout1 <= "0000" ; --Interrupt config: all zero
when "100100" =>
Dout1 <= "1111" ;
if(RW='0' and DS_D='1')then
if(AUTO_CONFIG_DONE = 0)then
if(RW='0')then
if(AUTO_CONFIG_DONE = 3)then
LAN_BASEADR(7 downto 0) <= D(15 downto 8); --Base adress
SHUT_UP(0) <='0'; --enable board
AUTO_CONFIG_DONE_CYCLE <= "01"; --done here
elsif(AUTO_CONFIG_DONE = 1)then
AUTO_CONFIG_DONE_CYCLE <= "10"; --done here
elsif(AUTO_CONFIG_DONE = 2)then
CP_BASEADR(7 downto 0) <= D(15 downto 8); --Base adress
SHUT_UP(1) <= '0'; --enable board
AUTO_CONFIG_DONE_CYCLE <= ('1' & not(AUTOBOOT_OFF)); --done here, if Autoboot = 1 skip ide part!
elsif(AUTO_CONFIG_DONE = 2)then
AUTO_CONFIG_DONE_CYCLE <= ('0' & AUTOBOOT_OFF); --done here, if Autoboot_off = 0 skip ide part!
elsif(AUTO_CONFIG_DONE = 1)then
IDE_BASEADR(7 downto 0) <= D(15 downto 8); --Base adress
SHUT_UP(2) <= '0'; --enable board
AUTO_CONFIG_DONE_CYCLE <= "11"; --done here
AUTO_CONFIG_DONE_CYCLE <= "00"; --done here
end if;
end if;
when "100110" =>
Dout1 <= "1111" ;
if(RW='0' and DS_D='1')then
AUTO_CONFIG_DONE_CYCLE <= AUTO_CONFIG_DONE_CYCLE+1; --done here
if(RW='0')then
AUTO_CONFIG_DONE_CYCLE <= AUTO_CONFIG_DONE-1; --done here
end if;
when others => Dout1 <= "1111" ;
end case;
end if;
end if;
end process autoconfig_proc; --- that's all
LAN_CS <= lan_adr when reset='1' else LAN_CS_RST;
LAN_WRL <= LAN_WRL_S when AS='0' and reset = '1' else LAN_WR_RST;
LAN_WRH <= LAN_WRH_S when AS='0' and reset = '1' else LAN_WR_RST;
LAN_RD <= LAN_RD_S when AS='0' and reset = '1' else '0';
CP_WE <= CP_WE_S when AS='0' and CP_WE_QUIRK ='1' else '1';
CP_RD <= CP_RD_S when AS='0' else '1';
DATA_SAMPLE: process(CLK_EXT)
begin
if(rising_edge(CLK_EXT))then
if(DS='0')then
if(lan_adr ='1' and lan_adr_sw ='1') then
D_IN <= D( 7 downto 0) & D(15 downto 8);
end if;
if(cp ='1') then
D_IN <= D(15 downto 8) & D(15 downto 8);
end if;
if((lan_adr ='1' and lan_adr_sw ='0') or ide ='1') then
D_IN <= D( 15 downto 0);
end if;
--out sample
if((lan_adr ='1' and lan_adr_sw ='0') or ide = '1') then
D_OUT <= DQ( 15 downto 0);
end if;
if(lan_adr ='1' and lan_adr_sw ='1') then
D_OUT <= DQ(7 downto 0)&DQ(15 downto 8);
end if;
if(cp = '1') then
D_OUT <= DQ(7 downto 0)&DQ(7 downto 0);
end if;
if(autoconfig ='1') then
D_OUT <= Dout1 & x"FFF";
end if;
end if;
end if;
end process;
LAN_CS <= lan_adr when LAN_RST_SM =done else LAN_CS_RST;
LAN_WRL <= LAN_WRL_S when AS ='0' and LAN_RST_SM =done else LAN_WR_RST;
LAN_WRH <= LAN_WRH_S when AS ='0' and LAN_RST_SM =done else LAN_WR_RST;
LAN_RD <= LAN_RD_S when (AS_D ='0' or AS ='0') and LAN_RST_SM =done else '0';
CP_WE <= CP_WE_S when AS ='0' and CP_WE_QUIRK ='1' else '1';
CP_RD <= CP_RD_S when (AS_D ='0' or AS ='0') else '1';
CP_CS <= not cp;
--the lanport is shifted by one adress line but I forgot to adopt the clockport address!
@@ -483,30 +521,23 @@ begin
--signal assignment
D <= --RAM_D when RW='1' and TRANSFER_IN_PROGRES ='1' else
DQ when RW='1' and lan_adr ='1' and lan_adr_sw ='0' and AS='0' else
DQ(7 downto 0)&DQ(15 downto 8) when RW='1' and lan_adr ='1' and lan_adr_sw ='1' and AS='0' else
DQ(7 downto 0)&DQ(7 downto 0) when RW='1' and (cp = '1' or ROM_OE_S ='0') and AS='0' else
DQ when RW='1' and ide = '1' and ROM_OE_S ='1' and AS='0' else
Dout1 & x"FFF" when RW='1' and autoconfig ='1' and AS='0' else
D_OUT when RW='1' and (AS_D ='0' or AS ='0') and (lan_adr ='1' or ide = '1' or cp = '1' or autoconfig ='1') else
(others => 'Z');
--defined lancp signal that matches both LAN and CP addresses (and IDE for Rev2 boards)
DQ <= LAN_D_CLR when (LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit) else
LAN_D_SET when (LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit) else
--D( 7 downto 0) & D( 7 downto 0) when RW='0' and AS='0' and lancp = '1' and LDS='0' and UDS='1' else
--D(15 downto 8) & D(15 downto 8) when RW='0' and AS='0' and lancp = '1' and LDS='1' and UDS='0' else
D( 7 downto 0) & D(15 downto 8) when RW='0' and AS='0' and lan_adr ='1' and lan_adr_sw ='1' else
D(15 downto 8) & D(15 downto 8) when RW='0' and AS='0' and cp ='1' else
D when RW='0' and AS='0' and lancp ='1'
DQ <=
LAN_D_CLR WHEN (LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit) else
LAN_D_SET WHEN (LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit) else
D_IN when (RW='0' and AS='0' and (lan_adr ='1' or cp ='1' or ide ='1'))
else (others => 'Z');
IDE_W <= IDE_W_S when AS='0' else '1';
IDE_R <= IDE_R_S when AS='0' else '1';
IDE_W <= IDE_W_S when AS = '0' else '1';
IDE_R <= IDE_R_S when AS = '0' else '1';
IDE_CS(0)<= not(A(12));
IDE_CS(1)<= not(A(13));
IDE_A(2 downto 0) <= A(11 downto 9);
ROM_B <= "00";
ROM_OE <= ROM_OE_S when AS='0' else '1';
ROM_OE <= ROM_OE_S when (AS_D ='0' or AS ='0') else '1';
-- INT_OUT <= 'Z';
INT2_OUT <= '0' when
@@ -519,14 +550,14 @@ begin
OWN <= 'Z';--'0' when AS='0' and (autoconfig = '1' or ide = '1' or lan_adr = '1' or cp = '1') else 'Z';
SLAVE <= '0' when AS='0' and (autoconfig = '1' or ide = '1' or lan_adr = '1' or cp = '1') else '1';
CFOUT <= '0' when AUTO_CONFIG_DONE=3 else '1';
SLAVE <= '0' when (AS_D ='0' or AS ='0') and (autoconfig = '1' or ide = '1' or lan_adr = '1' or cp = '1') else '1';
CFOUT <= '0' when AUTO_CONFIG_DONE = "00" else '1';
--OVR <= 'Z';
OVR <= '0' when ide='1' and AS='0' else 'Z';
OVR <= 'Z';
--OVR <= '0' when ide='1' and (AS_D ='0' or AS ='0') else 'Z';
DTACK <= IDE_TERM when ide='1' and AS='0' else 'Z';
--DTACK <= 'Z';
--DTACK <= IDE_TERM when ide='1' and (AS_D ='0' or AS ='0') else 'Z';
DTACK <= 'Z';
A <= (others => 'Z');
MTACK <= 'Z';