D Flip-Flop with Enable
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
D Flip-Flop with Enable
A D flip-flop that only captures `d` when the enable signal `en` is high. When `en=0`, `q` holds its current value regardless of what `d` does.
This is the **most common flip-flop variant in real RTL**. Every pipeline register, every configuration register, every write-gated storage element is this circuit. Synthesisers map it to a flip-flop with a dedicated clock-enable pin (CE on Xilinx, ENA on Intel/Altera) — saving power by stopping unnecessary switching.
**Interface**
| Port | Direction | Description |
|-------|-----------|----------------------------------|
| `clk` | input | Clock (rising-edge triggered) |
| `rst` | input | Async reset (active-high) |
| `en` | input | Clock enable |
| `d` | input | Data input |
| `q` | output | Registered output |
Implement for 1-bit. Verify that toggling `d` rapidly while `en=0` produces zero output transitions.
Constraints
- Reset is asynchronous: `always @(posedge clk or posedge rst)`.
- When rst=1: q <= 0 (async, immediate).
- When rst=0 and en=1: q <= d on posedge clk.
- When rst=0 and en=0: q holds its current value.
Examples
Input: en=0, d toggles every cycle
Output: q stays constant
Enable gates the capture
Input: en=1, d=1
Output: q=1 on next posedge clk
Normal capture when enabled
Input: rst=1 (async)
Output: q=0 immediately
Async reset overrides enable
Common questions
- What does the D Flip-Flop with Enable problem ask you to build?
- D Flip-Flop with Enable A D flip-flop that only captures `d` when the enable signal `en` is high. When `en=0`, `q` holds its current value regardless of what `d` does. This is the **most common flip-flop variant in real RTL**.
- What constraints does D Flip-Flop with Enable have?
- Reset is asynchronous: `always @(posedge clk or posedge rst)`.; When rst=1: q <= 0 (async, immediate).; When rst=0 and en=1: q <= d on posedge clk.; When rst=0 and en=0: q holds its current value.
- What is an example input and output for D Flip-Flop with Enable?
- Input en=0, d toggles every cycle gives output q stays constant. Enable gates the capture
- Which Verilog concepts does D Flip-Flop with Enable practise?
- sequential, flip-flop, DFF, enable, interview.