D Flip Flop with Asynchronous Reset

Problem Description
Design a D Flip Flop with an active-high asynchronous reset. The module takes a 1-bit data input d, a clock clk, and a reset signal rst. When rst goes high, output q is immediately forced to 0 — regardless of the clock. When rst is low, q captures the value of d on every rising edge of clk.
Interface Definition
Port | Direction | Width | Description |
|---|---|---|---|
clk | input | 1-bit | Positive-edge triggered clock |
rst | input | 1-bit | Active-high asynchronous reset — acts immediately, independent of clock |
d | input | 1-bit | Data input, captured on rising clock edge when rst=0 |
q | output | 1-bit | Registered output — resets instantly on rst, otherwise updates at posedge clk |
Edge Cases
rstasserted between clock edges —qgoes to0immediately, no clock edge neededrstandposedge clkhappen simultaneously — reset takes priority,qgoes to0rstdeasserted just before clock edge —qcapturesdon that rising edgerstpulses very briefly —qstill goes to0and holds until next clock edgedtoggles whilerstis high —qstays at0,dis ignored during reset
Verilog
Code Editor Access
Log in to write, run and submit your solution to this interview question. It's free.
