Tcl scripts: Reading STAchecklist, get_timing_path, write the setup/hold violation to csv
2018-01-01 20:53
531 查看
File description:
Time:2018/01/01Description: This scripts used to reading STA_check.csv file and parsing this file to generate get_timing_path command which used in PrimeTime to check the setup/hold violations, and write out the reports to .csv
Input CSV file(STA_check.csv):
Type,Description,Launch,From,Thr1,Thr2,Thr3,To,Capture,setup,setup_req,setup_bor,hold,hold_req Clock,Path1,,,,,,/IDDR4CHA/DDR4CHACHAN_GUT/path1_to/cell<1>/a,clk_cap_path1,,,,, Clock,Path2,clk_lau_path2,,,,,/IDDR4CHA/DDR4CHACHAN_GUT/path2_to/cell<2>/a,clk_cap_path2,,,,, Clock,Path3,clk_lau_path3,/IDDR4CHA/DDR4CHACHAN_GUT/path3_from/cell<1>/a,,,,/IDDR4CHA/DDR4CHACHAN_GUT/path3_to/cell<3>/a,clk_cap_path3,,,,, Clock,Path4,clk_lau_path4,/IDDR4CHA/DDR4CHACHAN_GUT/path4_from/cell<2>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path4_thr1/cell<3>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path4_thr2/cell<3>/a,,/IDDR4CHA/DDR4CHACHAN_GUT/path4_to/cell<4>/a,clk_cap_path4,,,,, Clock,Path5,clk_lau_path5,/IDDR4CHA/DDR4CHACHAN_GUT/path5_from/cell<3>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path5_thr1/cell<4>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path5_thr2/cell<4>/a,,/IDDR4CHA/DDR4CHACHAN_GUT/path5_to/cell<5>/a,clk_cap_path5,,,,, Clock,Path6,clk_lau_path6,/IDDR4CHA/DDR4CHACHAN_GUT/path6_from/cell<4>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path6_thr1/cell<5>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path6_thr2/cell<5>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path6_thr3/cell<5>/a,/IDDR4CHA/DDR4CHACHAN_GUT/path6_to/cell<6>/a,clk_cap_path6,,,,, ,,,,,,,,,,,,, Gate,Gate_path1,clk_gate1,/IDDR4CHA/DDR4CHACHAN_GUT/gate_paht_from1/cell<4>/a,,,,/IDDR4CHA/DDR4CHACHAN_GUT/gate_paht_to_1/cell<4>/a,clk_gate_to1,,,,,
CheckListRpt.tcl
set RmPathHeader "/IDDR4CHA/" set debug_file "./ChkPointRpt_debug.csv" proc test {args} { set vars(-f) "STA_check.csv" set vars(-out) "ChkPointRpt.csv" set vars(-d) "./ChkPointRpt_debug.csv" #parse_proc_argments -args $args vars #parse_proc_argments $args vars #puts "$vars(-f)" #puts "$vars(-out)" if { [file exists $vars(-f)] } { set fo [open $vars(-out) w] set pathLib [ ReadCheckList $vars(-f)] set pathLib [ RptTiming $pathLib] set pathLib [ RptPtList $pathLib] WriteCheckList $vars(-out) $vars(-d) $pathLib } else { puts "Error: There is no file $vars(-f)" puts "Error: Please check file path and name." } } proc RptTiming {pathLib} { puts "\[Info\] Begin Parsing ......" # Add new checp paths if both Launch and From setting foreach item [ dict keys $pathLib {path*}] { set checkType [dict get $pathLib $item Type] if {$checkType == "Clock" && [dict exists $pathLib $item "Launch"] && [dict exists $pathLib $item "From"]} { dict set pathLib ${item}_0 [dict remove [dict get $pathLib $item] "Launch"] dict set pathLib $item [dict remove [dict get $pathLib $item] "From"] } } set total_path [dict size $pathLib] incr total_path -1 set num 1 # Gen the reports command foreach item [ dict keys $pathLib {path*} ] { puts "Begin parse the $item : $num/$total_path ......" incr num set checkType [dict get $pathLib $item Type] #puts "Checktpe is $checkType" set cmd "get_timing_paths " set from_launch 0 dict for {key value} [dict get $pathLib $item] { #puts [format "%s -> %s" $key $value] if {$key == "From"} { if {[dict exists $pathLib $item "Launch"]} { continue } else { append cmd "-from \[get_pins $value\] " } } elseif {$key == "Launch"} { append cmd "-from \[get_clocks $value\] " } elseif {[regexp "Thr*" $key]} { set value [PathFix $value] append cmd "-thr \[get_pins $value\] " } elseif {$key == "To"} { set value [PathFix $value] append cmd "-to \[get_pins $value\] " } } dict set pathLib $item error_info 0 # Setup/Hold path check if {$checkType == "Clock"} { if {[dict exists $pathLib $item Launch] && [dict exists $pathLib $item Capture]} { append cmd "-group \[get_path_groups [dict get $pathLib $item Launch]-To-[dict get $pathLib $item Capture]\]" } elseif {[dict exists $pathLib $item "Launch"]} { append cmd "-group \[get_path_groups [dict get $pathLib $item Launch]-To-*\]" } elseif {[dict exists $pathLib $item Capture]} { append cmd "-group \[get_path_groups *-To-[dict get $pathLib $item Capture]\]" } else {dict set pathLib $item error_info "Error"} } elseif {$checkType == "Asyn"} { append cmd "-group \[get_path_groups *asyn*\]" } elseif {$checkType == "Gate"} { append cmd "-group \[get_path_groups *gating*\]" } if {[catch $cmd err_info] } {dict set pathLib $item error_info "Error"} dict set pathLib $item rpt_cmd $cmd } #dict for {key value} $pathLib { puts [format "%s->%s" $key $value] } return $pathLib } proc PathFix { in } { global RmPathHeader regsub ${RmPathHeader} $in "" out regsub -all -- <|> $out _ out return $out } # Read file and save check path to Dict proc ReadCheckList {inFile} { puts "\[Info\] Begin Reading file : $inFile" #dict create RptChkLstDict; set fi [open $inFile r] set pathNum 0 while { [gets $fi line] >= 0 } { #puts "line : $line" set SplitLine [split $line ","] if {[regexp "Type" $line] && [regexp "Launch" $line ]} { set n 0 foreach item $SplitLine { #if {$item != ""} { dict set HeadDict $n $item incr n #} } #dict for {key value} $HeadDict { puts [format "%s:%d" $key $value] } dict set RptChkLstDict Header $HeadDict } else { # Delete the lines without type info if {[lindex $SplitLine 0] == ""} {continue} incr pathNum set n 0 foreach item $SplitLine { if {$item != ""} { dict set RptChkLstDict path${pathNum} [dict get $HeadDict $n] $item } incr n } } } #dict for {key value} $RptChkLstDict { puts [format "%s:%s" $key $value] } close $fi return $RptChkLstDict } proc RptPtList {pathLib} { puts "\[Info\] Begin to report timing ......" set total_path [dict size $pathLib] incr total_path -1 set num 1 foreach item [ dict keys $pathLib {path*} ] { puts "Begin check the $item : $num/$total_path ......" # #set path_max [eval [dict get $pathLib $item rpt_cmd]] #set path_min [eval [dict get $pathLib $item rpt_cmd] -delay_type min] #set path_max_req [lindex [get_attribute $path_max endpoint_setup_time_value] 0] #set path_max_slk [lindex [get_attribute $path_max slack] 0] #set path_max_bor [lindex [get_attribute $path_max time_borrowed_from_endpoint] 0 ] #set path_min_req [lindex [get_attribute $path_max endpoint_hold_time_value] 0] #set path_min_slk [lindex [get_attribute $path_max slack] 0] #set path_min_bor [lindex [get_attribute $path_max time_borrowed_from_endpoint] 0 ] set path_max "max" set path_min "min" set path_max_req "${item}_setup_req" #set path_max_slk "${item}_setup_slk" set path_max_slk "" set path_max_bor "${item}_setup_bor" set path_min_req "${item}_hold_req" set path_min_slk "${item}_hold_slk" set path_min_bor "${item}_hold_bor" foreach val [dict values [dict get $pathLib Header] {setup*}] { switch $val { "setup" {dict set pathLib $item $val $path_max_slk} "setup_req" { if {$path_max_slk == ""} { dict set pathLib $item $val "No Path" } else { dict set pathLib $item $val $path_max_req } } "setup_bor" {dict set pathLib $item $val $path_max_bor} } } foreach val [dict values [dict get $pathLib Header] {hold*}] { switch $val { "hold" {dict set pathLib $item $val $path_min_slk} "hold_req" {dict set pathLib $item $val $path_min_req} "hold_bor" {dict set pathLib $item $val $path_min_bor} } } } #dict for {key value} $pathLib { puts [format "%s:%s" $key $value] } return $pathLib } proc WriteCheckList {outFile debugFile pathLib} { puts "\[Info\] Begin Writing file : $outFile" set fo [open $outFile w] set fo_debug [open $debugFile w] set outline "" foreach key [lsort -integer [dict keys [dict get $pathLib Header]]] { append outline "[dict get $pathLib Header $key]," } puts $fo $outline append outline "rpt_cmd" puts $fo_debug $outline foreach item [ lsort [dict keys $pathLib {path*} ] ] { set outline "" foreach key [lsort -integer [dict keys [dict get $pathLib Header]]] { #puts "We got [dict get $pathLib Header $key]" if { [dict exists $pathLib $item [dict get $pathLib Header $key]] } { append outline "[dict get $pathLib $item [dict get $pathLib Header $key]]," } else { append outline "," } #append outline "[dict get $pathLib $item [dict values [dict get $pathLib Header $key]]]," } puts $fo $outline append outline "[dict get $pathLib $item rpt_cmd]" puts $fo_debug $outline } close $fo close $fo_debug } #proc parse_proc_argments {in_vars out_vars} { # array set inArr $in_vars # parray inArr # return inArr #}
相关文章推荐
- Data Structure Linked List: Write a function to get the intersection point of two Linked Lists.
- sql server query to get the list of column name in a table
- unity打包出现Unable to list target platforms.Please make sure the android sdk path is correct.
- [Drupal] How to get the real path of a node, no matter it is a path or a url alias
- To get the tree list of the objects on which an object depends
- Error 1406. Setup cannot write the value DisableExceptionChainValidation to the registry key \SOFTWARE\Microsoft\Windows NT\Curr
- the method getcontextpath() from the type httpservletrequest refers to the missing type string
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- Get Remote Machines Last Boot Time From A List Of Machines And Write To Excel - 如何获得远程主机的启动时间
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)
- The method getContextPath() from the type HttpServletRequest refers to the missing type
- Get full pathname to the file
- Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
- 使用命令行创建Android工程报错:"Target id is not valid. Use 'android.bat list targets' to get the target ids"
- How to get the IIS root path in other application.
- Finding a Custom Object Id (01I…) to get the Setup page URL