--- name: vivado-sim description: Use this skill when the user needs help with Vivado simulation strategy, flow selection, and debugging. This includes behavioral simulation (RTL functional verification), post-synthesis simulation (netlist functional verification), post-implementation timing simulation (SDF back-annotation, timing verification), Vivado Simulator xsim usage (xvlog/xvhdl/xelab/xsim three-step flow, launch_simulation Project Mode), third-party simulator integration (Questa/ModelSim/VCS/Xcelium/Riviera/ActiveHDL, compile_simlib, export_simulation), SAIF/VCD power simulation (open_saif/log_saif, open_vcd/log_vcd, read_saif + report_power), simulation netlist generation (write_verilog -mode funcsim/timesim, write_sdf), xsim debugging commands (add_force, add_wave, log_wave, add_bp, step, run, restart, get_objects, get_value), simulation properties and settings, glbl.v usage, or any question about choosing the right simulation approach for verification or power analysis. --- # Vivado Simulation Decision Guide Based on UG900 (v2025.2). For complete command syntax and property tables, see REFERENCE.md. ## Simulation Flow Overview ``` RTL + Testbench ──→ Behavioral Sim (functional verification, fastest) ↓ synth_design Synthesized Netlist ──→ Post-Synth Sim (synthesis correctness, optional) ↓ place_design + route_design Implemented Netlist + SDF ──→ Timing Sim (timing verification, slowest) ↓ SAIF/VCD ──→ report_power (power analysis) ``` ### Three Simulation Stages | Stage | Input | Purpose | Speed | Accuracy | |-------|-------|---------|-------|----------| | Behavioral (RTL) | RTL source + TB | Functional verification | Fastest | No timing | | Post-Synthesis | Synth netlist | Verify synthesis correctness | Medium | Functional only | | Post-Implementation | Impl netlist + SDF | Timing verification | Slowest | Full timing | ### When to Use Each Stage - **Daily development** → Behavioral sim only - **Functional mismatch after synthesis** → Post-synthesis sim to isolate - **Timing closure verification** → Post-implementation timing sim - **Power estimation** → Any stage + SAIF dump → `report_power` --- ## Vivado Simulator (xsim) — Project Mode Recommended for interactive development with Vivado GUI/project. ```tcl # Configure simulation settings set_property -name {xsim.simulate.runtime} -value {1000ns} -objects [get_filesets sim_1] set_property -name {xsim.simulate.log_all_signals} -value {true} -objects [get_filesets sim_1] set_property -name {xsim.elaborate.debug_level} -value {typical} -objects [get_filesets sim_1] # Launch behavioral simulation launch_simulation run 100ns close_sim ``` ### Simulation Modes in Project Mode ```tcl launch_simulation -mode behavioral ;# RTL sim (default) launch_simulation -mode post-synthesis -type functional ;# Post-synth functional launch_simulation -mode post-synthesis -type timing ;# Post-synth timing launch_simulation -mode post-implementation -type functional ;# Post-impl functional launch_simulation -mode post-implementation -type timing ;# Post-impl timing ``` ### Generate Scripts Without Running ```tcl launch_simulation -scripts_only ;# Generate sim scripts only launch_simulation -scripts_only -absolute_path ;# With absolute paths ``` --- ## Vivado Simulator (xsim) — Non-Project Mode (Scripted) Three-step flow: **Compile → Elaborate → Simulate** ```tcl # Step 1: Compile exec xvlog design.v tb.v ;# Verilog exec xvlog -sv design.sv ;# SystemVerilog exec xvhdl design.vhd ;# VHDL exec xvhdl -2008 design.vhd ;# VHDL-2008 # Step 2: Elaborate (link) exec xelab -debug typical tb_top -s sim_snap # Step 3: Simulate exec xsim sim_snap -runall exec xsim sim_snap -t run.tcl ;# With TCL script exec xsim sim_snap -gui ;# With GUI ``` ### xelab Debug Level Decision | Scenario | Option | Effect | |----------|--------|--------| | Waveform + breakpoints | `-debug typical` | Standard debugging (recommended) | | All signals observable | `-debug all` | Full visibility, slower elaboration | | Fastest simulation | `-debug off` | No debug, maximum speed | | Line stepping | `-debug line` | Source-level stepping | ### xelab Key Options | Option | Purpose | |--------|---------| | `-d MACRO=value` | Verilog \`define | | `-i ` | Verilog include search path | | `-L ` | Library search order | | `-s ` | Output snapshot name | | `-timescale 1ns/1ps` | Default timescale | | `-mt ` | Multi-threading (2, 4, 8, off) | | `-transport_int_delays` | Transport delay mode (timing sim) | | `-pulse_r 0 -pulse_e 0` | Pulse rejection/error (timing sim) | | `-sdfroot ` | SDF annotation root instance | | `-generic_top ` | Override top-level generics (VHDL) | | `-override_timeunit` | Override module timeunit with -timescale | --- ## xsim Runtime / Debug Commands | Command | Description | |---------|-------------| | `run