Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/SystemVerilog Blocking vs. Nonblocking Assignments

Q001·Free·SystemVerilog

SystemVerilog Blocking vs. Nonblocking Assignments

Difficulty
Easy
Topic
SystemVerilog
Language
SV
Interview prompt

Question

What values are printed by display and strobe, in that order?

Provided context

Code to inspect

logic a;
initial begin
  a = 0;
  a <= 1;
  $display("D=%0b", a);
  $strobe("S=%0b", a);
end
Choose one

Answer choices

  1. A. D=0, S=0
  2. B. D=x, S=1
  3. C. D=1, S=1
  4. D. D=0, S=1
Answer framework

Short answer

Choose D: $display prints D=0 and $strobe prints S=1. The blocking assignment changes a immediately, while the nonblocking assignment schedules its update for the NBA region. $display runs before that scheduled update; $strobe reports later, after the new value has taken effect.

Why this reasoning works

At the start of the initial block, the blocking assignment places 0 into a in the current active-region execution. The following <= statement evaluates its right-hand side but defers writing 1. Therefore the immediate $display call still observes the old current value and emits D=0.

Nonblocking updates are committed later in the same simulation time slot, after active-region work. $strobe waits until the postponed region, when those updates are visible and the time slot has settled, so it emits S=1. No simulation time advances; the difference comes entirely from event-region ordering, which is central to race-free modeling in synchronous RTL.

Interview takeaways

  • $display sees active-region state
  • NBA updates occur later
  • $strobe sees settled state
Exact question handoffPractice Q001

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Scheduler and DPI

Review event regions, delays, clocking blocks, program scheduling, and DPI boundaries.

  • SystemVerilog
  • Basic scheduling
Scheduler and DPI →
Continue practicing

Related questions

Q265 · SystemVerilogAlways_combEasyP→Q1144 · SystemVerilogNonblocking assignment (NBA) evaluation and updateEasyP→Q1000 · SystemVerilogActive-region racesMediumP→Q408 · SystemVerilogInactive, nonblocking assignment (NBA), and postponed regionsHardP→Q547 · SystemVerilogReason about nonblocking assignment updatesEasyP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi