You are on page 1of 1

Getting Help Math Functions

help -v command
man command Tcl JOB AID 1 expr expression
incr var_name
info body rpt_TNV
info args rpt_TNV Fundamentals
printvar var_name
# TNV.tcl
redirect –variable rptstring \
String Commands List Commands {report_constraint –all_violators}
string equal glob set TNV [regexp –all VIOLATED $rptstring]
string match llength echo "The TNV is $TNV"
string first lappend # To run a script in the Synopsys tool
string last lindex source TNV.tcl
string range lrange
string length lsearch # Avoid exec if possible, potentially large memory footprint
string index linsert redirect –file tmp1212 \
join lminus {report_constraint –all_violators}
append split exec grep –c VIOLATED tmp1212
regexp concat file delete tmp1212
regsub list
format lreplace
scan lsort
Control Flow
# The argument expr below is evaluated in the same
subst # way that the command expr evaluates its argument
if {expr} {body}
proc metrics {header} { if {expr} {body} else {body}
global metrics_cpu_time if {expr} {body} elseif {expr} {body} else {body}
echo $header while {expr} {body}
for {start} {expr} {next} {body}
if {![info exists metrics_cpu_time]} { foreach loop_var list {body}
echo "CPU time since beginning [cputime]" switch string {pattern {body}}
} else { break
set new_time [expr [cputime] - $metrics_cpu_time] continue
echo "CPU time since last metrics $new_time"
}
< > <=
echo "Peak memory usage [mem]" Boolean compare. Returns 0 if false, 1 if true
Operators for >= == !=
set metrics_cpu_time [cputime]
expr
return "" Logical OR. Returns 0 if both operands are
||
} zero, 1 otherwise
# To remove user defined variables
Logical NOT. Returns 1 if operand is zero, 0
unset metrics_cpu_time !
otherwise

Logical AND. Returns 1 if both operands are


&&
© 2015 Synopsys, Inc. 1 non-zero, 0 otherwise

You might also like