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

Method compileTfCall

src/DesignCompile/CompileHelper.cpp:4111–4314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4109}
4110
4111UHDM::any* CompileHelper::compileTfCall(DesignComponent* component,
4112 const FileContent* fC,
4113 NodeId Tf_call_stmt,
4114 CompileDesign* compileDesign,
4115 any* pexpr) {
4116 UHDM::Serializer& s = compileDesign->getSerializer();
4117
4118 NodeId dollar_or_string = fC->Child(Tf_call_stmt);
4119 VObjectType leaf_type = fC->Type(dollar_or_string);
4120 NodeId tfNameNode;
4121 UHDM::tf_call* call = nullptr;
4122 std::string name;
4123 if (leaf_type == VObjectType::paDollar_keyword) {
4124 // System call, AST is:
4125 // n<> u<28> t<Subroutine_call> p<29> c<17> l<3>
4126 // n<> u<17> t<Dollar_keyword> p<28> s<18> l<3>
4127 // n<display> u<18> t<StringConst> p<28> s<27> l<3>
4128 // n<> u<27> t<List_of_arguments> p<28> c<22> l<3>
4129
4130 tfNameNode = fC->Sibling(dollar_or_string);
4131 call = s.MakeSys_func_call();
4132 name.assign("$").append(fC->SymName(tfNameNode));
4133 } else if (leaf_type == VObjectType::paImplicit_class_handle) {
4134 return compileComplexFuncCall(component, fC, fC->Child(Tf_call_stmt),
4135 compileDesign, Reduce::No, pexpr, nullptr,
4136 false);
4137 } else if (leaf_type == VObjectType::paDollar_root_keyword) {
4138 NodeId Dollar_root_keyword = dollar_or_string;
4139 NodeId nameId = fC->Sibling(Dollar_root_keyword);
4140 name.assign("$root.").append(fC->SymName(nameId));
4141 nameId = fC->Sibling(nameId);
4142 tfNameNode = nameId;
4143 func_call* fcall = s.MakeFunc_call();
4144 while (nameId) {
4145 if (fC->Type(nameId) == VObjectType::slStringConst) {
4146 name.append(".").append(fC->SymName(nameId));
4147 tfNameNode = nameId;
4148 } else if (fC->Type(nameId) == VObjectType::paConstant_bit_select) {
4149 NodeId Constant_expresion = fC->Child(nameId);
4150 if (Constant_expresion) {
4151 if (expr* select =
4152 (expr*)compileExpression(component, fC, Constant_expresion,
4153 compileDesign, Reduce::No, fcall)) {
4154 name.append("[").append(decompileHelper(select)).append("]");
4155 }
4156 tfNameNode = nameId;
4157 }
4158 } else {
4159 break;
4160 }
4161 nameId = fC->Sibling(nameId);
4162 }
4163 fcall->VpiName(name);
4164 fcall->VpiParent(pexpr);
4165 call = fcall;
4166 } else if (leaf_type == VObjectType::paSystem_task_names) {
4167 tfNameNode = dollar_or_string;
4168 call = s.MakeSys_func_call();

Callers

nothing calls this directly

Calls 15

populateCoreMembersMethod · 0.80
FunctionMethod · 0.80
TaskMethod · 0.80
getLetStmtMethod · 0.80
IosMethod · 0.80
needLateBindingMethod · 0.80
ExprMethod · 0.80
DeclMethod · 0.80
ChildMethod · 0.45
TypeMethod · 0.45
SiblingMethod · 0.45

Tested by

no test coverage detected