regex - TCL for DC: regexp matching of non-standard hierarchical names -
i'm trying write automation scripts synopsys design compiler, have troubles following case:
i see there logic tie-off nets have following name:
dc_shell> all_connected foo_top/foo/foo_pin {foo_top/*logic0*}
in script want detect pins connected logic tie-offs:
set connected_nets [find net [all_connected $pin]] foreach_in_collection net $connected_nets { if {[regexp {.*logic0.*} [get_object_name $net]] } { # skip pin because tied logic 0 continue } }
this matching never succeeds. works other pins , nets, fails on tie-offs.
i feeling has fact tie-off net specified * in name, i'm not sure how handle it.
what can overcome , able detect these tie-off nets?
thanks
if try invocation regexp {.*logic0.*} {foo_top/*logic0*}
1, it's not matching fails. seem command get_object_name
doesn't return expect to.
as side note, regular expression {.*logic0.*}
equivalent regular expression {logic0}
purpose of determining presence of pattern. unless add kind of anchor, ^
or $
, regular expression matching adds implied .*
either end of expression provide.
on other hand, variants not equivalent when capturing match:
set fbb foobarbaz set pat1 bar set pat2 {.*bar.*} if {[regexp -- $pat1 $fbb] == [regexp -- $pat2 $fbb]} {puts "the same"} # => same set cap1 [regexp -inline -- $pat1 $fbb] set cap2 [regexp -inline -- $pat2 $fbb] if {$cap1 ne $cap2} {puts "not same: $cap1 vs $cap2"} # => not same: bar vs foobarbaz
Comments
Post a Comment