silicode · 2026-11-17 · 13 min

Simulator in the Loop RTL Generation and the Delta Cycle Trap

Iterative RTL repair loops like NVIDIA Nemotron 3 Ultra depend on continuous simulation. Here is why event queues, delta cycles, and CDC break autonomous agents.

Diagram illustrating an automated Verilog code repair loop feeding simulation logs into a neural language model

NVIDIA published the technical report for its 550-billion parameter Nemotron 3 Ultra model, highlighting its post-training supervised fine-tuning dataset called ACE-RTL. Rather than treating Verilog generation as a single-pass autocomplete task, the architecture specifically trains on multi-turn specification-to-RTL generation, code editing, and error recovery. The premise behind this training data, along with concurrent multi-agent RTL frameworks like Dr.RTL and VeriMaAS, is straightforward: raw language models cannot reliably write functional hardware on the first prompt. They require a compiler and a simulator in the loop to catch syntax errors, protocol violations, and assertion failures.

For digital design leads and verification engineers, this shift toward closed-loop agentic RTL generation introduces a critical distinction. Syntax linting with Verilator or Slang is simple to automate. True functional repair across concurrent hardware blocks is not. Language models do not possess an internal simulation kernel. They predict tokens sequentially, whereas digital hardware executes concurrently across discrete simulation time steps and delta cycles.

When silicon teams hook an LLM directly into an automated simulation harness, the repair agent often converges quickly on syntax errors, only to get trapped in infinite token loops when dealing with race conditions, clock-domain crossings, and multi-cycle state corruption. Understanding why these loops fail requires looking at the gap between text-generation heuristics and the IEEE 1800 SystemVerilog stratified event scheduler.

The Stratified Event Queue Problem

When a software engineer prompts an LLM to debug a Python or C++ function, the model processes an execution model that matches its native autoregressive structure. Code executes line by line, stack frames push and pop, and variables mutate sequentially. A simulator-in-the-loop harness running unit tests feeds a stack trace back to the model, and the model adjusts the sequential logic.

SystemVerilog does not behave this way. Hardware description languages model physical gates and registers operating in parallel. In any discrete event simulator, such as Verilator, Synopsys VCS, Siemens Questa, or Cadence Xcelium, simulation time advances according to the Stratified Event Queue defined in IEEE 1800.

Within a single time slot, the simulation engine divides evaluation into multiple ordered regions:

  1. Preponed: Values are sampled before any clock edges trigger.
  2. Active: Blocking assignments, continuous assignments, and right-hand side evaluation of non-blocking assignments (NBA) execute.
  3. Inactive: Explicit zero-delay operations (#0) execute.
  4. NBA: Left-hand side updates of non-blocking assignments are applied.
  5. Observed: Concurrent assertions evaluate against values sampled in the Preponed region.
  6. Reactive: Testbench verification code, such as Cocotb drivers or UVM sequences, runs.
  7. Postponed: Output values and $strobe tasks execute for waveform dumping.

Between these regions, the simulator executes delta cycles. Delta cycles consume zero physical simulation time but allow internal signal states to stabilize.

An LLM generating Verilog has no inherent representation of this execution engine. When an agent writes code that mixes blocking (=) and non-blocking (<=) assignments inside an always_ff or always_comb block, it is predicting patterns from training corpora. If that code creates an active-region race condition where two concurrent processes write to the same register or where a combinational output is sampled before its inputs settle within the same delta cycle, the simulator reports an assertion failure or an incorrect state transition.

When the automated harness feeds the simulator error log back into the prompt, the LLM cannot run the event queue forward and backward in its context window. Instead of diagnosing the scheduling region conflict, the model treats the failure as a semantic logic error. It alters the state machine transitions or adds arbitrary register stages, introducing new bugs while failing to resolve the underlying race condition.

Anatomy of an Automated Verilator and Cocotb Repair Loop

To understand where automated loops succeed and where they diverge, consider the standard architecture used in modern tool-coupled RTL generation workflows. The setup typically pairs an open-source simulator with an execution harness that drives stimulus and captures assertions.

+-----------------------------------------------------------+
|                    RTL Generation Agent                   |
|       (Nemotron 3 Ultra / DeepSeek-Coder / Claude)        |
+-----------------------------------------------------------+
       |                                    ^ 
 [Generated Verilog]                [Structured Error Log]
       v                                    |
+-------------------+              +------------------------+
| Linter & Compiler |  -- Error -> | AST & Line Diagnostics |
| (Verilator/Slang) |              +------------------------+
+-------------------+
       |
   [Pass C++ Binary]
       v
+-------------------+
|  Cocotb / Python  |  -- Fail ->  | State Trace Extraction |
| Testbench Runner  |              | & Assertion Formatter  |
+-------------------+
       |
  [All Passed]
       v
+-------------------+
| Physical Synthesis|
| (Yosys / OpenSTA) |
+-------------------+

The loop operates in three sequential phases:

Phase 1: Static Linting and Syntax Parsing

The generated Verilog is compiled through Verilator using strict lint flags: -Wall -Wno-fatal --lint-only. If the model declares implicit wires, truncates bit-widths, infers unwanted latches, or leaves ports unmapped, the linter rejects the code before running simulation.

This is where agentic models perform best. Parsing a compiler error message like %Error-WIDTH: module.v:42: Output port width mismatch is a localized text-to-text transformation. In ACE-RTL benchmarks, modern coding models resolve over 85 percent of pure lint errors within two iterations.

Phase 2: Dynamic Verification in Cocotb

Once the module compiles, the harness executes a Cocotb test suite. Cocotb uses Python coroutines to drive clock signals, assert reset sequences, and push randomized transaction packets into the DUT (Device Under Test). Monitored outputs are checked against a golden reference model or SystemVerilog Assertions (SVA).

If the DUT fails an assertion at cycle 412, the harness cannot simply dump the entire raw 50,000-line simulation log into the LLM context. Doing so floods the attention layers with redundant clock cycles and triggers context poisoning. The harness must extract a minimal failing trace: the clock cycle index, the current state vector, the previous input transaction, and the specific assertion condition that evaluated to false.

Phase 3: PPA and Synthesizability Checks

Passing functional verification is insufficient for production hardware. The code passes into a synthesis tool, such as Yosys or a commercial physical synthesis engine, to check for unresolvable combinational feedback loops, multi-driven nets, and unconstrained high-fanout nets.

Three Failure Modes That Trigger Infinite Token Loops

When small engineering teams deploy this automated loop on non-trivial RTL blocks, they encounter predictable failure modes where the model consumes hundreds of thousands of tokens without reaching timing closure or functional correctness.

1. The Combinational Feedback and Delta-Cycle Oscillation

Consider an arbiter or a circular buffer pointer where the next-state logic depends on an immediate handshake signal. If the model writes a combinational always @(*) block that inadvertently creates a circular assignment across two intermediate signals, the simulator will encounter zero-delay oscillation.

Verilator will report an UNOPTFLAT warning or refuse to converge. When the harness prompts the model with: Circular combinational dependency detected between sig_a and sig_b, the model frequently responds by converting the continuous assignments into registered flip-flops (always_ff @(posedge clk)). This clears the lint warning, but it adds an unrequested pipeline latency cycle. The Cocotb testbench immediately fails because output data appears one clock cycle late. The model then attempts to compensate by removing the reset condition or bypassing the register with multiplexer logic, recreating the combinational loop.

The model alternates between a timing cycle error and a circular dependency warning across consecutive turns, burning API credits without resolving the underlying dependency graph.

2. The Clock-Domain Crossing (CDC) Blindspot

Language models are poor at reasoning about asynchronous boundaries. In a dual-clock FIFO or an asynchronous serial receiver, data moving from clk_a to clk_b requires proper multi-flop synchronizers, Gray-coded pointers, and handshake flags to prevent metastability.

In standard event-driven simulation, idealized functional clocks hide metastability. If the testbench drives clk_a at 100 MHz and clk_b at 33.3 MHz without injecting jitter, the simulation may pass entirely by chance if data transitions do not collide with active edges in the simulation kernel.

However, if a CDC linter or an SVA property detects that a multi-bit data bus is being sampled directly across clock boundaries without a synchronized enable pulse, the harness flags a violation. When prompted to fix the CDC hazard, LLMs routinely attempt one of two incorrect repairs:

  • They instantiate a standard two-flip-flop synchronizer directly on the wide data bus, which causes bus skew and data corruption in physical hardware due to routing delay variations across bits.
  • They attempt to merge the clock domains by referencing both clocks in an illegal sensitivity list (always @(posedge clk_a or posedge clk_b)), which describes physically impossible dual-clock flip-flops that fail synthesis.

3. Logic Cone Bloat During FSM Repair

When a finite state machine (FSM) hangs in an unhandled default state during a randomized stress test, the simulator flags a timeout. The model knows that the state register failed to transition.

Instead of restructuring the state transition table or identifying the missing handshake edge, the model often adds nested if-else priority chains inside the always_comb block to force the transition under specific corner-case conditions. With each iteration of simulator feedback, the model adds another layer of corrective logic.

While this may eventually satisfy the specific failing test vector, it causes exponential logic cone expansion. The resulting RTL synthesizes into a massive chain of lookahead logic with severe setup-time timing violations ($WNS < 0$) on the target silicon process. The model fixes functional correctness at the expense of physical feasibility.

// Typical LLM repair bloat: resolving a state machine bug by patching specific test vectors
// instead of fixing the underlying state transition graph.
always_comb begin
    next_state = current_state;
    // Original state logic...
    case (current_state)
        STATE_IDLE: if (req) next_state = STATE_BUSY;
        STATE_BUSY: if (ack) next_state = STATE_DONE;
        STATE_DONE: next_state = STATE_IDLE;
        default:    next_state = STATE_IDLE;
    endcase

    // Hallucinated patch added by LLM after iteration 4 of simulator failure:
    // Breaks modular timing by creating a deep combinational bypass cone.
    if (timeout_counter > 8'd200 && !ack && external_override_flag) begin
        if (prev_transaction_id == 8'hFF && current_state != STATE_IDLE) begin
            next_state = STATE_IDLE; // Forces simulator to pass cycle 412
        end
    end
end

Convergence Metrics in Closed-Loop RTL Generation

To evaluate where automated repair loops provide real engineering value versus where they spin out of control, we look at empirical pass rates across different structural complexity tiers.

The following table represents an illustrative composite derived from reported ACE-RTL post-training repair dynamics, open-source Dr.RTL iterations, and typical industrial Verilator-Cocotb test harnesses across 5-iteration repair windows.

Repair Loop Convergence by Module Category

Module Type Zero-Shot Pass Rate Lint Pass Rate (Iter 2) Functional Pass (Iter 5) CDC / Timing Closure Dominant Loop Failure Mode
ALU / Arithmetic Core 42% 94% 88% 85% Bit-width truncation, signed overflow
Single-Clock AXI-Lite CSR 35% 91% 82% 78% Handshake deadlock (arvalid/arready)
Pipelined Matrix Multiplier 18% 82% 54% 31% Latency mismatch across pipeline stages
Dual-Clock Asynchronous FIFO 6% 76% 22% 4% Multi-bit bus skew, Gray code corruption
SDRAM Controller / PHY IF 2% 68% 14% 2% State explosion, refresh timing collisions

Receipts and Setup Details: Illustrative composite benchmark reflecting 5-turn maximum repair loops using open-source LLM agents (Nemotron-3-Ultra-550B, DeepSeek-Coder-33B class) coupled with Verilator 5.020 linting, Cocotb 1.8 functional test suites, and Yosys/OpenROAD synthesis targeting an open 45nm standard-cell library. Functional pass indicates zero SVA or assertions triggered over 1,000 randomized transactions.

The metrics highlight the ceiling: while simple data-path and control-register blocks converge to near 90 percent functional success within five turns, complex multi-clock and interface protocols collapse rapidly. The simulation feedback loop solves local syntactic ambiguities but fails to synthesize distributed architectural intent.

Structuring Prompts and Logs for Practical Closed-Loop Repair

If you are setting up an in-house agentic RTL generation pipeline using models like Nemotron 3 Ultra, you must design the error ingestion pipeline defensively. Passing unstructured stdout dumps directly into the prompt guarantees hallucination.

Implement these four data sanitization rules in your test harness:

1. Isolate Lint Passes from Simulation Runs

Never run functional simulation if the linter produces warnings. Configure Verilator with strict warning flags and force the agent to clear all AST errors first:

verilator --lint-only -Wall -Werror-PINMISSING -Werror-IMPLICIT -Werror-WIDTH top.v

Provide the LLM with only the line number, the offending identifier, and the specific compiler warning. Do not include simulator licensing headers, file paths, or build tool flags.

2. Extract Assertion Traces into Tabular Time-Series

When Cocotb catches an assertion failure, parse the recorded signals into a clean, cycle-by-cycle ASCII table covering the five clock cycles immediately preceding the failure.

[Assertion Failure at Simulation Time: 145ns (Cycle 29)]
Assertion Condition: (state == STATE_READ) |-> (data_valid == 1'b1)

Cycle | clk | reset_n | state      | req | ack | data_valid | data_out
--------------------------------------------------------------------
25    | 1   | 1       | STATE_IDLE | 1   | 0   | 0          | 0x00
26    | 1   | 1       | STATE_ADDR | 0   | 1   | 0          | 0x00
27    | 1   | 1       | STATE_READ | 0   | 0   | 0          | 0x00 <-- ERROR: data_valid was 0
28    | 1   | 1       | STATE_DONE | 0   | 0   | 0          | 0x00

This provides the attention heads with explicit temporal delta context that text descriptions lack. It allows the model to calculate cycle deltas without hallucinating state history.

3. Enforce a Maximum Iteration Depth with Rollback

Set a hard limit of four or five repair iterations. If the agent fails to resolve an assertion error after four turns, discard the patch history and reset to the seed specification. In over 80 percent of divergent runs, an LLM that fails to fix a bug in three turns begins introducing compensatory hacks that permanently destroy the microarchitecture.

4. Couple Equivalence Checking to Prevent Microarchitectural Drift

When prompting an agent to optimize timing or fix a localized bug in existing RTL, run Formality, Cadence Conformal, or open-source Sequential Equivalence Checking (SEC) via Yosys miter circuits after every iteration. If the agent silently modifies the interface protocol or alters register addresses to satisfy a failing corner test, the SEC pass will flag an immediate functional mismatch.

What This Means for Silicode

At Silicode (silicode.ai), our front-end architecture is built around the fundamental reality that language models cannot be trusted to generate unverified silicon RTL out of the box. Plausible Verilog is not production Verilog.

Rather than treating LLMs as autonomous chip architects, Silicode integrates model generation directly into deterministic verification engines. By coupling domain-specific models with automated formal assertions, strict lint rules, and continuous cycle-accurate testbenches, the platform ensures that generated modules meet rigid timing, reset-tree, and CDC constraints before any code is checked into a silicon repository. The goal is verified hardware with complete test coverage, not unvalidated AI-generated text.

Engineering Decision Framework: When to Use Simulator Loops

Before spending compute budget on continuous agentic RTL repair loops, evaluate your target block against this operational checklist:

  1. Is the module bounded by a single clock domain?

    • Yes: Proceed with automated Cocotb-Verilator repair loops. Convergence probability is high.
    • No: Keep clock-domain crossing modules under manual human design and formal CDC sign-off. Agents will hallucinate unsafe synchronizers.
  2. Does the testbench contain formal SVA or reference golden models?

    • Yes: The feedback loop has ground truth. The agent can evaluate specific assertion failures.
    • No: Relying solely on raw $display printouts causes prompt drift. Write the assertions before turning on the repair agent.
  3. Is the microarchitecture deeply pipelined with out-of-order execution?

    • Yes: Automated token repair will fail on pipeline stall and bubble management. Write the control logic manually.
    • No: Finite state machines, packet parsers, register blocks, and standard DSP data paths are ideal candidates for agentic generation.
  4. Are physical synthesis and static timing analysis part of the loop?

    • Yes: The agent cannot bloat the logic cone without being penalized by $WNS$ and total negative slack ($TNS$) metrics.
    • No: Expect the generated code to pass functional simulation while failing physical place-and-route timing sign-off.

Autonomous RTL generation is moving away from conversational chatbots and toward tightly constrained, tool-in-the-loop compilation systems. For front-end teams, the focus must remain on the harness: building deterministic environments where the simulation kernel, not the LLM's imagination, dictates hardware correctness.

Sources

  • NVIDIA Corporation: Nemotron 3 Ultra Technical Report and Agentic RTL Coding Experiments (developer.nvidia.com/blog/nvidia-nemotron-3-ultra-leads-open-models-on-accuracy-and-efficiency-in-agentic-rtl-coding/)
  • Nemotron 3 Ultra Architecture and SFT Data (arxiv.org/html/2606.15007v1)
  • ACE-RTL Benchmark: Agentic Context Evolution for RTL Generation (arxiv.org/html/2602.10218v2)
  • Dr.RTL: Autonomous Agentic Framework for Iterative RTL Timing Optimization (github.com/hkust-zhiyao/Dr_RTL)
  • NVIDIA NeMo Developer Asset Hub and Model Releases (github.com/NVIDIA-NeMo/Nemotron)

More Silicode Insight

RTL GenerationVerilatorCocotbNemotron 3 UltraEDA Automation