File size: 13,765 Bytes
34292e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | proc report_puts { out } {
upvar 1 when when
upvar 1 filename filename
set fileId [open $filename a]
puts $fileId $out
close $fileId
}
#-----------------------------------------------------------------------------
# Gets the power file scope arg and escapes, if necessary
#-----------------------------------------------------------------------------
proc get_power_file_scope_args { } {
set args [list]
if { [env_var_exists_and_non_empty POWER_FILE_SCOPE] } {
set scope_val $::env(POWER_FILE_SCOPE)
# 1. Strip surrounding quotes from shell/Make
set scope_val [string trim $scope_val "\"'"]
# 2. Normalize: remove ALL backslashes preceding [, ], or .
regsub -all {\\+(\[|\]|\.)} $scope_val {\1} scope_val
# 3. Apply exactly one backslash escape to [, ], and .
regsub -all {(\[|\]|\.)} $scope_val {\\\1} scope_val
lappend args -scope $scope_val
}
return $args
}
proc report_metrics { stage when { include_erc true } { include_clock_skew true } } {
if { $::env(SKIP_REPORT_METRICS) } {
return
}
puts "Report metrics stage $stage, $when..."
set filename $::env(REPORTS_DIR)/${stage}_[string map {" " "_"} $when].rpt
set fileId [open $filename w]
close $fileId
report_puts "\n=========================================================================="
report_puts "$when report_tns"
report_puts "--------------------------------------------------------------------------"
report_tns >> $filename
report_tns_metric
report_tns_metric -hold
report_puts "\n=========================================================================="
report_puts "$when report_wns"
report_puts "--------------------------------------------------------------------------"
report_wns >> $filename
report_puts "\n=========================================================================="
report_puts "$when report_worst_slack"
report_puts "--------------------------------------------------------------------------"
report_worst_slack >> $filename
report_worst_slack_metric
report_worst_slack_metric -hold
report_puts "\n=========================================================================="
report_puts "$when report_clock_min_period"
report_puts "--------------------------------------------------------------------------"
report_clock_min_period -include_port_paths >> $filename
report_fmax_metric
if { $include_clock_skew && $::env(REPORT_CLOCK_SKEW) } {
report_puts "\n=========================================================================="
report_puts "$when report_clock_skew"
report_puts "--------------------------------------------------------------------------"
report_clock_skew >> $filename
report_clock_skew_metric
report_clock_skew_metric -hold
}
report_puts "\n=========================================================================="
report_puts "$when report_checks -path_delay min"
report_puts "--------------------------------------------------------------------------"
report_checks -path_delay min -fields {slew cap input net fanout} \
-format full_clock_expanded >> $filename
report_puts "\n=========================================================================="
report_puts "$when report_checks -path_delay max"
report_puts "--------------------------------------------------------------------------"
report_checks -path_delay max -fields {slew cap input net fanout} \
-format full_clock_expanded >> $filename
report_puts "\n=========================================================================="
report_puts "$when report_checks -unconstrained"
report_puts "--------------------------------------------------------------------------"
report_checks -unconstrained -fields {slew cap input net fanout} \
-format full_clock_expanded >> $filename
if { $include_erc } {
report_puts "\n=========================================================================="
report_puts "$when report_check_types -max_slew -max_cap -max_fanout -violators"
report_puts "--------------------------------------------------------------------------"
report_check_types -max_slew -max_capacitance -max_fanout -violators >> $filename
report_erc_metrics
report_puts "\n=========================================================================="
report_puts "$when max_slew_check_slack"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_slew_check_slack]"
report_puts "\n=========================================================================="
report_puts "$when max_slew_check_limit"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_slew_check_limit]"
if { [sta::max_slew_check_limit] < 1e30 } {
report_puts "\n=========================================================================="
report_puts "$when max_slew_check_slack_limit"
report_puts "--------------------------------------------------------------------------"
report_puts [format "%.4f" [sta::max_slew_check_slack_limit]]
}
report_puts "\n=========================================================================="
report_puts "$when max_fanout_check_slack"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_fanout_check_slack]"
report_puts "\n=========================================================================="
report_puts "$when max_fanout_check_limit"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_fanout_check_limit]"
if { [sta::max_fanout_check_limit] < 1e30 } {
report_puts "\n=========================================================================="
report_puts "$when max_fanout_check_slack_limit"
report_puts "--------------------------------------------------------------------------"
report_puts [format "%.4f" [sta::max_fanout_check_slack_limit]]
}
report_puts "\n=========================================================================="
report_puts "$when max_capacitance_check_slack"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_capacitance_check_slack]"
report_puts "\n=========================================================================="
report_puts "$when max_capacitance_check_limit"
report_puts "--------------------------------------------------------------------------"
report_puts "[sta::max_capacitance_check_limit]"
if { [sta::max_capacitance_check_limit] < 1e30 } {
report_puts "\n=========================================================================="
report_puts "$when max_capacitance_check_slack_limit"
report_puts "--------------------------------------------------------------------------"
report_puts [format "%.4f" [sta::max_capacitance_check_slack_limit]]
}
report_puts "\n=========================================================================="
report_puts "$when max_slew_violation_count"
report_puts "--------------------------------------------------------------------------"
report_puts "max slew violation count [sta::max_slew_violation_count]"
report_puts "\n=========================================================================="
report_puts "$when max_fanout_violation_count"
report_puts "--------------------------------------------------------------------------"
report_puts "max fanout violation count [sta::max_fanout_violation_count]"
report_puts "\n=========================================================================="
report_puts "$when max_cap_violation_count"
report_puts "--------------------------------------------------------------------------"
report_puts "max cap violation count [sta::max_capacitance_violation_count]"
report_puts "\n=========================================================================="
report_puts "$when setup_violation_count"
report_puts "--------------------------------------------------------------------------"
report_puts "setup violation count [sta::endpoint_violation_count max]"
report_puts "\n=========================================================================="
report_puts "$when hold_violation_count"
report_puts "--------------------------------------------------------------------------"
report_puts "hold violation count [sta::endpoint_violation_count min]"
set critical_path [lindex [find_timing_paths -sort_by_slack] 0]
if { $critical_path != "" } {
set path_delay [sta::format_time [[$critical_path path] arrival] 4]
set path_slack [sta::format_time [[$critical_path path] slack] 4]
} else {
set path_delay -1
set path_slack 0
}
if { [llength [all_registers]] != 0 } {
report_puts "\n=========================================================================="
report_puts "$when report_checks -path_delay max reg to reg"
report_puts "--------------------------------------------------------------------------"
report_checks -path_delay max -from [all_registers] -to [all_registers] \
-format full_clock_expanded >> $filename
report_puts "\n=========================================================================="
report_puts "$when report_checks -path_delay min reg to reg"
report_puts "--------------------------------------------------------------------------"
report_checks -path_delay min -from [all_registers] -to [all_registers] \
-format full_clock_expanded >> $filename
set inp_to_reg_critical_path \
[lindex [find_timing_paths -path_delay max -from [all_inputs] -to [all_registers]] 0]
if { $inp_to_reg_critical_path != "" } {
set target_clock_latency_max \
[sta::format_time [$inp_to_reg_critical_path target_clk_delay] 4]
} else {
set target_clock_latency_max 0
}
set inp_to_reg_critical_path [lindex \
[find_timing_paths -path_delay min -from [all_inputs] -to [all_registers]] 0]
if { $inp_to_reg_critical_path != "" } {
set target_clock_latency_min \
[sta::format_time [$inp_to_reg_critical_path target_clk_delay] 4]
set source_clock_latency [sta::format_time [$inp_to_reg_critical_path source_clk_latency] 4]
} else {
set target_clock_latency_min 0
set source_clock_latency 0
}
report_puts "\n=========================================================================="
report_puts "$when critical path target clock latency max path"
report_puts "--------------------------------------------------------------------------"
report_puts "$target_clock_latency_max"
report_puts "\n=========================================================================="
report_puts "$when critical path target clock latency min path"
report_puts "--------------------------------------------------------------------------"
report_puts "$target_clock_latency_min"
report_puts "\n=========================================================================="
report_puts "$when critical path source clock latency min path"
report_puts "--------------------------------------------------------------------------"
report_puts "$source_clock_latency"
} else {
puts "No registers in design"
}
# end if all_registers
report_puts "\n=========================================================================="
report_puts "$when critical path delay"
report_puts "--------------------------------------------------------------------------"
report_puts "$path_delay"
report_puts "\n=========================================================================="
report_puts "$when critical path slack"
report_puts "--------------------------------------------------------------------------"
report_puts "$path_slack"
report_puts "\n=========================================================================="
report_puts "$when slack div critical path delay"
report_puts "--------------------------------------------------------------------------"
if { $path_delay != 0.0 } {
report_puts "[format "%4f" [expr $path_slack / $path_delay * 100]]"
} else {
report_puts "N/A (0 delay)"
}
}
report_puts "\n=========================================================================="
report_puts "$when report_power"
report_puts "--------------------------------------------------------------------------"
set scope_args [get_power_file_scope_args]
if { [env_var_exists_and_non_empty SAIF_FILE] } {
read_saif {*}$scope_args $::env(SAIF_FILE)
report_activity_annotation
} elseif { [env_var_exists_and_non_empty VCD_FILE] } {
read_vcd {*}$scope_args $::env(VCD_FILE)
report_activity_annotation
}
if { [env_var_exists_and_non_empty CORNERS] } {
foreach corner $::env(CORNERS) {
report_puts "Corner: $corner"
report_power -scene $corner >> $filename
report_power_metric -corner $corner
}
unset corner
} else {
report_power >> $filename
report_power_metric
}
# TODO these only work to stdout, whereas we want to append to the $filename
puts "\n=========================================================================="
puts "$when report_design_area"
puts "--------------------------------------------------------------------------"
report_design_area
report_design_area_metrics
}
|