| 2521 | } |
| 2522 | |
| 2523 | void UhdmWriter::lateTypedefBinding(UHDM::Serializer& s, DesignComponent* mod, |
| 2524 | scope* m) { |
| 2525 | for (UHDM::any* var : mod->getLateTypedefBinding()) { |
| 2526 | const typespec* orig = nullptr; |
| 2527 | if (expr* ex = any_cast<expr*>(var)) { |
| 2528 | if (ref_typespec* rt = ex->Typespec()) { |
| 2529 | orig = rt->Actual_typespec(); |
| 2530 | } |
| 2531 | } else if (typespec_member* ex = any_cast<typespec_member*>(var)) { |
| 2532 | if (ref_typespec* rt = ex->Typespec()) { |
| 2533 | orig = rt->Actual_typespec(); |
| 2534 | } |
| 2535 | } else if (parameter* ex = any_cast<parameter*>(var)) { |
| 2536 | if (ref_typespec* rt = ex->Typespec()) { |
| 2537 | orig = rt->Actual_typespec(); |
| 2538 | } |
| 2539 | } else if (type_parameter* ex = any_cast<type_parameter*>(var)) { |
| 2540 | if (ref_typespec* rt = ex->Typespec()) { |
| 2541 | orig = rt->Actual_typespec(); |
| 2542 | } |
| 2543 | } else if (io_decl* ex = any_cast<io_decl*>(var)) { |
| 2544 | if (ref_typespec* rt = ex->Typespec()) { |
| 2545 | orig = rt->Actual_typespec(); |
| 2546 | } |
| 2547 | } |
| 2548 | if (orig && (orig->UhdmType() == uhdmunsupported_typespec)) { |
| 2549 | unsupported_typespec* unsup = (unsupported_typespec*)orig; |
| 2550 | std::string_view name = StringUtils::trim(orig->VpiName()); |
| 2551 | const typespec* tps = nullptr; |
| 2552 | bool found = false; |
| 2553 | |
| 2554 | if (name.find("::") != std::string::npos) { |
| 2555 | std::vector<std::string_view> res; |
| 2556 | StringUtils::tokenizeMulti(name, "::", res); |
| 2557 | if (res.size() > 1) { |
| 2558 | const std::string_view packName = res[0]; |
| 2559 | const std::string_view typeName = res[1]; |
| 2560 | Package* pack = |
| 2561 | m_compileDesign->getCompiler()->getDesign()->getPackage(packName); |
| 2562 | if (pack) { |
| 2563 | const auto& itr = m_componentMap.find(pack); |
| 2564 | if (itr != m_componentMap.end()) { |
| 2565 | package* p = (package*)itr->second; |
| 2566 | if (p->Typespecs()) { |
| 2567 | for (auto n : *p->Typespecs()) { |
| 2568 | if (n->VpiName() == typeName) { |
| 2569 | found = true; |
| 2570 | tps = n; |
| 2571 | break; |
| 2572 | } |
| 2573 | const std::string pname = |
| 2574 | StrCat(p->VpiName(), "::", typeName); |
| 2575 | if (n->VpiName() == pname) { |
| 2576 | found = true; |
| 2577 | tps = n; |
| 2578 | break; |
| 2579 | } |
| 2580 | } |
nothing calls this directly
no test coverage detected