TDEB Top Bar

Trending
Semiconductor Industry News — The Digital Electronics Blog
Follow Us

TDEB Masthead

The Semiconductor Hub

Semiconductors.  Chips and Systems.  Innovation.

Indexed by leading Search Engines, AI and referenced by Engineers worldwide 500+ Articles 10M+ Pageviews 30+ Reports 50+ Citations

TCL for EDA: A Free Repository of Tcl/Tk Tools and Scripts

The Editor's Desk
by
2
Share Facebook X LinkedIn WhatsApp Email

The TCL for EDA project (tclforeda.org, now offline; the link goes to an archived copy) was an open-source repository of TCL/TK tools, applications, scripts and methodological articles. The TCL for EDA project targets different stages of chip design: from Verification to Project Management and up to Synthesis, Static Timing Analysis and Design-for-Test.

Update, November 2026: the tclforeda.org site went offline around 2011, and the domain now shows a parking page. The links below point to Internet Archive copies of the original pages. Further down you will find where Tcl scripts for chip design live today, and a short practical guide to Tcl as used inside EDA tools.

What the project offered (2008)

Some of their offerings:

Tools:

  • Netedit: Verilog netlist editor/viewer. It parsed a post-synthesis Verilog netlist into a database, let you edit it with Tcl commands, then wrote the netlist back out as Verilog.
  • Netman: Verilog netlist manager/viewer. It extracted the module hierarchy from a synthesized netlist and showed the connectivity around a chosen port, gate or net.
  • Pman: Project manager (allows navigation, viewing and editing of verilog files), with push-button runs of lint and synthesis in a commercial synthesis tool.
  • TCL-PLI: TCL pli library for driving Verilog simulation from Tcl through the programming language interface (PLI), used for the project's interactive simulation GUI. The link is the project's paper.

Scripts:

  • Verilog Structural Integration Methodology and Scripts (make_top): Sounds interesting.. It generated structural templates for wiring sub-blocks together into a top-level Verilog netlist, then helped correct the final netlist.
  • Lots of DC, Timing, DFT and verification scripts! The archived scripts index lists synthesis, timing report, timing constraint, DFT methodology, connectivity report and verification sets.

A very interesting site indeed!

Why Tcl matters in chip design

Tcl was born in EDA. John Ousterhout began it in 1988 at UC Berkeley because the command languages in his own IC design tools, such as Magic and Crystal, were weak and could not be reused from one tool to the next (see the history of Tcl). He wanted one small language that any tool could embed and extend with its own commands.

That idea won. Most synthesis, timing, place-and-route and FPGA tools today accept Tcl commands, and timing constraints in SDC format are written as Tcl commands. If you work in physical design, timing, DFT or FPGA implementation, you will write Tcl almost daily: to run flows, query the design database, and turn long reports into short answers.

Where to find Tcl for EDA today

  • Xilinx Tcl Store: an open-source repository of Tcl apps for the Vivado Design Suite, covering design utilities, methodology checks and tool integrations. A good place to read well-structured production Tcl.
  • Vivado User Guide: Tcl Scripting (UG894): AMD's guide to scripting Vivado in Tcl.
  • Tincr: Tcl libraries from BYU for building custom CAD tools on top of Vivado, including export of device and design data to open formats.
  • OpenROAD documentation: the open-source RTL-to-GDS tool, controlled through a Tcl command interpreter (with Python bindings too). Every step of the flow is a Tcl command you can read and change.
  • OpenSTA: an open-source gate-level static timing analyzer that reads Verilog, Liberty, SDC, SDF and SPEF and is driven from Tcl. Ideal for learning timing scripts without a commercial license.
  • Tcl wiki page on EDA: a community-kept list of Tcl-based EDA projects and learning resources.

Deep dive: the numbers and details

This part holds a worked Tcl script for timing reports, the Tcl commands you use most in EDA work, and the common mistakes. Skip it if the overview is all you need.

The handful of Tcl commands that do most EDA work

CommandWhat you use it forReference
procWrap a repeated step (a report, a check) into a reusable commandproc manual
foreachLoop over cells, pins, nets or report linesforeach manual
regexpPull names and numbers out of report textregexp manual
open, gets, closeRead reports and logs line by line, write your own summariesopen manual
dictKeep per-block or per-clock results in key/value formdict manual
exprArithmetic on slack, delays and countsexpr manual

Worked example: WNS and TNS from a timing report

The script below is plain Tcl, so it runs in tclsh or inside any Tcl-based tool. It reads a text timing report, keeps each endpoint whose slack is reported as VIOLATED, sorts them worst first, and prints the worst negative slack (WNS), total negative slack (TNS) and the count. The regular expressions assume report lines of the form Endpoint: FF2/D and slack (VIOLATED) -0.120; adjust them to your tool's exact format.

# Summarize violating endpoints from a text timing report
proc neg_slack {file} {
    set fh [open $file r]
    set result {}
    set endpoint ""
    while {[gets $fh line] >= 0} {
        if {[regexp {^Endpoint:\s+(\S+)} $line -> ep]} {
            set endpoint $ep
        }
        if {[regexp {slack \(VIOLATED\)\s+(-?[0-9.]+)} $line -> s]} {
            lappend result [list $endpoint $s]
        }
    }
    close $fh
    return [lsort -real -index 1 $result]
}

set viol [neg_slack timing.rpt]
set tns 0.0
foreach item $viol {
    lassign $item ep s
    puts [format "%-12s %8.3f" $ep $s]
    set tns [expr {$tns + $s}]
}
if {[llength $viol] > 0} {
    puts [format "WNS %.3f  TNS %.3f  count %d" \
          [lindex $viol 0 1] $tns [llength $viol]]
}

With three violating endpoints at -0.12 ns (FF2/D), -0.05 ns (FF7/D) and -0.02 ns (OUT1), the output is:

FF2/D          -0.120
FF7/D          -0.050
OUT1           -0.020
WNS -0.120  TNS -0.190  count 3

The same numbers are worked by hand in our post on slack, WNS and TNS in static timing analysis.

Constraints are Tcl too

Timing constraints in SDC are Tcl commands, which is why you can build them with variables and loops. A minimal clock definition:

set period 1.0
create_clock -name clk -period $period [get_ports clk]
set_input_delay  [expr {0.2 * $period}] -clock clk [all_inputs]
set_output_delay [expr {0.2 * $period}] -clock clk [all_outputs]

Changing one variable retargets every constraint, and the file still loads in any tool that reads SDC, such as OpenSTA.

Common mistakes in EDA Tcl scripts

  • Unbraced expressions. Write expr {$a + $b}, not expr $a + $b. The braced form is compiled once and avoids double substitution; the expr manual covers why.
  • Treating tool collections as lists. Many commercial tools return collection handles, not Tcl lists; use the tool's own iteration command instead of foreach on the handle.
  • Square brackets in names. Bus bits such as data[3] trigger command substitution unless you brace or escape them.
  • Parsing reports that change format. Report layouts change between tool versions; prefer database queries over text parsing when the tool offers them.
  • Floating-point comparisons. Compare slack against a small tolerance, not exactly zero.

Interview angle

Physical design and STA interviews often include a short Tcl task: read a report and list the worst N paths, count cells of a type, or generate constraints for a bus. Know proc, foreach, regexp, lsort and braced expr well enough to write the script above from memory.

The Editor's Desk
About the Author
The Editor's Desk
Share Facebook X LinkedIn WhatsApp Email

Post a Comment

2 Comments

Your comments will be moderated before it appears here.

  1. Looks like the site has disappeared? Too bad, I would like to check it out.

    John

    ReplyDelete
  2. You are correct John, the site seems to be experiencing some issues. We can only wait :-)

    ReplyDelete
Post a Comment

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!