Difference between revisions of "How to change name of id in Verilog parsetree"

From Verific Design Automation FAQ
Jump to: navigation, search
(Created page with "'''Q:How do I change the name of an id (VeriIdDef) in Verilog parsetree?''' Name of identifier can be changed using following steps: 1. Get the scope where identifier is dec...")
 
Line 3: Line 3:
 
Name of identifier can be changed using following steps:
 
Name of identifier can be changed using following steps:
  
1. Get the scope where identifier is declared (say 'decl_scope')
+
1. Get the scope where identifier is declared (say 'decl_scope').
  
 
2. Remove the identifier from its declaration scope:
 
2. Remove the identifier from its declaration scope:

Revision as of 13:29, 10 February 2017

Q:How do I change the name of an id (VeriIdDef) in Verilog parsetree?

Name of identifier can be changed using following steps:

1. Get the scope where identifier is declared (say 'decl_scope').

2. Remove the identifier from its declaration scope:

       decl_scope->Undeclare(id);

3. Change the name of identifier:

       id->SetName("newname");

4. Declare the identifier in decl_scope:

       decl_scope->Declare(id);