| 1 |
- BlackBox: |
| 2 |
name: Clash.Explicit.Testbench.assert |
| 3 |
kind: Declaration |
| 4 |
type: |- |
| 5 |
assert |
| 6 |
:: (KnownDomain dom, Eq a, ShowX a) -- (ARG[0], ARG[1], ARG[2]) |
| 7 |
=> Clock dom -- ARG[3] |
| 8 |
-> Reset dom -- ARG[4] |
| 9 |
-> String -- ARG[5] |
| 10 |
-> Signal dom a -- Checked value (ARG[6]) |
| 11 |
-> Signal dom a -- Expected value (ARG[7]) |
| 12 |
-> Signal dom b -- Return valued (ARG[8]) |
| 13 |
-> Signal dom b |
| 14 |
template: |- |
| 15 |
// assert begin |
| 16 |
// pragma translate_off |
| 17 |
always @(~IF~ACTIVEEDGE[Rising][0]~THENposedge~ELSEnegedge~FI ~ARG[3]) begin |
| 18 |
if (~VAR[checked][6] !== ~VAR[expected][7]) begin |
| 19 |
$display("@%0tns: %s, expected: %b, actual: %b", $time, ~LIT[5], ~VAR[expected][7], ~VAR[checked][6]); |
| 20 |
$finish; |
| 21 |
end |
| 22 |
end |
| 23 |
// pragma translate_on |
| 24 |
assign ~RESULT = ~ARG[8]; |
| 25 |
// assert end |
| 26 |
- BlackBox: |
| 27 |
name: Clash.Explicit.Testbench.assertBitVector |
| 28 |
kind: Declaration |
| 29 |
type: |- |
| 30 |
assertBitVector |
| 31 |
:: ( KnownDomain dom -- ARG[0] |
| 32 |
, KnownNat n -- ARG[1] |
| 33 |
=> Clock dom -- ARG[2] |
| 34 |
-> Reset dom -- ARG[3] |
| 35 |
-> String -- ARG[4] |
| 36 |
-> Signal dom (BitVector n) -- Checked value (ARG[5]) |
| 37 |
-> Signal dom (BitVector n) -- Expected value (ARG[6]) |
| 38 |
-> Signal dom b -- Return valued (ARG[7]) |
| 39 |
-> Signal dom b |
| 40 |
template: |- |
| 41 |
// assertBitVector begin |
| 42 |
// pragma translate_off |
| 43 |
wire ~TYP[5] ~GENSYM[maskXor][0] = ~ARG[6] ^ ~ARG[6]; |
| 44 |
wire ~TYP[5] ~GENSYM[checked][1] = ~ARG[5] ^ ~SYM[0]; |
| 45 |
wire ~TYP[5] ~GENSYM[expected][2] = ~ARG[6] ^ ~SYM[0]; |
| 46 |
|
| 47 |
always @(~IF~ACTIVEEDGE[Rising][0]~THENposedge~ELSEnegedge~FI ~ARG[2]) begin |
| 48 |
if (~SYM[1] !== ~SYM[2]) begin |
| 49 |
$display("@%0tns: %s, expected: %b, actual: %b", $time, ~LIT[4], ~VAR[expected][6], ~VAR[checked][5]); |
| 50 |
$finish; |
| 51 |
end |
| 52 |
end |
| 53 |
// pragma translate_on |
| 54 |
assign ~RESULT = ~ARG[7]; |
| 55 |
// assertBitVector end |