From 98d825daee11af3f5fd94c5e86cb2b05934ead02 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sat, 18 Aug 2018 23:28:28 +0800 Subject: [PATCH] T80: tweak NMI trigger. --- t80/T80.vhd | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/t80/T80.vhd b/t80/T80.vhd index e613900..e6db89f 100644 --- a/t80/T80.vhd +++ b/t80/T80.vhd @@ -1034,37 +1034,13 @@ begin IORQ <= IORQ_i; Stop <= I_DJNZ; -------------------------------------------------------------------------- --- --- Syncronise inputs --- -------------------------------------------------------------------------- - process (RESET_n, CLK_n) - variable OldNMI_n : std_logic; - begin - if RESET_n = '0' then - BusReq_s <= '0'; - NMI_s <= '0'; - OldNMI_n := '0'; - elsif rising_edge(CLK_n) then - if CEN = '1' then - BusReq_s <= not BUSRQ_n; - if NMICycle = '1' then - NMI_s <= '0'; - elsif NMI_n = '0' and OldNMI_n = '1' then - NMI_s <= '1'; - end if; - OldNMI_n := NMI_n; - end if; - end if; - end process; - ------------------------------------------------------------------------- -- -- Main state machine -- ------------------------------------------------------------------------- process (RESET_n, CLK_n) + variable OldNMI_n : std_logic; begin if RESET_n = '0' then MCycle <= "001"; @@ -1080,9 +1056,17 @@ begin Auto_Wait_t1 <= '0'; Auto_Wait_t2 <= '0'; M1_n <= '1'; + BusReq_s <= '0'; + NMI_s <= '0'; elsif rising_edge(CLK_n) then - if CEN = '1' then + if NMI_n = '0' and OldNMI_n = '1' then + NMI_s <= '1'; + end if; + OldNMI_n := NMI_n; + + if CEN = '1' then + BusReq_s <= not BUSRQ_n; Auto_Wait_t2 <= Auto_Wait_t1; if T_Res = '1' then Auto_Wait_t1 <= '0'; @@ -1139,7 +1123,8 @@ begin MCycle <= "001"; IntCycle <= '0'; NMICycle <= '0'; - if NMI_s = '1' and Prefix = "00" then + if NMI_s = '1' and Prefix = "00" then + NMI_s <= '0'; NMICycle <= '1'; IntE_FF1 <= '0'; elsif IntE_FF1 = '1' and INT_n='0' and Prefix = "00" and SetEI = '0' then