get_lib_cells/get_lib_pins allow dashes

This commit is contained in:
James Cherry 2021-04-09 22:32:51 -07:00
parent c08019d635
commit a1df318eeb
3 changed files with 30 additions and 53 deletions

View File

@ -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 } { proc get_property_cmd { cmd type_key cmd_args } {
parse_key_args $cmd cmd_args keys $type_key flags {-quiet} parse_key_args $cmd cmd_args keys $type_key flags {-quiet}
set quiet [info exists flags(-quiet)] set quiet [info exists flags(-quiet)]

View File

@ -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. # sta namespace end.
} }

View File

@ -650,7 +650,7 @@ proc get_lib_cells { args } {
set divider $keys(-hsc) set divider $keys(-hsc)
check_path_divider $divider check_path_divider $divider
} }
set cell_regexp [cell_wild_regexp $divider] set cell_regexp [cell_regexp_hsc $divider]
set quiet [info exists flags(-quiet)] set quiet [info exists flags(-quiet)]
foreach pattern $patterns { foreach pattern $patterns {
if { ![regexp $cell_regexp $pattern ignore lib_name cell_pattern]} { if { ![regexp $cell_regexp $pattern ignore lib_name cell_pattern]} {
@ -707,8 +707,8 @@ proc get_lib_pins { args } {
set divider $keys(-hsc) set divider $keys(-hsc)
check_path_divider $divider check_path_divider $divider
} }
set port_regexp1 [port_wild_regexp $divider] set port_regexp1 [port_regexp_hsc $divider]
set port_regexp2 [cell_wild_regexp $divider] set port_regexp2 [cell_regexp_hsc $divider]
set ports {} set ports {}
foreach pattern $patterns { foreach pattern $patterns {
# match library/cell/port # match library/cell/port
@ -3235,5 +3235,25 @@ proc default_operating_conditions {} {
return $op_cond 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. # sta namespace end.
} }