Skip to content
systemcoding.dev
Hardware

Run Vivado in batch mode with a Tcl build script

Run Vivado 2024.2 headless with vivado -mode batch -source build.tcl, using the non-project flow from synth_design to write_bitstream.

1 min read
Summarize in AI

Vivado's non-project flow runs the whole build from one Tcl script, with no project files and no GUI, which suits scripts and CI.

build.tcltcl
read_verilog top.v
read_xdc basys3.xdc

synth_design -top top -part xc7a35tcpg236-1
opt_design
place_design
route_design

report_timing_summary -file timing.rpt
write_bitstream -force top.bit
Shell
vivado -mode batch -nojournal -log build.log -source build.tcl

-mode batch runs the script and exits when it ends, with no prompt. -log and -nojournal keep the log in a file you choose and stop Vivado dropping a journal file in the current directory every run. The part xc7a35tcpg236-1 is the Artix-7 chip on the Basys 3, in Vivado 2024.2 naming.

Each command in the script is the same step the GUI buttons run: synthesis, optimisation, placement and routing. Because there is no project, Vivado keeps the design in memory and you must write out whatever you need. If you want to reopen a routed design in the GUI, add write_checkpoint -force routed.dcp before the bitstream, then open it later with open_checkpoint.

When a step fails, the script stops there, and build.log has the message. Check report_timing_summary before loading the bitstream, because write_bitstream still succeeds when timing is not met.

Taggedfpga
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.