MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / decompile

Function decompile

src/DesignCompile/CompileDesign.cpp:433–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433void decompile(ValuedComponentI* instance) {
434 FileSystem* const fileSystem = FileSystem::getInstance();
435 if (instance) {
436 ModuleInstance* inst = valuedcomponenti_cast<ModuleInstance*>(instance);
437 if (inst) {
438 DesignComponent* component = inst->getDefinition();
439 while (inst) {
440 std::cout << "Instance:" << inst->getFullPathName() << " "
441 << fileSystem->toPath(inst->getFileId()) << "\n";
442 std::cout << "Mod: " << inst->getModuleName() << " "
443 << fileSystem->toPath(
444 component->getFileContents()[0]->getFileId())
445 << "\n";
446
447 for (const auto& ps : inst->getMappedValues()) {
448 const std::string& name = ps.first;
449 Value* val = ps.second.first;
450 std::cout << std::string(" " + name + " = " + val->uhdmValue() +
451 "\n");
452 }
453 for (const auto& ps : inst->getComplexValues()) {
454 const std::string& name = ps.first;
455 std::cout << std::string(" " + name + " = complex\n");
456 }
457 if (inst->getNetlist() && inst->getNetlist()->param_assigns()) {
458 for (auto ps : *inst->getNetlist()->param_assigns()) {
459 std::cout << ps->Lhs()->VpiName() << " = "
460 << "\n";
461 decompile((UHDM::any*)ps->Rhs());
462 }
463 }
464 inst = inst->getParent();
465 }
466 }
467 }
468}
469} // namespace SURELOG

Callers 3

elaborateInstance_Method · 0.85
decompileMethod · 0.85

Calls 9

getFullPathNameMethod · 0.80
toPathMethod · 0.80
getModuleNameMethod · 0.80
uhdmValueMethod · 0.80
param_assignsMethod · 0.80
getDefinitionMethod · 0.45
getFileIdMethod · 0.45
getNetlistMethod · 0.45
getParentMethod · 0.45

Tested by

no test coverage detected