Copyright | (C) 2013-2015, University of Twente |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | Unsafe |
Language | Haskell2010 |
Extensions |
|
- assert :: (Eq a, Show a) => Signal' t a -> Signal' t a -> Signal' t b -> Signal' t b
- stimuliGenerator :: forall l a. KnownNat l => Vec l a -> Signal a
- outputVerifier :: forall l a. (KnownNat l, Eq a, Show a) => Vec l a -> Signal a -> Signal Bool
- stimuliGenerator' :: forall l clk a. KnownNat l => SClock clk -> Vec l a -> Signal' clk a
- outputVerifier' :: forall l clk a. (KnownNat l, Eq a, Show a) => SClock clk -> Vec l a -> Signal' clk a -> Signal' clk Bool
Testbench functions for circuits synchronised to the system slock
:: (Eq a, Show a) | |
=> Signal' t a | Checked value |
-> Signal' t a | Expected value |
-> Signal' t b | Return valued |
-> Signal' t b |
Compares the first two arguments for equality and logs a warning when they
are not equal. The second argument is considered the expected value. This
function simply returns the third argument unaltered as its result. This
function is used by coutputVerifier
.
NB: This function is can be used in synthesizable designs.
To be used as a one of the functions to create the "magical" testInput
value, which the CλaSH compilers looks for to create the stimulus generator
for the generated VHDL testbench.
Example:
testInput ::Signal
Int testInput =stimuliGenerator
$(v
[(1::Int),3..21])
>>>
sampleN 13 testInput
[1,3,5,7,9,11,13,15,17,19,21,21,21]
:: (KnownNat l, Eq a, Show a) | |
=> Vec l a | Samples to compare with |
-> Signal a | Signal to verify |
-> Signal Bool | Indicator that all samples are verified |
To be used as a functions to generate the "magical" expectedOutput
function, which the CλaSH compilers looks for to create the signal verifier
for the generated VHDL testbench.
Example:
expectedOutput ::Signal
Int ->Signal
Bool expectedOutput =outputVerifier
$(v
([70,99,2,3,4,5,7,8,9,10]::[Int]))
>>>
import qualified Data.List as List
>>>
sampleN 12 (expectedOutput (fromList ([0..10] List.++ [10,10,10])))
[ expected value: 70, not equal to actual value: 0 False, expected value: 99, not equal to actual value: 1 False,False,False,False,False, expected value: 7, not equal to actual value: 6 False, expected value: 8, not equal to actual value: 7 False, expected value: 9, not equal to actual value: 8 False, expected value: 10, not equal to actual value: 9 False,True,True]
Testbench functions for circuits synchronised to arbitrary clocks
:: KnownNat l | |
=> SClock clk | Clock to which to synchronize the output signal |
-> Vec l a | Samples to generate |
-> Signal' clk a | Signal of given samples |
To be used as a one of the functions to create the "magical" testInput
value, which the CλaSH compilers looks for to create the stimulus generator
for the generated VHDL testbench.
Example:
type ClkA =Clk
"A" 100 clkA ::SClock
ClkA clkA =sclock
testInput' ::Signal'
clkA Int testInput' =stimuliGenerator'
clkA $(v
[(1::Int),3..21])
>>>
sampleN 13 testInput'
[1,3,5,7,9,11,13,15,17,19,21,21,21]
:: (KnownNat l, Eq a, Show a) | |
=> SClock clk | Clock to which the input signal is synchronized to |
-> Vec l a | Samples to compare with |
-> Signal' clk a | Signal to verify |
-> Signal' clk Bool | Indicator that all samples are verified |
To be used as a functions to generate the "magical" expectedOutput
function, which the CλaSH compilers looks for to create the signal verifier
for the generated VHDL testbench.
Example:
type ClkA =Clk
"A" 100 clkA ::SClock
ClkA clkA =sclock
expectedOutput' ::Signal'
ClkA Int ->Signal'
ClkA Bool expectedOutput' =outputVerifier'
clkA $(v
([70,99,2,3,4,5,7,8,9,10]::[Int]))
>>>
import qualified Data.List as List
>>>
sampleN 12 (expectedOutput' (fromList ([0..10] List.++ [10,10,10])))
[ expected value: 70, not equal to actual value: 0 False, expected value: 99, not equal to actual value: 1 False,False,False,False,False, expected value: 7, not equal to actual value: 6 False, expected value: 8, not equal to actual value: 7 False, expected value: 9, not equal to actual value: 8 False, expected value: 10, not equal to actual value: 9 False,True,True]