Hiring, or looking for work? Employers: post a job on Far Reach, compare proposals, and fund a milestone that is released when you accept the work. Freelancers: join Far Reach and get hired for what you do best. Post a job on Far Reach →Join as a freelancer →

trsim › Manuals › Command Reference

trsim Command Reference

The Tuwa RTL Simulator, version 1.0 (Windows x64)


Synopsis

trsim                                 launch the windowed front end
trsim [options] file.v [file.v ...]   run in batch and exit

With no arguments trsim starts trsimgui.exe, which must be in the same directory. With arguments it compiles, elaborates and simulates, prints to standard output, and exits with a code that says what happened.

Options

-top <module>

The module to elaborate as the top level. If you do not give one, trsim uses the first module it finds, which is rarely what you want once you have more than one file.

trsim -top my_tb -time 100000 rtl\*.v tb\my_tb.v

-time <n>

How long to simulate, counted in the unit set by -timeunit or by a `timescale in the source. The default is 1000.

The run also stops early if the design calls $finish, which is the usual way a self-checking testbench ends.

-timeunit <ns|us|ms|ps|fs>

The unit -time is expressed in. A `timescale directive in the source takes precedence, so this only applies to designs that do not set one.

trsim -top my_tb -time 500 -timeunit us rtl\*.v tb\my_tb.v

+incdir+<dir>[+<dir>...]

Directories to search for `include files. Several may be given in one option, separated by +, and the option may be repeated.

trsim -top my_tb +incdir+rtl\include+rtl\shared -time 100000 rtl\*.v

-I <dir>

The same thing, one directory per option, for people used to that spelling.

-vcd <out.vcd>

Write a VCD waveform file. You do not need this if the testbench calls $dumpfile and $dumpvars itself, which is the more usual arrangement because it keeps the choice with the design. See the Waveforms manual.

-f <project.tvp>

Read sources and settings from a project file instead of listing them on the command line. This is the same project the windowed front end uses.

-o <report>

Mirror everything trsim prints into a file as well as to standard output. Useful in a regression run where you want the transcript kept.

trsim -q -o run.log -top my_tb -time 100000 rtl\*.v tb\my_tb.v

-q

Quiet. Suppresses the banner. The design's own output is unaffected.

-h, --help

Print the option list and exit.

-version, --version

Print the version and exit:

$ trsim -version
trsim 1.1.0 (Tuwa RTL Simulator, built Aug 20 2026)
Copyright (c) 2026 Muhammad Anisur Rahman

The version is major.minor.patch. Major changes when the command line, the project file format, or the C generated by -native changes in a way that breaks an existing setup; minor when language coverage or features are added, leaving existing designs alone; patch for fixes only.

The first line's second field is the bare number, so a script can gate on it:

ver=$(trsim -version | cut -d' ' -f2)

Every VCD file trsim writes carries the same string on its $version line, so a waveform recorded months ago still says which build produced it.

-native <out.c>

Compile the design to C instead of interpreting it, writing the generated source to <out.c>. Nothing is simulated by this run; you build the C and run that. See the Compiled Backend manual.

trsim -top my_tb -time 100000 -native build\my_tb.c rtl\*.v tb\my_tb.v

-gatesynthesis <out.v>

Synthesise the elaborated design to a gate-level Verilog netlist of primitives trsim can itself simulate, and write it to <out.v>. The design is compiled first; a design that does not compile is not synthesised.

Anything outside the supported subset is refused by name and line number rather than guessed at, and the run reports how many constructs it refused. A netlist with refusals covers only part of the design and is not equivalent to the RTL. See the Synthesis and Physical Design manual.

trsim -q -top cpu -gatesynthesis build\cpu_gates.v rtl\*.v

-techlib <file.tlib>

Load a technology library: cell widths, heights and delays, layer pitches and directions, and the placement site. Without one the physical stages have no real dimensions to work from, so -physical requires it.

The reader is strict. A library with problems is reported with line numbers and refused rather than half-loaded, because a partially loaded library produces numbers that look plausible and are wrong.

-physical <dir>

Run the six physical design stages over a gate netlist, writing a report per stage into <dir>:

StageWhat it produces
1 floorplandie and core area, rows, at the target utilisation
2 powerrings, straps, and the per-row rails they feed
3 placementcells into rows, wirelength-driven
4 ctsthe clock tree, and the skew it achieves
5 routingwirelength and peak congestion
6 signoffRC from the routed geometry, and an SDF file

The netlist is the one -gatesynthesis wrote if the same command synthesised one; otherwise it is the last source file given.

trsim -q -top cpu -techlib tech\generic65.tlib ^
      -gatesynthesis build\cpu_gates.v -physical build\pd rtl\*.v

-utilisation <fraction>

The core area the floorplan aims to fill with cells, between 0 and 1. The default is 0.70. Higher packs the design tighter and makes routing harder; lower wastes area.

-sdf <file.sdf>

Annotate the compiled design with the delays in <file.sdf> before simulating. This is what closes the loop: synthesise to gates, place and route, write SDF at signoff, then simulate the netlist with the delays its own layout implies.

An instance path may name a module, or a gate inside one — cpu.g0 — which is what the SDF written by -physical uses. A bare gate name resolves when it is unique in the design.

An SDF file that annotates nothing is refused and the run stops, naming the cells it could not place. Simulating with no timing while appearing to be back-annotated is the one outcome worth preventing.

trsim -q -top cpu_tb -time 100000 -sdf build\pd\design.sdf ^
      build\cpu_gates.v tb\cpu_tb.v

Exit codes

CodeMeaning
0ran to completion, no failures reported
1compile or link error &mdash; nothing was simulated
2the simulation reported a failure
3the command line could not be understood

In a batch file:

trsim -q -top my_tb -time 100000 rtl\*.v tb\my_tb.v
if errorlevel 3 echo bad command line & exit /b 3
if errorlevel 2 echo simulation FAILED  & exit /b 2
if errorlevel 1 echo did not compile    & exit /b 1
echo passed

In PowerShell, read $LASTEXITCODE after the call.

Environment variables

These are read by a program built from -native output, not by trsim.exe itself. They let you get a waveform or a trace out of an already-built simulation without regenerating anything.

TRS_VCD=<file>

Write a VCD of every signal to <file>. This works even when the design never calls $dumpfile, which is what makes it useful on a binary somebody handed you.

set TRS_VCD=run.vcd
my_tb_native.exe

TRS_TRACE=<substring>

Print every change of every signal whose hierarchical name contains <substring>, with the time and the new value. The filter is a plain substring match, not a pattern.

set TRS_TRACE=cpu.alu
my_tb_native.exe

Note that signal names carry no brackets, so filtering on mem[ never matches. Filter on the name and read the index from the output.

TRS_STATS=1

Print a summary at the end of the run: how many events were processed, how many signal updates, and where the time went.

TRS_PROGRESS=<n>

Print a progress line every <n> simulated time units. Useful on a long run to see it is still moving.

Reading the output

A normal run prints the files as it compiles them, any warnings, the link step, then the design's own output, then the end-of-simulation line.

Warnings worth attending to:

← All trsim manuals