in reply to Re: regular expression help
in thread regular expression help

Agreed, Cadence bus syntax can be much more complex than
this. However splitting on commas and parsing the contents
in '<>' doesn't allow me to identify unique field types.

Eg.
XI0<15:0> HD_DEC0_B<(7:0)*2> HD_DEC1_B<15:0:2*2> <*2>H<3:0>,<*4>P<1:0>

Because this is an cadence array'd instance, the expansion
of each field type is different so I need a way to
identify this.

HD_DEC0_B<(7:0)*2> --> field_type1
HD_DEC1_B<15:0:2*2> --> field_type2
<*2>H<3:0>,<*4>P<1:0> --> field_type3

There are many more different field_types that I need to be able to identify, the above is just an example.
What this line expands to is:

XI0_15 HD_DEC0_B_7 HD_DEC1_B_15 H_3
XI0_14 HD_DEC0_B_6 HD_DEC1_B_15 H_2
XI0_13 HD_DEC0_B_5 HD_DEC1_B_13 H_1
XI0_12 HD_DEC0_B_4 HD_DEC1_B_13 H_0
XI0_11 HD_DEC0_B_3 HD_DEC1_B_11 H_3
XI0_10 HD_DEC0_B_2 HD_DEC1_B_11 H_2
XI0_9 HD_DEC0_B_1 HD_DEC1_B_9 H_1
XI0_8 HD_DEC0_B_0 HD_DEC1_B_9 H_0
XI0_7 HD_DEC0_B_7 HD_DEC1_B_7 P_1
XI0_6 HD_DEC0_B_6 HD_DEC1_B_7 P_0
XI0_5 HD_DEC0_B_5 HD_DEC1_B_5 P_1
XI0_4 HD_DEC0_B_4 HD_DEC1_B_5 P_0
XI0_3 HD_DEC0_B_3 HD_DEC1_B_3 P_1
XI0_2 HD_DEC0_B_2 HD_DEC1_B_3 P_0
XI0_1 HD_DEC0_B_1 HD_DEC1_B_1 P_1
XI0_0 HD_DEC0_B_0 HD_DEC1_B_1 P_0

For field_type3, I already have a routine that will explode this type and populate an array.
However I'd like to have a regular expression that will match
all variations of field_type3 but not match my
other field_types.

Thanks!

Replies are listed 'Best First'.
Re^3: regular expression help
by Anonymous Monk on Jun 06, 2009 at 20:32 UTC
    The other field_types come about as a result of a combination of the bus syntax. For instance, you may combine field_type2 & field_type3 syntaxes and it'd still be valid bus syntax.

    Maybe you'd want to expand the bus string into its individual signals first. Cadence already has a SKILL function to do this.

    By the way, the expansions you have shown (with underscores) already have netlist name mappings performed so they can be taken into spectre without choking.

    Make sure you take the *2 and *4 multipliers into account. The expansion will be the cross product of each bus's individual signals (multiplied or not).