Turbostar logo Turbostar
Step 1 • Project Setup

Configure Target FPGA Architecture in turbostar.json

Every synthesis, timing, and simulation command reads project defaults from turbostar.json in your project root. Instead of hand-editing JSON or maintaining sprawling synthesis Makefiles, run turbostar-verilog config to set your target FPGA family, part, package, top-level module, clock constraint (in MHz), pin constraints (.pcf), and RTL source directory. Running turbostar-verilog config with no flags inspects the current configuration and verifies your installed EDA binaries.

  • Supported Targets: ice40 (Lattice iCE40 with -abc9 LUT4/carry mapping), ecp5 (Lattice ECP5), gowin, xilinx, or generic.
  • Zero-Flag Inspection: Run turbostar-verilog config at any time to inspect active settings, detected yosys/nextpnr binaries, and discovered .pcf files.
$ cd examples/test8008
$ turbostar-verilog config --target ice40 --device hx8k --package cb132 \
    --top main --freq 80 --pcf pcf/cu.pcf --sv-path sv
Successfully saved FPGA project configuration to `/home/user/test8008/turbostar.json`.

## FPGA Project Settings

- Config File: `/home/user/test8008/turbostar.json`
- Target Architecture: `ice40`
- Device: `hx8k`
- Package: `cb132`
- Top Module: `main`
- Clock Frequency: 80.0 MHz
- PCF Pin Constraints: `pcf/cu.pcf`
- RTL Source Directory: `sv`

### System EDA Environment
- Yosys: `/usr/bin/yosys`
- Installed nextpnr Targets: `ice40, generic`

### Discovered Pin Constraints (.pcf)
- `pcf/cu.pcf`
Step 2 • Verification Mapping

Auto-Scan Testbenches & Bind Verification Tiers (config --scan)

In multi-module designs, running every system testbench after a one-line ALU edit wastes minutes, while running only a leaf testbench misses integration bugs. On an existing project, turbostar-verilog config --scan inspects every testbench in your workspace, identifies the Device Under Test (preferring explicit dut/uut instances over helper RAM/bus models), marks composite parent modules with hierarchical=true, and writes the complete mapping to turbostar.json in one step—warning immediately if two testbenches collide on the same $dumpfile VCD path.

  • One-Command Auto-Discovery (-s, --scan): Populates turbostar.json for all workspace testbenches (9 testbenches in examples/test8008, or all 38 testbenches in examples/test8080) and enables bottom-up hierarchical verification on composite parent modules (cpu, main, top).
  • Cumulative Test Tiers (--tb ... --level): Fine-tune individual testbenches as quick (fast unit tests), comprehensive (subsystem integration tests), or extreme (long soak tests).
# 1. Auto-scan the workspace to bind all testbenches and detect composite parent modules:
$ turbostar-verilog config --scan
### Verilog Testbench Configuration

- Action: Scanned 9 workspace testbench(es): added 9 new association(s), enabled default `hierarchical=true` on 2 composite module(s).
- Config File: `turbostar.json`
- Modules with Default `hierarchical=true`: `cpu`, `main`

#### Configured Testbenches
┌───────────────────────┬────────────────────┬───────┬───────────────────────┐
│ Testbench             │ Associated Modules │ Level │ $dumpfile VCD         │
├───────────────────────┼────────────────────┼───────┼───────────────────────┤
│ tb/tb_alu.sv          │ alu_mod            │ quick │ dump_alu.vcd          │
│ tb/tb_main.sv         │ main               │ quick │ dump.vcd              │
│ tb/tb_register.sv     │ register           │ quick │ dump_register.vcd     │
│ tb/tb_regsel.sv       │ regsel             │ quick │ dump_regsel.vcd       │
│ tb/tb_regsel_write.sv │ regsel_write       │ quick │ dump_regsel_write.vcd │
│ tb/tb_sequencer.sv    │ sequencer_mod      │ quick │ dump_sequencer.vcd    │
│ tb/tb_stack.sv        │ stack_mod          │ quick │ dump_stack.vcd        │
│ tb/tb_stack_probe.sv  │ stack_mod          │ quick │ *(none)*              │
│ tb/tb_stackprobe.sv   │ stack_mod          │ quick │ *(none)*              │
└───────────────────────┴────────────────────┴───────┴───────────────────────┘

# 2. Optionally customize specific testbenches (e.g. bind tb_main.sv to both 'cpu' and 'main' at tier 'comprehensive'):
$ turbostar-verilog config --tb tb/tb_main.sv --modules cpu,main --level comprehensive

# Resulting turbostar.json written in the project root:
{
  "fpga": {
    "device": "hx8k",
    "freq_mhz": 80.0,
    "package": "cb132",
    "pcf_file": "pcf/cu.pcf",
    "sv_path": "sv",
    "target": "ice40",
    "top_module": "main"
  },
  "hierarchical_modules": [ "cpu", "main" ],
  "testbenches": [
    { "level": "quick",         "modules": [ "alu_mod" ],       "testbench": "tb/tb_alu.sv" },
    { "level": "comprehensive", "modules": [ "main", "cpu" ],   "testbench": "tb/tb_main.sv" },
    { "level": "quick",         "modules": [ "register" ],      "testbench": "tb/tb_register.sv" },
    { "level": "quick",         "modules": [ "regsel" ],        "testbench": "tb/tb_regsel.sv" },
    { "level": "quick",         "modules": [ "regsel_write" ],  "testbench": "tb/tb_regsel_write.sv" },
    { "level": "quick",         "modules": [ "sequencer_mod" ], "testbench": "tb/tb_sequencer.sv" },
    { "level": "quick",         "modules": [ "stack_mod" ],     "testbench": "tb/tb_stack.sv" }
  ]
}
Step 3 • Static Verification & Synthesis

Fast Verilator Lint & Yosys Synthesis Triage (compile)

Raw synthesis logs bury critical multi-driver nets and latch inferences inside thousands of lines of LUT mapping progress. turbostar-verilog compile runs Verilator static analysis and Yosys synthesis while separating real hardware bugs (undriven nets, width mismatches, inferred latches) from routine style notes (unused wires).

  • Sub-Second Static Lint (-l, --lint-only): Checks syntax, port widths, and undriven signals across the module hierarchy in ~0.2 seconds.
  • Submodule Synthesis Scoping (-m <module> -s): Synthesize a single module or file in isolation without waiting for full-chip place-and-route.
$ turbostar-verilog compile --lint-only
# Verilog Lint Report: `main`

- Status: PASSED (Lint Only, 0.24s)
- Target Scope: `main` (11 RTL files in hierarchy)
- Diagnostics Summary: 3 correctness warning(s), 15 style/unused note(s)
- Full Log: `tmp://synthesis.log` (89 lines, 8486 bytes)

## Correctness & Synthesis Warnings (3)

- [Verilator] `%Warning-UNDRIVEN: sv/cpu/cpu.sv:8:21: Signal is not driven: 'mem_read_en'`
- [Verilator] `%Warning-UNDRIVEN: sv/mem_arbiter/mem_arbiter.sv:13:22: Signal is not driven: 'port2_data'`
- [Verilator] `%Warning-UNDRIVEN: sv/mem_arbiter/mem_arbiter.sv:14:20: Signal is not driven: 'port2_valid'`

## Style & Unused Resource Notes (15)

- `PINCONNECTEMPTY` (3 occurrences) — e.g. `%Warning-PINCONNECTEMPTY: sv/cpu/cpu.sv:61:10: Instance pin connected by name with empty reference: 'port2_valid'` *(+2 more in `tmp://synthesis.log`)*
- `UNUSEDSIGNAL` (11 occurrences) — e.g. `%Warning-UNUSEDSIGNAL: sv/cpu/cpu.sv:33:12: Signal is not driven, nor used: 'carry'` *(+10 more in `tmp://synthesis.log`)*
- `VARHIDDEN` (1): `%Warning-VARHIDDEN: sv/stack/stack.sv:11:15: Declaration of signal hides declaration in upper scope: 'stack'`
Step 4 • Automated Simulation & Regression Diffing

Module-Targeted & Bottom-Up Hierarchical Simulation (sim)

turbostar-verilog sim compiles and runs your SystemVerilog testbenches with Verilator (`--timing --trace`), automatically stages any $readmemh/$readmemb initialization files, and compares every generated .vcd dump cycle-by-cycle against the prior run (.previous.vcd) and last passing baseline (.lastpass.vcd).

  • Single-Module Inner Loop (sim -m alu_mod): Runs only the testbenches associated with alu_mod and verifies whether the resulting waveform is identical to the previous run.
  • Bottom-Up Hierarchical Verification (sim -m cpu or -H): Computes the transitive dependency graph of cpu, executes leaf unit testbenches first (`register` → `regsel` → `alu_mod` → `stack_mod` → `sequencer_mod`), and finishes with the top-level `cpu` integration testbench.
# 1. Fast unit simulation of a single leaf module:
$ turbostar-verilog sim -m alu_mod
## Module Verification Report: `alu_mod`

- Level Filter: `comprehensive`
- Summary: 1 Passed, 0 Failed (out of 1 testbench run(s))

┌──────────────┬───────────┬───────┬────────┬──────────────┬───────────────────────┐
│ Testbench    │ Module(s) │ Level │ Result │ Waveform     │ vs. Previous          │
├──────────────┼───────────┼───────┼────────┼──────────────┼───────────────────────┤
│ tb/tb_alu.sv │ alu_mod   │ quick │ PASS   │ dump_alu.vcd │ IDENTICAL to previous │
└──────────────┴───────────┴───────┴────────┴──────────────┴───────────────────────┘

# 2. Full bottom-up hierarchical verification across 'cpu' and all instantiated submodules:
$ turbostar-verilog sim -m cpu
## Module Verification Report: `cpu` (Hierarchical)

- Hierarchy Mode: Ran with `hierarchical=true` due to project settings for `cpu` in `turbostar.json`
- Bottom-Up Module Order: `mem_arbiter_mod` -> `register` -> `regsel` -> `regsel_write` -> `decode_mod` -> `alu_mod` -> `stack_mod` -> `sequencer_mod` -> `cpu`
- Level Filter: `comprehensive`
- Summary: 7 Passed, 2 Info (no assertions), 0 Failed (out of 9 testbench run(s))

┌───────────────────────┬───────────────┬───────────────┬──────────────────────┬───────────────────────┬───────────────────────┐
│ Testbench             │ Module(s)     │ Level         │ Result               │ Waveform              │ vs. Previous          │
├───────────────────────┼───────────────┼───────────────┼──────────────────────┼───────────────────────┼───────────────────────┤
│ tb/tb_register.sv     │ register      │ quick         │ PASS                 │ dump_register.vcd     │ IDENTICAL to previous │
│ tb/tb_regsel.sv       │ regsel        │ quick         │ PASS                 │ dump_regsel.vcd       │ IDENTICAL to previous │
│ tb/tb_regsel_write.sv │ regsel_write  │ quick         │ PASS                 │ dump_regsel_write.vcd │ IDENTICAL to previous │
│ tb/tb_alu.sv          │ alu_mod       │ quick         │ PASS                 │ dump_alu.vcd          │ IDENTICAL to previous │
│ tb/tb_stack.sv        │ stack_mod     │ quick         │ PASS                 │ dump_stack.vcd        │ IDENTICAL to previous │
│ tb/tb_stack_probe.sv  │ stack_mod     │ quick         │ INFO (no assertions) │ *(none)*              │ -                     │
│ tb/tb_stackprobe.sv   │ stack_mod     │ quick         │ INFO (no assertions) │ *(none)*              │ -                     │
│ tb/tb_sequencer.sv    │ sequencer_mod │ quick         │ PASS                 │ dump_sequencer.vcd    │ IDENTICAL to previous │
│ tb/tb_main.sv         │ cpu           │ comprehensive │ PASS                 │ dump.vcd              │ IDENTICAL to previous │
└───────────────────────┴───────────────┴───────────────┴──────────────────────┴───────────────────────┴───────────────────────┘
Step 4b • SymbiYosys Formal Verification (formal)

Automated Bounded, k-Induction & Coverability Proofs (formal)

turbostar-verilog formal auto-discovers SystemVerilog bind <module> property modules in formal/*_props.sv, resolves transitive RTL dependencies, stages $readmemh/$readmemb files, and drives SymbiYosys (sby) with auto-detected SMT solvers (bitwuzla → yices → z3) and Yosys read_slang.

  • All-Modules or Single-Module Runs (formal / formal -m alu8): Defaults to --mode all (prove + cover), printing per-module elapsed timing, collapsing passing coverpoint tables inline (pass -v to expand all), and warning on Vacuity Risk if a proof passes while any cover() is unreachable.
  • Parameter Overrides (-P KEY=VAL): Override large counter widths (e.g. -P COUNTER_BITS=4) via read_slang -G / chparam so coverability reaches all states quickly without editing RTL defaults.
  • Counterexample VCD Integration: Failing assertions display --> source snippets with the failing step, copy the counterexample VCD to wave/formal_<mod>_<task>.vcd, and print a ready-to-run turbostar-verilog vcd-wave ... -i <mod> command.
# 1. Run prove + cover across all modules with formal/*_props.sv bindings:
$ turbostar-verilog formal
## Formal Verification Report (SymbiYosys `smtbmc bitwuzla`, depth=20)

┌───────────────┬──────────────────────────────┬───────┬──────┬─────────────┬──────┬──────────────────────────────────┐
│ Module        │ Property File(s)             │ Task  │ Status│ Coverpoints │ Time │ Counterexample VCD               │
├───────────────┼──────────────────────────────┼───────┼──────┼─────────────┼──────┼──────────────────────────────────┤
│ alu16         │ formal/alu16_props.sv        │ prove │ PASS │ -           │ 0.5s │ -                                │
│ alu16         │ formal/alu16_props.sv        │ cover │ PASS │ 11/11 hit   │ -    │ -                                │
│ alu8          │ formal/alu8_props.sv         │ prove │ PASS │ -           │ 0.8s │ -                                │
│ alu8          │ formal/alu8_props.sv         │ cover │ PASS │ 21/21 hit   │ -    │ -                                │
│ sequencer_mod │ formal/sequencer_props.sv    │ prove │ PASS │ -           │ 0.5s │ -                                │
│ sequencer_mod │ formal/sequencer_props.sv    │ cover │ PASS │ 15/15 hit   │ -    │ -                                │
└───────────────┴──────────────────────────────┴───────┴──────┴─────────────┴──────┴──────────────────────────────────┘

# 2. Override a large counter parameter to prove full reachability quickly:
$ turbostar-verilog formal -m eightsegment -P COUNTER_BITS=4
*Config: auto-generated `.sby` (`read_slang`)* — *Parameters: `COUNTER_BITS=4`*
Step 5 • Structural Logic Depth & In-Place Port Annotations

Combinational LUT Depth, Area & In-Place // [timing: ...] Annotations

Timing analysis is the default mode of turbostar-verilog (also accessible via turbostar-verilog timing). It synthesizes the target module into technology-mapped LUTs and carry chains (using synth_ice40 -abc9 when configured for iCE40) and extracts input-to-register, register-to-output, and internal register-to-register logic levels alongside a cell area breakdown.

  • Single-Module Depth & Inline RTL (-m <module> -k <top_k>): Groups critical paths by bottleneck sink and prints the exact SystemVerilog statement at each hop alongside LUT and carry-chain counts.
  • Project-Wide Dry-Run Summary (--dry-run): Synthesizes every module in your project and prints a single comparison table of Reg->Reg Depth, LUTs, and FFs.
  • In-Place Port Annotations (-u, --update): Writes and updates vertically aligned // [timing: ...] comments directly on module port declarations inside your .sv files.
# 1. Inspect LUT logic depth, critical combinational cones, and area for 'alu_mod':
$ turbostar-verilog -m alu_mod -k 2
# Timing: `alu_mod`

Target: iCE40
Max Internal Reg -> Reg Depth: 14

## Inputs
┌────────┬───────┬───────────┬──────────┐
│ Name   │ Width │ Layers to │ Sinks to │
├────────┼───────┼───────────┼──────────┤
│ clk    │ 1     │ -         │ Clock    │
│ input1 │ 8     │ 0         │ Register │
│ input2 │ 8     │ 0         │ Register │
│ opcode │ 8     │ 8         │ Register │
│ retire │ 1     │ 1         │ Register │
│ rst    │ 1     │ 0         │ Register │
└────────┴───────┴───────────┴──────────┘

## Outputs
┌───────────────┬───────┬─────────────┬──────────────┐
│ Name          │ Width │ Layers from │ Sourced from │
├───────────────┼───────┼─────────────┼──────────────┤
│ alu_out       │ 8     │ 13          │ Register     │
│ alu_out_valid │ 1     │ 2           │ Register     │
│ flags_out     │ 4     │ 0           │ Register     │
└───────────────┴───────┴─────────────┴──────────────┘

## Worst Combinational Paths (Grouped by Bottleneck Sink)

Critical Path Summary: 14 levels (6 LUTs + 8 carry), converging on `flags[0]` from 1 source signals

### Path #1 [Reg -> Reg] Depth: 14 (6 LUTs + 8 carry)
- Start: `input2_reg[0]` (`alu.sv:22-32` | `input2_reg <= input2;`)
  1. `cells_map.v` (1 LUT, from `input2_reg[0]`)                   -> `carry`
  2. `alu.sv:163`  (1 LUT + 7 carry)                               -> `carry`    | `{carry, alu_out} = input1_reg - input2_reg;`
  3. `alu.sv:143`  (1 LUT + 1 carry)                               -> `carry`    | `{carry, alu_out} = input1_reg - input2_reg - {7'b0000000, carry_in};`
  4. `cells_map.v` (2 LUTs, from `input1_reg[7]`, `input1_reg[0]`) -> `carry`
  5. `alu.sv:13`   (1 LUT)                                         -> `carry`    | `logic carry;`
- End: `flags[0]` (`alu.sv:22-32` | `flags <= next_flags;`)

## Area Summary
- LUTs: 190 | Flip-Flops: 20 | Carry: 46 | Total Cells: 256

# 2. Scan all 11 modules across the project (--dry-run previews without modifying files; -u updates .sv ports in-place):
$ turbostar-verilog --dry-run
┌──────────────────┬────────────────┬──────┬─────┬────────┬─────────┬─────────┬───────────────────────────────┐
│ Module           │ Reg->Reg Depth │ LUTs │ FFs │ Inputs │ Outputs │ Status  │ Source File                   │
├──────────────────┼────────────────┼──────┼─────┼────────┼─────────┼─────────┼───────────────────────────────┤
│ alu_mod          │ 14 LUTs        │ 190  │ 20  │ 6      │ 3       │ DRY-RUN │ sv/alu/alu.sv                 │
│ cpu              │ 16 LUTs        │ 505  │ 296 │ 3      │ 5       │ DRY-RUN │ sv/cpu/cpu.sv                 │
│ decode_mod       │ 17 LUTs        │ 185  │ 88  │ 11     │ 10      │ DRY-RUN │ sv/decode_mod/decode_mod.sv   │
│ main             │ 16 LUTs        │ 538  │ 301 │ 2      │ 1       │ DRY-RUN │ sv/main.sv                    │
│ mem_arbiter_mod  │ 0 LUTs         │ 0    │ 1   │ 7      │ 5       │ DRY-RUN │ sv/mem_arbiter/mem_arbiter.sv │
│ initialized_bram │ 4 LUTs         │ 42   │ 31  │ 5      │ 1       │ DRY-RUN │ sv/ram/ram.sv                 │
│ register         │ 0 LUTs         │ 0    │ 8   │ 4      │ 1       │ DRY-RUN │ sv/register/register.sv       │
│ regsel           │ 0 LUTs         │ 55   │ 0   │ 9      │ 1       │ DRY-RUN │ sv/regsel/regsel.sv           │
│ regsel_write     │ 0 LUTs         │ 7    │ 7   │ 4      │ 7       │ DRY-RUN │ sv/regsel/regsel_write.sv     │
│ sequencer_mod    │ 2 LUTs         │ 10   │ 3   │ 4      │ 3       │ DRY-RUN │ sv/sequencer/sequencer.sv     │
│ stack_mod        │ 3 LUTs         │ 111  │ 147 │ 6      │ 1       │ DRY-RUN │ sv/stack/stack.sv             │
└──────────────────┴────────────────┴──────┴─────┴────────┴─────────┴─────────┴───────────────────────────────┘

# 3. Running 'turbostar-verilog -u' annotates module ports in-place in sv/alu/alu.sv:
module alu_mod
	(input logic	    clk,           // [timing: clock]
	 input logic	    rst,           // [timing: 0 -> Reg]
	 input logic [7:0]  input1,        // [timing: 0 -> Reg]
	 input logic [7:0]  input2,        // [timing: 0 -> Reg]
	 input logic [7:0]  opcode,        // [timing: 8 -> Reg]
	 input logic	    retire,        // [timing: 1 -> Reg]
	 output logic [3:0] flags_out,     // [timing: 0 <- Reg]
	 output logic [7:0] alu_out,       // [timing: 13 <- Reg]
	 output logic	    alu_out_valid  // [timing: 2 <- Reg]
);
Step 6 • Post-Routing Physical Timing

Multi-Seed Place-and-Route Timing Closure (--pnr)

Pass --pnr to run full Yosys synthesis plus nextpnr physical placement and routing. When targeting the project's top module, turbostar-verilog --pnr applies your .pcf pin constraints; when given -m <submodule>, it runs unconstrained out-of-context submodule PnR and automatically evaluates multiple placement seeds to report median and min-max achieved Fmax.

  • Logic vs. Wire Routing Breakdown: Every critical path hop displays its exact logic delay, physical routing delay, net fanout (sink count), and chip Manhattan tile span.
  • Detailed Cell Segments (--segments): Pass --segments to expand any critical path into individual SB_LUT4, SB_CARRY, and routing interconnect hops.
$ turbostar-verilog --pnr -m alu_mod -k 2
> [!NOTE] Out-of-Context Submodule PnR (`alu_mod`): Analyzed submodule `alu_mod` with unconstrained I/O placement (configured project `top_module` is `main`).

## Clock Domain & Frequency Timing
┌───────────────────────┬────────────┬──────────────────────────────────────────────────┬───────────┬────────┐
│ Clock Domain          │ Constraint │ Achieved Fmax                                    │ Slack     │ Status │
├───────────────────────┼────────────┼──────────────────────────────────────────────────┼───────────┼────────┤
│ clk$SB_IO_IN_$glb_clk │ 80.00 MHz  │ 102.63 MHz (median of 5 seeds: 99.90-103.90 MHz) │ +2.756 ns │ MET    │
└───────────────────────┴────────────┴──────────────────────────────────────────────────┴───────────┴────────┘

## Hardware Resource Utilization
┌──────────────┬──────┬───────────┬─────────────┐
│ Resource     │ Used │ Available │ Utilization │
├──────────────┼──────┼───────────┼─────────────┤
│ ICESTORM_LC  │ 217  │ 7680      │ 2.8%        │
│ ICESTORM_PLL │ 0    │ 2         │ 0.0%        │
│ ICESTORM_RAM │ 0    │ 32        │ 0.0%        │
│ SB_GB        │ 1    │ 8         │ 12.5%       │
│ SB_IO        │ 40   │ 95        │ 42.1%       │
│ SB_WARMBOOT  │ 0    │ 1         │ 0.0%        │
└──────────────┴──────┴───────────┴─────────────┘

## Physical Critical Paths (Grouped by Bottleneck Sink)

Critical Path Summary: 9.744 ns (3.543 ns logic [36%], 5.803 ns routing [60%]), converging on `flags[3]` from 1 source signals

### Path #1 [Reg -> Reg] Delay: 9.744 ns (36% logic, 60% routing) — Converging on `flags[3]`
- Start: `input2_reg[0]`
- Chain:
  1. `sv/alu/alu.sv:22-32` (input2_reg)                 | `input2_reg <= input2;`                                                — 1.128 ns (0.540 ns logic, 0.588 ns routing) -> `alu_out` [8 sinks, span: 2 tiles]
  2. `sv/alu/alu.sv:14`    (carry_in)                   | `logic carry_in;`                                                      — 0.903 ns (0.315 ns logic, 0.588 ns routing) [4 sinks, span: 1 tile]
  3. `sv/alu/alu.sv:163`   (carry_in)                   | `{carry, alu_out} = input1_reg - input2_reg;`                          — 1.708 ns (0.378 ns logic, 1.330 ns routing) [2 sinks, span: 4 tiles]
  4. `sv/alu/alu.sv:14`    (carry_in)                   | `logic carry_in;`                                                      — 0.231 ns (0.231 ns logic, 0.000 ns routing) [2 sinks]
  5. `sv/alu/alu.sv:133`   (carry_in, 7 carry/LUT hops) | `{carry, alu_out} = input1_reg + input2_reg + {7'b0000000, carry_in};` — 1.918 ns (1.071 ns logic, 0.847 ns routing) [max 13 sinks, max span: 1 tile]
  6. `sv/alu/alu.sv:13`    (carry, 2 carry/LUT hops)    | `logic carry;`                                                         — 1.869 ns (0.693 ns logic, 1.176 ns routing) [max 1 sink, max span: 2 tiles]
  7. `sv/alu/alu.sv:10`    (alu_out)                    | `output logic [7:0] alu_out,`                                          — 1.589 ns (0.315 ns logic, 1.274 ns routing) -> `alu_out[7]` [3 sinks, span: 7 tiles]
- Dominant Routing Delays:
  - 1.330 ns routing via `carry_in` (2 sinks, span: 4 tiles)
  - 1.274 ns routing via `alu_out[7]` (3 sinks, span: 7 tiles)
  - 0.588 ns routing via `alu_out` (8 sinks, span: 2 tiles)
- End: `flags[3]` (`sv/alu/alu.sv:22-32` | `flags <= next_flags;`)
Step 7 • Waveform Debugging from the Terminal

Cycle-Accurate VCD Inspection, Condition Search & RTL Net Tracing (vcd-*)

Instead of opening a GUI waveform viewer and manually adding signals after every simulation run, turbostar-verilog provides seven vcd-* subcommands that render clock-aligned waveform tables, toggle statistics, condition searches, cycle-by-cycle VCD diffs, and structural RTL net traces directly in your terminal.

  • Zero-Config Enum Auto-Discovery: vcd-info, vcd-wave, and vcd-search automatically scan your SystemVerilog typedef enum declarations so FSM states render as 0x1 (FETCH), 0x2 (DECODE), and 0x4 (RETIRE) without manual setup.
  • Module Boundary & Shorthand Signal Sampling: Pass an instance or module name like -i alu (or vcd-wave alu) to automatically sample all of its input and output ports, or pass leaf names like -s sequencer.state,current_ip,alu_out; vcd-wave resolves full hierarchical paths automatically and collapses identical idle clock cycles.
  • Structural Net Traceability (vcd-trace): Map any VCD signal back to every module port, wire declaration, driving cell, and sink load across your RTL hierarchy.
# 1. Inspect VCD signals and toggle activity statistics in the sequencer scope:
$ turbostar-verilog vcd-info dump.vcd --stats -f "*sequencer*"
#### Filtered Signals (Scope: `*` | Filter: `*sequencer*` | Count: 8)
┌─────────────────────────────────────────────────┬───────┬──────┬─────────────────────┬─────────────┐
│ Signal Name                                     │ Width │ Type │ First Toggle (Tick) │ Toggle Rate │
├─────────────────────────────────────────────────┼───────┼──────┼─────────────────────┼─────────────┤
│ tb_main.uut.cpu8008.sequencer.clk               │ 1     │ wire │ 0                   │ [ref clk]   │
│ tb_main.uut.cpu8008.sequencer.rst               │ 1     │ wire │ 2                   │ 0.5%        │
│ tb_main.uut.cpu8008.sequencer.decode_phase      │ 1     │ wire │ 4                   │ 3.5%        │
│ tb_main.uut.cpu8008.sequencer.retire_phase      │ 1     │ wire │ 4                   │ 3.0%        │
│ tb_main.uut.cpu8008.sequencer.instruction_valid │ 1     │ wire │ 3                   │ 3.5%        │
│ tb_main.uut.cpu8008.sequencer.opcode            │ 8     │ wire │ 3                   │ 2.0%        │
│ tb_main.uut.cpu8008.sequencer.state             │ 3     │ wire │ 4                   │ 3.5%        │
│ tb_main.uut.cpu8008.sequencer.next_state        │ 3     │ wire │ 3                   │ 3.5%        │
└─────────────────────────────────────────────────┴───────┴──────┴─────────────────────┴─────────────┘

# 2. Render clock-aligned waveforms across ticks 0..12 (with automatic enum state decoding):
$ turbostar-verilog vcd-wave dump.vcd -s sequencer.state,current_ip,instruction_data,alu_out --start-tick 0 --end-tick 12
### VCD Waveform: `dump.vcd`
Sampled on: `tb_main.clk` (posedge) | Timescale: 1ps | Total Rows: 13

┌──────┬────────────┬─────────────────┬────────────┬──────────────────┬─────────┐
│ Tick │ Time (1ps) │ sequencer.state │ current_ip │ instruction_data │ alu_out │
├──────┼────────────┼─────────────────┼────────────┼──────────────────┼─────────┤
│ 0    │ 5000       │ 0x1 (FETCH)     │ 0x0000     │ 0x00             │ 0x01    │
│ 1    │ 15000      │ 0x1 (FETCH)     │ 0x0000     │ 0x00             │ 0x01    │
│ 2    │ 25000      │ 0x1 (FETCH)     │ 0x0000     │ 0x00             │ 0x01    │
│ 3    │ 35000      │ 0x1 (FETCH)     │ 0x0001     │ 0x00             │ 0x00    │
│ 4    │ 45000      │ 0x2 (DECODE)    │ 0x0002     │ 0x41             │ 0x41    │
│ 5    │ 55000      │ 0x1 (FETCH)     │ 0x0002     │ 0x41             │ 0x41    │
│ 6    │ 65000      │ 0x1 (FETCH)     │ 0x0003     │ 0x41             │ 0x41    │
│ 7    │ 75000      │ 0x2 (DECODE)    │ 0x0004     │ 0x80             │ 0x80    │
│ 8    │ 85000      │ 0x1 (FETCH)     │ 0x0004     │ 0x80             │ 0x80    │
│ 9    │ 95000      │ 0x2 (DECODE)    │ 0x0005     │ 0x80             │ 0x41    │
│ 10   │ 105000     │ 0x1 (FETCH)     │ 0x0005     │ 0x80             │ 0x41    │
│ 11   │ 115000     │ 0x1 (FETCH)     │ 0x0006     │ 0x80             │ 0x80    │
│ 12   │ 125000     │ 0x4 (RETIRE)    │ 0x0006     │ 0x41             │ 0x41    │
└──────┴────────────┴─────────────────┴────────────┴──────────────────┴─────────┘

> [!TIP] Signal `instruction_data` has no symbolic labels yet. To display enum names alongside hex values (and search by name in `turbostar-verilog vcd-search`), run:
> `turbostar-verilog vcd-labels dump.vcd -s instruction_data -l "0x00=<NAME_1>,0x41=<NAME_2>"`

# 3. Search for clock cycles matching a symbolic enum state or hex condition:
$ turbostar-verilog vcd-search dump.vcd -w sequencer.state=RETIRE
### VCD Search: `tb_main.uut.cpu8008.sequencer.state` == `RETIRE` in `dump.vcd`
┌──────────┬────────────┬──────────┬────────┬───────────────────┬───────────────┐
│ Interval │ Start Tick │ End Tick │ Cycles │ Time Window (1ps) │ Matched Value │
├──────────┼────────────┼──────────┼────────┼───────────────────┼───────────────┤
│ 1        │ 12         │ 201      │ 190    │ 125000 - 2015000  │ 0x4 (RETIRE)  │
└──────────┴────────────┴──────────┴────────┴───────────────────┴───────────────┘

> [!TIP] To inspect waveforms around match 1, run:
> `turbostar-verilog vcd-wave dump.vcd -s sequencer.state --start 11 --end 13`

# 4. Trace a simulation net back to its RTL drivers and consumers across module boundaries:
$ turbostar-verilog vcd-trace alu_out
### Signal Source Trace: `alu_out`
- Matched Net: `cpu8008.alu.alu_out` (Width: 8-bit, Bit IDs: 117..124)

#### Hierarchy Declarations & Port Connections
- `mem_write_data` [sv/main.sv:12]: module wire / net
- `cpu8008.alu_out` [sv/cpu/cpu.sv:32]: module output port
- `main_memory.wdata` [sv/ram/ram.sv:5]: module wire / net
- `cpu8008.A_reg.load_value` .. `cpu8008.L_reg.load_value` [sv/register/register.sv:7]: module wire / net
- `cpu8008.alu.alu_out` [sv/alu/alu.sv:10]: module output port

#### Drivers
- `cpu8008.\alu` [sv/alu/alu.sv:45-172]: multiplexer ($pmux) port Y

#### Consumers (Sinks)
- `cpu8008.\A_reg` .. `cpu8008.\L_reg` [sv/register/register.sv:17]: $mux
- `cpu8008.\alu` [sv/alu/alu.sv:174, 176, 181]: $logic_not, $mux, $reduce_xor
- `main_memory` [sv/ram/ram.sv:23]: $mux
Step 8 • Regression Triage (vcd-compare)

Pinpoint First Cycle of Waveform Divergence Across 255 Signals

When an RTL edit or ROM change causes a testbench to diverge, hundreds of downstream registers drift on subsequent clock cycles. Every run of turbostar-verilog sim automatically preserves the prior waveform as .previous.vcd and the last passing waveform as .lastpass.vcd. Running turbostar-verilog vcd-compare diffs the two traces cycle-by-cycle on the reference clock edge and isolates the exact first clock tick and root-cause signals where behavior diverged—filtering out the downstream cascade.

  • Automatic Baseline Diffing in sim: Removing the FF (HLT) byte from ram_init.hex in examples/test8008 immediately triggers a divergence alert in sim at Tick 12.
  • Root-Cause Isolation at Tick 12: Out of 255 signals and 190 differing cycles, vcd-compare shows that Ticks 0–11 matched in lock-step and isolates the 9 memory-read and decode bus signals at Tick 12 where 0xFF became 0x44, complete with a copy-pasteable vcd-wave follow-up command.
# Remove the 'FF' (HLT) byte from ram_init.hex (06 41 36 80 F8 FF 44 -> 06 41 36 80 F8 44) and re-simulate:
$ turbostar-verilog sim --tb tb/tb_main.sv
#### Generated VCD Summary (`dump.vcd`)
- Detected Clock: `tb_main.clk` (202 posedge cycles, period: 10000 1ps)
- Total Signals: 255 across 18 hierarchy scope(s)
- Comparison vs. Previous (`dump.previous.vcd`): DIVERGED (102 signal(s) differ across 190 of 202 cycle(s); first difference at tick 12)

# Compare the candidate waveform against the previous baseline to isolate the root cause at Tick 12:
$ turbostar-verilog vcd-compare dump.previous.vcd dump.vcd
### VCD Compare: DIVERGENCE DETECTED at Tick 12 (Time 1250001ps)

- File A (Reference): `dump.previous.vcd`
- File B (Candidate): `dump.vcd`
- Reference Clock: `tb_main.clk` (sampled on `posedge`)
- In-Sync Prefix: Ticks 0–11 matched identically across all 255 common signals (12 initial cycles in lock-step).
- First Divergence: Tick 12 (9 differing signal(s) at this cycle).
- Post-Divergence Cascade: 190 of 190 subsequent cycles differed as state drifted.
- Signals Evaluated: 255 common signals

> [!NOTE] Applied 1 qualifier(s) symmetrically to both traces.

#### Divergent Signals at First Divergence (Tick 12):
┌───────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────┐
│ Signal                                        │ File A (Reference) │ File B (Candidate) │ Difference     │
├───────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┤
│ tb_main.LED                                   │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.LED                               │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.cpu8008.decode.mem_data           │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.cpu8008.decode_mem_data           │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.cpu8008.mem_arbiter.mem_read_data │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.cpu8008.mem_arbiter.port1_data    │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.cpu8008.mem_read_data             │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.main_memory.rdata                 │ 0xFF               │ 0x44               │ Value mismatch │
│ tb_main.uut.mem_read_data                     │ 0xFF               │ 0x44               │ Value mismatch │
└───────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────┘

> [!TIP] To inspect waveforms around divergence in File B (ticks 10–15), run:
> `turbostar-verilog vcd-wave dump.vcd -s tb_main.LED,tb_main.uut.LED,tb_main.uut.cpu8008.decode.mem_data,tb_main.uut.cpu8008.decode_mem_data,tb_main.uut.cpu8008.mem_arbiter.mem_read_data,tb_main.uut.cpu8008.mem_arbiter.port1_data --start 10 --end 15`
Step 9 • Interactive Schematic & VCD Replay (gridcad-export)

Visualize Synthesized Hierarchy & Step Through Simulations Clock-by-Clock

Once you write or refine SystemVerilog inside TurboStar—or generate and verify it through TurboStar’s Verilog and MCP tools—you can export the entire module hierarchy for visual inspection in GridCad. turbostar-verilog gridcad-export synthesizes the design with Yosys into word-level registers, muxes, priority muxes, adders/subtractors, comparators, reductions, memories, and multi-output LUT8 truth tables while preserving module boundaries, named signals, enum label tables, and source-line provenance.

  • Hierarchical & Word-Level Export: Preserves submodules and multi-bit buses end-to-end (with automatic gridcad_slice, gridcad_split, and gridcad_concat wiring) so schematics stay readable instead of flattening to raw gates.
  • Clock-by-Clock VCD Replay: Load the exported JSON alongside your sim VCD trace to scrub through every clock tick and watch every signal, bus probe, and register value update live across the hierarchy.
  • RTL Source Provenance on Hover: Every component carries its originating file:line and Verilog snippet (src / src_verilog), so hovering over a block in GridCad shows the exact SystemVerilog line behind it.
# Testbench-driven (one command): simulates tb/lda_tb.sv, exports its DUT (`cpu`), and prints the exact gridcad command:
$ turbostar-verilog gridcad-export tb/lda_tb.sv
Exported gridcad scene JSON for `cpu` to gridcad_lda_tb.json
Run: gridcad --import gridcad_lda_tb.json --vcd wave/dump_lda_tb.vcd

# Or module-driven (static export without running simulation):
$ turbostar-verilog gridcad-export -m register16 --shallow -o register16.json
register16.sv edited in TurboStar with inline timing annotations
1. Author & annotate RTL (register16.sv) in TurboStar.
register16 schematic in GridCad replaying VCD at Tick 12
2. Inspect the synthesized schematic & bus probes at Tick 12.
register16 schematic in GridCad stepping to Tick 16 with Verilog source provenance
3. Step clock-by-clock (Tick 16) & hover blocks for Verilog source.

Complete turbostar-verilog Subcommand Reference

Pass --no-frames to any command to emit raw Markdown tables instead of UTF-8 box-drawing borders.

Subcommand Primary Flags & Arguments Description
config -s, --scan, --target, --device, --package, --top, --freq, --pcf, --sv-path, --sby-path, --tb, --modules, --level, --hierarchical Inspect detected EDA tools (Yosys, nextpnr, sby, SMT solvers), auto-scan testbenches (--scan), or populate FPGA settings and testbench bindings in turbostar.json.
timing (or default) -m <mod>, -k <top_k>, -c <lines>, --pnr, --seeds <N>, --segments, -u, --update, --dry-run Run LUT logic depth analysis (default), multi-seed physical PnR timing closure (--pnr), or batch in-place // [timing: ...] port annotations (-u).
compile [module], -m, --module, -l, --lint-only, -s, --synth-only, -o, --output Run Verilator static lint, Yosys synthesis, and optional nextpnr verification with categorized diagnostics.
sim / simulate [module], -m, --module, -b, --tb, -H, --hierarchical, -l, --level, --coverage, --no-formal, -q, --quiet, -v, --verbose Compile and run SystemVerilog testbenches with automatic $readmemh staging, formal/*.sv live assertions, optional RTL/formal coverage, and .previous.vcd regression comparison.
formal [module], -m, --module, --mode bmc|prove|cover|prove+cover|bmc+cover|all, --depth <N>, --solver auto|bitwuzla|yices|z3, -P, --param KEY=VAL, --timeout <S>, -v, --verbose Run SymbiYosys (sby) formal verification on formal/*_props.sv bind modules with transitive deps, parameter overrides, vacuity warnings, per-module timing, and counterexample VCD export.
vcd-info [vcd], --scope, -f, --filter, --stats, --start-tick, --end-tick Inspect VCD timescale, detected reference clock, hierarchy scopes, signal bit-widths, and toggle rates.
vcd-wave [vcd|instance], -i, --instance, -m, --module, -s, --signals, --start-tick, --end-tick, --max-rows, --radix, --no-collapse, --gtkw Render clock-aligned waveform tables for all I/O ports of a module instance (-i) or explicit signals (-s), with automatic enum state decoding, idle cycle collapsing, and optional .gtkw export.
vcd-search [vcd], -w, --where, -s, --signal, --value, -l, --limit, --first, --last, --backward Search VCD traces for clock intervals matching single or multi-signal conditions (hex, binary wildcards, or enum labels).
vcd-compare [vcd_a] [vcd_b], -s, --signals, --scope, --start-tick, --end-tick, --strict Compare two VCD traces cycle-by-cycle and pinpoint the exact clock tick and signals where behavior first diverges.
vcd-trace <signal>, -s, --signal, -n, --netlist Trace a simulation signal across hierarchy boundaries to its RTL declarations, driving logic, and consuming sinks.
vcd-labels [vcd], -s, --signal, -m, --map <val=name>, --list, --clear, --local Register, list, or clear custom symbolic value labels (e.g. opcodes or bus commands) in vcd_labels.json.
vcd-qualifier [vcd], -s, --signal, -q, --qualifier, -b, --bindings, --list, --clear Bind enable/valid strobe signals to buses so inactive cycles are masked as - in vcd-wave and ignored in vcd-search.
gridcad-export [tb.sv|module], -b, --tb, -m, --module, -o, --output, --shallow, --no-sim Given a testbench .sv file, runs simulation to produce a fresh VCD and exports its DUT module to GridCad scene JSON; given a module name, performs a static Yosys scene export.