Difference between revisions of "Escaped identifiers in RTL files and in Verific data structures"

From Verific Design Automation FAQ
Jump to: navigation, search
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''>>> This page is under construction <<<'''
+
'''Verific Data Structures :'''
  
'''Verific data structures:'''
+
In Verific Data Structures (parsetrees and netlist database) there are no naming rules, hence no need to escape identifiers.
  
No naming rules, thus no need to escape identifiers.
+
In netlist outputs and in pretty-print outputs, naming rules are applied to identifiers based on the naming rules of the language of the output file. As a result, identifiers in the output file may need to be escaped.
  
In netlist outputs and in pretty-print outputs, identifiers are escaped based on the naming rules of the language of the output file.
+
'''For Verilog :'''
  
'''Verilog:'''
+
Escaped identifiers begin with a backslash and end with a space character.
  
Escaped identifiers start with a backslash and end with a space character.
+
Per the LRMs, the escaping characters '\' and ' ' are not part of the name :  'foo' is the same object as '\foo '.
  
The escaping characters '\' and ' ' are not part of the name. 'foo' is the same object as '\foo '
+
When using AddSignal() to create a new signal, the specified name does not need to be escaped.
  
With AddSignal() when you define the name, you don't need to escape it.
+
When referring to an escaped identifier, the name must be escaped.
  
But when you refer to an escaped id, you need to escape it.
+
To get the 'Verilog name' for an identifier in the Verilog parsetree, use VeriNode::MakeVerilogName()
  
'''VHDL:'''
+
To get the 'Verilog name' for an identifier in the netlist database, use VeriWrite::MakeVerilogName()
  
Escaped identifiers are enclosed in a pair backslashes. The backslashes are part of the name.
+
'''For VHDL :'''
  
'\foo\' and 'foo' are too different objects
+
Escaped identifiers are enclosed in a pair of backslashes.
 +
 +
Per the LRMs, the backslashes are part of the name :  '\foo\' and 'foo' are two different objects, and thus both are stored in the parsetree as different nodes.

Latest revision as of 08:51, 16 June 2023

Verific Data Structures :

In Verific Data Structures (parsetrees and netlist database) there are no naming rules, hence no need to escape identifiers.

In netlist outputs and in pretty-print outputs, naming rules are applied to identifiers based on the naming rules of the language of the output file. As a result, identifiers in the output file may need to be escaped.

For Verilog :

Escaped identifiers begin with a backslash and end with a space character.

Per the LRMs, the escaping characters '\' and ' ' are not part of the name : 'foo' is the same object as '\foo '.

When using AddSignal() to create a new signal, the specified name does not need to be escaped.

When referring to an escaped identifier, the name must be escaped.

To get the 'Verilog name' for an identifier in the Verilog parsetree, use VeriNode::MakeVerilogName()

To get the 'Verilog name' for an identifier in the netlist database, use VeriWrite::MakeVerilogName()

For VHDL :

Escaped identifiers are enclosed in a pair of backslashes.

Per the LRMs, the backslashes are part of the name : '\foo\' and 'foo' are two different objects, and thus both are stored in the parsetree as different nodes.