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
|
-- we really only use inUseVec after emptying out our `resetTagCounter` buffer
|
||||||
-- perhaps rename this variable to better communicate that
|
-- perhaps rename this variable to better communicate that
|
||||||
inUseVec :: Vector numTags (Reg Bool)
|
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
|
-- 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
|
-- reset, we can pretend as if the buffer within our tagFIFO is populated
|
||||||
|
@ -72,9 +72,11 @@ mkTagEngine =
|
||||||
case resetTagCounter of
|
case resetTagCounter of
|
||||||
Just 0 -> do
|
Just 0 -> do
|
||||||
resetTagCounter := Nothing
|
resetTagCounter := Nothing
|
||||||
|
(select inUseVec 0) := True
|
||||||
return 0
|
return 0
|
||||||
Just tag -> do
|
Just tag -> do
|
||||||
resetTagCounter := Just |> tag - 1
|
resetTagCounter := Just |> tag - 1
|
||||||
|
(select inUseVec tag) := True
|
||||||
return tag
|
return tag
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
let tag = freeQueue.first
|
let tag = freeQueue.first
|
||||||
|
@ -85,16 +87,12 @@ mkTagEngine =
|
||||||
-- so it is advisable that the caller of `retireTag` only attempt to retire valid tags.
|
-- 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
|
-- Internally, the tagEngine will keep a correct and consistent state since TagEngine
|
||||||
-- validates tags before attempting to retire them.
|
-- 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 :: UIntLog2N(numTags) -> Action
|
||||||
retireTag tag =
|
retireTag tag =
|
||||||
do
|
do
|
||||||
let
|
let
|
||||||
tagValid = tag < reifiedNumTags
|
tagValid = tag < reifiedNumTags
|
||||||
tagInUse = case resetTagCounter of
|
tagInUse = readReg (select inUseVec tag)
|
||||||
Just tagCounter -> tag > tagCounter
|
|
||||||
Nothing -> readReg (select inUseVec tag)
|
|
||||||
if (tagValid && tagInUse)
|
if (tagValid && tagInUse)
|
||||||
then do
|
then do
|
||||||
retireTag := tag
|
retireTag := tag
|
||||||
|
|
Loading…
Reference in a new issue