JK Flip-Flop
intermediate · sequential · 120 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Problem
JK Flip-Flop
The JK flip-flop eliminates the forbidden state of the SR flip-flop. When J=K=1, the output **toggles** instead of being undefined.
On every `posedge clk`:
| J | K | Action |
|---|---|---------------|
| 0 | 0 | Hold (no change) |
| 0 | 1 | Reset → Q=0 |
| 1 | 0 | Set → Q=1 |
| 1 | 1 | Toggle → Q=~Q |
**Interface**
| Port | Direction | Description |
|-------|-----------|---------------------------|
| `clk` | input | Clock (rising-edge) |
| `j` | input | J input |
| `k` | input | K input |
| `q` | output | State output |
| `qn` | output | Complement output |
The JK is the most versatile single-bit flip-flop and was widely used in TTL-era designs. The T flip-flop is a special case where J=K=1 always.
Constraints
- Use always @(posedge clk).
- Use non-blocking assignments (<=).
- J=K=1 must toggle Q.
Examples
Input: clk↑, j=1, k=0 (Q was 0)
Output: q=1
Input: clk↑, j=1, k=1 (Q was 1)
Output: q=0 (toggled)
Input: clk↑, j=0, k=0
Output: q=prev
Common questions
- What does the JK Flip-Flop problem ask you to build?
- JK Flip-Flop The JK flip-flop eliminates the forbidden state of the SR flip-flop. When J=K=1, the output **toggles** instead of being undefined.
- What constraints does JK Flip-Flop have?
- Use always @(posedge clk).; Use non-blocking assignments (<=).; J=K=1 must toggle Q.
- What is an example input and output for JK Flip-Flop?
- Input clk↑, j=1, k=0 (Q was 0) gives output q=1.
- Which Verilog concepts does JK Flip-Flop practise?
- sequential, flip-flop, JK, toggle.