watchall

set b.out_v 0
set b.flush 0
set-qdi-channel-neutral "b.in" 7

cycle


mode run
system "echo '[] Set reset 0'"
status X
set Reset 0
cycle
assert b.in.a 0
assert b.in.v 0


system "echo '[] Flushing data'"
set b.flush 1
cycle
assert b.out.d[0].t 0
assert b.out.d[1].t 0
assert b.out.d[2].t 0
assert b.out.d[3].t 0
assert b.out.d[4].t 0
assert b.out.d[5].t 0
assert b.out.d[6].t 0
assert b.out.d[0].f 0
assert b.out.d[1].f 0
assert b.out.d[2].f 0
assert b.out.d[3].f 0
assert b.out.d[4].f 0
assert b.out.d[5].f 0
assert b.out.d[6].f 0
set b.out_v 0
set b.flush 0
cycle

system "echo '[] Sending in a 0'"
set-qdi-channel-valid "b.in" 7 0
cycle
# assert-qdi-channel-valid 'b.out' 7 127
assert b.in.a 0
assert b.in.v 1
assert-var-int "b.out" 7 0

system "echo '[] Sending in output valid'"
set b.out_v 1
cycle
assert b.in.a 1
assert b.in.v 1
assert-var-int "b.out" 7 0

system "echo '[] Removing input'"
set-qdi-channel-neutral "b.in" 7
cycle
assert b.in.a 0
assert b.in.v 0
assert-var-int "b.out" 7 0


system "echo '[] Flushing data'"
set b.flush 1
cycle
assert b.out.d[0].t 0
assert b.out.d[1].t 0
assert b.out.d[2].t 0
assert b.out.d[3].t 0
assert b.out.d[4].t 0
assert b.out.d[5].t 0
assert b.out.d[6].t 0
assert b.out.d[0].f 0
assert b.out.d[1].f 0
assert b.out.d[2].f 0
assert b.out.d[3].f 0
assert b.out.d[4].f 0
assert b.out.d[5].f 0
assert b.out.d[6].f 0
set b.out_v 0
cycle
set b.flush 0
cycle


system "echo '[] Sending in a 127'"
set-qdi-channel-valid "b.in" 7 127
cycle
# assert-qdi-channel-valid 'b.out' 7 127
assert b.in.a 0
assert b.in.v 1
assert-var-int "b.out" 7 127

system "echo '[] Sending in output valid'"
set b.out_v 1
cycle
assert b.in.a 1
assert b.in.v 1
assert-var-int "b.out" 7 127

system "echo '[] Removing input'"
set-qdi-channel-neutral "b.in" 7
cycle
assert b.in.a 0
assert b.in.v 0
assert-var-int "b.out" 7 127




system "echo '[] Flushing data'"
set b.flush 1
cycle
assert b.out.d[0].t 0
assert b.out.d[1].t 0
assert b.out.d[2].t 0
assert b.out.d[3].t 0
assert b.out.d[4].t 0
assert b.out.d[5].t 0
assert b.out.d[6].t 0
assert b.out.d[0].f 0
assert b.out.d[1].f 0
assert b.out.d[2].f 0
assert b.out.d[3].f 0
assert b.out.d[4].f 0
assert b.out.d[5].f 0
assert b.out.d[6].f 0
set b.out_v 0
cycle
set b.flush 0
cycle




system "echo '[] Sending in a 56'"
set-qdi-channel-valid "b.in" 7 56
cycle
assert b.in.a 0
assert b.in.v 1
assert-var-int "b.out" 7 56

system "echo '[] Sending in output valid'"
set b.out_v 1
cycle
assert b.in.a 1
assert b.in.v 1
assert-var-int "b.out" 7 56

system "echo '[] Removing input'"
set-qdi-channel-neutral "b.in" 7
cycle
assert b.in.a 0
assert b.in.v 0
assert-var-int "b.out" 7 56

system "echo '[] Resetting'"
set Reset 1
cycle
assert-var-int "b.out" 7 127
set Reset 0
cycle
assert-var-int "b.out" 7 127
