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

Method bindDataType_

src/DesignCompile/ElaborationStep.cpp:803–1014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803const DataType* ElaborationStep::bindDataType_(
804 std::string_view type_name, const FileContent* fC, NodeId id,
805 const DesignComponent* parent, ErrorDefinition::ErrorType errtype) {
806 Compiler* compiler = m_compileDesign->getCompiler();
807 ErrorContainer* errors = compiler->getErrorContainer();
808 SymbolTable* symbols = compiler->getSymbolTable();
809 Design* design = compiler->getDesign();
810 std::string libName = "work";
811 if (!parent->getFileContents().empty()) {
812 libName = parent->getFileContents()[0]->getLibrary()->getName();
813 }
814 ClassNameClassDefinitionMultiMap classes = design->getClassDefinitions();
815 bool found = false;
816 bool classFound = false;
817 std::string class_in_lib = StrCat(libName, "@", type_name);
818 ClassNameClassDefinitionMultiMap::iterator itr1 = classes.end();
819
820 if (type_name == "signed") {
821 return new DataType(fC, id, type_name, VObjectType::paSigning_Signed);
822 } else if (type_name == "unsigned") {
823 return new DataType(fC, id, type_name, VObjectType::paSigning_Unsigned);
824 } else if (type_name == "logic") {
825 return new DataType(fC, id, type_name, VObjectType::paIntVec_TypeLogic);
826 } else if (type_name == "bit") {
827 return new DataType(fC, id, type_name, VObjectType::paIntVec_TypeBit);
828 } else if (type_name == "byte") {
829 return new DataType(fC, id, type_name, VObjectType::paIntegerAtomType_Byte);
830 }
831
832 const DataType* result = nullptr;
833 if ((result = parent->getDataType(type_name))) {
834 found = true;
835 }
836 if (found == false) {
837 itr1 = classes.find(class_in_lib);
838
839 if (itr1 != classes.end()) {
840 found = true;
841 classFound = true;
842 }
843 }
844 if (found == false) {
845 itr1 = classes.find(type_name);
846
847 if (itr1 != classes.end()) {
848 found = true;
849 classFound = true;
850 }
851 }
852 if (found == false) {
853 std::string class_in_class = StrCat(parent->getName(), "::", type_name);
854 itr1 = classes.find(class_in_class);
855
856 if (itr1 != classes.end()) {
857 found = true;
858 classFound = true;
859 }
860 }

Callers

nothing calls this directly

Calls 15

StrCatFunction · 0.85
getDesignMethod · 0.80
getParameterMethod · 0.80
getBaseDataTypeMethod · 0.80
getContainerMethod · 0.80
getTypeDefMethod · 0.80
getNamedObjectMethod · 0.80
getCompilerMethod · 0.45
getErrorContainerMethod · 0.45
getSymbolTableMethod · 0.45
getNameMethod · 0.45
getLibraryMethod · 0.45

Tested by

no test coverage detected