things still typecheck
This commit is contained in:
parent
989c4e9616
commit
b4c7537a85
3 changed files with 31 additions and 43 deletions
|
@ -1,5 +1,5 @@
|
|||
package TagEngine(
|
||||
TagType,
|
||||
MkTagType,
|
||||
TagEngine(..),
|
||||
Util.BasicResult(..),
|
||||
mkTagEngine) where
|
||||
|
@ -10,11 +10,11 @@ import FIFO
|
|||
import FIFOF
|
||||
import SpecialFIFOs
|
||||
|
||||
type TagType a = (UInt (TLog a))
|
||||
type MkTagType numTags = (UInt (TLog numTags))
|
||||
|
||||
interface (TagEngine :: # -> *) numTags =
|
||||
requestTag :: ActionValue (TagType numTags)
|
||||
retireTag :: (TagType numTags) -> Action
|
||||
requestTag :: ActionValue (MkTagType numTags)
|
||||
retireTag :: (MkTagType 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
|
||||
|
@ -45,7 +45,7 @@ mkTagEngine = do
|
|||
debugOnce <- mkReg True
|
||||
|
||||
-- Rules
|
||||
addRules $
|
||||
addRules |>
|
||||
rules
|
||||
"debug_initial_state": when debugOnce ==> do
|
||||
$display "tagUsage: " (fshow (readVReg tagUsage))
|
||||
|
@ -78,9 +78,9 @@ mkTagEngine = do
|
|||
(Nothing, Nothing) -> action {}
|
||||
|
||||
-- Interface
|
||||
return $
|
||||
return |>
|
||||
interface TagEngine
|
||||
requestTag :: ActionValue (TagType numTags)
|
||||
requestTag :: ActionValue (MkTagType numTags)
|
||||
requestTag = do
|
||||
case initialTagDistributor of
|
||||
Just 0 -> do
|
||||
|
@ -101,7 +101,7 @@ mkTagEngine = do
|
|||
-- 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.
|
||||
retireTag :: (TagType numTags) -> Action
|
||||
retireTag :: (MkTagType numTags) -> Action
|
||||
retireTag tag =
|
||||
do
|
||||
let
|
||||
|
|
Reference in a new issue