33 lines
961 B
Haskell
33 lines
961 B
Haskell
import Clash.Prelude
|
|
import Clash.Explicit.Testbench
|
|
|
|
foo
|
|
:: Applicative f
|
|
=> (a -> b -> c)
|
|
-> f a
|
|
-> f b
|
|
-> f c
|
|
foo fn x y = fn <$> x <*> y
|
|
|
|
topEntity
|
|
:: Clock System
|
|
-> Reset System
|
|
-> Enable System
|
|
-> Signal System (Signed 8)
|
|
-> Signal System (Signed 8)
|
|
-> Signal System (Signed 8)
|
|
topEntity = exposeClockResetEnable $ foo (+)
|
|
|
|
|
|
testBench :: Signal System Bool
|
|
testBench = done
|
|
where
|
|
--testInput = stimuliGenerator clk rst $(listToVecTH [2 :: Signed 8, 5, 7]) $(listToVecTH [3 :: Signed 8, 1, 5])
|
|
--expectOutput = outputVerifier' clk rst $(listToVecTH [5 :: Signed 8, 12])
|
|
testInput = stimuliGenerator clk rst ((2 :: Signed 8) :> 5 :> 7 :> Nil) ((3 :: Signed 8) :> 1 :> 5 :> Nil)
|
|
expectOutput = outputVerifier' clk rst ((5 :: Signed 8) :> 12 :> Nil)
|
|
done = expectOutput (topEntity clk rst en testInput)
|
|
en = enableGen
|
|
clk = tbSystemClockGen (not <$> done)
|
|
rst = systemResetGen
|