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

Method compileParameterDeclaration

src/DesignCompile/CompileHelper.cpp:3435–3919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3433}
3434
3435bool CompileHelper::compileParameterDeclaration(
3436 DesignComponent* component, const FileContent* fC, NodeId nodeId,
3437 CompileDesign* compileDesign, Reduce reduce, bool localParam,
3438 ValuedComponentI* instance, bool port_param, bool muteErrors) {
3439 UHDM::Serializer& s = compileDesign->getSerializer();
3440 compileDesign->lockSerializer();
3441 std::vector<UHDM::any*>* parameters = component->getParameters();
3442 if (parameters == nullptr) {
3443 component->setParameters(s.MakeAnyVec());
3444 parameters = component->getParameters();
3445 }
3446 UHDM::VectorOfparam_assign* param_assigns = component->getParam_assigns();
3447 if (param_assigns == nullptr) {
3448 component->setParam_assigns(s.MakeParam_assignVec());
3449 param_assigns = component->getParam_assigns();
3450 }
3451 if (fC->Type(nodeId) == VObjectType::paList_of_type_assignments) {
3452 // Type param
3453 NodeId typeNameId = fC->Child(nodeId);
3454 while (typeNameId) {
3455 NodeId ntype = fC->Sibling(typeNameId);
3456 bool skip = false;
3457 if (ntype && fC->Type(ntype) == VObjectType::paData_type) {
3458 ntype = fC->Child(ntype);
3459 if (fC->Type(ntype) == VObjectType::paVIRTUAL)
3460 ntype = fC->Sibling(ntype);
3461 skip = true;
3462 } else {
3463 ntype = InvalidNodeId;
3464 }
3465 UHDM::type_parameter* p = s.MakeType_parameter();
3466 p->VpiName(fC->SymName(typeNameId));
3467 fC->populateCoreMembers(typeNameId, typeNameId, p);
3468 if (typespec* tps = compileTypespec(component, fC, ntype, compileDesign,
3469 Reduce::No, p, nullptr, false)) {
3470 if (p->Typespec() == nullptr) {
3471 ref_typespec* tpsRef = s.MakeRef_typespec();
3472 tpsRef->VpiParent(p);
3473 p->Typespec(tpsRef);
3474 }
3475 p->Typespec()->Actual_typespec(tps);
3476 tps->VpiParent(p);
3477 }
3478 if (localParam) {
3479 p->VpiLocalParam(true);
3480 }
3481 parameters->push_back(p);
3482 Parameter* param = new Parameter(fC, typeNameId, fC->SymName(typeNameId),
3483 ntype, port_param);
3484 param->setTypeParam();
3485 param->setUhdmParam(p);
3486 component->insertParameter(param);
3487 typeNameId = fC->Sibling(typeNameId);
3488 if (skip) typeNameId = fC->Sibling(typeNameId);
3489 }
3490
3491 } else if (fC->Type(nodeId) == VObjectType::paTYPE) {
3492 // Type param

Callers 8

collectObjects_Method · 0.80
collectObjects_Method · 0.80
collectModuleObjects_Method · 0.80
collectObjects_Method · 0.80

Calls 15

isMultidimensionalFunction · 0.85
lockSerializerMethod · 0.80
getParametersMethod · 0.80
setParametersMethod · 0.80
getParam_assignsMethod · 0.80
setParam_assignsMethod · 0.80
populateCoreMembersMethod · 0.80
setTypeParamMethod · 0.80
setUhdmParamMethod · 0.80
insertParameterMethod · 0.80
setComplexValueMethod · 0.80

Tested by

no test coverage detected