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

Function setDirectionAndType

src/DesignCompile/CompileHelper.cpp:1615–1714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1613}
1614
1615void setDirectionAndType(DesignComponent* component, const FileContent* fC,
1616 NodeId signal, VObjectType type,
1617 VObjectType signal_type, NodeId packed_dimension,
1618 bool is_signed, bool is_var, NodeId nodeType,
1619 UHDM::VectorOfattribute* attributes) {
1620 ModuleDefinition* module =
1621 valuedcomponenti_cast<ModuleDefinition*>(component);
1622 VObjectType dir_type = VObjectType::slNoType;
1623 if (type == VObjectType::paInput_declaration)
1624 dir_type = VObjectType::paPortDir_Inp;
1625 else if (type == VObjectType::paOutput_declaration)
1626 dir_type = VObjectType::paPortDir_Out;
1627 else if (type == VObjectType::paInout_declaration)
1628 dir_type = VObjectType::paPortDir_Inout;
1629
1630 if (module) {
1631 while (signal) {
1632 bool found = false;
1633 for (Signal* port : module->getPorts()) {
1634 std::string_view port_name = port->getName();
1635 if (port_name == fC->SymName(signal)) {
1636 found = true;
1637 }
1638 if (port->isExplicitlyNamed()) {
1639 if (fC->Type(port->getPortExpression()) ==
1640 VObjectType::slStringConst) {
1641 port_name = fC->SymName(port->getPortExpression());
1642 } else if (fC->Type(port->getPortExpression()) ==
1643 VObjectType::paPort_expression) {
1644 NodeId Port_reference = fC->Child(port->getPortExpression());
1645 NodeId Actual = fC->Child(Port_reference);
1646 port_name = fC->SymName(Actual);
1647 }
1648 }
1649 if (port_name == fC->SymName(signal)) {
1650 port->setStatic();
1651 if (is_signed) port->setSigned();
1652 NodeId unpacked_dimension = fC->Sibling(signal);
1653 if (fC->Type(unpacked_dimension) ==
1654 VObjectType::paUnpacked_dimension) {
1655 port->setUnpackedDimension(unpacked_dimension);
1656 }
1657 if (fC->Type(unpacked_dimension) ==
1658 VObjectType::paConstant_expression) {
1659 port->setDefaultValue(unpacked_dimension);
1660 }
1661 if (attributes) port->attributes(attributes);
1662 port->setPackedDimension(packed_dimension);
1663 port->setDirection(dir_type);
1664 if (signal_type != VObjectType::paData_type_or_implicit) {
1665 port->setType(signal_type);
1666 }
1667 if (nodeType) {
1668 port->setTypespecId(nodeType);
1669 }
1670 if (is_var) port->setVar();
1671 break;
1672 }

Callers 1

Calls 15

isExplicitlyNamedMethod · 0.80
getPortExpressionMethod · 0.80
setStaticMethod · 0.80
setUnpackedDimensionMethod · 0.80
setDefaultValueMethod · 0.80
attributesMethod · 0.80
setPackedDimensionMethod · 0.80
setDirectionMethod · 0.80
setTypeMethod · 0.80
setTypespecIdMethod · 0.80
setVarMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected