From 34fc5cf2592fdee635c2fffd5938509cdd8ada9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BA=91=E9=BE=99?= Date: Sat, 26 Oct 2024 16:59:39 +0800 Subject: [PATCH] Fixed the bug where the Queue still allowed entries when reset or flush was active, causing the IFU to continue fetching instructions while reset was active. --- src/main/scala/utils/FlushableQueue.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/scala/utils/FlushableQueue.scala b/src/main/scala/utils/FlushableQueue.scala index 1e1380fe..be7707e4 100644 --- a/src/main/scala/utils/FlushableQueue.scala +++ b/src/main/scala/utils/FlushableQueue.scala @@ -30,6 +30,8 @@ class FlushableQueue[T <: Data](gen: T, val entries: Int, private val full = ptr_match && maybe_full private val do_enq = WireInit(io.enq.fire) private val do_deq = WireInit(io.deq.fire) +//Unable enter quene when reset or flush + private val not_enq = RegInit(true.B) when (do_enq) { ram(enq_ptr.value) := io.enq.bits @@ -43,7 +45,7 @@ class FlushableQueue[T <: Data](gen: T, val entries: Int, } io.deq.valid := !empty - io.enq.ready := !full + io.enq.ready := !full & !not_enq io.deq.bits := ram(deq_ptr.value) if (flow) { @@ -65,6 +67,11 @@ class FlushableQueue[T <: Data](gen: T, val entries: Int, deq_ptr.value := 0.U } maybe_full := false.B + not_enq := true.B + } + + when (!io.flush){ + not_enq := false.B //add } private val ptr_diff = enq_ptr.value - deq_ptr.value