The Rename Rules use the full power of the Perl Regular expression engine to perform search and replace on the pin_names. The following example describes a powerful set of regular expression used to rename some strangely named clk output pins found in a TI data sheet (for the LMK00338 device) . The 4 regular expression replace rules start on line 7. As the block below describes, those 4 rules can do the work of the 20 rules that are expanded below them.
#rename rules for clock out diff_pairs #These rename rules were used with a TI clk buffer chip which named its clock output pins # clkouta0 and clkouta0* #we want to rename clkouta0 to clockouta0_p and clkouta0* to clkouta0_n #Using the power of Regular Expressions, we can get all of the signals renamed with the following REPLACE_RULES (CLKOUT[AB]\d+)$:$1_P (CLKOUT[AB]\d+)[*]$:$1_N (CLKIN\d+)$:$1_P (CLKIN\d+)[*]$:$1_N #the $ in the regular expression says the match must occur at the end of the string. #The CLKOUT[AB]\d+ says the match has to have CLKOUT followed by A or B, followed by any number of digits (0-9). #The Parenthesis tell the Regular Experession engine to capture everything that matches between the Parenthesis in the $1 variable. #Then we can use the $1 Variable and append the _P or _N to it. #so when PartBuilder sees CLKOUTA0, the first Regular expression matches it and CLKOUTA0 is stored in $1 #We then replace it with $1_P so we get CLKOUTA0_P #when PartBuilder sees CLKOUTA1*, the 2nd Regular expression matches it and CLKOUTA1 is stored in $1 (without the asterix since it is outside the parenthesis). #We then replace it with $1_N so we get CLKOUTA0_N #if we want to avoid using the advanced Regular expression constructs, we could enter every match by hand # Like this: Note they are all commented out here #CLKOUTA0:CLKOUTA0_P #CLKOUTA0*:CLKOUTA0_N #CLKOUTA1:CLKOUTA1_P #CLKOUTA1*:CLKOUTA1_N #CLKOUTA2:CLKOUTA2_P #CLKOUTA2*:CLKOUTA2_N #CLKOUTA3:CLKOUTA3_P #CLKOUTA3*:CLKOUTA3_N #CLKOUTB0:CLKOUTB0_P #CLKOUTB0*:CLKOUTB0_N #CLKOUTB1:CLKOUTB1_P #CLKOUTB1*:CLKOUTB1_N #CLKOUTB2:CLKOUTB2_P #CLKOUTB2*:CLKOUTB2_N #CLKOUTB3:CLKOUTB3_P #CLKOUTB3*:CLKOUTB3_N #CLKIN0:CLKIN0_P #CLKIN0*:CLKIN0_N #CLKIN1:CLKIN1_P #CLKIN1*:CLKIN1_N
0 Comments