TCL Scripts

 



1. TCL Scripts for Physical Design/Tcl_Proc_find Duty Cycle_Frequency_Period from SDC.tcl

# Version:1.0


proc DCFTP {in} {
set inf [open "$in" r]
while {[gets $inf line] >= 0} {
if {[regexp -all "period*" $line m] | [regexp -all "waveform*" $line n]} {
set x [regexp -all {[^period*]+\w+\w+[*.0]+\w} $line match2 ];
puts "Time Period: $match2 ns"
puts "Frequency : [expr 1/$match2] GHz"
set y [regexp -all {\w[^0.]+[*.0]\w} $line match3 ];
#puts "$match3" ;
set D [expr [lindex $match3 1]/$match2 ]
#set y [regexp -all {\d[^0.]+[*.0]\d} $line match3 ];
set y [regexp -all {\d[^waveform]+[*.0]\d} $line match3 ];
puts "$match3" ;
set e [expr [lindex $match3 0]+[lindex $match3 1]]
set D [expr $e/$match2 ]
puts "Duty Cycle: [expr $D*100]%"
break
} else {}
}
#close $inf
close $inf
}

DCFTP "sample_SDC.sdc"

# sample Output
# Time Period: 16.0 ns
# Frequency : 0.0625 GHz
# 0.0 8.0
# Duty Cycle: 50.0% 2. TCL Script to sort and display the list of files (file names) based on Size.



set in [glob *]
set l [list]
foreach a $in {
set l [append l "$a [file size $a]" " "]
}
puts $l
puts [set len [llength $l]]
foreach {i v} $l {
# puts "$i $v"
set array1($v) $i
}
puts [array get array1]

##Sort based on Size
puts [set val [array names array1 ]]
puts [set sv [lsort -integer $val]]
set l_value {} ; # sorted list based on size/value
foreach in $sv {
set l_value [append l_value [array get array1 $in ] " "]
}
puts $l_value

Comments

Popular posts from this blog

Logic Synthesis

ASIC Block level PD flow