puts -> report_line

This commit is contained in:
James Cherry 2020-12-25 16:55:46 -08:00
parent ee86a30338
commit 7d6c70c6f8
13 changed files with 200 additions and 231 deletions

View File

@ -82,10 +82,10 @@ proc report_edge_dcalc { edge corner min_max digits } {
# Filter timing checks based on min_max. # Filter timing checks based on min_max.
if {!(($min_max == "max" && $role == "hold") \ if {!(($min_max == "max" && $role == "hold") \
|| ($min_max=="min" && $role=="setup"))} { || ($min_max=="min" && $role=="setup"))} {
puts "Library: [get_name $library]" report_line "Library: [get_name $library]"
puts "Cell: [get_name $cell]" report_line "Cell: [get_name $cell]"
puts "Arc sense: [$edge sense]" report_line "Arc sense: [$edge sense]"
puts "Arc type: $role" report_line "Arc type: $role"
set arc_iter [$edge timing_arc_iterator] set arc_iter [$edge timing_arc_iterator]
while {[$arc_iter has_next]} { while {[$arc_iter has_next]} {
@ -94,15 +94,14 @@ proc report_edge_dcalc { edge corner min_max digits } {
set from_rf [$arc from_trans] set from_rf [$arc from_trans]
set to [get_name [$to_pin port]] set to [get_name [$to_pin port]]
set to_rf [$arc to_trans] set to_rf [$arc to_trans]
puts "$from $from_rf -> $to $to_rf" report_line "$from $from_rf -> $to $to_rf"
puts -nonewline [report_delay_calc_cmd $edge $arc $corner $min_max $digits] report_line [report_delay_calc_cmd $edge $arc $corner $min_max $digits]
if { [$edge delay_annotated $arc $corner $min_max] } { if { [$edge delay_annotated $arc $corner $min_max] } {
set delay [$edge arc_delay $arc $corner $min_max] set delay [$edge arc_delay $arc $corner $min_max]
puts "Annotated value = [format_time $delay $digits]" report_line "Annotated value = [format_time $delay $digits]"
} }
puts "" report_line "............................................."
puts "............................................." report_line ""
puts ""
} }
$arc_iter finish $arc_iter finish
} }

View File

@ -38,7 +38,7 @@ public:
Report(); Report();
virtual ~Report(); virtual ~Report();
// Primitives to print output. // Primitive to print output.
// Return the number of characters written. // Return the number of characters written.
virtual size_t printString(const char *buffer, virtual size_t printString(const char *buffer,
size_t length); size_t length);
@ -47,6 +47,8 @@ public:
va_list args); va_list args);
void print(const string *str); void print(const string *str);
void print(const string &str); void print(const string &str);
// Print line with return.
virtual void printLine(const char *line);
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@ -27,21 +27,21 @@ proc report_clock1 { clk } {
if { [$clk waveform_valid] } { if { [$clk waveform_valid] } {
set digits $sta_report_default_digits set digits $sta_report_default_digits
puts -nonewline [format "%-20s" [get_name $clk]]
puts -nonewline [format "%10s" [format_time [$clk period] $digits]]
puts -nonewline " "
set waveform [$clk waveform] set waveform [$clk waveform]
if { $waveform == {} } { if { $waveform == {} } {
puts -nonewline " " set wave " "
} else { } else {
set wave ""
foreach edge $waveform { foreach edge $waveform {
puts -nonewline [format "%10s" [format_time $edge $digits]] set wave "$wave[format "%10s" [format_time $edge $digits]]"
} }
} }
if {[$clk is_generated]} { if {[$clk is_generated]} {
puts -nonewline " (generated)" set generated " (generated)"
} else {
set generated ""
} }
puts "" report_line "[format %-20s [get_name $clk]][format %10s [format_time [$clk period] $digits]] $wave$generated"
} }
} }
@ -75,10 +75,10 @@ proc check_setup_cmd { cmd cmd_args } {
$generated_clocks] $generated_clocks]
foreach error $errors { foreach error $errors {
# First line is the error msg. # First line is the error msg.
puts [lindex $error 0] report_line [lindex $error 0]
if { $verbose } { if { $verbose } {
foreach obj [lrange $error 1 end] { foreach obj [lrange $error 1 end] {
puts " $obj" report_line " $obj"
} }
} }
} }

View File

@ -95,27 +95,25 @@ proc report_edges_ { vertex iter_proc wire_from_name_proc wire_to_name_proc } {
proc report_edge_ { edge vertex_from_name_proc vertex_to_name_proc } { proc report_edge_ { edge vertex_from_name_proc vertex_to_name_proc } {
global sta_report_default_digits global sta_report_default_digits
puts -nonewline "[$vertex_from_name_proc [$edge from]] -> [$vertex_to_name_proc [$edge to]] [$edge role]"
set latch_enable [$edge latch_d_to_q_en] set latch_enable [$edge latch_d_to_q_en]
if { $latch_enable != "" } { if { $latch_enable != "" } {
puts " enable $latch_enable" set latch_enable " enable $latch_enable"
} else {
puts ""
} }
report_line "[$vertex_from_name_proc [$edge from]] -> [$vertex_to_name_proc [$edge to]] [$edge role]$latch_enable"
set disables [edge_disable_reason $edge] set disables [edge_disable_reason $edge]
if { $disables != "" } { if { $disables != "" } {
puts " Disabled by $disables" report_line " Disabled by $disables"
} }
set cond [$edge cond] set cond [$edge cond]
if { $cond != "" } { if { $cond != "" } {
puts " Condition: $cond" report_line " Condition: $cond"
} }
set mode_name [$edge mode_name] set mode_name [$edge mode_name]
if { $mode_name != "" } { if { $mode_name != "" } {
puts " Mode: $mode_name [$edge mode_value]" report_line " Mode: $mode_name [$edge mode_value]"
} }
set iter [$edge timing_arc_iterator] set iter [$edge timing_arc_iterator]
@ -127,7 +125,7 @@ proc report_edge_ { edge vertex_from_name_proc vertex_to_name_proc } {
if { [timing_arc_disabled $edge $arc] } { if { [timing_arc_disabled $edge $arc] } {
set disable_reason " disabled" set disable_reason " disabled"
} }
puts " [$arc from_trans] -> [$arc to_trans] $delays_fmt$disable_reason" report_line " [$arc from_trans] -> [$arc to_trans] $delays_fmt$disable_reason"
} }
$iter finish $iter finish
} }
@ -217,16 +215,20 @@ proc report_constant { obj } {
proc report_pin_constant { pin } { proc report_pin_constant { pin } {
set sim_value [pin_sim_logic_value $pin] set sim_value [pin_sim_logic_value $pin]
puts -nonewline "[pin_property $pin lib_pin_name] $sim_value"
set case_value [pin_case_logic_value $pin] set case_value [pin_case_logic_value $pin]
if { $case_value != "X" } { if { $case_value != "X" } {
puts -nonewline " case=$case_value" set case " case=$case_value"
} else {
set case ""
} }
set logic_value [pin_logic_value $pin] set logic_value [pin_logic_value $pin]
if { $logic_value != "X" } { if { $logic_value != "X" } {
puts -nonewline " logic=$logic_value" set logic " logic=$logic_value"
} else {
set logic ""
} }
puts "" report_line "[pin_property $pin lib_pin_name] $sim_value$case$logic"
} }
################################################################ ################################################################
@ -236,21 +238,21 @@ proc report_disabled_edges {} {
if { [$edge role] == "wire" } { if { [$edge role] == "wire" } {
set from_pin_name [get_full_name [[$edge from] pin]] set from_pin_name [get_full_name [[$edge from] pin]]
set to_pin_name [get_full_name [[$edge to] pin]] set to_pin_name [get_full_name [[$edge to] pin]]
puts -nonewline "$from_pin_name $to_pin_name" report_line "$from_pin_name $to_pin_name [edge_disable_reason_verbose $edge]"
} else { } else {
set from_pin [[$edge from] pin] set from_pin [[$edge from] pin]
set to_pin [[$edge to] pin] set to_pin [[$edge to] pin]
set inst_name [get_full_name [$from_pin instance]] set inst_name [get_full_name [$from_pin instance]]
set from_port_name [get_name [$from_pin port]] set from_port_name [get_name [$from_pin port]]
set to_port_name [get_name [$to_pin port]] set to_port_name [get_name [$to_pin port]]
puts -nonewline "$inst_name $from_port_name $to_port_name"
set cond [$edge cond] set cond [$edge cond]
if { $cond != "" } { if { $cond != "" } {
puts -nonewline " when: $cond" set when " when: $cond"
} else {
set when ""
} }
report_line "$inst_name $from_port_name $to_port_name$when [edge_disable_reason_verbose $edge]"
} }
set reason [edge_disable_reason_verbose $edge]
puts " $reason"
} }
} }
@ -297,7 +299,7 @@ proc report_slews { pin } {
set pin1 [get_port_pin_error "pin" $pin] set pin1 [get_port_pin_error "pin" $pin]
foreach vertex [$pin1 vertices] { foreach vertex [$pin1 vertices] {
puts "[vertex_path_name $vertex] [rise_short_name] [format_times [$vertex slews rise] $sta_report_default_digits] [fall_short_name] [format_times [$vertex slews fall] $sta_report_default_digits]" report_line "[vertex_path_name $vertex] [rise_short_name] [format_times [$vertex slews rise] $sta_report_default_digits] [fall_short_name] [format_times [$vertex slews fall] $sta_report_default_digits]"
} }
} }
@ -330,7 +332,7 @@ proc vertex_name_ { vertex pin pin_name } {
proc hier_pins_crossed_by_edge { edge } { proc hier_pins_crossed_by_edge { edge } {
set from_pins [hier_pins_above [[$edge from] pin]] set from_pins [hier_pins_above [[$edge from] pin]]
set to_pins [hier_pins_above [[$edge to] pin]] set to_pins [hier_pins_above [[$edge to] pin]]
foreach p $to_pins { puts [$p path_name] } foreach p $to_pins { report_line [$p path_name] }
while { [llength $from_pins] > 0 \ while { [llength $from_pins] > 0 \
&& [llength $to_pins] > 0 \ && [llength $to_pins] > 0 \
&& [lindex $from_pins 0] == [lindex $to_pins 0] } { && [lindex $from_pins 0] == [lindex $to_pins 0] } {
@ -369,7 +371,7 @@ proc report_level { pin } {
set pin1 [get_port_pin_error "pin" $pin] set pin1 [get_port_pin_error "pin" $pin]
foreach vertex [$pin1 vertices] { foreach vertex [$pin1 vertices] {
if { $vertex != "NULL" } { if { $vertex != "NULL" } {
puts "[vertex_path_name $vertex] level = [$vertex level]" report_line "[vertex_path_name $vertex] level = [$vertex level]"
} }
} }
} }
@ -392,9 +394,9 @@ proc report_level_distribution {} {
} }
$iter finish $iter finish
puts "level pin count" report_line "level pin count"
for { set level 0 } { $level < $max_level } { incr level } { for { set level 0 } { $level < $max_level } { incr level } {
puts " $level $count($level)" report_line " $level $count($level)"
} }
} }

View File

@ -62,11 +62,11 @@ proc report_instance1 { instance connections verbose } {
} else { } else {
set inst_name [get_full_name $instance] set inst_name [get_full_name $instance]
} }
puts "Instance $inst_name" report_line "Instance $inst_name"
set cell [instance_property $instance "cell"] set cell [instance_property $instance "cell"]
puts " Cell: [get_name $cell]" report_line " Cell: [get_name $cell]"
puts " Library: [get_name [$cell library]]" report_line " Library: [get_name [$cell library]]"
puts " Path cells: [instance_cell_path $instance]" report_line " Path cells: [instance_cell_path $instance]"
if { $connections } { if { $connections } {
report_instance_pins $instance $verbose report_instance_pins $instance $verbose
} }
@ -87,7 +87,7 @@ proc report_instance_pins { instance verbose } {
proc report_instance_pins1 {instance verbose header header_optional dirs} { proc report_instance_pins1 {instance verbose header header_optional dirs} {
set header_shown 0 set header_shown 0
if { !$header_optional } { if { !$header_optional } {
puts $header report_line $header
set header_shown 1 set header_shown 1
} }
set iter [$instance pin_iterator] set iter [$instance pin_iterator]
@ -96,7 +96,7 @@ proc report_instance_pins1 {instance verbose header header_optional dirs} {
set dir [pin_direction $pin] set dir [pin_direction $pin]
if { [lsearch $dirs $dir] != -1 } { if { [lsearch $dirs $dir] != -1 } {
if { !$header_shown } { if { !$header_shown } {
puts $header report_line $header
set header_shown 1 set header_shown 1
} }
report_instance_pin $pin $verbose report_instance_pin $pin $verbose
@ -106,22 +106,22 @@ proc report_instance_pins1 {instance verbose header header_optional dirs} {
} }
proc report_instance_pin { pin verbose } { proc report_instance_pin { pin verbose } {
puts -nonewline " [$pin port_name] [pin_direction $pin]"
set net [$pin net] set net [$pin net]
if { $net == "NULL" } { if { $net == "NULL" } {
puts " (unconnected)" set net_name "(unconnected)"
} else { } else {
puts " [get_full_name [$net highest_connected_net]]" set net_name [get_full_name [$net highest_connected_net]]
if { $verbose } { }
set pins [net_connected_pins_sorted $net] report_line " [$pin port_name] [pin_direction $pin] $net_name"
foreach pin $pins { if { $verbose && $net != "NULL" } {
if [$pin is_load] { set pins [net_connected_pins_sorted $net]
if [$pin is_top_level_port] { foreach pin $pins {
puts " [get_full_name $pin] [pin_direction $pin] port" if [$pin is_load] {
} else { if [$pin is_top_level_port] {
puts " [get_full_name $pin] [pin_direction $pin]" report_line " [get_full_name $pin] [pin_direction $pin] port"
} } else {
} report_line " [get_full_name $pin] [pin_direction $pin]"
}
} }
} }
} }
@ -142,9 +142,9 @@ proc instance_cell_path { instance } {
proc report_instance_children_ { instance } { proc report_instance_children_ { instance } {
set children [instance_sorted_children $instance] set children [instance_sorted_children $instance]
if { $children != {} } { if { $children != {} } {
puts " Children:" report_line " Children:"
foreach child $children { foreach child $children {
puts " [get_name $child] ([instance_property $child ref_name])" report_line " [get_name $child] ([instance_property $child ref_name])"
} }
} }
} }
@ -176,48 +176,48 @@ proc report_lib_cell_ { cell } {
global sta_report_default_digits global sta_report_default_digits
set lib [$cell liberty_library] set lib [$cell liberty_library]
puts "Cell [get_name $cell]" report_line "Cell [get_name $cell]"
puts "Library [get_name $lib]" report_line "Library [get_name $lib]"
set filename [liberty_cell_property $cell "filename"] set filename [liberty_cell_property $cell "filename"]
if { $filename != "" } { if { $filename != "" } {
puts "File $filename" report_line "File $filename"
} }
set iter [$cell liberty_port_iterator] set iter [$cell liberty_port_iterator]
while {[$iter has_next]} { while {[$iter has_next]} {
set port [$iter next] set port [$iter next]
if { [$port is_bus] } { if { [$port is_bus] } {
puts -nonewline " [$port bus_name] [liberty_port_direction $port]" set port_name [$port bus_name]
} else { } else {
puts -nonewline " [get_name $port] [liberty_port_direction $port]" set port_name [get_name $port]
} }
set enable [$port tristate_enable] set enable [$port tristate_enable]
if { $enable != "" } { if { $enable != "" } {
puts -nonewline " enable=$enable" set enable " enable=$enable"
} }
set func [$port function] set func [$port function]
if { $func != "" } { if { $func != "" } {
puts -nonewline " function=$func" set func " function=$func"
} }
puts [port_capacitance_str $port $sta_report_default_digits] report_line " $port_name [liberty_port_direction $port]$enable$func[port_capacitance_str $port $sta_report_default_digits]"
} }
$iter finish $iter finish
} }
proc report_cell_ { cell } { proc report_cell_ { cell } {
set lib [$cell library] set lib [$cell library]
puts "Cell [get_name $cell]" report_line "Cell [get_name $cell]"
puts "Library [get_name $lib]" report_line "Library [get_name $lib]"
set filename [liberty_cell_property $cell "filename"] set filename [liberty_cell_property $cell "filename"]
if { $filename != "" } { if { $filename != "" } {
puts "File $filename" report_line "File $filename"
} }
set iter [$cell port_iterator] set iter [$cell port_iterator]
while {[$iter has_next]} { while {[$iter has_next]} {
set port [$iter next] set port [$iter next]
if { [$port is_bus] } { if { [$port is_bus] } {
puts " [$port bus_name] [port_direction $port]" report_line " [$port bus_name] [port_direction $port]"
} else { } else {
puts " [get_name $port] [port_direction $port]" report_line " [get_name $port] [port_direction $port]"
} }
} }
$iter finish $iter finish
@ -285,20 +285,20 @@ proc report_net_ { net } {
} }
proc report_net1 { net connections verbose hier_pins corner digits } { proc report_net1 { net connections verbose hier_pins corner digits } {
puts "Net [get_full_name $net]" report_line "Net [get_full_name $net]"
if {$connections} { if {$connections} {
set pins [net_connected_pins_sorted $net] set pins [net_connected_pins_sorted $net]
if {$verbose} { if {$verbose} {
report_net_caps $net $pins $corner $digits report_net_caps $net $pins $corner $digits
} }
puts "Driver pins" report_line "Driver pins"
report_net_pins $pins "is_driver" $verbose $corner $digits report_net_pins $pins "is_driver" $verbose $corner $digits
puts "" report_line ""
puts "Load pins" report_line "Load pins"
report_net_pins $pins "is_load" $verbose $corner $digits report_net_pins $pins "is_load" $verbose $corner $digits
if {$hier_pins} { if {$hier_pins} {
puts "" report_line ""
puts "Hierarchical pins" report_line "Hierarchical pins"
report_net_pins $pins "is_hierarchical" $verbose $corner $digits report_net_pins $pins "is_hierarchical" $verbose $corner $digits
} }
report_net_other_pins $pins $verbose $corner $digits report_net_other_pins $pins $verbose $corner $digits
@ -336,10 +336,10 @@ proc report_net_caps { net pins corner digits } {
incr load_count incr load_count
} }
} }
puts " Number of drivers: $driver_count" report_line " Number of drivers: $driver_count"
puts " Number of loads: $load_count" report_line " Number of loads: $load_count"
puts " Number of pins: $pin_count" report_line " Number of pins: $pin_count"
puts "" report_line ""
} }
proc report_net_cap { net caption cap_msg corner digits } { proc report_net_cap { net caption cap_msg corner digits } {
@ -347,7 +347,7 @@ proc report_net_cap { net caption cap_msg corner digits } {
set cap_r_max [$net $cap_msg "rise" $corner "max"] set cap_r_max [$net $cap_msg "rise" $corner "max"]
set cap_f_min [$net $cap_msg "fall" $corner "min"] set cap_f_min [$net $cap_msg "fall" $corner "min"]
set cap_f_max [$net $cap_msg "fall" $corner "max"] set cap_f_max [$net $cap_msg "fall" $corner "max"]
puts " $caption capacitance: [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]" report_line " $caption capacitance: [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]"
} }
proc report_net_pins { pins pin_pred verbose corner digits } { proc report_net_pins { pins pin_pred verbose corner digits } {
@ -363,8 +363,8 @@ proc report_net_other_pins { pins verbose corner digits } {
foreach pin $pins { foreach pin $pins {
if { !([$pin is_driver] || [$pin is_load] || [$pin is_hierarchical]) } { if { !([$pin is_driver] || [$pin is_load] || [$pin is_hierarchical]) } {
if { !$header } { if { !$header } {
puts "" report_line ""
puts "Other pins" report_line "Other pins"
set header 1 set header 1
} }
report_net_pin $pin $verbose $corner $digits report_net_pin $pin $verbose $corner $digits
@ -375,16 +375,17 @@ proc report_net_other_pins { pins verbose corner digits } {
proc report_net_pin { pin verbose corner digits } { proc report_net_pin { pin verbose corner digits } {
if [$pin is_leaf] { if [$pin is_leaf] {
set cell_name [get_name [[$pin instance] cell]] set cell_name [get_name [[$pin instance] cell]]
puts -nonewline " [get_full_name $pin] [pin_direction $pin] ($cell_name)" set cap ""
if { $verbose } { if { $verbose } {
set liberty_port [$pin liberty_port] set liberty_port [$pin liberty_port]
if { $liberty_port != "NULL" } { if { $liberty_port != "NULL" } {
puts -nonewline [port_capacitance_str $liberty_port $digits] set cap [port_capacitance_str $liberty_port $digits]
} }
} }
puts "[pin_location_str $pin]" report_line " [get_full_name $pin] [pin_direction $pin] ($cell_name)$cap[pin_location_str $pin]"
} elseif [$pin is_top_level_port] { } elseif [$pin is_top_level_port] {
puts -nonewline " [get_full_name $pin] [pin_direction $pin] port" set wire_cap ""
set pin_cap ""
if { $verbose } { if { $verbose } {
set port [$pin port] set port [$pin port]
set cap_r_min [port_ext_wire_cap $port "rise" "min"] set cap_r_min [port_ext_wire_cap $port "rise" "min"]
@ -392,7 +393,7 @@ proc report_net_pin { pin verbose corner digits } {
set cap_f_min [port_ext_wire_cap $port "fall" "min"] set cap_f_min [port_ext_wire_cap $port "fall" "min"]
set cap_f_max [port_ext_wire_cap $port "fall" "max"] set cap_f_max [port_ext_wire_cap $port "fall" "max"]
if { $cap_r_min > 0 || $cap_r_max > 0 || $cap_f_min > 0 || $cap_r_max > 0 } { if { $cap_r_min > 0 || $cap_r_max > 0 || $cap_f_min > 0 || $cap_r_max > 0 } {
puts -nonewline " wire [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]" set wire_cap " wire [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]"
} }
set port [$pin port] set port [$pin port]
@ -401,12 +402,12 @@ proc report_net_pin { pin verbose corner digits } {
set cap_f_min [port_ext_pin_cap $port "fall" "min"] set cap_f_min [port_ext_pin_cap $port "fall" "min"]
set cap_f_max [port_ext_pin_cap $port "fall" "max"] set cap_f_max [port_ext_pin_cap $port "fall" "max"]
if { $cap_r_min > 0 || $cap_r_max > 0 || $cap_f_min > 0 || $cap_r_max > 0} { if { $cap_r_min > 0 || $cap_r_max > 0 || $cap_f_min > 0 || $cap_r_max > 0} {
puts -nonewline " pin [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]" set pin_cap " pin [capacitances_str $cap_r_min $cap_r_max $cap_f_min $cap_f_max $digits]"
} }
} }
puts "[pin_location_str $pin]" report_line " [get_full_name $pin] [pin_direction $pin] port$wire_cap$pin_cap[pin_location_str $pin]"
} elseif [$pin is_hierarchical] { } elseif [$pin is_hierarchical] {
puts " [get_full_name $pin] [pin_direction $pin]" report_line " [get_full_name $pin] [pin_direction $pin]"
} }
} }
@ -426,11 +427,11 @@ proc pin_location_str { pin } {
proc report_pin_ { pin } { proc report_pin_ { pin } {
global sta_report_default_digits global sta_report_default_digits
puts -nonewline "Pin [get_full_name $pin] [pin_direction_desc $pin]"
set liberty_port [$pin liberty_port] set liberty_port [$pin liberty_port]
if { $liberty_port != "NULL" } { if { $liberty_port != "NULL" } {
puts -nonewline [port_capacitance_str $liberty_port $sta_report_default_digits] set cap [port_capacitance_str $liberty_port $sta_report_default_digits]
} else {
set cap ""
} }
if { [$pin is_top_level_port] } { if { [$pin is_top_level_port] } {
@ -444,10 +445,11 @@ proc report_pin_ { pin } {
set net [$pin net] set net [$pin net]
} }
if { $net == "NULL" } { if { $net == "NULL" } {
puts " (unconnected)" set net_name "(unconnected)"
} else { } else {
puts " [get_full_name [$net highest_connected_net]]" set net_name [get_full_name [$net highest_connected_net]]
} }
report_line "Pin [get_full_name $pin] [pin_direction_desc $pin]$cap $net_name"
} }
proc pin_direction_desc { pin } { proc pin_direction_desc { pin } {

View File

@ -69,11 +69,7 @@ proc report_power_design { corner digits } {
report_title_dashes5 $field_width report_title_dashes5 $field_width
report_power_row "Total" $power_result $design_total $field_width $digits report_power_row "Total" $power_result $design_total $field_width $digits
puts -nonewline [format "%-20s" ""] report_line "[format %-20s {}][power_col_percent $design_internal $design_total $field_width][power_col_percent $design_switching $design_total $field_width][power_col_percent $design_leakage $design_total $field_width]"
report_power_col_percent $design_internal $design_total $field_width
report_power_col_percent $design_switching $design_total $field_width
report_power_col_percent $design_leakage $design_total $field_width
puts ""
} }
proc max { x y } { proc max { x y } {
@ -85,15 +81,11 @@ proc max { x y } {
} }
proc report_power_title5 { title1 title2 title3 title4 title5 field_width } { proc report_power_title5 { title1 title2 title3 title4 title5 field_width } {
puts -nonewline [format "%-20s" $title1] report_line "[format %-20s $title1] [format %${field_width}s $title2] [format %${field_width}s $title3] [format %${field_width}s $title4] [format %${field_width}s $title5]"
report_power_title4 $title2 $title3 $title4 $title5 $field_width
} }
proc report_power_title4 { title1 title2 title3 title4 field_width } { proc report_power_title4 { title1 title2 title3 title4 field_width } {
puts -nonewline [format " %${field_width}s" $title1] report_line " [format %${field_width}s $title1] [format %${field_width}s $title2] [format %${field_width}s $title3] [format %${field_width}s $title4]"
puts -nonewline [format " %${field_width}s" $title2]
puts -nonewline [format " %${field_width}s" $title3]
puts [format " %${field_width}s" $title4]
} }
proc report_title_dashes5 { field_width } { proc report_title_dashes5 { field_width } {
@ -107,10 +99,11 @@ proc report_title_dashes4 { field_width } {
} }
proc report_title_dashes { count } { proc report_title_dashes { count } {
set line ""
for {set i 0} {$i < $count} {incr i} { for {set i 0} {$i < $count} {incr i} {
puts -nonewline "-" set line "-$line"
} }
puts "" report_line $line
} }
proc report_power_row { type row_result design_total field_width digits } { proc report_power_row { type row_result design_total field_width digits } {
@ -120,40 +113,35 @@ proc report_power_row { type row_result design_total field_width digits } {
} else { } else {
set percent [expr $total / $design_total * 100] set percent [expr $total / $design_total * 100]
} }
puts -nonewline [format "%-20s" $type] report_line "[format %-20s $type][power_col $internal $field_width $digits][power_col $switching $field_width $digits][power_col $leakage $field_width $digits][power_col $total $field_width $digits] [format %5.1f%% $percent]"
report_power_col $internal $field_width $digits
report_power_col $switching $field_width $digits
report_power_col $leakage $field_width $digits
report_power_col $total $field_width $digits
puts [format " %5.1f%%" $percent]
} }
proc is_nan { str } { proc is_nan { str } {
return [string match "*NaN" $str] return [string match "*NaN" $str]
} }
proc report_power_col { pwr field_width digits } { proc power_col { pwr field_width digits } {
if { [is_nan $pwr] } { if { [is_nan $pwr] } {
puts -nonewline [format " %${field_width}s" $pwr] format " %${field_width}s" $pwr
} else { } else {
puts -nonewline [format " %$field_width.${digits}e" $pwr] format " %$field_width.${digits}e" $pwr
} }
} }
proc report_power_col_percent { col_total total field_width } { proc power_col_percent { col_total total field_width } {
if { $total == 0.0 || [is_nan $total]} { if { $total == 0.0 || [is_nan $total]} {
set percent 0.0 set percent 0.0
} else { } else {
set percent [expr $col_total / $total * 100] set percent [expr $col_total / $total * 100]
} }
puts -nonewline [format "%$field_width.1f%%" $percent] format "%$field_width.1f%%" $percent
} }
proc report_power_line { type pwr digits } { proc report_power_line { type pwr digits } {
if { [is_nan $pwr] } { if { [is_nan $pwr] } {
puts [format "%-16s %s" $type $pwr] report_line [format "%-16s %s" $type $pwr]
} else { } else {
puts [format "%-16s %.${digits}e" $type $pwr] report_line [format "%-16s %.${digits}e" $type $pwr]
} }
} }
@ -194,11 +182,7 @@ proc inst_pwr_cmp { inst_pwr1 inst_pwr2 } {
proc report_power_inst { inst power_result field_width digits } { proc report_power_inst { inst power_result field_width digits } {
lassign $power_result internal switching leakage total lassign $power_result internal switching leakage total
report_power_col $internal $field_width $digits report_line "[power_col $internal $field_width $digits][power_col $switching $field_width $digits][power_col $leakage $field_width $digits][power_col $total $field_width $digits] [get_full_name $inst]"
report_power_col $switching $field_width $digits
report_power_col $leakage $field_width $digits
report_power_col $total $field_width $digits
puts " [get_full_name $inst]"
} }
################################################################ ################################################################
@ -262,7 +246,7 @@ proc power_find_nan { } {
set power_result [instance_power $inst $corner] set power_result [instance_power $inst $corner]
lassign $power_result internal switching leakage total lassign $power_result internal switching leakage total
if { [is_nan $internal] || [is_nan $switching] || [is_nan $leakage] } { if { [is_nan $internal] || [is_nan $switching] || [is_nan $leakage] } {
puts "[get_full_name $inst] $internal $switching $leakage" report_line "[get_full_name $inst] $internal $switching $leakage"
break break
} }
} }

View File

@ -76,7 +76,7 @@ proc source_ { filename echo verbose } {
gets $stream line gets $stream line
if { $line != "" } { if { $line != "" } {
if {$echo} { if {$echo} {
puts $line report_line $line
} }
} }
append cmd $line "\n" append cmd $line "\n"
@ -89,7 +89,7 @@ proc source_ { filename echo verbose } {
# Flush results printed outside tcl to stdout/stderr. # Flush results printed outside tcl to stdout/stderr.
fflush fflush
switch $error_code { switch $error_code {
0 { if { $verbose && $result != "" } { puts $result } } 0 { if { $verbose && $result != "" } { report_line $result } }
1 { set error $result } 1 { set error $result }
2 { set error {invoked "return" outside of a proc.} } 2 { set error {invoked "return" outside of a proc.} }
3 { set error {invoked "break" outside of a loop.} } 3 { set error {invoked "break" outside of a loop.} }
@ -99,9 +99,9 @@ proc source_ { filename echo verbose } {
if { $sta_continue_on_error } { if { $sta_continue_on_error } {
# Only prepend error message with file/line once. # Only prepend error message with file/line once.
if { [string first "Error" $error] == 0 } { if { [string first "Error" $error] == 0 } {
puts $error report_line $error
} else { } else {
puts "Error: [file tail $sdc_file], $sdc_line $error" report_line "Error: [file tail $sdc_file], $sdc_line $error"
} }
set error {} set error {}
} else { } else {
@ -176,7 +176,7 @@ proc current_instance { {inst ""} } {
set current_instance [get_instance_error "instance" $inst] set current_instance [get_instance_error "instance" $inst]
} }
set cell [get_name [$current_instance cell]] set cell [get_name [$current_instance cell]]
puts "Current instance is $cell." report_line "Current instance is $cell."
# Current instance state variable must be part of the sta state so # Current instance state variable must be part of the sta state so
# the tcl interpreter can be shared by multiple sdc files. # the tcl interpreter can be shared by multiple sdc files.
set_current_instance $current_instance set_current_instance $current_instance

View File

@ -59,7 +59,7 @@ proc report_delays_wrt_clk { vertex what clk clk_rf } {
} else { } else {
set clk_str "" set clk_str ""
} }
puts "$clk_str r $rise_fmt f $fall_fmt" report_line "$clk_str r $rise_fmt f $fall_fmt"
} }
} }
@ -94,7 +94,7 @@ proc report_wrt_clk { vertex what clk clk_rf } {
} else { } else {
set clk_str "" set clk_str ""
} }
puts "$clk_str r $rise_fmt f $fall_fmt" report_line "$clk_str r $rise_fmt f $fall_fmt"
} }
} }
@ -173,12 +173,12 @@ proc_redirect report_path {
while {[$path_iter has_next]} { while {[$path_iter has_next]} {
set path [$path_iter next] set path [$path_iter next]
if { $first } { if { $first } {
puts "Tag group: [$vertex tag_group_index]" report_line "Tag group: [$vertex tag_group_index]"
} else { } else {
puts "" report_line ""
} }
if { $report_tags } { if { $report_tags } {
puts "Tag: [$path tag]" report_line "Tag: [$path tag]"
} }
report_path_cmd $path report_path_cmd $path
delete_path_ref $path delete_path_ref $path
@ -189,7 +189,7 @@ proc_redirect report_path {
set worst_path [vertex_worst_arrival_path_rf $vertex $tr $min_max] set worst_path [vertex_worst_arrival_path_rf $vertex $tr $min_max]
if { $worst_path != "NULL" } { if { $worst_path != "NULL" } {
if { $report_tags } { if { $report_tags } {
puts "Tag: [$worst_path tag]" report_line "Tag: [$worst_path tag]"
} }
report_path_cmd $worst_path report_path_cmd $worst_path
delete_path_ref $worst_path delete_path_ref $worst_path
@ -386,33 +386,33 @@ proc report_slew_limits { corner min_max all_violators verbose nosplit } {
if { $all_violators } { if { $all_violators } {
set violators [pin_slew_limit_violations $corner $min_max] set violators [pin_slew_limit_violations $corner $min_max]
if { $violators != {} } { if { $violators != {} } {
puts "${min_max} slew" report_line "${min_max} slew"
puts "" report_line ""
if { $verbose } { if { $verbose } {
foreach pin $violators { foreach pin $violators {
report_slew_limit_verbose $pin $corner $min_max report_slew_limit_verbose $pin $corner $min_max
puts "" report_line ""
} }
} else { } else {
report_slew_limit_short_header report_slew_limit_short_header
foreach pin $violators { foreach pin $violators {
report_slew_limit_short $pin $corner $min_max report_slew_limit_short $pin $corner $min_max
} }
puts "" report_line ""
} }
} }
} else { } else {
set pin [pin_min_slew_limit_slack $corner $min_max] set pin [pin_min_slew_limit_slack $corner $min_max]
if { $pin != "NULL" } { if { $pin != "NULL" } {
puts "${min_max} slew" report_line "${min_max} slew"
puts "" report_line ""
if { $verbose } { if { $verbose } {
report_slew_limit_verbose $pin $corner $min_max report_slew_limit_verbose $pin $corner $min_max
puts "" report_line ""
} else { } else {
report_slew_limit_short_header report_slew_limit_short_header
report_slew_limit_short $pin $corner $min_max report_slew_limit_short $pin $corner $min_max
puts "" report_line ""
} }
} }
} }
@ -422,33 +422,33 @@ proc report_fanout_limits { min_max all_violators verbose nosplit } {
if { $all_violators } { if { $all_violators } {
set violators [pin_fanout_limit_violations $min_max] set violators [pin_fanout_limit_violations $min_max]
if { $violators != {} } { if { $violators != {} } {
puts "${min_max} fanout" report_line "${min_max} fanout"
puts "" report_line ""
if { $verbose } { if { $verbose } {
foreach pin $violators { foreach pin $violators {
report_fanout_limit_verbose $pin $min_max report_fanout_limit_verbose $pin $min_max
puts "" report_line ""
} }
} else { } else {
report_fanout_limit_short_header report_fanout_limit_short_header
foreach pin $violators { foreach pin $violators {
report_fanout_limit_short $pin $min_max report_fanout_limit_short $pin $min_max
} }
puts "" report_line ""
} }
} }
} else { } else {
set pin [pin_min_fanout_limit_slack $min_max] set pin [pin_min_fanout_limit_slack $min_max]
if { $pin != "NULL" } { if { $pin != "NULL" } {
puts "${min_max} fanout" report_line "${min_max} fanout"
puts "" report_line ""
if { $verbose } { if { $verbose } {
report_fanout_limit_verbose $pin $min_max report_fanout_limit_verbose $pin $min_max
puts "" report_line ""
} else { } else {
report_fanout_limit_short_header report_fanout_limit_short_header
report_fanout_limit_short $pin $min_max report_fanout_limit_short $pin $min_max
puts "" report_line ""
} }
} }
} }
@ -458,33 +458,33 @@ proc report_capacitance_limits { corner min_max all_violators verbose nosplit }
if { $all_violators } { if { $all_violators } {
set violators [pin_capacitance_limit_violations $corner $min_max] set violators [pin_capacitance_limit_violations $corner $min_max]
if { $violators != {} } { if { $violators != {} } {
puts "${min_max} capacitance" report_line "${min_max} capacitance"
puts "" report_line ""
if { $verbose } { if { $verbose } {
foreach pin $violators { foreach pin $violators {
report_capacitance_limit_verbose $pin $corner $min_max report_capacitance_limit_verbose $pin $corner $min_max
puts "" report_line ""
} }
} else { } else {
report_capacitance_limit_short_header report_capacitance_limit_short_header
foreach pin $violators { foreach pin $violators {
report_capacitance_limit_short $pin $corner $min_max report_capacitance_limit_short $pin $corner $min_max
} }
puts "" report_line ""
} }
} }
} else { } else {
set pin [pin_min_capacitance_limit_slack $corner $min_max] set pin [pin_min_capacitance_limit_slack $corner $min_max]
if { $pin != "NULL" } { if { $pin != "NULL" } {
puts "${min_max} capacitance" report_line "${min_max} capacitance"
puts "" report_line ""
if { $verbose } { if { $verbose } {
report_capacitance_limit_verbose $pin $corner $min_max report_capacitance_limit_verbose $pin $corner $min_max
puts "" report_line ""
} else { } else {
report_capacitance_limit_short_header report_capacitance_limit_short_header
report_capacitance_limit_short $pin $corner $min_max report_capacitance_limit_short $pin $corner $min_max
puts "" report_line ""
} }
} }
} }

View File

@ -25,7 +25,7 @@ namespace eval sta {
define_cmd_args show_splash {} define_cmd_args show_splash {}
proc show_splash {} { proc show_splash {} {
puts "OpenSTA [sta::version] [string range [sta::git_sha1] 0 9] Copyright (c) 2019, Parallax Software, Inc. report_line "OpenSTA [sta::version] [string range [sta::git_sha1] 0 9] Copyright (c) 2019, Parallax Software, Inc.
License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html> License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>
This is free software, and you are free to change and redistribute it This is free software, and you are free to change and redistribute it
@ -36,7 +36,7 @@ This program comes with ABSOLUTELY NO WARRANTY; for details type `show_warranty'
define_cmd_args show_warranty {} define_cmd_args show_warranty {}
proc show_warranty {} { proc show_warranty {} {
puts {15. Disclaimer of Warranty. report_line {15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability. 16. Limitation of Liability.
@ -49,7 +49,7 @@ If the disclaimer of warranty and limitation of liability provided above cannot
define_cmd_args show_copying {} define_cmd_args show_copying {}
proc show_copying {} { proc show_copying {} {
puts { GNU GENERAL PUBLIC LICENSE report_line { GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>

View File

@ -303,7 +303,7 @@ proc_redirect report_checks {
parse_report_path_options "report_checks" args "full" 0 parse_report_path_options "report_checks" args "full" 0
set path_ends [find_timing_paths_cmd "report_checks" args] set path_ends [find_timing_paths_cmd "report_checks" args]
if { $path_ends == {} } { if { $path_ends == {} } {
puts "No paths found." report_line "No paths found."
} else { } else {
report_path_ends $path_ends report_path_ends $path_ends
} }
@ -535,7 +535,7 @@ proc_redirect report_tns {
set digits $sta_report_default_digits set digits $sta_report_default_digits
} }
puts "tns [format_time [total_negative_slack_cmd "max"] $digits]" report_line "tns [format_time [total_negative_slack_cmd "max"] $digits]"
} }
################################################################ ################################################################
@ -557,7 +557,7 @@ proc_redirect report_wns {
if { $slack > 0.0 } { if { $slack > 0.0 } {
set slack 0.0 set slack 0.0
} }
puts "wns [format_time $slack $digits]" report_line "wns [format_time $slack $digits]"
} }
################################################################ ################################################################
@ -575,7 +575,7 @@ proc_redirect report_worst_slack {
set digits $sta_report_default_digits set digits $sta_report_default_digits
} }
puts "worst slack [format_time [worst_slack_cmd "max"] $digits]" report_line "worst slack [format_time [worst_slack_cmd "max"] $digits]"
} }
################################################################ ################################################################
@ -1036,8 +1036,8 @@ define_sta_cmd_args "report_clock_properties" {[clocks]}
proc_redirect report_clock_properties { proc_redirect report_clock_properties {
check_argc_eq0or1 "report_clock_properties" $args check_argc_eq0or1 "report_clock_properties" $args
update_generated_clks update_generated_clks
puts "Clock Period Waveform" report_line "Clock Period Waveform"
puts "----------------------------------------------------" report_line "----------------------------------------------------"
if { [llength $args] == 0 } { if { [llength $args] == 0 } {
set clk_iter [clock_iterator] set clk_iter [clock_iterator]
while {[$clk_iter has_next]} { while {[$clk_iter has_next]} {
@ -1054,51 +1054,19 @@ proc_redirect report_clock_properties {
################################################################ ################################################################
define_sta_cmd_args "report_object_full_names" {[-verbose] objects} define_sta_cmd_args "report_object_full_names" {objects}
proc report_object_full_names { args } { proc report_object_full_names { objects } {
parse_key_args "report_object_full_names" args keys {} flags {-verbose} foreach obj [sort_by_full_name $objects] {
report_line [get_full_name $obj]
set objects [lindex $args 0]
if { [info exists flags(-verbose)] } {
puts -nonewline "{"
set first 1
foreach obj [sort_by_full_name $objects] {
if { !$first } {
puts -nonewline ", "
}
puts -nonewline \"[get_object_type $obj]:[get_full_name $obj]\"
set first 0
}
puts "}"
} else {
foreach obj [sort_by_full_name $objects] {
puts [get_full_name $obj]
}
} }
} }
define_sta_cmd_args "report_object_names" {[-verbose] objects} define_sta_cmd_args "report_object_names" {objects}
proc report_object_names { args } { proc report_object_names { objects } {
parse_key_args "report_object_names" args keys {} flags {-verbose} foreach obj [sort_by_name $objects] {
report_line [get_name $obj]
set objects [lindex $args 0]
if { [info exists flags(-verbose)] } {
puts -nonewline "{"
set first 1
foreach obj [sort_by_name $objects] {
if { !$first } {
puts -nonewline ", "
}
puts -nonewline \"[get_object_type $obj]:[get_name $obj]\"
set first 0
}
puts "}"
} else {
foreach obj [sort_by_name $objects] {
puts [get_name $obj]
}
} }
} }
@ -1109,7 +1077,7 @@ define_sta_cmd_args "report_units" {}
proc report_units { args } { proc report_units { args } {
check_argc_eq0 "report_units" $args check_argc_eq0 "report_units" $args
foreach unit {"time" "capacitance" "resistance" "voltage" "current" "power" "distance"} { foreach unit {"time" "capacitance" "resistance" "voltage" "current" "power" "distance"} {
puts " $unit 1[unit_scale_abreviation $unit][unit_suffix $unit]" report_line " $unit 1[unit_scale_abreviation $unit][unit_suffix $unit]"
} }
} }

View File

@ -1947,7 +1947,8 @@ void
report_error(int id, report_error(int id,
const char *msg) const char *msg)
{ {
Sta::sta()->report()->error(id, "%s", msg); Report *report = Sta::sta()->report();
report->error(id, "%s", msg);
} }
void void
@ -1956,14 +1957,16 @@ report_file_error(int id,
int line, int line,
const char *msg) const char *msg)
{ {
Sta::sta()->report()->error(id, filename, line, "%s", msg); Report *report = Sta::sta()->report();
report->error(id, filename, line, "%s", msg);
} }
void void
report_warn(int id, report_warn(int id,
const char *msg) const char *msg)
{ {
Sta::sta()->report()->warn(id, "%s", msg); Report *report = Sta::sta()->report();
report->warn(id, "%s", msg);
} }
void void
@ -1972,13 +1975,15 @@ report_file_warn(int id,
int line, int line,
const char *msg) const char *msg)
{ {
Sta::sta()->report()->fileWarn(id, filename, line, "%s", msg); Report *report = Sta::sta()->report();
report->fileWarn(id, filename, line, "%s", msg);
} }
void void
report(const char *msg) report_line(const char *msg)
{ {
Sta::sta()->report()->print(msg); Report *report = Sta::sta()->report();
report->printLine(msg);
} }
void void

View File

@ -225,25 +225,25 @@ proc show_cmd_args { cmd } {
set max_col 80 set max_col 80
set indent 2 set indent 2
set indent_str " " set indent_str " "
puts -nonewline $cmd set line $cmd
set col [string length $cmd] set col [string length $cmd]
set arglist $cmd_args($cmd) set arglist $cmd_args($cmd)
# Break the arglist up into max_col length lines. # Break the arglist up into max_col length lines.
while {1} { while {1} {
if {[regexp {(^ *)([a-zA-Z0-9>_\|\-]+|\[.*\])(.*)} \ if {[regexp {(^ *)([a-zA-Z0-9_\\\|\-]+|\[.*\])(.*)} \
$arglist ignore space arg rest]} { $arglist ignore space arg rest]} {
set arg_length [string length $arg] set arg_length [string length $arg]
if { $col + $arg_length < $max_col } { if { $col + $arg_length < $max_col } {
puts -nonewline " $arg" set line "$line $arg"
set col [expr $col + $arg_length + 1] set col [expr $col + $arg_length + 1]
} else { } else {
puts "" report_line $line
puts -nonewline "$indent_str $arg" set line "$line$indent_str $arg"
set col [expr $indent + $arg_length + 1] set col [expr $indent + $arg_length + 1]
} }
set arglist $rest set arglist $rest
} else { } else {
puts "" report_line $line
break break
} }
} }

View File

@ -142,6 +142,13 @@ Report::print(const char *fmt, ...)
va_end(args); va_end(args);
} }
void
Report::printLine(const char *line)
{
printString(line, strlen(line));
printString("\n", 1);
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
void void