Fixed reset issue: The initialisation loop must be performed exactly once!
buffered address
This commit is contained in:
@@ -94,7 +94,6 @@ architecture Behavioral of LAN_IDE_CP is
|
||||
);
|
||||
|
||||
SIGNAL LAN_RST_SM: lan_reset :=nop;
|
||||
SIGNAL lancp: STD_LOGIC; -- LAN or ClockPort
|
||||
SIGNAL ide: STD_LOGIC;
|
||||
SIGNAL autoconfig: STD_LOGIC;
|
||||
SIGNAL lan_adr: STD_LOGIC;
|
||||
@@ -105,6 +104,7 @@ architecture Behavioral of LAN_IDE_CP is
|
||||
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 A_LAN_OUT:STD_LOGIC_VECTOR(13 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);
|
||||
@@ -131,6 +131,7 @@ architecture Behavioral of LAN_IDE_CP is
|
||||
signal CP_RD_S: std_logic;
|
||||
signal CP_WE_S: std_logic;
|
||||
signal CP_WE_QUIRK: std_logic;
|
||||
signal SET_FREQUENCY: std_logic :='1';
|
||||
|
||||
signal LAN_CS_RST: std_logic;
|
||||
signal LAN_WR_RST: std_logic;
|
||||
@@ -153,17 +154,22 @@ begin
|
||||
|
||||
DS <= UDS and LDS;
|
||||
|
||||
AS_DELAY: process(CLK_EXT)
|
||||
AS_DELAY: process(CLK_EXT,reset)
|
||||
begin
|
||||
|
||||
if(rising_edge(AMIGA_CLK))then
|
||||
AS_D <= AS;
|
||||
if(reset = '0' )then
|
||||
AS_D <= '1';
|
||||
else
|
||||
AS_D <= AS;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
clock_init: process(CLK_EXT)
|
||||
begin
|
||||
if(rising_edge(CLK_EXT))then
|
||||
if(reset = '0' )then
|
||||
if(reset = '0' and SET_FREQUENCY ='1')then
|
||||
LAN_RST_SM <= nop;
|
||||
LAN_CS_RST<='0';
|
||||
LAN_WR_RST<='0';
|
||||
@@ -199,6 +205,7 @@ begin
|
||||
LAN_WR_RST<='0';
|
||||
LAN_RST_SM<=done;
|
||||
when done=> --stay here
|
||||
SET_FREQUENCY <='0';
|
||||
LAN_CS_RST<='0';
|
||||
LAN_WR_RST<='0';
|
||||
LAN_RST_SM<=done;
|
||||
@@ -215,7 +222,6 @@ begin
|
||||
lan_adr <= '0';
|
||||
lan_adr_sw <= '0';
|
||||
cp <= '0';
|
||||
lancp <= '0';
|
||||
elsif(rising_edge(AMIGA_CLK))then
|
||||
--default values
|
||||
autoconfig <= '0';
|
||||
@@ -223,7 +229,6 @@ begin
|
||||
lan_adr <= '0';
|
||||
lan_adr_sw <= '0';
|
||||
cp <= '0';
|
||||
lancp <= '0';
|
||||
if(A(23 downto 16) = x"E8" and AUTO_CONFIG_DONE > "00" and CFIN='0')then
|
||||
autoconfig <= '1';
|
||||
end if;
|
||||
@@ -232,15 +237,12 @@ begin
|
||||
lan_adr_sw <= '1';
|
||||
end if;
|
||||
lan_adr <= '1';
|
||||
lancp <= '1';
|
||||
end if;
|
||||
if(A(23 downto 16) = CP_BASEADR and SHUT_UP(1)='0')then
|
||||
cp <= '1';
|
||||
lancp <= '1';
|
||||
end if;
|
||||
if(A(23 downto 16) = IDE_BASEADR and SHUT_UP(2)='0')then
|
||||
ide <= '1';
|
||||
lancp <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process ADDRESS_DECODE;
|
||||
@@ -249,21 +251,21 @@ begin
|
||||
lan_int_proc: process (AMIGA_CLK,reset)
|
||||
begin
|
||||
if(reset ='0') then
|
||||
LAN_INT_ENABLE <='0';
|
||||
LAN_INT_ENABLE <='1';
|
||||
LAN_IRQ_D0 <='1';
|
||||
LAN_IRQ_OUT <='1';
|
||||
elsif falling_edge(AMIGA_CLK) then
|
||||
LAN_IRQ_D0 <= LAN_INT;
|
||||
if(LAN_INT ='0' and LAN_IRQ_D0 ='1') then
|
||||
LAN_IRQ_OUT <='0';
|
||||
elsif(LAN_INT ='1' or LAN_INT_ENABLE = '0')then
|
||||
elsif(LAN_INT ='1' or LAN_INT_ENABLE = '1')then
|
||||
LAN_IRQ_OUT <='1';
|
||||
elsif(lan_adr = '1' and DS ='0' and RW='0' and A(15)='1') then
|
||||
LAN_IRQ_OUT <= D(14); --controll lan irq
|
||||
end if;
|
||||
|
||||
if(lan_adr = '1' and DS ='0' and RW='0' and A(15)='1') then --enable if a write to A15 occured
|
||||
LAN_INT_ENABLE <= D(15);
|
||||
LAN_INT_ENABLE <= not(D(15));
|
||||
end if;
|
||||
end if;
|
||||
end process lan_int_proc;
|
||||
@@ -272,20 +274,20 @@ begin
|
||||
lan_rw_gen: process (AMIGA_CLK,reset)
|
||||
begin
|
||||
if(reset ='0') then
|
||||
LAN_RD_S <= '0';
|
||||
LAN_WRH_S <= '0';
|
||||
LAN_WRL_S <= '0';
|
||||
LAN_RD_S <= '1';
|
||||
LAN_WRH_S <= '1';
|
||||
LAN_WRL_S <= '1';
|
||||
elsif falling_edge(AMIGA_CLK) then
|
||||
--default values
|
||||
LAN_RD_S <= '0';
|
||||
LAN_WRH_S <= '0';
|
||||
LAN_WRL_S <= '0';
|
||||
LAN_RD_S <= '1';
|
||||
LAN_WRH_S <= '1';
|
||||
LAN_WRL_S <= '1';
|
||||
|
||||
if(lan_adr='1' and DS='0' and A(15)='0')then
|
||||
LAN_RD_S <= RW;
|
||||
LAN_RD_S <= not(RW);
|
||||
-- swapped LDS/UDS here: ENC624 is little endian
|
||||
LAN_WRH_S <= not LDS and not RW;
|
||||
LAN_WRL_S <= not UDS and not RW;
|
||||
LAN_WRH_S <= not(not LDS and not RW);
|
||||
LAN_WRL_S <= not(not UDS and not RW);
|
||||
end if;
|
||||
end if;
|
||||
end process lan_rw_gen;
|
||||
@@ -469,10 +471,40 @@ begin
|
||||
end if;
|
||||
end process autoconfig_proc; --- that's all
|
||||
|
||||
ADDRESS_SAMPLE: process(CLK_EXT)
|
||||
begin
|
||||
if(rising_edge(CLK_EXT))then
|
||||
--clear and set-register adresses during initialization phase
|
||||
if(LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit)then
|
||||
A_LAN_OUT <= LAN_A_CLRREG(13 downto 0);
|
||||
end if;
|
||||
if(LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit)then
|
||||
A_LAN_OUT <= LAN_A_SETREG(13 downto 0);
|
||||
end if;
|
||||
|
||||
if(lan_adr ='1')then --the lanport is shifted by one adress line but I forgot to adopt the clockport address!
|
||||
A_LAN_OUT <= A(14 downto 1);
|
||||
end if;
|
||||
|
||||
if(cp = '1')then
|
||||
A_LAN_OUT <= A(12 downto 1) &"00";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
DATA_SAMPLE: process(CLK_EXT)
|
||||
begin
|
||||
if(rising_edge(CLK_EXT))then
|
||||
if(DS='0')then
|
||||
|
||||
if(LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit) then
|
||||
D_IN <= LAN_D_CLR;
|
||||
end if;
|
||||
|
||||
if(LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit) then
|
||||
D_IN <= LAN_D_SET;
|
||||
end if;
|
||||
|
||||
|
||||
if(lan_adr ='1' and lan_adr_sw ='1') then
|
||||
D_IN <= D( 7 downto 0) & D(15 downto 8);
|
||||
@@ -503,32 +535,22 @@ begin
|
||||
|
||||
|
||||
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';
|
||||
LAN_WRL <= not(LAN_WRL_S) when AS ='0' and LAN_RST_SM =done else LAN_WR_RST;
|
||||
LAN_WRH <= not(LAN_WRH_S) when AS ='0' and LAN_RST_SM =done else LAN_WR_RST;
|
||||
LAN_RD <= not(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!
|
||||
A_LAN(13 downto 0)<= LAN_A_CLRREG(13 downto 0) when (LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit) else
|
||||
LAN_A_SETREG(13 downto 0) when (LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit) else
|
||||
A(14 downto 1) when lan_adr ='1' else
|
||||
A(12 downto 1) &"00";
|
||||
|
||||
|
||||
A_LAN(13 downto 0)<= A_LAN_OUT;
|
||||
|
||||
--signal assignment
|
||||
D <= --RAM_D when RW='1' and TRANSFER_IN_PROGRES ='1' 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
|
||||
D <= 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_IN when (RW='0' and AS='0' and (lan_adr ='1' or cp ='1' or ide ='1'))
|
||||
|
||||
DQ <= D_IN when (RW='0' and AS='0' and (lan_adr ='1' or cp ='1' or ide ='1')) or SET_FREQUENCY ='1'
|
||||
else (others => 'Z');
|
||||
|
||||
IDE_W <= IDE_W_S when AS = '0' else '1';
|
||||
@@ -539,13 +561,10 @@ begin
|
||||
ROM_B <= "00";
|
||||
ROM_OE <= ROM_OE_S when (AS_D ='0' or AS ='0') else '1';
|
||||
|
||||
-- INT_OUT <= 'Z';
|
||||
INT2_OUT <= '0' when
|
||||
(LAN_IRQ_OUT = '0' and LAN_INT_ENABLE = '1')
|
||||
INT2_OUT <= '0' when (LAN_IRQ_OUT = '0' and LAN_INT_ENABLE = '0')
|
||||
else 'Z';
|
||||
|
||||
INT6_OUT <= '0' when
|
||||
CP_IRQ = '0'
|
||||
INT6_OUT <= '0' when CP_IRQ = '0'
|
||||
else 'Z';
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user