Codiode

Debug: Missing Edge in Sensitivity List

MediumVerilog / SystemVerilogBuildFree6 solved

An asynchronous reset initialises a register without waiting for a clock edge. This D flip-flop is meant to have an active-high asynchronous reset.

Expected behaviour:

  • When rst is 1, q becomes 0 immediately, whether or not the clock is running.
  • When rst is 0, q captures d on the rising edge of clk.

What the simulation shows: with the clock held at 0 and q at 1, raising rst leaves q at 1. It only clears on the next rising edge of clk, which is a synchronous reset, not an asynchronous one.

The design below has one bug. Find it and fix it.

Signal Direction Width Description
clk input 1 Clock, rising edge
rst input 1 Asynchronous reset, active high
d input 1 Data in
q output 1 Registered data out

Constraints

  • The reset must stay active high and asynchronous.
  • Keep the port list and signal names as they are.
  • Change at most 1 line.

Topics

DebugSequential LogicRegistersVerilog

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.

Free to solve. A Codiode account keeps your progress.

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Part of Sequential RTL

Problem 7 of 26 in the Sequential RTL track.

Related problems

Browse all problems · Verilog practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.