set_bus_syntax_mode Command

set_bus_syntax_mode <mode>

Tcl normally interprets square brackets as containing commands. For bus names, this functionality means that you need to escape any square brackets that do not contain commands, specifically bus names. set_bus_syntax_mode changes how the brackets are processed, so you can use square brackets for bus indic(es) without having to use escape characters.

The set_bus_syntax_mode command has one option, <mode>, which is natural (you do not need to use escape characters) or disabled. The default is natural.

For example:
  • In natural mode, you can use bus_name[0] (single-dimensional bus) or bus_name[0][1] (multi-dimensional bus).
  • In disabled mode, you need to use bus_name\[0\].

You can disable natural bus syntax processing at any point in your SDC script with the command set_bus_syntax_mode disabled. The software parses all bus names after the disabled command with normal Tcl syntax. Use set_bus_syntax_mode natural to turn it on again. For example:

# Using natural mode
set bus_index 10
set bus_name bus[$bus_index]

# disable natural mode
set_bus_syntax_mode disabled
set bus_index 10
set bus_name bus\[$bus_index\]

# Turn natural mode back on
set_bus_syntax_mode natural

You can also use the set_bus_syntax_mode command in the Tcl console (in the GUI and at the command line). The setting does not persist across sessions. That is, if you close and then re-open the Tcl Command Console (GUI or command-line), you need to use the set_bus_syntax_mode again to ensure the correct setting.

The following example shows commands in the Tcl Command Console:

set x 10 
puts var[$x] 
puts var[*1] 
set_bus_syntax_mode disabled 
puts var\[$x\] 
set_bus_syntax_mode natural 
puts var[$x]