Skip to question and answer

Hardware interview practice

SystemVerilog Clocking Blocks Explained

MediumVerification UtilitiesMultiple choice

What timing intent is expressed by this clocking block?

Question code
clocking cb @(posedge clk);
  default input #1step output #0;
  input  q;
  output d;
endclocking

Answer choices

  1. A. q is sampled one full clock period earlier and d one period later
  2. B. q is sampled one simulator time step before the edge, and d is driven with zero skew at the clocking event
  3. C. q and d are both changed in the preponed region
  4. D. The declaration inserts synthesizable delays into the DUT

Concise answer

The answer and the key reason

`q` is observed at the `#1step` input sampling point immediately preceding each positive edge, whereas assignments to `d` use the clocking event’s zero-skew output slot. This coordinates simulator scheduling for verification code and leaves the synthesized circuit unchanged.

Deeper explanation

Work through the implementation and tradeoffs

Each positive edge of `clk` establishes the clocking event. The default input skew applies to `q`, so `#1step` takes its sampled value immediately before that event. The default output skew applies to `d`, and `#0` schedules the clocking-block drive without moving it to a later simulation time.

Separating the observation and drive instants helps a testbench avoid races with design processes triggered by the same clock edge. Code should access these signals through the clocking block to receive those semantics. The declaration affects simulator scheduling at the verification boundary; it does not change the DUT’s clock-to-output behavior or synthesize delay elements.

What to remember

  • `#1step` samples before the edge
  • `#0` drives at event time
  • Clocking skew is testbench timing

Practice the complete prompt

Explain it first, then compare the reviewed solution.

Open this exact question in the practice bank to attempt it, check your reasoning, and access the full member solution.Practice this question

Keep practicing

Verification UtilitiesSystemVerilog Interface Modports ExplainedVerification UtilitiesWhy UVM Uses SystemVerilog Virtual InterfacesUVM ComponentsHow to Pass a Virtual Interface with uvm_config_db