EcrioniX/ VLSI/ Yosys show SVG
Yosys · Netlist Visualization

Yosys show -format svg -prefix
Export Schematic as SVG / PNG / PDF

Complete guide to using Yosys show command to export RTL and gate-level schematics — with all options, real examples, and netlistsvg alternative.

TL;DR — Export schematic as SVG in one command:

yosys
yosys -p "read_verilog design.v; synth -top top_module; show -format svg -prefix schematic"

Produces schematic.svg in the current directory. Requires Graphviz installed.

The show Command REFERENCE

The Yosys show command renders the current design's netlist as a graph using Graphviz's dot layout engine. It visualizes:

Prerequisite: Graphviz must be installed and dot must be in your PATH. Test with dot -V. Install: Ubuntu: sudo apt install graphviz | macOS: brew install graphviz | Windows: graphviz.org/download

All show Options OPTIONS

-format <fmt>

Output format: svg, pdf, png, ps, dot, json. Default: dot (launches viewer)

-prefix <name>

Output filename prefix. With -format svg, creates <name>.svg

-viewer <cmd>

Launch viewer after rendering. e.g. -viewer xdg-open or -viewer eog

-module <mod>

Show specific module only. Without it, shows top module

-colors <N>

Assign N random colors to distinguish nets/cells

-stretch

Stretch the schematic for better readability of wide designs

-width

Adjust output width for landscape rendering

-notitle

Suppress the module name title from the output

-nobg

Don't launch in background — wait for viewer to close

-pause

Pause Yosys until the viewer window is closed

-dpi <N>

DPI for PNG output. Default: 72. Use 150-300 for print quality

-enum

Enumerate cells — add numbers to help identify them

Complete Usage Examples EXAMPLES

1. Basic RTL Visualization

yosys script
# Visualize RTL before synthesis
read_verilog counter.v
hierarchy -top counter
proc              # convert always blocks to logic
show -format svg -prefix counter_rtl

2. Gate-Level Schematic After Synthesis

yosys script
# Synthesize then visualize gate-level netlist
read_verilog fsm.v
synth -top fsm -flatten
show -format svg -prefix fsm_gates -stretch

3. One-Liner from Command Line

bash
# Quick SVG generation from terminal
yosys -p "read_verilog alu.v; synth -top alu; show -format svg -prefix alu_schematic"

# With specific module (useful in multi-module designs)
yosys -p "read_verilog top.v; hierarchy -top top; show -format svg -prefix top_rtl -module alu_unit"

4. Export as PNG (high DPI)

yosys script
read_verilog adder.v
synth -top adder
show -format png -prefix adder_schema -dpi 150

5. Export as DOT then convert manually

bash
# Step 1: Export as .dot file
yosys -p "read_verilog design.v; synth -top top; show -format dot -prefix design"

# Step 2: Convert .dot to any format with Graphviz
dot -Tsvg design.dot -o design.svg
dot -Tpng design.dot -o design.png -Gdpi=150
dot -Tpdf design.dot -o design.pdf

6. Full Synthesis + Show Script (.ys file)

yosys (.ys)
# save as synth_show.ys → run with: yosys synth_show.ys

# Read design
read_verilog -sv design.sv

# Hierarchy check
hierarchy -check -top top_module

# RTL elaboration
proc
opt
memory

# Export RTL-level schematic
show -format svg -prefix rtl_view -colors 3

# Technology mapping
techmap
opt

# Export gate-level schematic
show -format svg -prefix gate_view -stretch

# Write netlist
write_verilog netlist.v
stat

Using netlistsvg for Prettier Output ALTERNATIVE

netlistsvg produces cleaner, more readable schematics than Yosys show — with proper gate symbols (AND, OR, MUX, DFF icons) instead of raw Graphviz boxes.

bash
# Step 1: Install netlistsvg
npm install -g netlistsvg

# Step 2: Export Yosys JSON
yosys -p "read_verilog design.v; synth -top top; write_json design.json"

# Step 3: Generate pretty SVG
netlistsvg design.json -o schematic.svg

# Open in browser
xdg-open schematic.svg    # Linux
open schematic.svg         # macOS

netlistsvg vs yosys show: netlistsvg renders with standard IEEE logic gate symbols (triangle for buffer, D-shape for AND) — much better for documentation and presentations. Yosys show uses generic box-and-wire Graphviz layout — better for debugging internal Yosys cell structure and large complex netlists.

Format Options Comparison FORMATS

FormatCommandBest ForGraphviz needed?
svg-format svgWeb, documentation, browser-viewableYes
png-format pngSlides, reports, raster imagesYes
pdf-format pdfPrint-quality documentationYes
ps-format psPostScript for printingYes
dot-format dotDebug or manual Graphviz processingNo (outputs raw dot)
jsonwrite_json (separate cmd)netlistsvg renderingNo

Troubleshooting FIXES

ProblemCauseFix
ERROR: dot not foundGraphviz not installed or not in PATHsudo apt install graphviz — verify with dot -V
Empty or tiny SVGDesign not elaborated — proc not runAdd proc; opt; before show
Wrong module shownTop module not specifiedAdd -module <module_name> or run hierarchy -top top
SVG too large to readLarge design — too many cellsUse -module to show one submodule at a time
show hangs / no outputViewer launched in foregroundAdd -format svg -prefix name — don't use interactive viewer mode
SystemVerilog not parsedMissing -sv flagread_verilog -sv design.sv

Yosys show in Makefile / CI AUTOMATION

Makefile
# Generate schematics as part of build
DESIGN = top_module
SRC    = src/$(DESIGN).v

schematic: $(SRC)
	yosys -p "read_verilog $(SRC); \
	          synth -top $(DESIGN); \
	          show -format svg -prefix docs/$(DESIGN)_schematic"

rtl_view: $(SRC)
	yosys -p "read_verilog $(SRC); \
	          hierarchy -top $(DESIGN); proc; \
	          show -format svg -prefix docs/$(DESIGN)_rtl"

.PHONY: schematic rtl_view

Frequently Asked Questions FAQ

How do I export Yosys schematic as SVG? +

Run: yosys -p "read_verilog design.v; synth -top top; show -format svg -prefix output". This creates output.svg. Graphviz must be installed (sudo apt install graphviz).

What does -prefix do in Yosys show? +

-prefix sets the base filename for output. With -format svg -prefix mydesign, Yosys creates mydesign.svg. Without -prefix, a temporary file is used and opened in a viewer.

Yosys show says "dot not found" — how to fix? +

Install Graphviz: Ubuntu: sudo apt install graphviz. macOS: brew install graphviz. Windows: download from graphviz.org. Verify: dot -V. Then re-run Yosys.

How to view Yosys schematic in browser? +

Export with -format svg, then open the .svg file directly in Chrome, Firefox, or Edge. SVG files are natively supported in all modern browsers — just drag and drop.

What is netlistsvg and how is it different from Yosys show? +

netlistsvg is a separate tool (npm install -g netlistsvg) that renders Yosys JSON netlists with IEEE gate symbols. It produces prettier, documentation-quality schematics. Yosys show uses Graphviz boxes — better for debugging internal structure. For presentations, use netlistsvg.

Related topics:

VLSI Synthesis Commands Verilog Simulator Verilog