D Flip-Flop
beginner · sequential · 100 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
Implement a positive-edge triggered D flip-flop with synchronous reset.
**Interface**
| Port | Direction | Width | Description |
|---------|-----------|-------|---------------------------------|
| `clk` | input | 1 | Clock (positive edge triggered) |
| `rst` | input | 1 | Synchronous active-high reset |
| `d` | input | 1 | Data input |
| `q` | output | 1 | Data output |
**Behaviour**
- On every rising edge of `clk`:
- If `rst` is high → `q` becomes 0
- Otherwise → `q` captures `d`
**Notes**
- Use an `always @(posedge clk)` block.
- Declare `q` as `reg`.
Constraints
- Must use posedge clock trigger.
- Reset must be synchronous (checked inside the clocked always block).
- Output q must be declared as reg.
Examples
Input: rst=1 then clk↑
Output: q=0
Input: d=1, rst=0 then clk↑
Output: q=1
Common questions
- What does the D Flip-Flop problem ask you to build?
- D Flip-Flop Implement a positive-edge triggered D flip-flop with synchronous reset.
- What constraints does D Flip-Flop have?
- Must use posedge clock trigger.; Reset must be synchronous (checked inside the clocked always block).; Output q must be declared as reg.
- What is an example input and output for D Flip-Flop?
- Input rst=1 then clk↑ gives output q=0.
- Which Verilog concepts does D Flip-Flop practise?
- sequential, flip-flop, registers.