Skip to content

Commit

Permalink
[ibex,fpga] Fix FPGA related Ibex counter issue
Browse files Browse the repository at this point in the history
This commit fixes the reset logic of the Ibex counter
module for the FPGA.

Signed-off-by: Pascal Nasahl <[email protected]>
(commit is original to earlgrey_1.0.0)
  • Loading branch information
nasahlpa authored and luismarques committed Dec 9, 2024
1 parent 20bf77b commit c643d81
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hw/vendor/lowrisc_ibex/rtl/ibex_counter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ module ibex_counter #(
localparam int DspPragma = CounterWidth < 49 ? "yes" : "no";
(* use_dsp = DspPragma *) logic [CounterWidth-1:0] counter_q;

// DSP output register requires synchronous reset.
`define COUNTER_FLOP_RST posedge clk_i
if (CounterWidth < 49) begin : g_dsp_counter
// DSP output register requires synchronous reset.
`define COUNTER_FLOP_RST posedge clk_i
end else begin : g_no_dsp_counter
`define COUNTER_FLOP_RST posedge clk_i or negedge rst_ni
end
`else
logic [CounterWidth-1:0] counter_q;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/ibex_counter.sv b/ibex_counter.sv
index c78e510ee4..b4dc7ec347 100644
--- a/ibex_counter.sv
+++ b/ibex_counter.sv
@@ -55,8 +55,12 @@ module ibex_counter #(
localparam int DspPragma = CounterWidth < 49 ? "yes" : "no";
(* use_dsp = DspPragma *) logic [CounterWidth-1:0] counter_q;

- // DSP output register requires synchronous reset.
- `define COUNTER_FLOP_RST posedge clk_i
+ if (CounterWidth < 49) begin : g_dsp_counter
+ // DSP output register requires synchronous reset.
+ `define COUNTER_FLOP_RST posedge clk_i
+ end else begin : g_no_dsp_counter
+ `define COUNTER_FLOP_RST posedge clk_i or negedge rst_ni
+ end
`else
logic [CounterWidth-1:0] counter_q;

0 comments on commit c643d81

Please sign in to comment.