reverting as it seems we really cant condition rules on arguments safely
This commit is contained in:
parent
996febbff5
commit
35fc49382d
2 changed files with 47 additions and 26 deletions
|
@ -9,8 +9,7 @@ import Util
|
|||
|
||||
interface (TagEngine :: # -> *) numTags =
|
||||
requestTag :: ActionValue UIntLog2N(numTags)
|
||||
setTagToRetire :: UIntLog2N(numTags) -> Action
|
||||
retireTag :: Action
|
||||
retireTag :: UIntLog2N(numTags) -> Action
|
||||
|
||||
-- The tag engine returns a tag that is unique for the duration of
|
||||
-- the lifetime of the tag. Useful when you need to tag transactions
|
||||
|
@ -30,9 +29,6 @@ mkTagEngine =
|
|||
stackPtr :: (Reg (Maybe(UIntLog2N(numTags))))
|
||||
stackPtr <- mkReg |> Just |> reifiedNumTags - 1
|
||||
|
||||
tagToRetire :: RWire (UIntLog2N(numTags))
|
||||
tagToRetire <- mkRWireSBR
|
||||
|
||||
debugOnce <- mkReg True
|
||||
|
||||
addRules $
|
||||
|
@ -60,27 +56,19 @@ mkTagEngine =
|
|||
when
|
||||
Just sampledStackPtr <- stackPtr
|
||||
|
||||
setTagToRetire :: UIntLog2N(numTags) -> Action
|
||||
setTagToRetire tag =
|
||||
let
|
||||
tagValid = tag < (reifiedNumTags - 1)
|
||||
tagInUse = readReg (select inUseVec tag)
|
||||
in
|
||||
do
|
||||
if (tagValid && tagInUse)
|
||||
then do tagToRetire.wset tag
|
||||
else do action {}
|
||||
|
||||
retireTag :: Action
|
||||
retireTag =
|
||||
retireTag :: UIntLog2N(numTags) -> Action
|
||||
retireTag tag =
|
||||
do
|
||||
let nextStackPtrUint =
|
||||
let
|
||||
tagValid = tag < reifiedNumTags
|
||||
tagInUse = readReg (select inUseVec tag)
|
||||
nextStackPtrUint =
|
||||
case stackPtr of
|
||||
Nothing -> 0
|
||||
Just n -> n + 1
|
||||
|
||||
(select freeStackVec nextStackPtrUint) := tag
|
||||
stackPtr := Just nextStackPtrUint
|
||||
(select inUseVec tag) := False
|
||||
when
|
||||
Valid tag <- tagToRetire.wget
|
||||
if (tagValid && tagInUse)
|
||||
then do
|
||||
(select inUseVec tag) := False
|
||||
(select freeStackVec nextStackPtrUint) := tag
|
||||
stackPtr := Just nextStackPtrUint
|
||||
else action {}
|
||||
|
|
Reference in a new issue