Back to Interview Prep

Tcl Reference Guide: Part 11 — Miscellaneous Commands

June 3, 2026 HDL2Chips Team Tcl Reference

Part 11, the final part of the Tcl Command Reference series, covering Miscellaneous commands used for tool configuration, session management, attribute querying, file I/O, and utility operations. These commands support the physical design flow by providing environment control, data access, and scripting infrastructure in ICC2 and Innovus.

The complete physical design flow follows this order:

  • Design & Database Setup
  • Floorplanning
  • Power Planning
  • Placement
  • Clock Tree Synthesis
  • Routing
  • Optimization
  • Signoff & Reports

Quick Reference: Miscellaneous Commands for EDA Tools

Miscellaneous commands form the glue that connects all other commands in a physical design flow. Application variables control tool behavior, attributes store metadata on design objects, session management saves and restores design state, and file I/O commands manage output logging and script execution.

CommandDescription
set_app_varSets application variable for tool configuration
get_app_varGets the value of an application variable
set_host_optionsSets host/distributed computing options
get_host_optionsGets current host options settings
set_unitsSets measurement units (time, capacitance, etc.)
get_attributeGets attribute value from a design object
set_attributeSets attribute value on a design object
redirectRedirects command output to a file
echoDisplays a message in the console
sourceSources and executes a Tcl script file
putsPrints a message to stdout
exitExits the tool session
reset_designResets the design to initial state
save_sessionSaves the current tool session state
restore_sessionRestores a previously saved session
report_memory_usageReports tool memory consumption
versionShows the tool version information

Typical Session and Utility Script

# === Typical Session and Utility Flow ===
# Configure tool settings
set_app_var -name physopt_power_effort -value high
set_host_options -max_cores 8

# Set design units
set_units -time ns -capacitance pF -resistance kOhm

# Source setup scripts
source scripts/tech_setup.tcl
source scripts/constraints.tcl

# Set attributes on objects
set_attribute -name is_fixed -value true [get_cells inst_macro]

# Query attributes
get_attribute -name is_fixed [get_cells inst_macro]

# Log output
redirect -file logs/flow.log {
  report_design
  report_qor
}

# Save session periodically
save_session -name checkpoint_after_placement

# Check version
version
set_app_var / get_app_var Set and get application variables

What it is: set_app_var configures application variables that control tool behavior, optimization effort, report formatting, and flow customization. get_app_var retrieves the current value of any application variable for inspection or conditional logic.

Where we use it: At the start of scripts to configure tool behavior. Each variable has a name and a value (string, integer, boolean, or list). Common variables control timing effort, power optimization, routing mode, and log verbosity.

Syntax: set_app_var -name <var_name> -value <value> | get_app_var -name <var_name>

# Set application variables
set_app_var -name physopt_power_effort -value high
set_app_var -name route_drc_prevention -value true

# Get variable value
set effort [get_app_var -name physopt_power_effort]
puts "Current power effort: $effort"
get_attribute / set_attribute Query and set design attributes

What it is: get_attribute retrieves attributes (metadata) stored on design objects like cells, nets, pins, and ports. set_attribute assigns or modifies these attributes. Attributes store properties such as placement status, timing derate, or user-defined flags.

Where we use it: To query cell properties (is_placed, is_fixed, is_hard_macro) during scripting. Also used to mark cells for special handling like dont_touch, size_only, or keep_placement.

Syntax: get_attribute -name <attr> <object> | set_attribute -name <attr> -value <val> <object>

# Query cell attributes
set is_fixed [get_attribute -name is_fixed [get_cells inst_123]]
set cell_area [get_attribute -name area [get_cells inst_123]]

# Set attributes
set_attribute -name is_fixed -value true [get_cells macro_inst]
set_attribute -name dont_touch -value true [get_cells clock_buffer_*]
redirect Redirects command output

What it is: redirect captures the console output of one or more Tcl commands and writes it to a file. It is the primary method for generating reports and logs. Output can be appended to existing files or used to suppress console display.

Where we use it: Every report generation uses redirect. It is also used to create detailed logs of flow execution for debugging and documentation. The -tee option displays output on screen while also writing to file.

Syntax: redirect [-append] [-tee] <file> {<commands>}

# Redirect single command output
redirect -file reports/area.rpt { report_area }

# Redirect with tee (show and save)
redirect -tee -file logs/flow.log { report_qor }

# Append to existing file
redirect -append -file logs/debug.log { check_design }
source Sources and executes a Tcl script

What it is: source loads and executes a Tcl script file within the current tool session. It is the standard way to organize reusable procedures, setup scripts, and constraint files into modular components.

Where we use it: At the start of every flow to source technology setup, timing constraints, and custom Tcl procedures. Scripts can be nested (a sourced script can source other scripts) for complex design flows.

Syntax: source [-echo] [-verbose] <file_path>

# Source setup scripts
source scripts/tech_setup.tcl
source scripts/constraints/my_chip.sdc

# Source with echo (show commands as they execute)
source -echo scripts/custom_procs.tcl

# Source with verbose messages
source -verbose scripts/flow_control.tcl
save_session / restore_session Save and restore tool sessions

What it is: save_session saves the complete tool session state including design data, constraints, application variables, and GUI settings to disk. restore_session loads a previously saved session, allowing you to resume work without re-running the entire flow.

Where we use it: Before major optimization steps as a checkpoint. If optimization degrades the design, you can restore the checkpoint. Also used to share design state between team members or switch between machines.

Syntax: save_session -name <session_name> | restore_session <session_name>

# Save checkpoint
save_session -name before_placement

# Save with specific directory
save_session -name checkpoint/after_cts

# Restore a session
restore_session before_placement

This concludes the Tcl Command Reference series covering the complete physical design flow from database setup through signoff timing analysis. Mastering these commands gives you the ability to automate, optimize, and debug any physical design EDA flow using ICC2, Innovus, or Fusion Compiler. Each part of this series builds on the previous one, following the industry-standard P&R flow order. Bookmark these pages as your go-to Tcl command reference for VLSI physical design.