| 1258 | } |
| 1259 | |
| 1260 | bool ElaborationStep::bindPortType_(Signal* signal, const FileContent* fC, |
| 1261 | NodeId id, Scope* scope, |
| 1262 | ModuleInstance* instance, |
| 1263 | DesignComponent* parentComponent, |
| 1264 | ErrorDefinition::ErrorType errtype) { |
| 1265 | if (signal->getDataType() || signal->getInterfaceDef() || |
| 1266 | signal->getModPort()) |
| 1267 | return true; |
| 1268 | Compiler* compiler = m_compileDesign->getCompiler(); |
| 1269 | ErrorContainer* errors = compiler->getErrorContainer(); |
| 1270 | SymbolTable* symbols = compiler->getSymbolTable(); |
| 1271 | Design* design = compiler->getDesign(); |
| 1272 | const std::string_view libName = fC->getLibrary()->getName(); |
| 1273 | VObjectType type = fC->Type(id); |
| 1274 | switch (type) { |
| 1275 | case VObjectType::paPort: |
| 1276 | /* |
| 1277 | n<mem_if> u<3> t<StringConst> p<6> s<5> l<1> |
| 1278 | n<> u<4> t<Constant_bit_select> p<5> l<1> |
| 1279 | n<> u<5> t<Constant_select> p<6> c<4> l<1> |
| 1280 | n<> u<6> t<Port_reference> p<11> c<3> s<10> l<1> |
| 1281 | n<mif> u<7> t<StringConst> p<10> s<9> l<1> |
| 1282 | n<> u<8> t<Constant_bit_select> p<9> l<1> |
| 1283 | n<> u<9> t<Constant_select> p<10> c<8> l<1> |
| 1284 | n<> u<10> t<Port_reference> p<11> c<7> l<1> |
| 1285 | n<> u<11> t<Port_expression> p<12> c<6> l<1> |
| 1286 | n<> u<12> t<Port> p<13> c<11> l<1> |
| 1287 | */ |
| 1288 | { |
| 1289 | NodeId Port_expression = fC->Child(id); |
| 1290 | if (Port_expression && |
| 1291 | (fC->Type(Port_expression) == VObjectType::paPort_expression)) { |
| 1292 | NodeId if_type = fC->Child(Port_expression); |
| 1293 | if (fC->Type(if_type) == VObjectType::paPort_reference) { |
| 1294 | NodeId if_type_name_s = fC->Child(if_type); |
| 1295 | NodeId if_name = fC->Sibling(if_type); |
| 1296 | if (if_name) { |
| 1297 | std::string interfaceName = |
| 1298 | StrCat(libName, "@", fC->SymName(if_type_name_s)); |
| 1299 | ModuleDefinition* interface = |
| 1300 | design->getModuleDefinition(interfaceName); |
| 1301 | if (interface) { |
| 1302 | signal->setInterfaceDef(interface); |
| 1303 | } else { |
| 1304 | Location loc(fC->getFileId(if_type_name_s), |
| 1305 | fC->Line(if_type_name_s), |
| 1306 | fC->Column(if_type_name_s), |
| 1307 | symbols->registerSymbol(interfaceName)); |
| 1308 | Error err(ErrorDefinition::COMP_UNDEFINED_INTERFACE, loc); |
| 1309 | errors->addError(err); |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | } |
| 1314 | break; |
| 1315 | } |
| 1316 | case VObjectType::paInput_declaration: |
| 1317 | case VObjectType::paOutput_declaration: |
nothing calls this directly
no test coverage detected