contents.gifindex.gif

Pin-to-Pin Example

This example is a pin-to-pin description of a 2-bit counter with a reset.

module count
q0,q1 pin istype 'reg';
clock pin;
reset pin;
equations
[q1,q0].clk = clock;
[q1,q0] := ([q1.fb,q0.fb] + 1) & !reset;
test vectors ([clock,reset]->[q1,q0])
[ .c. , 1 ]->[ 0, 0];
[ .c. , 0 ]->[ 0, 1];
[ .c. , 0 ]->[ 1, 0];
[ .c. , 0 ]->[ 1, 1];
[ .c. , 0 ]->[ 0, 0];
[ .c. , 0 ]->[ 0, 1];
[ .c. , 1 ]->[ 0, 0];
end