From 77afff4e4819184abba35c1e1d83180498f80b52 Mon Sep 17 00:00:00 2001 From: bsdevlin Date: Sat, 20 Jul 2019 15:37:19 +0800 Subject: [PATCH] Bugfix for arbitrator locking --- .settings/org.eclipse.core.resources.prefs | 1 + ip_cores/util/src/rtl/packet_arb.sv | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 30425f2..643fd20 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,3 +1,4 @@ eclipse.preferences.version=1 +encoding//ip_cores/ec/src/rtl/ec_fp12_arithmetic.sv=UTF-8 encoding//ip_cores/ec/src/rtl/ec_fp2_arithmetic.sv=UTF-8 encoding//ip_cores/ec/src/rtl/ec_fp6_arithmetic.sv=UTF-8 diff --git a/ip_cores/util/src/rtl/packet_arb.sv b/ip_cores/util/src/rtl/packet_arb.sv index 47811df..ec4c669 100644 --- a/ip_cores/util/src/rtl/packet_arb.sv +++ b/ip_cores/util/src/rtl/packet_arb.sv @@ -112,15 +112,19 @@ always_ff @ (posedge i_clk) begin locked <= 0; idx <= 0; end else begin - if (~locked) begin - idx <= get_next(idx); - if (val[get_next(idx)] && ~(eop[idx] && rdy[idx])) begin - locked <= 1; - end - end else if (eop[idx] && val[idx] && rdy[idx]) begin - idx <= get_next(idx); + + if (~locked) idx <= get_next(idx); + + if (val[idx]) begin + locked <= 1; + idx <= idx; + end + + if (eop[idx] && val[idx] && rdy[idx]) begin locked <= 0; + idx <= get_next(idx); end + end end