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

Method compileTypeDef

src/DesignCompile/CompileHelper.cpp:501–1103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501const DataType* CompileHelper::compileTypeDef(DesignComponent* scope,
502 const FileContent* fC,
503 NodeId data_declaration,
504 CompileDesign* compileDesign,
505 Reduce reduce, UHDM::any* pstmt) {
506 DataType* newType = nullptr;
507 Serializer& s = compileDesign->getSerializer();
508 UHDM::VectorOftypespec* typespecs = nullptr;
509 if (pstmt) {
510 UHDM::scope* scope = any_cast<UHDM::scope*>(pstmt);
511 if (scope) {
512 typespecs = scope->Typespecs();
513 if (typespecs == nullptr) {
514 typespecs = s.MakeTypespecVec();
515 scope->Typespecs(typespecs);
516 }
517 }
518 }
519 /*
520 n<> u<1> t<IntVec_TypeBit> p<12> s<11> l<5>
521 n<1> u<2> t<IntConst> p<3> l<5>
522 n<> u<3> t<Primary_literal> p<4> c<2> l<5>
523 n<> u<4> t<Constant_primary> p<5> c<3> l<5>
524 n<> u<5> t<Constant_expression> p<10> c<4> s<9> l<5>
525 n<0> u<6> t<IntConst> p<7> l<5>
526 n<> u<7> t<Primary_literal> p<8> c<6> l<5>
527 n<> u<8> t<Constant_primary> p<9> c<7> l<5>
528 n<> u<9> t<Constant_expression> p<10> c<8> l<5>
529 n<> u<10> t<Constant_range> p<11> c<5> l<5>
530 n<> u<11> t<Packed_dimension> p<12> c<10> l<5>
531 n<> u<12> t<Enum_base_type> p<21> c<1> s<14> l<5>
532 n<UVM_INFO> u<13> t<StringConst> p<14> l<7>
533 n<> u<14> t<Enum_name_declaration> p<21> c<13> s<16> l<7>
534 n<UVM_WARNING> u<15> t<StringConst> p<16> l<8>
535 n<> u<16> t<Enum_name_declaration> p<21> c<15> s<18> l<8>
536 n<UVM_ERROR> u<17> t<StringConst> p<18> l<9>
537 n<> u<18> t<Enum_name_declaration> p<21> c<17> s<20> l<9>
538 n<UVM_FATAL> u<19> t<StringConst> p<20> l<10>
539 n<> u<20> t<Enum_name_declaration> p<21> c<19> l<10>
540 n<> u<21> t<Data_type> p<23> c<12> s<22> l<5>
541 n<uvm_severity> u<22> t<StringConst> p<23> l<11>
542 n<> u<23> t<Type_declaration> p<24> c<21> l<5>
543 n<> u<24> t<Data_declaration> p<25> c<23> l<5>
544 */
545
546 NodeId type_declaration = fC->Child(data_declaration);
547 NodeId data_type = fC->Child(type_declaration);
548
549 VObjectType dtype = fC->Type(data_type);
550 NodeId type_name;
551 if (dtype == VObjectType::paClass_keyword ||
552 dtype == VObjectType::paStruct_keyword ||
553 dtype == VObjectType::paUnion_keyword ||
554 dtype == VObjectType::paInterface_class_keyword ||
555 dtype == VObjectType::paEnum_keyword) {
556 type_name = fC->Sibling(data_type);
557 const std::string_view name = fC->SymName(type_name);
558 const TypeDef* prevDef = scope->getTypeDef(name);

Callers

nothing calls this directly

Calls 15

getTypeDefMethod · 0.80
insertTypeDefMethod · 0.80
populateCoreMembersMethod · 0.80
isForwardDeclarationMethod · 0.80
insertDataTypeMethod · 0.80
setDefinitionMethod · 0.80
InstanceMethod · 0.80
getUhdmInstanceMethod · 0.80
setBaseTypespecMethod · 0.80
getBaseTypespecMethod · 0.80
fromVpiValueMethod · 0.80
evalExprMethod · 0.80

Tested by

no test coverage detected