0% found this document useful (0 votes)
136 views11 pages

Example TCL

The document contains code snippets from various Tcl scripts. The snippets deal with topics like calculating age from date of birth, calculating cell utilization, getting file information, finding number of instances of a cell and number of violations. Functions are defined to handle these tasks.

Uploaded by

Sachin Mirashe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views11 pages

Example TCL

The document contains code snippets from various Tcl scripts. The snippets deal with topics like calculating age from date of birth, calculating cell utilization, getting file information, finding number of instances of a cell and number of violations. Functions are defined to handle these tasks.

Uploaded by

Sachin Mirashe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Age.

tcl
# DOB should be given in the followin format 1 2 2000
proc age {arg1 arg2 arg3} {
set !arg3"
set i 0"
while {! # 2012} {
set $e%pr ! & 1'
incr i
}
set ( $e%pr !arg2 ) 1'
puts *!i +ears !( months !arg1 da+s*
}
#age 1 2 2000
calc_util.tcl
set core,area $get,attribute $get,core,area' area'
set mac,area 0
set std,cel,area 0
foreach,in,collection m $all,macro,cells' {
set am $get,attr $get,cells !m' area'
set mac,area $e%pr !mac,area & !am'
}
foreach,in,collection s $get,cells )hierarchical )filter {is,hierarchical -- false ..
is,hard,macro--false .. is,ph+sical,onl+--false}' {
set as $get,attr $get,cells !s' area'
set std,cel,area $e%pr !std,cel,area & !as'
}
set format/tr {011s011s011s}
set format2al {01132f01132f01130f}
puts $format !format/tr core,area mac,area std,cel,area'
puts $format !format/tr !core,area !mac,area !std,cel,area'
set util $e%pr 4!mac,area & !std,cel,area56!core,area'
set std,util $e%pr 4!std,cel,area564!core,area)!mac,area5'
set nd2a $get,attr $get,lib,cell um70np(ldst,ff1p21vn70c6/89,:D2,/,1' area'
set gates $e%pr 4!std,cel,area564!nd2a5'
puts **
puts $format !format/tr *;til* */td cel util* *:o of gates*'
puts $format !format2al !util !std,util !gates'
cell_indfo.tcl
proc cell {args} {
puts *<eference name - $get,attri !args ref,name'*"
puts *:umber of pins - $get,attri !args number,of,pins'*"
puts *=rea - $get,attri !args area'*"
puts *Bbo% - $get,attri !args bbo%'*"
puts *>he pins are ?*
set e $get,pins )of,obects !args'"
foreach,in,collection f !e {
puts $get,attri !f pin,t+pe'
}
}
#cell #cell,name@
details_age.tcl
proc age {args} {
parse,proc,arguments )args !args results
if {$info e%ist results4)da+5'} {
set a * varriable a is !results4)da+5 *
printvar !a
}
if {$info e%ist results4)month5'} {
set a * varriable a is !results4)month5 *
printvar !a
}
if {$info e%ist results4)+ear5'} {
set a * varriable a is !results4)+ear5 *
printvar !a
}
if {$info e%ist results4)+ears5'} {
set a * =ge in +ears is !resulsts4)+ears5 *
printvar !a
set ans $e%pr !var1 & !var2 '
printvar !ans
}
if {$info e%ist results4)month5'} {
set a * substraction is !resulsts4)sub5 *
printvar !a
set ans $e%pr !var1 ) !var2 '
printvar !ans
}
if {$info e%ist results4)mul5'} {
set a * multiplication is !resulsts4)mul5 *
printvar !a
set ans $e%pr !var1 A !var2 '
printvar !ans
}
}
define,proc,attributes func )info *Berforms an opperation based on input arguments* C
)define,args {
{)verbose *Denerate verbose output* ** boolean optional} C
{)add * performs addition if set true ? default true* string } C
{)sub * performs addition if set true ? default false* string } C
{)mul * performs addition if set true ? default false* string} C
{)var1 * varriable a value * int} C
{)var2 * varriable b value * int} C
}
func )var1 3 )var2 7
file_info.tcl
##>o Eind the no of lines in a file4reports ol+ continouus lines without blan( lines53
proc file,info {args} {
set fileid $open *!args* r'
set i 0"
while {!i # !i&1} {
set a $gets !fileid'
#puts !a
if {!a -- **} {
brea( }
incr i
}
set ( $e%ec ls )l *!args*'"
set l $linde% !( 0'"
set m $linde% !( 7'"
puts *:umber of lines - !i*"
puts *Bermissions - !l*"
puts *Eile siFe - !m*"
}
# file,info #absolute path fr file@
num_instances.tcl
# >o get the number of instances of the cell inthe design
set args #cell name@"
redirect )file a {report,design )ph+sical}"
set b !a"
set c $lsearch !b !args'"
set d $linde% !b $e%pr !c & 2''"
puts !d"
file delete a"
num_sinks.tcl
redirect )variable a {report,cloc(,tree )summar+ }"
set b !a"
set c $get,cloc(s'"
foreach,in,collection d !c {
set m $get,attri !d full,name'"
set e $lsearch !b !m'"
if {!e -- )1} {
puts *Gloc( !m is for e%ternal refrenceCn*"
} else {
set f $linde% !b $e%pr !e & 1''"
puts *:umber of sin(s for !m - !fCn*"
}
}

num_violations.tcl
#>o get the number of ma%,transH ma%,cap . ma%,fanout violations
redirect )variable a {report,constraint )ma%,transition )all,violators }"
set b !a"
set c $lsearch !b *>otal*'"
if {!c -- )1} {
puts *Ia% >ransition violations - 0 *"
} else {
set d $linde% !b $e%pr !c & 1''"
puts * Ia% >ransition violations - !d*"
}
redirect )variable e {report,constraint )ma%,capacitance )all,violators }"
set f !e"
set g $lsearch !f *>otal*'"
if {!g -- )1} {
puts *Ia% Gapacitance violations - 0 *"
} else {
set h $linde% !f $e%pr !g & 1''"
puts * Ia% Gapacitance violations - !h*"
}
redirect )variable i {report,constraint )ma%,fanout )all,violators }"
set !i"
set ( $lsearch ! *>otal*'"
if {!( -- )1} {
puts *Ia% Eanout violations - 0 *"
} else {
set l $linde% ! $e%pr !( & 1''"
puts * Ia% Eanout violations - !l*"
}
optimize.tcl
proc optimiFe {args} {
set a $get,attri $get,timing,paths )group !args' slac('
puts !a"
#threshold considered slac( )1
if {!a # )1} {
puts *Bath)group !args reJuires further optimiFation*"
} else {
puts *Bath)group !args does not reJuire further optimiFation*
}
}
# optimiFe #path)group@
ports_info.tcl
proc ports {args} {
set a $get,ports )filter *Kdirection -- !args*'"
set i 0"
foreach,in,collection b !a {
puts $get,attri !b full,name'"
set i $e%pr !i & 1'"
}
puts *:umber of !args ports - !i*"
}
#ports #direction@

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy