Tag Engine Now Finished it seems #10
2
Makefile
2
Makefile
|
@ -61,7 +61,7 @@ $(BDPI_OBJ): $(BDPI_SRC)
|
||||||
|
|
||||||
BSC_LINK_FLAGS += -keep-fires
|
BSC_LINK_FLAGS += -keep-fires
|
||||||
|
|
||||||
BSC_PATHS = -p bs/:bsv/:+
|
BSC_PATHS = -p bs/:bs/Tests/:bsv/:+
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
|
|
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
|
47
bs/Top.bs
47
bs/Top.bs
|
@ -10,6 +10,8 @@ import TagEngine
|
||||||
import List
|
import List
|
||||||
import ActionSeq
|
import ActionSeq
|
||||||
|
|
||||||
|
import TagEngineTester
|
||||||
|
|
||||||
type FCLK = 25000000
|
type FCLK = 25000000
|
||||||
type BAUD = 9600
|
type BAUD = 9600
|
||||||
|
|
||||||
|
@ -102,56 +104,13 @@ mkSim :: Module Empty
|
||||||
mkSim = do
|
mkSim = do
|
||||||
let cfg :: BRAM_Configure = defaultValue
|
let cfg :: BRAM_Configure = defaultValue
|
||||||
|
|
||||||
tagEngine :: TagEngine 5 <- mkTagEngine
|
tagEngineTester :: Empty <- mkTagEngineTester
|
||||||
count :: Reg (UInt 4) <- mkReg 0;
|
count :: Reg (UInt 4) <- mkReg 0;
|
||||||
initCFunctions :: Reg Bool <- mkReg False;
|
initCFunctions :: Reg Bool <- mkReg False;
|
||||||
core :: Core FCLK <- mkCore;
|
core :: Core FCLK <- mkCore;
|
||||||
|
|
||||||
s :: ActionSeq
|
|
||||||
s <-
|
|
||||||
let
|
|
||||||
requestTagAction :: Action
|
|
||||||
requestTagAction =
|
|
||||||
do
|
|
||||||
tag <- tagEngine.requestTag
|
|
||||||
$display "got tag : " (fshow tag)
|
|
||||||
in
|
|
||||||
actionSeq $
|
|
||||||
do requestTagAction
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do
|
|
||||||
res <- tagEngine.retireTag 3
|
|
||||||
$display "retiring tag : 3 " (fshow res)
|
|
||||||
action {}
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do
|
|
||||||
res <- tagEngine.retireTag 4
|
|
||||||
$display "retiring tag : 4 " (fshow res)
|
|
||||||
action {}
|
|
||||||
|> do
|
|
||||||
res <- tagEngine.retireTag 4
|
|
||||||
$display "retiring tag : 4 " (fshow res)
|
|
||||||
action {}
|
|
||||||
|> do
|
|
||||||
res <- tagEngine.retireTag 0
|
|
||||||
$display "retiring tag : 0 " (fshow res)
|
|
||||||
action {}
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do requestTagAction
|
|
||||||
|> do
|
|
||||||
res <- tagEngine.retireTag 1
|
|
||||||
$display "retiring tag : 1 " (fshow res)
|
|
||||||
action {}
|
|
||||||
|> do requestTagAction
|
|
||||||
|
|
||||||
addRules $
|
addRules $
|
||||||
rules
|
rules
|
||||||
"testIncrement": when (count < 10) ==>
|
|
||||||
do
|
|
||||||
count := count + 1
|
|
||||||
s.start
|
|
||||||
"initCFunctionsOnce": when not initCFunctions ==>
|
"initCFunctionsOnce": when not initCFunctions ==>
|
||||||
do
|
do
|
||||||
initTerminal
|
initTerminal
|
||||||
|
|
Loading…
Reference in a new issue