Bus types typecheck!!!

This commit is contained in:
Yehowshua Immanuel 2025-04-08 23:36:54 -04:00
parent fe2fa21fcc
commit 989c4e9616
3 changed files with 27 additions and 17 deletions

View file

@ -1,4 +1,5 @@
package TagEngine(
TagType,
TagEngine(..),
Util.BasicResult(..),
mkTagEngine) where
@ -9,11 +10,11 @@ import FIFO
import FIFOF
import SpecialFIFOs
#define UIntLog2N(n) (UInt (TLog n))
type TagType a = (UInt (TLog a))
interface (TagEngine :: # -> *) numTags =
requestTag :: ActionValue UIntLog2N(numTags)
retireTag :: UIntLog2N(numTags) -> Action
requestTag :: ActionValue (TagType numTags)
retireTag :: (TagType 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
@ -79,7 +80,7 @@ mkTagEngine = do
-- Interface
return $
interface TagEngine
requestTag :: ActionValue UIntLog2N(numTags)
requestTag :: ActionValue (TagType numTags)
requestTag = do
case initialTagDistributor of
Just 0 -> do
@ -100,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 :: UIntLog2N(numTags) -> Action
retireTag :: (TagType numTags) -> Action
retireTag tag =
do
let