From 31ea6e6016a89f8ee29e1e6518c377e811519a89 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Wed, 22 May 2024 00:10:33 +0200 Subject: [PATCH] fw irq improvements (force high state for one clock when de-asserting irq) --- fw/rtl/n64/n64_cfg.sv | 7 ++++++- fw/rtl/n64/n64_top.sv | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/fw/rtl/n64/n64_cfg.sv b/fw/rtl/n64/n64_cfg.sv index 47b7ceb..c046ffa 100644 --- a/fw/rtl/n64/n64_cfg.sv +++ b/fw/rtl/n64/n64_cfg.sv @@ -138,7 +138,12 @@ module n64_cfg ( lock_sequence_counter <= 1'd0; end if (lock_sequence_counter == 1'd1) begin - n64_scb.cfg_unlock <= (reg_bus.wdata != 16'hFFFF); + if (reg_bus.wdata == 16'hFFFF) begin + n64_scb.cfg_unlock <= 1'b0; + cmd_irq_request <= 1'b0; + cmd_irq <= 1'b0; + mcu_irq <= 1'b0; + end end end diff --git a/fw/rtl/n64/n64_top.sv b/fw/rtl/n64/n64_top.sv index e0e75e9..b638bcb 100644 --- a/fw/rtl/n64/n64_top.sv +++ b/fw/rtl/n64/n64_top.sv @@ -26,13 +26,19 @@ module n64_top ( logic n64_dd_irq; logic n64_cfg_irq; - logic n64_irq_oe; + + logic irq_data; + logic irq_dq; + logic [1:0] irq_oe; + + assign irq_data = (n64_dd_irq || n64_cfg_irq); always @(posedge clk) begin - n64_irq_oe <= (n64_dd_irq || n64_cfg_irq); + irq_dq <= (~irq_data); + irq_oe <= {irq_oe[0], irq_data}; end - assign n64_irq = n64_irq_oe ? 1'b0 : 1'bZ; + assign n64_irq = irq_oe[1] ? irq_dq : 1'bZ; n64_reg_bus reg_bus ();