Command Reference 2. Synopsys Commands define_name_rules
NAME
define_name_rules
Defines a set of name rules for designs.
SYNTAX
int define_name_rules rules_name [-max_length length] [-allowed chars]
[-restricted chars] [-first_restricted chars] [-last_restricted chars]
[-replacement_char char] [-remove_chars] [-reserved_words reserves]
[-equal_ports_nets] [-collapse_name_space] [-case_insensitive]
[-prefix prefix_name] [-special special_target] [-map map_string]
[-type object_type] [-reset]
string rules_name
int length
string chars
string char
list reserves
string prefix_name
string special_target
string map_string
string object_type
ARGUMENTS
rules_name Specifies the name of the rules being
defined. If name rules called
rules_name do not exist, they are
created.
-max_length length
Specifies the maximum length of a name;
must be 8 or more characters, except
that a value of 0 resets the maximum
length to its default (any length).
-allowed chars Specifies the set of characters allowed
in names. The format of the chars
string is described in the "DESCRIPTION"
section. By default, any printable
character is allowed in a name.
-restricted chars
Specifies the set of characters not
allowed in names. The format of the
chars string is described in the
"DESCRIPTION" section. By default, any
printable character is allowed in a
name.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-1
define_name_rules 2. Synopsys Commands Command Reference
-first_restricted chars
Specifies a set of characters not
allowed as the first character in a
name. The format of the chars string is
described in the "DESCRIPTION" section.
By default, any printable character is
allowed as the first character of a
name.
2-2 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
-last_restricted chars
Specifies a set of characters not
allowed as the last character in a name.
The format of the chars string is
described in the "DESCRIPTION" section.
By default, any printable character is
allowed as the last character of a name.
-replacement_char char
Specifies the character used to replace
characters not allowed in names as
specified by -allowed or -restricted.
By default, the replacement character is
the underscore character, "_".
-remove_chars Specifies that characters not allowed in
names, as specified by -allowed or
-restricted, are removed rather than
replaced. By default, illegal
characters are replaced by the character
specified with -replacement_char.
-reserved_words reserves
Specifies a list of words that cannot be
used as a name. reserves contains words
that are considered "reserved" in the
user's target system. By default, there
are no reserved words.
-equal_ports_nets
Specifies that nets connected to ports
must have the same name as their
connecting port. If a net is connected
to more than one port, the net's name is
not changed and a warning is issued. By
default, nets are not required to match
the names of ports to which they are
connected.
-collapse_name_space
Specifies that the name space of ports,
cells, and nets is the same. No port,
cell, or net in a design can have the
same name. By default, ports, cells,
and nets each have their own name space.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-3
define_name_rules 2. Synopsys Commands Command Reference
-case_insensitive
Specifies that the case of characters is
not significant when comparing names.
For example, the name "example" is
equivalent to the name "EXAMPLE". If
two names are found to be equivalent
within a name space, one of the names
must be changed. By default, the case
of a name is significant.
-prefix prefix_name
Specifies a prefix used when changing a
name. By default, the prefixes are "P"
for ports, "U" for cells, and "N" for
nets. NOTE: This option is only used
when change_names needs to create a
completely new name to insure the name's
uniqueness. See STEP 3 of the NAMING
RULES section below for more information
about how this option is used.
-special special_target
Specifies that special rules pertaining
to a specific target system be used when
changing names. By default, no special
rules apply. The possible values for
special_target are: sge, vhdl, sge_vhdl,
and siff.
2-4 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
-map map_string
The mapping rule provides an additional
mechanism to change object names in a
way beyond the previously specified name
rules. It specifies the name mapping
and replacement rules as defined in the
map_string. See Mapping Rules under
NAMING RULES section for detailed
explanation.
-type object_type
Specifies that the rules being defined
apply only to the given type of objects.
Allowed values for object_type are port,
cell, or net. By default, the rules
defined apply to all object types.
-reset Resets all rules to their default
values. With all rules set to defaults,
no restrictions are imposed on names.
DESCRIPTION
Defines a set of rules for naming design objects. Name
rules are used by change_names and report_names.
report_name_rules displays a listing of the name rules
currently defined in dc_shell.
Name rules can be defined in multiple calls to
define_name_rules. An example of multiple calls is
shown in the "EXAMPLES" section.
-type enables you to define rules that apply to a
specific object type (port, cell, or net). Each call
to define_name_rules is additive or overrides previous
calls for a specified name rules.
NAMING RULES
This section describes the effects of specific options
when defining name rules with define_name_rules.
Maximum Length Rules
The maximum number of characters in a name can be
restricted with -max_length.
Names shorter than the specified maximum length remain
unchanged. Names longer than the specified maximum
length are modified so that their lengths are less than
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-5
define_name_rules 2. Synopsys Commands Command Reference
or equal to the maximum.
Fixed names are guaranteed to be unique within the
design. The following steps are applied in succession
to fix a name to meet the uniqueness criteria:
STEP 1 Truncation - Names are truncated to meet
the maximum length. The truncated name
is accepted if it is unique within the
design. For example, if the name is
"THIS_NAME_IS_TOO_LONG_TO_BE_ACCEPTABLE"
and the maximum is 16, the resulting
name is "THIS_NAME_IS_TOO".
2-6 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
STEP 2 Truncation with index - Names are
truncated. The truncated name is
appended with an index in an attempt to
make it unique. If a unique name is
found, it is accepted. If the name from
the previous example,
"THIS_NAME_IS_TOO", is not unique, this
step tries "THIS_NAME_IS_T1",
"THIS_NAME_IS_T2", up to
"THIS_NAME_IS_T99". The first unique
name is accepted.
STEP 3 Basic names - If both previous steps
fail, the original name is deleted and
names of the form <prefix><index> are
generated until a unique name is found.
The <prefix> can be defined using the
-prefix option. Examples are "N1",
"N2", and so on.
In the unlikely event that all three steps fail to
generate a unique name, the original name is retained
and a warning message is issued.
Character Restriction Rules
Characters that make up names can be specified with
-allowed, -restricted, -first_restricted, and
-last_restricted.
Use -allowed or -restricted to specify the character
set allowed. Either of these options overrides the
previous values of -allowed, -restricted,
-first_restricted, and -last_restricted.
In conjunction with -allowed or -restricted, use
-first_restricted and -last_restricted to further
restrict the available characters for the first and
last character of a name.
-first_restricted and -last_restricted depend on
-allowed and -restricted, and modify the set of
available characters for their special cases. The set
of characters available for first and last characters
cannot exceed that defined for all other characters.
The chars string contains the characters that can be
used (that is, they are -allowed) or cannot be used
(that is, they are -restricted) in design object names.
The dash character "-" indicates a range of ASCII
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-7
define_name_rules 2. Synopsys Commands Command Reference
characters; to include a literal dash character in the
chars parameter, precede it with 2 backslashes "\-".
Blank spaces are disregarded. A minimum of 10
characters must be allowed or an error is reported.
The order of the characters in the chars string
parameter is not significant.
The following example specifies a character set
consisting of upper case characters and an underscore.
define_name_rules -allowed "A-Z _"
In the following example, some punctuation characters
are restricted. First characters cannot be lower case.
The dash character is restricted with the character
sequence "\\-".
define_name_rules -restricted "!@#$%^&*()\-" \\
-first_restricted "A-Z"
In the following example, an attempt is made to
restrict the character set to less than 10 characters.
An error is reported.
define_name_rules -allowed "ABCDE"
If a design object name contains a character that is
restricted for its object type, the following steps are
taken to fix the name:
STEP 1 Remove the character - If -remove_chars
is specified in the name rules, the
offending character is removed.
STEP 2 Change the case - The case of characters
is changed to meet character
restrictions. The change is accepted if
the new character is allowed. For
example, if names are restricted to
upper case characters, the name
"sum_port" is changed to "SUM_PORT".
STEP 3 Replace the character - A restricted
2-8 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
character is changed to the value of
-replacement_char. For example, if
punctuation characters are not allowed
and the replacement character is an
underscore, the name "U$1" is changed to
"U_1".
STEP 4 Uniquify the name - If the name created
in either step 1 or step 2 is not
unique, an index is appended to the new
name.
Reserved Word Rules
Specific names can be prohibited from becoming design
object names by using -reserved_words. The parameter
to this option is a list names not to be allowed as
design object names.
The following example uses -reserved_words. The words
"DESIGN", "MODULE", "START" and "END" are designated as
reserved. The case of the names in this list is
significant.
define_name_rules -reserved_words { "DESIGN", \
"MODULE", "START", "END" }
Case Insensitive Rules
If -case_insensitive is specified, the case of
characters in a name is not significant when comparing
names.
If -case_insensitive is specified, the case of
characters in reserved words is not significant. For
example, if -case_insensitive is used and the string
"MODULE" is specified as a reserved word, the name
"module" will also be considered a reserved word and
will be changed.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-9
define_name_rules 2. Synopsys Commands Command Reference
Port and Net Rules
The name of a net connected to a port can be made equal
to the name of that port with -equal_ports_nets. If
this substitution causes a conflict, no names are
changed and a warning message is issued. If a net is
connected to more than one port, then no names are
changed and a warning message is issued. -
equal_ports_nets cannot be specified together with
-collapse_name_space, because the two options conflict.
Name Space Rules
In dc_shell, by default, name spaces of ports, cells,
and nets are separate. Names of ports and cells must
be unique within a design. A port, a cell, and a net
within a design can share the same name.
Name spaces for ports, cells, and nets can be shared
using -collapse_name_space. Ports, cells, and nets
within a design must be unique across all objects.
Conflicting names are modified by appending digits to
their name. -collapse_name_space cannot be specified
together with -equal_ports_nets, because the two
options conflict.
Type-specific Rules
With -type, name rules can be tailored for specific
object types: ports, cells, or nets.
The options to define_name_rules that can be specified
by object type are: -max_length, -allowed,
-restricted, -first_restricted, -last_restricted,
-replacement_char, -remove_chars, and -prefix. To
specify the maximum length restriction on ports
different than that for cells, make multiple calls to
define_name_rules.
In the following example, the maximum length of ports
is set to 12. The maximum length of cells is set to 8.
The maximum length of nets is unrestricted.
define_name_rules EXAMPLE -max_length 12 -type net
define_name_rules EXAMPLE -max_length 8 -type cell
Special Rules
With -special, name rules can be defined that are
2-10 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
peculiar to a specific target system and cannot be
modeled with the general define_name_rules options.
The systems that are currently supported by -special
are sge, vhdl, sge_vhdl, and siff.
Specifying -special vhdl adds one rule to make names
conform to the rules of VHDL. With this option,
consecutive underscores are not allowed in a name.
Specifying -special sge adds one rule to make names
conform to the rules of the SGE system. With this
option, net names that start with the characters
"BBBB_" and "NNNN_" are disallowed. These names are
reserved by the SGE system.
Specifying -special sge_vhdl is a combination of the
above two rules. change_names will enforce "-
collapse_name_space" and "equal_ports_nets", but
because these two rules conflict with each other, the
sge_vhdl rule applies under the following conditions:
The "-collapse_name_space" rule first checks the
object class type. If the object is a port, it checks
to see if the name is used by any reference names. If
the object is a cell or a design, it checks to verify
that the name is not used previously by any reference
or port. If the object is a net, it checks the
reference, port, and cell name spaces. If there is any
name conflict, it changes the name so that it is
unique. Refer to the "-collapse_name_space" rule
description for details.
The "equal_ports_nets" rule is applied to a scalar net
or a net object whose owning bus is not of a single
width. Refer to the "equal_ports_nets" rule description
for details.
Specifying -special siff adds one rule to make names
conform to the rules for the "Synopsys Integrator For
Falcon".
All the special rules above share the same name rules
in addition to their own name rules:
1. The names of bussed ports/nets will follow the
"bus_naming_style" except that sge_vhdl will always use
"%s(%d)" instead of "bus_naming_style".
2. The names of bussed ports/nets owned by the same bus
will have the same base name. The bus index order will
follow the index part defined in the owning bus.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-11
define_name_rules 2. Synopsys Commands Command Reference
3. If a net does not belong to a busbag and it contains
a separator character defined in bus_naming_style, this
separator character will be changed to "_" and the
ending separator will be removed. For example, net name
"sample[24][3]" will be changed to "sample_24_3".
Please note that specifying -special does not create
all the rules necessary for VHDL, SGE, or SIFF
compliance. Only the non-general rules described above
are created. Use the other options in conjunction with
-special to define_name_rules to constrain names to
meet the requirements of SGE and VHDL fully.
It is suggested not to merge special name rules with
user defined name rules in order to avoid conflict.
When defined name rules conflict, change_names could
generate names that are not compliant to the user's
name rule. When there is a conflict among name rules,
define each one of those name rules using a different
name in define_name_rules and apply each of them using
change_names. The last rule applied will generate names
that override names generated by previous rules.
Mapping Rules
-map specifies the name mapping and replacement rules
as defined in the map_string. The mapping string has
the following format: {{"pattern", "replacement"}
[,{"pattern", "replacement"}]*} It is grouped into
pairs. There can be any number of pairs in a mapping
string. Each pair is enclosed by a pair of braces ({})
and separated by a comma. change_names() and
report_names() will apply all of them according to the
order specified in the map_string.
The first member of each pair is the pattern string,
which is used to match against the object name. The
second member is the replacement string, which is used
to replace the matched portion of the object name. Both
the pattern and replacement string must be double
quoted. There is a comma between pattern and
replacement string.
For example, define_name_rules my_rule -map {{"_reg",
""}, {"A", "a"}} will have the first occurrence of any
portion of a object name that contains "_reg" replaced
by an empty string and the first occurrence of any
portion of a object name that contains "A" replaced by
"a" in new name.
The pattern string also provides limited regular
2-12 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
expression capability. Four special characters are
supported to make the mapping strings more specific:
The "$" indicates the end of string.
The "^" indicates the beginning of string.
The "*" indicates wildcard matching 0 or more
characters.
The "?" indicates wildcard matching 1 character.
For example, define_name_rules my_rule0 -map {{"_reg$",
"in"} defines a rule that any name ending with "_reg"
will be replaced by "in" at the end string.
define_name_rules my_rule1 -map {{"^_reg", "in"}}
defines a rule that any name beginning with "_reg" will
be replaced by "in" at the beginning string.
define_name_rules my_rule2 -map {{"_r*g", "in"}}
defines a rule that the first occurence of any
substring of a name that begins with "_r" and ends with
"g" will be replaced by "in" string.
define_name_rules my_rule3 -map {{"_r?g", "in"}}
defines a rule that the first occurence of any
substring of a name that begins with "_r" followed any
one character, then ending with "g" will be replaced by
"in".
Notice that once a mapping rule has been defined, you
can only use -reset to reset the mapping rule. You
cannot just redefine the same matching pattern within
the same rule.
For example, if you define the following rule:
define_name_rules my_rule4 -map {{"A", "X"} and then
decide to replace all "A"s with "Z"s, you must first
execute define_name_rules my_rule4 -reset and then
define_name_rules my_rule4 -map {{"A", "Z"}
The 1-map option can also be used to insert escape
characters into names. This can be useful prior to
generating reports if the report output will be
processed by a program that requires certain characters
to be escaped. For example, if names contain the '/'
character, there is no way to differentiate between a
'/' in a name and a '/' that denotes a change in
hierarchy. Defining a rule with define_name_rules -map
{{"/", "\\/"}} will replace any '/' in a name with
'\/'. The name "HAS/SLASH" inside hierarchy "A" would
then be written out as "A/HAS\/SLASH".
Default Rules Values
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-13
define_name_rules 2. Synopsys Commands Command Reference
Once defined, name rules can be reset to their default
values with -reset. Name rules with all default values
impose no restrictions on design object names.
Default values for specific rules are shown below. A
set of name rules called ALL_DEFAULTS is defined with
no options. report_name_rules displays the default
value of each specific rule.
dc_shell> define_name_rules ALL_DEFAULTS
dc_shell> report_name_rules ALL_DEFAULTS
****************************************
Report : name_rules
Name Rules : ALL_DEFAULTS
Version: v3.0
Date : Fri Sep 27 09:36:52 1991
****************************************
Rules Name: ALL_DEFAULTS
Equal port and net names: false
Collapse name space: false
Case insensitive: false
Special rules: none
Reserved words: none
Max Repl Rem
Rules Type Len Char Chrs Prefix Allowed Chars
-------------------------------------------------
Port Rules none '_' no P No restrictions
Cell Rules none '_' no U No restrictions
Net Rules none '_' no N No restrictions
Many rules can be reset individually by specifying
empty values for the option. The following table shows
how to specify the default value for these fields.
Options that are not listed in the table must be reset
with the -reset option.
Option Default Value
------ -------------
-max_length 0
-restricted ""
-allowed ""
-first_restricted ""
-last_restricted ""
-reserved_words {}
-replacement_char ""
-prefix ""
2-14 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
APPLYING NAME RULES
When names are changed using change_names or
report_names commands, name rules are applied
sequentially even though they are specified
concurrently in define_name_rules command. Name rules
are applied in order; therefore, rules applied later
might overwrite previous names rules and there will be
cases where names after change_names or report_names do
not conform to all rules specified.
This section describes the order in which name rules
are applied, so that the user will know what results to
expect.
The name rules are applied in the following order:
1. Map rule: rules that are applied to an object name
string. The rule in this category is -map_rule.
2. Character rules: rules that are applied to object
name characters. Rules in this category are -allowed,
-restricted, -first_restricted, and -last_restricted.
Use -remove_char, -replacement_chars to support the
character rules.
3. Design rules: rules that are applied to object name
in terms of whole design naming methodology. Rules in
this category are -equal_ports_nets (for net objects
only), -special, -max_length, and -reserve_words.
4. Meta rules: rules that extend beyond a single
category above. Rules in this catetory are
-collapse_name_space, -case_insensitive, -prefix, and
-type.
Since rules applied earlier might be overwritten by
later rules, the "must have" rule should be applied
last. The name rules will be applied to object names
according to the above order. That is, the string rules
will be applied first, then the character rules, and
last, the design rules. Meta rules are used for
supporting those rules during name changes. Rules
within the same category will be applied following the
same order as the above list. Because later rules might
override previous ones, to preserve the priority it is
better to use separately those rules that will cause
conflict. Among these rules, mapping should mostly be
used exclusively.
During name changes, the objects are categorized into
three types: port, cell, and net. Port objects are
changed first, then cell objects, then net objects.
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-15
define_name_rules 2. Synopsys Commands Command Reference
When there is a name conflict among a port name, a cell
name, and a net name, the port name has highest
priority (not changed). The net and port names must be
changed to unique names.
CHANGE BUS NAMING STYLE
When define_name_rules changes the bus naming style,
the user must also change the bus_naming_style variable
to conform to the new change.
For example, the following script changes the bus
naming style from [] to <>.
define_name_rules LEFT_SQ_BRACKET -restricted "[" -replacement_char "<"
define_name_rules RIGHT_SQ_BRACKET -restricted "]" -replacement_char ">"
bus_naming_style="%s<%d>"
change_names -rule LEFT_SQ_BRACKET -hierarchy
change_names -rule RIGHT_SQ_BRACKET -hierarchy
Notice that bus_naming_style="%s<%d>" has been changed
from "%s[%d]" to "%s<%d>".
EXAMPLES
The first example defines a name rule called "SIMPLE"
that requires design names in upper case. "SIMPLE" is
used as the default name rule by change_names.
dc_shell> define_name_rules SIMPLE -allowed "A-Z _"
dc_shell> default_name_rules = SIMPLE
dc_shell> change_names
Information: Using name rules 'SIMPLE'.
Information: 153 names changed in design 'MY_DESIGN'.
The following example defines name rules called
"MY_RULES" using multiple calls to define_name_rules.
The length of names is restricted to 16. The allowed
character set and a replacement character are defined.
dc_shell> define_name_rules MY_RULES -max_length 16
dc_shell> define_name_rules MY_RULES -replacement_char "X"
2-16 Synopsys Inc. 1988-1994. All rights reserved. V3.1
Command Reference 2. Synopsys Commands define_name_rules
dc_shell> define_name_rules MY_RULES -allowed "A-Z _"
In the following example, multiple calls to
define_name_rules use most of the options.
report_name_rules displays the effect of these calls.
dc_shell> define_name_rules SMORG -collapse_name_space
dc_shell> define_name_rules SMORG -case_insensitive
dc_shell> define_name_rules SMORG -reserved_words {IN,OUT,INOUT}
dc_shell> define_name_rules SMORG -case_insensitive
dc_shell> define_name_rules SMORG -type port -max_length 16 \
-allowed "A-Z a-z 0-9_*" \
-replacement_char "*"
dc_shell> define_name_rules SMORG -type cell -prefix "CELL" \
-restrict "()[]{}"
dc_shell> define_name_rules SMORG -type net -allowed "A-Za-z_*" \
-first_restrict "0-9" -last_restrict "0-9" \
-replacement_char "*"
V3.1 Synopsys Inc. 1988-1994. All rights reserved. 2-17
define_name_rules 2. Synopsys Commands Command Reference
dc_shell> report_name_rules SMORG
****************************************
Report : name_rules
Name Rules : SMORG
Version: v3.0
Date : Fri Sep 27 11:00:09 1991
****************************************
Rules Name: SMORG
Equal port and net names: false
Collapse name space: true
Case insensitive: true
Special rules: none
Reserved words: {IN, OUT, INOUT}
Max Repl Rem
Rules Type Len Char Chrs Prefix Allowed Chars
---------------------------------------------------
Port Rules 16 '*' no P Use "A-Z a-z 0-9_*"
Cell Rules none '_' no CELL Don't use "()[]{}"
Net Rules none '*' no N Use "A-Za-z_*"
First: Don't use "0-9"
Last: Don't use "0-9"
SEE ALSO
change_names(2), report_name_rules(2), report_names(2);
system_variables(3).
2-18 Synopsys Inc. 1988-1994. All rights reserved. V3.1