[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  Schedule::Load
  SVN::S4
  Synopsys-modes
  SystemPerl
  Verilog-Pli
  Voneline
  Vregs
General Info
  Papers

V3Localize not working outside of toplevel

Added by Ted Campbell over 2 years ago

Running Verilator-3.713 I notice that when a module isn't inlined (either by -Oi, or because it is large) that V3Localize will localize any variables in it.

V3Localize depends on V3Descope to set hierThis for module variables, but with the disabled 'thisp' optimization, it is set incorrectly (I think!).

In V3Descope.cpp - DescopeVisitor::descopedName, hierThis is cleared when scope isn't toplevel, even if scopep == m_scope.

Changing "hierThisr = false;" to check that scope doesn't match solves the problem for me, and test_regress passes.
        } else {
            // Reference to something else, use global variable
            UINFO(8,"      Descope "<<scopep<<endl);
            UINFO(8,"           to "<<scopep->name()<<endl);
            UINFO(8,"        under "<<m_scopep->name()<<endl);
+++         if (scopep != m_scopep) hierThisr = false;
---         hierThisr = false;
            if (!scopep->aboveScopep()) { // Top
                return "vlTOPp->";      // == "vlSymsp->TOPp->", but GCC would suspect aliases
            } else {
                return scopep->nameVlSym()+".";
            }
        }

Is this valid? Vars that fail to localize will still end up using the qualified names.