| 67 | namespace SURELOG { |
| 68 | |
| 69 | bool checkValidFunction(const DataType* dtype, std::string_view function, |
| 70 | Statement* stmt, Design* design, |
| 71 | std::string& datatypeName) { |
| 72 | bool validFunction = true; |
| 73 | VObjectType type = dtype->getType(); |
| 74 | const DataType* def = dtype->getDefinition(); |
| 75 | if (type == VObjectType::paClass_declaration) { |
| 76 | const ClassDefinition* the_class = |
| 77 | datatype_cast<const ClassDefinition*>(dtype); |
| 78 | if (the_class) { |
| 79 | Function* func = the_class->getFunction(function); |
| 80 | if (func) |
| 81 | stmt->setFunction(func); |
| 82 | else |
| 83 | validFunction = false; |
| 84 | } else { |
| 85 | the_class = datatype_cast<const ClassDefinition*>(def); |
| 86 | if (the_class) { |
| 87 | Function* func = the_class->getFunction(function); |
| 88 | if (func) |
| 89 | stmt->setFunction(func); |
| 90 | else |
| 91 | validFunction = false; |
| 92 | ClassDefinition* genClass = |
| 93 | design->getClassDefinition("builtin::any_sverilog_class"); |
| 94 | if (genClass && genClass->getFunction(function)) { |
| 95 | validFunction = true; |
| 96 | stmt->setFunction(genClass->getFunction(function)); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } else if (DataType::isString_type(type)) { |
| 101 | ClassDefinition* array = design->getClassDefinition("builtin::string"); |
| 102 | if (array) { |
| 103 | Function* func = array->getFunction(function); |
| 104 | if (func) |
| 105 | stmt->setFunction(func); |
| 106 | else { |
| 107 | datatypeName = "string"; |
| 108 | validFunction = false; |
| 109 | } |
| 110 | } else |
| 111 | validFunction = false; |
| 112 | } else |
| 113 | validFunction = false; |
| 114 | return validFunction; |
| 115 | } |
| 116 | |
| 117 | bool checkValidBuiltinClass_(std::string_view classname, |
| 118 | std::string_view function, Statement* stmt, |
no test coverage detected