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

Method checkModule_

src/DesignCompile/CompileModule.cpp:1528–1604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1526}
1527
1528bool CompileModule::checkModule_() {
1529 FileSystem* const fileSystem = FileSystem::getInstance();
1530 int32_t countMissingType = 0;
1531 int32_t countMissingDirection = 0;
1532 Location* missingTypeLoc = nullptr;
1533 Location* missingDirectionLoc = nullptr;
1534 for (Signal* port : m_module->m_ports) {
1535 if (port->isInterface()) continue;
1536 const FileContent* fC = port->getFileContent();
1537 NodeId portId = port->getNodeId();
1538 if (fC->Type(portId) == VObjectType::paPort) {
1539 NodeId expName = fC->Child(portId);
1540 if (fC->Type(expName) == VObjectType::slStringConst) {
1541 // Port expression
1542 continue;
1543 }
1544 }
1545 if (port->getType() == VObjectType::paData_type_or_implicit) {
1546 if (port->getDirection() == VObjectType::paPortDir_Out ||
1547 port->getDirection() == VObjectType::paPortDir_Inout) {
1548 if (countMissingType == 0)
1549 missingTypeLoc = new Location(
1550 fileSystem->copy(
1551 port->getFileContent()->getFileId(port->getNodeId()),
1552 m_symbols),
1553 port->getFileContent()->Line(port->getNodeId()),
1554 port->getFileContent()->Column(port->getNodeId()),
1555 m_symbols->registerSymbol(port->getName()));
1556 countMissingType++;
1557 }
1558 }
1559 if (port->getDirection() == VObjectType::slNoType) {
1560 if (countMissingDirection == 0)
1561 missingDirectionLoc = new Location(
1562 fileSystem->copy(
1563 port->getFileContent()->getFileId(port->getNodeId()),
1564 m_symbols),
1565 port->getFileContent()->Line(port->getNodeId()),
1566 port->getFileContent()->Column(port->getNodeId()),
1567 m_symbols->registerSymbol(port->getName()));
1568 countMissingDirection++;
1569 }
1570 }
1571 if (countMissingType) {
1572 Location countLoc(
1573 m_symbols->registerSymbol(std::to_string(countMissingType - 1)));
1574 if (countMissingType - 1 > 0) {
1575 Error err(ErrorDefinition::COMP_PORT_MISSING_TYPE, *missingTypeLoc,
1576 countLoc);
1577 m_errors->addError(err);
1578 } else {
1579 Error err(ErrorDefinition::COMP_PORT_MISSING_TYPE, *missingTypeLoc);
1580 m_errors->addError(err);
1581 }
1582 delete missingTypeLoc;
1583 }
1584 if (countMissingDirection) {
1585 Location countLoc(

Callers

nothing calls this directly

Calls 14

isInterfaceMethod · 0.80
copyMethod · 0.80
getFileContentMethod · 0.45
getNodeIdMethod · 0.45
TypeMethod · 0.45
ChildMethod · 0.45
getTypeMethod · 0.45
getDirectionMethod · 0.45
getFileIdMethod · 0.45
LineMethod · 0.45
ColumnMethod · 0.45
registerSymbolMethod · 0.45

Tested by

no test coverage detected