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

Method compileDatastructureTypespec

src/DesignCompile/CompileType.cpp:702–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702typespec* CompileHelper::compileDatastructureTypespec(
703 DesignComponent* component, const FileContent* fC, NodeId type,
704 CompileDesign* compileDesign, Reduce reduce,
705 SURELOG::ValuedComponentI* instance, std::string_view suffixname,
706 std::string_view typeName) {
707 UHDM::Serializer& s = compileDesign->getSerializer();
708 typespec* result = nullptr;
709 if (component) {
710 const DataType* dt = component->getDataType(typeName);
711 if (dt == nullptr) {
712 const std::string_view libName = fC->getLibrary()->getName();
713 dt = compileDesign->getCompiler()->getDesign()->getClassDefinition(
714 StrCat(libName, "@", typeName));
715 if (dt == nullptr) {
716 dt = compileDesign->getCompiler()->getDesign()->getClassDefinition(
717 StrCat(component->getName(), "::", typeName));
718 }
719 if (dt == nullptr) {
720 if (component->getParentScope())
721 dt = compileDesign->getCompiler()->getDesign()->getClassDefinition(
722 StrCat(((DesignComponent*)component->getParentScope())->getName(),
723 "::", typeName));
724 }
725 if (dt == nullptr) {
726 dt = compileDesign->getCompiler()->getDesign()->getClassDefinition(
727 typeName);
728 }
729 if (dt == nullptr) {
730 Parameter* p = component->getParameter(typeName);
731 if (p && p->getUhdmParam() &&
732 (p->getUhdmParam()->UhdmType() == uhdmtype_parameter))
733 dt = p;
734 }
735 if (dt == nullptr) {
736 for (ParamAssign* passign : component->getParamAssignVec()) {
737 const FileContent* fCP = passign->getFileContent();
738 if (fCP->SymName(passign->getParamId()) == typeName) {
739 UHDM::param_assign* param_assign = passign->getUhdmParamAssign();
740 UHDM::parameter* lhs = (UHDM::parameter*)param_assign->Lhs();
741 if (ref_typespec* rt = lhs->Typespec()) {
742 result = rt->Actual_typespec();
743 }
744 if (result == nullptr) {
745 if (int_typespec* tps = buildIntTypespec(
746 compileDesign, fC->getFileId(), typeName, "",
747 fC->Line(type), fC->Column(type), fC->EndLine(type),
748 fC->EndColumn(type))) {
749 if (lhs->Typespec() == nullptr) {
750 ref_typespec* tpsRef = s.MakeRef_typespec();
751 tpsRef->VpiParent(lhs);
752 lhs->Typespec(tpsRef);
753 }
754 lhs->Typespec()->Actual_typespec(tps);
755 result = tps;
756 }
757 }
758 if (result->UhdmType() == uhdmint_typespec) {
759 int_typespec* ts = (int_typespec*)result;

Callers

nothing calls this directly

Calls 15

StrCatFunction · 0.85
getDesignMethod · 0.80
getParameterMethod · 0.80
getUhdmParamMethod · 0.80
getParamIdMethod · 0.80
getUhdmParamAssignMethod · 0.80
EndLineMethod · 0.80
EndColumnMethod · 0.80
fileunitMethod · 0.80
getUhdmDefinitionMethod · 0.80
populateCoreMembersMethod · 0.80

Tested by

no test coverage detected