diff --git a/app/Main.cc b/app/Main.cc index fcdf978f..2bceb8a6 100644 --- a/app/Main.cc +++ b/app/Main.cc @@ -181,7 +181,7 @@ initStaApp(int &argc, Sta_Init(interp); // Eval encoded sta TCL sources. evalTclInit(interp, tcl_inits); - Tcl_Eval(interp, "init_sta"); + Tcl_Eval(interp, "init_sta_cmds"); } static void diff --git a/tcl/Init.tcl b/tcl/Init.tcl index f03b461a..107d8398 100644 --- a/tcl/Init.tcl +++ b/tcl/Init.tcl @@ -14,11 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -proc init_sta {} { +proc init_sta_cmds {} { global auto_index # Import exported commands from sta namespace to global namespace. - sta::define_sta_cmds namespace import sta::* if { [info exists tclreadline::version] } { diff --git a/tcl/Sdc.tcl b/tcl/Sdc.tcl index 6589793e..3a3d1519 100644 --- a/tcl/Sdc.tcl +++ b/tcl/Sdc.tcl @@ -39,6 +39,15 @@ proc_redirect read_sdc { ################################################################ +# The builtin Tcl "source" command is redefined by sta. +# This rename provides a mechanism to refer to the original TCL +# command. +# Protected so this file can be reloaded without blowing up. +if { ![info exists renamed_source] } { + rename source builtin_source + set renamed_source 1 +} + set ::sta_continue_on_error 0 define_cmd_args "source" \ diff --git a/tcl/Search.tcl b/tcl/Search.tcl index 81c7865d..f1978cc3 100644 --- a/tcl/Search.tcl +++ b/tcl/Search.tcl @@ -1086,23 +1086,6 @@ proc report_path_ends { path_ends } { report_path_end_footer } -proc define_report_path_fields {} { - variable report_path_field_width_extra - - set_rise_fall_short_names "^" "v" - set_report_path_field_order { fanout capacitance slew \ - incr total edge case description } - set_report_path_field_properties "description" "Description" 36 1 - set width $report_path_field_width_extra - set_report_path_field_properties "total" "Time" $width 0 - set_report_path_field_properties "incr" "Delay" $width 0 - set_report_path_field_properties "capacitance" "Cap" $width 0 - set_report_path_field_properties "slew" "Slew" $width 0 - set_report_path_field_properties "fanout" "Fanout" 6 0 - set_report_path_field_properties "edge" " " 1 0 - set_report_path_field_properties "case" " " 11 0 -} - ################################################################ define_cmd_args "report_clock_min_period" \ diff --git a/tcl/Util.tcl b/tcl/Util.tcl index 1f6af40b..0e0e0887 100644 --- a/tcl/Util.tcl +++ b/tcl/Util.tcl @@ -395,50 +395,45 @@ proc check_percent { cmd_arg arg } { ################################################################ -# The builtin Tcl "source" and "unknown" commands are redefined by sta. -# This rename provides a mechanism to refer to the original TCL -# command. -# Protected so this file can be reloaded without blowing up. -if { ![info exists renamed_source] } { - rename source builtin_source - rename unknown builtin_unknown - set renamed_source 1 -} - -# Numeric expressions eval to themselves so braces aren't required -# around bus names like foo[2] or foo[*]. +# Bus signal names like foo[2] or bar[31:0] use brackets that +# look like "eval" to TCL. Catch the numeric "function" with the +# namespace's unknown handler and return the value instead of an error. proc sta_unknown { args } { global errorCode errorInfo set name [lindex $args 0] - if { [llength $args] == 1 \ - && ([string is integer $name] || [string equal $name "*"]) } { + if { [llength $args] == 1 && [is_bus_subscript $args] } { return "\[$args\]" - } else { - # Implement command name abbreviation from init.tcl/unknown. - # Remove restrictions in that version that prevent it from - # running in non-interactive interpreters. - - set ret [catch {set cmds [info commands $name*]} msg] - if {[string equal $name "::"]} { - set name "" + } + + # Command name abbreviation support. + set ret [catch {set cmds [info commands $name*]} msg] + if {[string equal $name "::"]} { + set name "" + } + if { $ret != 0 } { + return -code $ret -errorcode $errorCode \ + "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg" } - if {$ret != 0} { - return -code $ret -errorcode $errorCode \ - "error in unknown while checking if \"$name\" is a unique command abbreviation: $msg" - } - if {[llength $cmds] == 1} { - return [uplevel 1 [lreplace $args 0 0 $cmds]] - } - if {[llength $cmds]} { - if {[string equal $name ""]} { - return -code error "empty command name \"\"" - } else { - return -code error \ - "ambiguous command name \"$name\": [lsort $cmds]" - } + if { [llength $cmds] == 1 } { + return [uplevel 1 [lreplace $args 0 0 $cmds]] + } + if { [llength $cmds] > 1 } { + if {[string equal $name ""]} { + return -code error "empty command name \"\"" + } else { + return -code error \ + "ambiguous command name \"$name\": [lsort $cmds]" } } + + ::unknown {*}$args +} + +proc is_bus_subscript { subscript } { + return [expr [string is integer $subscript] \ + || [string match $subscript "*"] \ + || [regexp {[0-9]+:[0-9]} $subscript]] } namespace unknown sta_unknown