CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Debug: Blocking Assignment Race Condition

MediumVerilog / SystemVerilogBuild

A two-stage pipeline delays the input data by two clock cycles to synchronize logic.

Expected behavior:

| Cycle | d | q | |-------|-----|-----| | 1 | 1 | 0 | | 2 | 0 | 0 | | 3 | 0 | 1 | | 4 | 0 | 0 |

Simulation shows q = 1 on Cycle 1 when d = 1. The output updates to the current value of the input on the exact same clock edge. The pipeline is simulating as a zero-cycle direct wire instead of a two-stage shift register. Inspect the RTL code and correct the fault.

Constraints

  • The module must maintain the exact same port list: clk, d, and q.
  • Do not add additional pipeline stages or registers.
  • Only modify the assignment operators inside the sequential block.

Topics

DebugVerilogRTLPipeline

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

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.

Related problems

  • Basic D Flip FlopEasy
  • Debug: Missing Edge in Sensitivity ListMedium
  • Read After Write Hazard DetectionEasy
  • Parameterized Interface with ModportsHard
  • Struct Array PipelineHard
  • T Flip Flop from D Flip Flop TemplateEasy
  • Recursive Generate Reduction TreeHard
  • Four Stage Shift RegisterEasy

Browse all problems · Learning tracks