chipsalliance / UHDM

Universal Hardware Data Model. A complete modeling of the IEEE SystemVerilog Object Model with VPI Interface, Elaborator, Serialization, Visitor and Listener. Used as a compiled interchange format in between SystemVerilog tools. Compiles on Linux gcc, Windows msys2-gcc & msvc, OsX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full instance scope of uhdmref_obj via vpiActual

mysoreanoop opened this issue · comments

commented

You got it.
If you want to avoid going back and forth, you can invoke the optional UHDM uniquification phase:

That way you can navigate the uhdmTopModules and don't need to go to the uhdmAllModules. Memory is larger or course, but all types and sizes are uniquified.

Originally posted by @alaindargelas in #319 (comment)

Hi @alaindargelas
We are able to uniquify uhdmallModules and uhdmtopModules structures, and we're able to fetch the full paths of, for example, nets in continuous assignments when we're walking through uhdmtopModules -- except that some objects of type uhdmref_obj do not produce full instance paths when queried for vpiFullName, and so, we instead fetch the handle for vpiActual (according to uhdm-dump) which gives us another uhdmref_obj with which we again query vpiFullName; this is giving a segmentation fault. However, vpiName (instead of vpiFullName) prints the local name as expected. Any idea what's going on here? Could segmentation error be for something else?

The relevant part of our code looks like this:

std::string visitref_obj(vpiHandle h) {
  vpiHandle actual = vpi_handle(vpiActual, h);
  if(actual) { //because some objects are directly resolved
    result += "found actual: ";
    result += vpi_get_str(vpiFullName, actual); //vpiName works just fine
  }
  else result += vpi_get_str(vpiFullName, h); //also works fine
  return result;
}

If you need more details, I can share the entire code.

TIA
Anoop

commented

Resolved the issue. So, vpiActual when available, will have a vpiFullName (at least we did). But the segmentation fault was because sometimes, this ref_obj would be of type uhdmenum_const in which case fetching vpiFullName was throwing the segmentation fault; we were able to mitigate this issue by having a conditional fetch of vpiDecompile for uhdmenum_const for our use case.