contents.gifindex.gif

Detailed Example

This example describes a 2-bit counter that uses the built-in register reset of some devices.

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

Pin-to-pin design methods cannot be used for this form of the design, since there is no pin-to-pin syntax for describing reset logic for built-in reset features. This design uses an istype 'buffer' declaration to ensure that the flip-flop reset propagates to the pin without an unwanted inversion.


Note: When you describe a preset or reset function with a detailed description, you need to include an 'invert' or 'buffer' attribute. If you specify 'invert', the preset logic is reversed (and acts as a reset when observed from the pin).