From a1df318eebf83e15f647fecd04ebac359f6ccec0 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 9 Apr 2021 22:32:51 -0700 Subject: [PATCH] get_lib_cells/get_lib_pins allow dashes --- tcl/Cmds.tcl | 50 --------------------------------------------- tcl/NetworkEdit.tcl | 7 +++++++ tcl/Sdc.tcl | 26 ++++++++++++++++++++--- 3 files changed, 30 insertions(+), 53 deletions(-) diff --git a/tcl/Cmds.tcl b/tcl/Cmds.tcl index c77870b1..281ddca0 100644 --- a/tcl/Cmds.tcl +++ b/tcl/Cmds.tcl @@ -1771,56 +1771,6 @@ proc get_nets_arg { arg_name arglist warn_error } { ################################################################ -proc cell_regexp {} { - global hierarchy_separator - if { $hierarchy_separator == "." } { - set lib_regexp {[a-zA-Z0-9_]+} - } else { - set lib_regexp {[a-zA-Z0-9_\.]+} - } - set cell_regexp {[a-zA-Z0-9_]+} - return "^(${lib_regexp})${hierarchy_separator}(${cell_regexp})$" -} - -proc cell_wild_regexp { divider } { - if { $divider == "." } { - set lib_regexp {[a-zA-Z0-9_*+?^$\{\}]+} - } else { - set lib_regexp {[a-zA-Z0-9_.*+?^$\{\}]+} - } - set cell_wild_regexp {[a-zA-Z0-9_.*+?^$\{\}]+} - return "^(${lib_regexp})${divider}(${cell_wild_regexp})$" -} - -proc port_regexp {} { - global hierarchy_separator - if { $hierarchy_separator == "." } { - set lib_regexp {[a-zA-Z0-9_]+} - } else { - set lib_regexp {[a-zA-Z0-9_\.]+} - } - set id_regexp {[a-zA-Z0-9_]+(?:\[[0-9]+\])?} - return "^(${lib_regexp})${hierarchy_separator}(${id_regexp})${hierarchy_separator}(${id_regexp})$" -} - -proc port_wild_regexp { divider } { - if { $divider == "." } { - set lib_regexp {[a-zA-Z0-9_]+} - } else { - set lib_regexp {[a-zA-Z0-9_\.]+} - } - set cell_regexp {[a-zA-Z0-9_]+} - set wild_regexp {[a-zA-Z0-9_.*+?^$\{\}]+} - return "^(${lib_regexp})${divider}(${wild_regexp})${divider}(${wild_regexp})$" -} - -proc path_regexp {} { - global hierarchy_separator - set id_regexp {[a-zA-Z0-9_]+(?:\[[0-9]+\])?} - set prefix_regexp "${id_regexp}(?:${hierarchy_separator}${id_regexp})*" - return "^(${prefix_regexp})${hierarchy_separator}(${id_regexp})$" -} - proc get_property_cmd { cmd type_key cmd_args } { parse_key_args $cmd cmd_args keys $type_key flags {-quiet} set quiet [info exists flags(-quiet)] diff --git a/tcl/NetworkEdit.tcl b/tcl/NetworkEdit.tcl index ff4e2f54..8a279e94 100644 --- a/tcl/NetworkEdit.tcl +++ b/tcl/NetworkEdit.tcl @@ -236,5 +236,12 @@ proc replace_cell { instance lib_cell } { } } +proc path_regexp {} { + global hierarchy_separator + set id_regexp "\[^${hierarchy_separator}\]+" + set prefix_regexp "${id_regexp}(?:${hierarchy_separator}${id_regexp})*" + return "^(${prefix_regexp})${hierarchy_separator}(${id_regexp})$" +} + # sta namespace end. } diff --git a/tcl/Sdc.tcl b/tcl/Sdc.tcl index 80f0ed0d..124a4ab5 100644 --- a/tcl/Sdc.tcl +++ b/tcl/Sdc.tcl @@ -650,7 +650,7 @@ proc get_lib_cells { args } { set divider $keys(-hsc) check_path_divider $divider } - set cell_regexp [cell_wild_regexp $divider] + set cell_regexp [cell_regexp_hsc $divider] set quiet [info exists flags(-quiet)] foreach pattern $patterns { if { ![regexp $cell_regexp $pattern ignore lib_name cell_pattern]} { @@ -707,8 +707,8 @@ proc get_lib_pins { args } { set divider $keys(-hsc) check_path_divider $divider } - set port_regexp1 [port_wild_regexp $divider] - set port_regexp2 [cell_wild_regexp $divider] + set port_regexp1 [port_regexp_hsc $divider] + set port_regexp2 [cell_regexp_hsc $divider] set ports {} foreach pattern $patterns { # match library/cell/port @@ -3235,5 +3235,25 @@ proc default_operating_conditions {} { return $op_cond } +################################################################ + +proc cell_regexp {} { + global hierarchy_separator + return [cell_regexp_hsc $hierarchy_separator] +} + +proc cell_regexp_hsc { hsc } { + return "^(\[^${hsc}\]+)${hsc}(\[^${hsc}\]+)$" +} + +proc port_regexp {} { + global hierarchy_separator + return [port_regexp_hsc $hierarchy_separator] +} + +proc port_regexp_hsc { hsc } { + return "^(\[^${hsc}\]+)${hsc}(\[^${hsc}\]+)${hsc}(\[^${hsc}\]+)$" +} + # sta namespace end. }