How to change name of id in Verilog parsetree

From Verific Design Automation FAQ
Jump to: navigation, search

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);