JK-Flip-Flop: Preset and Clear-Inputs swapped
Brought to you by:
jefferyhansen
In the symbol of the JK-Flip-Flop the _P and _C -Inputs seem to be interchanged: Putting _C to low and _P to High, does not Reset the Flip-Flop but sets it. Putting _C to high and _P to low resets the Flip-Flop instead of setting it (see attached image). Putting _C and _P both to high (inactive) works as expected.
Simulation of JK-Flip-Flop
Found the reason:
In the file /usr/share/tkgate/primitives/jkff.v are the lines
//
// Handle preset and clear signals
//
always @ (PRE or CLR)
if (!PRE)
Qreg = ${JK_BITS}'b0;
else if (!CLR)
Qreg = ~${JK_BITS}'b0;
I think it shoult be ${JK_BITS}'b1 in both cases.