1 - TCL Tutorial CAD Glossary PDF
1 - TCL Tutorial CAD Glossary PDF
1 - TCL Tutorial CAD Glossary PDF
Winter 2015-2016
Office hours:
Intel employees: you can contact me on internal
messenger
All others: send your CVs
Both: mail me for schedule
Amnon Stanislavsky
Please open an account in the VLSI lab
A representative from the lab will come next week to handle
this
An industrial tool will be used for homework execution
(Synopsys IC compiler)
We will talk about it next tutorial
6 HWs. 50% of the final grade
Hand outs and hand ins are staggered
The other 50% will be an exam or a mini project. Still to
be decided
Administration
Moodle site is here:
http://moodle.technion.ac.il/course/view.php?id=3186
Moodle
Introduction to Tcl
Tcl = Tool Command Language
An interpreted programming language
Build on-the-fly commands, procedures
Platform-independent
Language used to operate Synopsys IC compiler
What is Tcl?
1. Run inside IC compiler or any other Tcl using CAD
program (for example: design compiler, PrimeTime,
Conformal)
2. Open a Tcl Shell. There are several Shells to choose from.
(For example: tcl, tclsh, wish)
A program can reside in a file or written on-the-fly
Basic operations
# : single-line comments, similar to "//" in C
;# : in-line comments, just like "//" in C
\ : escape character, same function as in C
: also used to break a long line of code to two lines
$ : get the value of a variable
var : name of variable
$var : value of variable
[] : evaluate command inside brackets
Special characters
if then else
set income 32000
if {$income > 30000} {
puts "$income -- high" This is the
} elseif {$income > 20000} {
correct syntax!
puts "$income -- middle"
} else {
puts "$income -- low"
}
while loops
set i 0
while {$i < 100} {
puts "I am at count $i"
incr i
}
foreach loops
set lstColors {red orange yellow green blue purple}
foreach c $lstColors {
puts $c
}
proc bar { } {
puts "I'm in the bar procedure"
}
bar
Procedures
local and global variables
set a 5
set b 6
set c 7
proc var_scope { } {
global a
set a 3
set b 2
set ::c 1
}
var_scope
puts "The value for a b c is: $a $b $c"
Variable scope
Everything is a list!
Many ways to create a list
set myList [list a b c]
set myList "a b c"
set myList {a b c}
set s Hello
puts "The length of $s is [string length $s]."
=> The length of Hello is 5.
puts {The length of $s is [string length $s].}
=> The length of $s is [string length $s].
Lists in Tcl
set lstStudents [list "Fan" "Kristy" "Susan"]
puts [lindex $lstStudents 0]
puts [lindex $lstStudents end]
puts [llength lstStudents] (unexpected result!)
puts [llength $lstStudents]
lappend $lstStudents "Peter" (wrong!)
lappend lstStudents "Peter"
puts [linsert lstStudents 2 "Tom"] (wrong!)
puts [linsert $lstStudents 2 "Tom"]
set lstStudents [linsert $lstStudents 2 "Tom"]
set lstStudents [lreplace $lstStudents 3 3 "Rachel"]
set lstStudents [lreplace $lstStudents end end]
set lstStudents [lsort ascii $lstStudents]
puts [lsearch $lstStudents "Peter"]
List operations
set a [list [list x y z]]
puts [lindex $a 0]
puts [lindex [lindex $a 0] 1]
puts [lindex [lindex $a 1] 0] (unexpected result)
set a [list x [list [list y] [list z]]]
=> How to get to the z?
Array operations
regsub
set stmt "Fan is one of Shanias fans"
regsub nocase "fan" $stmt "Kristy" newStmt
?switches? exp string subSpec ?varName?
puts "$newStmt"
regsub nocase all "fan" $stmt "Kristy" newStmt
puts "$newStmt"
regexp
(returns 1 if the regular expression matches the string, else returns 0)
puts [regexp nocase "fan" $stmt]
?switches? regexp string
Regular expressions
set statement " Fan is a student "
set statement [string trim $statement]
puts [string length $statement]
puts [string length statement]
puts [string index $statement 4]
puts [string index $statement end]
puts [string first "is" $statement]
(string last)
puts [string first $statement "is"]
puts [string range $statement 4 end]
puts [string replace $statement 9 end "professor"]
puts [string match "*student" $statement] (* ? [])
String operations
set fRead [open source.txt r]
set fWrite [open target.txt w]
while {![eof $fRead]} {
set strLine [gets $fRead] ;#or gets $fRead strLine
regsub nocase all "fan" $strLine "kristy" strLine
puts $fWrite $strLine
}
close $fRead
close $fWrite
File operations
unset: destroy a variable
unset num
Info exists : check whether the named variable has been defined
if {![info exists num]} {
set num 0
}
incr num
Miscellaneous commands
pseudocode:
create a path which just has the start state
make this path the only member of the list of alternatives to be explored
while list of alternatives is not empty and not done
set firstpath to be the first path from the list of alternatives
update alternatives so it doesn't include the first path
set last to be the last member of firstpath
for each cell connected to the last member
create newpath with cell at the end of firstpath
if cell is 16
display path
else
add newpath to end of list of alternatives
Introduction
Cell
Pin
Port
Net
Module
Instance
Netlist
Hierarchy
Flat
Standard cell
Cell row
Tracks
Definitions
cell
pins
Module
ports
instance
instance
A1
Q17
nets
Hierarchical netlist
Flat netlist
Cell rows Standard cells
tracks