now using wire instead of FIFO
This commit is contained in:
parent
e055b1bbdf
commit
d1e3358197
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue