Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash populating design with special nets #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions rsyn/src/rsyn/io/reader/PopulateRsyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,72 @@ void PopulateRsyn::populateRsyn(
} // end else
} // end for
} // end for

// Creates special nets from DEF
for (const DefSpecialNetDscp &net : defDscp.clsSpecialNets) {
if (net.clsName == "") {
std::cout << "[ERROR] Empty net name.\n";
for (unsigned i = 0; i < net.clsConnections.size(); i++) {
std::cout << "Connection: " << net.clsConnections[i].clsComponentName << ":" << net.clsConnections[i].clsPinName << "\n";
} // end for
exit(1);
} // end if

Rsyn::Net rsynNet = top.createNet(net.clsName);

const string use = net.clsUse;
if (use == "ANALOG") {
rsynNet.setUse(Rsyn::ANALOG);
} else if (use == "CLOCK") {
rsynNet.setUse(Rsyn::CLOCK);
} else if (use == "GROUND") {
rsynNet.setUse(Rsyn::GROUND);
} else if (use == "POWER") {
rsynNet.setUse(Rsyn::POWER);
} else if (use == "RESET") {
rsynNet.setUse(Rsyn::RESET);
} else if (use == "SCAN") {
rsynNet.setUse(Rsyn::SCAN);
} else if (use == "SIGNAL") {
rsynNet.setUse(Rsyn::SIGNAL);
} else if (use == "TIEOFF") {
rsynNet.setUse(Rsyn::TIEOFF);
} // end if

for (const DefNetConnection &connection : net.clsConnections) {
if (connection.clsComponentName == "PIN") {
Rsyn::Port rsynCell =
rsynDesign.findPortByName(connection.clsPinName);

if (!rsynCell) {
std::cout << "[ERROR] The primary input/ouput port '"
<< connection.clsPinName << "' not found.\n";
exit(1);
} // end if

Rsyn::Pin rsynPin = rsynCell.getInnerPin();
rsynPin.connect(rsynNet);
} else if (connection.clsComponentName == "*") {
for (Rsyn::Instance inst: rsynDesign.getTopModule().allInstances()) {
Rsyn::Pin rsynPin = inst.getPinByName(connection.clsPinName);
if (!rsynPin) {
continue;
} // end if
rsynPin.connect(rsynNet);
} // end for
} else {
Rsyn::Cell rsynCell = rsynDesign.findCellByName(connection.clsComponentName);
if (!rsynCell) {
std::cout << "[ERROR] Cell '"
<< connection.clsComponentName << "' not found.\n";
exit(1);
} // end if

Rsyn::Pin rsynPin = rsynCell.getPinByName(connection.clsPinName);
rsynPin.connect(rsynNet);
} // end else
} // end for
} // end for
} // end method

// -----------------------------------------------------------------------------
Expand Down