From d1e335819710f785d86ef496b069a57d0f22f372 Mon Sep 17 00:00:00 2001 From: Yehowshua Immanuel Date: Wed, 2 Apr 2025 03:03:39 -0400 Subject: [PATCH] now using wire instead of FIFO --- bs/TagEngine.bs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bs/TagEngine.bs b/bs/TagEngine.bs index e54eff4..b5f04b1 100644 --- a/bs/TagEngine.bs +++ b/bs/TagEngine.bs @@ -26,7 +26,7 @@ mkTagEngine = -- we really only use inUseVec after emptying out our `resetTagCounter` buffer -- perhaps rename this variable to better communicate that inUseVec :: Vector numTags (Reg Bool) - inUseVec <- replicateM |> mkReg True + inUseVec <- replicateM |> mkReg False -- Since Bluespec doesn't allow us to initialize FIFOs with values at -- reset, we can pretend as if the buffer within our tagFIFO is populated @@ -72,9 +72,11 @@ mkTagEngine = case resetTagCounter of Just 0 -> do resetTagCounter := Nothing + (select inUseVec 0) := True return 0 Just tag -> do resetTagCounter := Just |> tag - 1 + (select inUseVec tag) := True return tag Nothing -> do let tag = freeQueue.first @@ -85,16 +87,12 @@ mkTagEngine = -- so it is advisable that the caller of `retireTag` only attempt to retire valid tags. -- Internally, the tagEngine will keep a correct and consistent state since TagEngine -- validates tags before attempting to retire them. - -- Also worth noting the TagEngin will ignore attempts to retire a tag you just - -- requested in the same cycle. This is enforce with `tag > tagCounter` below. retireTag :: UIntLog2N(numTags) -> Action retireTag tag = do let tagValid = tag < reifiedNumTags - tagInUse = case resetTagCounter of - Just tagCounter -> tag > tagCounter - Nothing -> readReg (select inUseVec tag) + tagInUse = readReg (select inUseVec tag) if (tagValid && tagInUse) then do retireTag := tag