D Flip Flop with Asynchronous Reset

Qualcomm
Nvidia

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

  • rst asserted between clock edges — q goes to 0 immediately, no clock edge needed

  • rst and posedge clk happen simultaneously — reset takes priority, q goes to 0

  • rst deasserted just before clock edge — q captures d on that rising edge

  • rst pulses very briefly — q still goes to 0 and holds until next clock edge

  • d toggles while rst is high — q stays at 0, d is ignored during reset

Verilog

Code Editor Access

Log in to write, run and submit your solution to this interview question. It's free.

Output

Output goes here...