The short answer: Tcl interviews for VLSI roles test two things: core Tcl (substitution and quoting rules, lists, arrays and dicts, procs, upvar, regexp, file handling and error handling) and how you use it inside EDA tools (collections vs lists, filtering cells and nets, parsing reports, automating runs). Most interviews include a short script to write on the spot, such as parsing a timing report or counting cells.
Tcl isn’t glamorous, but it’s the language you’ll type into synthesis, STA and place-and-route tools every day, and SDC constraints are Tcl commands. For physical design, STA and synthesis roles in particular, interviewers expect you to be comfortable with it.
I’ve split this into core language questions and EDA-specific ones, with short scripts you can practise. The EDA commands use Synopsys-style syntax; other tools have equivalents with different names.
- Core Tcl
- Tcl in EDA tools
- How I’d prepare
Table of Contents
Part 1: Core Tcl

1. Why do EDA tools use Tcl?
Tcl was designed to be embedded in applications as a command language. Tools add their own commands (like create_clock or get_cells) on top of the core language, so users get variables, loops and procs for free. SDC, the standard constraint format, is a set of Tcl commands.
2. How does substitution work in Tcl?
Tcl does three kinds of substitution before running a command: variable substitution with $, command substitution with [ ], and backslash substitution. Everything is a string until a command interprets it.
3. What is the difference between double quotes and braces?
set x 5
puts "x is $x" ;# x is 5 (substitution happens)
puts {x is $x} ;# x is $x (no substitution)
Braces group without substitution, which is why the bodies of if, for, proc and expr are written in braces: the command itself decides when to evaluate them.
4. Why should expr arguments be in braces?
expr {$a + $b} lets expr do the substitution once, which is faster (it can be compiled) and safer. Without braces, Tcl substitutes first and expr substitutes again, which can give wrong results or even run unintended code if a variable contains brackets.
5. Which list commands should you know?
list, lappend, lindex, llength, lrange, lsearch, lsort, linsert, lreplace, join and split. For example, lsort -real -decreasing $slacks sorts numbers, and split $line "," turns a CSV line into a list.
6. Arrays or dicts?
Arrays are collections of variables indexed by string, like set count(DFF) 10; they can’t be passed by value. Dicts (Tcl 8.5+) are values, so they can be returned from procs and nested. I use dicts for new code.
7. What do upvar and uplevel do?
proc incr_by {varName amount} {
upvar 1 $varName v
set v [expr {$v + $amount}]
}
set total 10
incr_by total 5 ;# total is now 15
upvar links a local name to a variable in the caller’s scope, which is how you pass variables by reference. uplevel runs a script in the caller’s scope.
8. How do you read a file line by line?
set fh [open "input.txt" r]
while {[gets $fh line] >= 0} {
puts $line
}
close $fh
9. How do you handle errors?
catch {script} result returns non-zero if the script fails and stores the message. Tcl 8.6 adds try/on error/finally. After a failure, $::errorInfo holds the stack trace, which is very useful for debugging long tool scripts.
10. How do regexp and regsub work?
set line "Startpoint: u_core/reg_a_reg[3]"
if {[regexp {Startpoint:\s+(\S+)} $line -> sp]} {
puts $sp ;# u_core/reg_a_reg[3]
}
set clean [regsub -all {\[[0-9]+\]} $sp ""] ;# u_core/reg_a_reg
Put patterns in braces so Tcl doesn’t substitute the brackets and backslashes before regexp sees them.
Part 2: Tcl in EDA tools
11. What is the difference between a collection and a list?
Commands like get_cells return a collection: a handle to objects inside the tool, not a list of names. You loop over it with foreach_in_collection, count it with sizeof_collection, and turn objects into names with get_object_name. Treating a collection as a plain list is a classic bug.
12. How do you count the sequential cells in a design?
set seq [get_cells -hierarchical -filter "is_sequential == true"]
puts "sequential cells: [sizeof_collection $seq]"
foreach_in_collection c $seq {
puts [get_object_name $c]
}
Attribute names vary between tools, so check the tool’s list of attributes (list_attributes in Synopsys tools).
13. How do you filter objects?
Use -filter with attribute expressions, such as -filter "ref_name =~ *DFF*", or filter_collection on an existing collection. Filtering inside the tool is much faster than getting everything and looping in Tcl.
14. Write a script that counts setup violations in a timing report and finds the worst slack.
set fh [open "timing.rpt" r]
set worst 0.0
set nviol 0
while {[gets $fh line] >= 0} {
if {[regexp {slack \(VIOLATED\)\s+(-?[0-9.]+)} $line -> s]} {
incr nviol
if {$s < $worst} { set worst $s }
}
}
close $fh
puts "violating paths: $nviol, worst slack: $worst"
Inside the tool, you’d usually query timing paths directly instead of parsing text, but interviewers like this question because it tests file handling and regexp together.
15. Write a proc that counts word frequency in a file.
proc word_count {fname} {
set fh [open $fname r]
set counts [dict create]
while {[gets $fh line] >= 0} {
foreach w [split $line] {
if {$w eq ""} continue
dict incr counts $w
}
}
close $fh
return $counts
}
dict for {w n} [word_count "log.txt"] { puts "$w $n" }
16. How do you make a script work across different designs?
Avoid hard-coded names: take the design, clocks and paths as arguments or from a config file, use procs with clear inputs, check that objects exist before using them (sizeof_collection), and print what the script did. Scripts that silently do nothing when a name doesn’t match are the hardest to debug.
17. What are namespaces for?
They group procs and variables under a prefix (like ::myflow::report_qor) so your utilities don’t clash with the tool’s own commands or other scripts.
Part 3: How I’d prepare
- Write the scripts above from memory, then run them in tclsh. Most of the core language works outside any EDA tool.
- Practise reading a real timing or area report and extracting numbers with regexp.
- Learn the collection commands of the tool you’ll use (get_cells, get_pins, get_nets, get_timing_paths and their filters).
- Know the quoting rules well enough to explain them; “why braces?” is one of the most common questions.
Practise this on VLSI Forge
I built VLSI Forge so you can write RTL in your browser, run it on a real simulator and check every signal in the waveform. Free, nothing to install.
FAQ
Is Tcl enough, or should I learn Python too?
Learn both. Tcl is needed inside EDA tools; Python is widely used for regressions, data analysis and flow automation around them.
Which roles ask the most Tcl questions?
Physical design, STA, synthesis and CAD or flow engineers. Verification roles ask fewer, usually just basics.
Can I practise Tcl without EDA tools?
Yes. tclsh is free and runs the core language. Practise lists, dicts, procs, regexp and file handling there.
What is the most common Tcl interview question?
The difference between quotes and braces, and writing a short script to parse a report.
