refactor into standalone TagEngineTester
This commit is contained in:
parent
6e3b3e9178
commit
5588fafebd
3 changed files with 52 additions and 45 deletions
48
bs/Tests/TagEngineTester.bs
Normal file
48
bs/Tests/TagEngineTester.bs
Normal file
|
@ -0,0 +1,48 @@
|
|||
package TagEngineTester(mkTagEngineTester) where
|
||||
|
||||
import TagEngine
|
||||
import ActionSeq
|
||||
|
||||
mkTagEngineTester :: Module Empty
|
||||
mkTagEngineTester = do
|
||||
tagEngine :: TagEngine 5 <- mkTagEngine
|
||||
count :: Reg (UInt 4) <- mkReg 0;
|
||||
|
||||
s :: ActionSeq
|
||||
s <-
|
||||
let
|
||||
requestTagAction :: Action
|
||||
requestTagAction =
|
||||
do
|
||||
tag <- tagEngine.requestTag
|
||||
$display "got tag : " (fshow tag)
|
||||
|
||||
retireTagAction :: UInt 3 -> Action
|
||||
retireTagAction tag =
|
||||
do
|
||||
res <- tagEngine.retireTag tag
|
||||
$display "retiring tag : " (fshow tag) " " (fshow res)
|
||||
action {}
|
||||
|
||||
in
|
||||
actionSeq $
|
||||
do requestTagAction
|
||||
|> do requestTagAction
|
||||
|> do requestTagAction
|
||||
|> do retireTagAction 3
|
||||
|> do requestTagAction
|
||||
|> do requestTagAction
|
||||
|> do retireTagAction 4
|
||||
|> do retireTagAction 4
|
||||
|> do retireTagAction 0
|
||||
|> do requestTagAction
|
||||
|> do requestTagAction
|
||||
|> do retireTagAction 1
|
||||
|> do requestTagAction
|
||||
|
||||
addRules $
|
||||
rules
|
||||
"testIncrement": when (count < 10) ==>
|
||||
do
|
||||
count := count + 1
|
||||
s.start
|
Reference in a new issue