Skip to content

Commit

Permalink
Merge pull request #814 from os-fpga/bug/EDA-3307/multi_bit_consts
Browse files Browse the repository at this point in the history
Adding support for multi-bit constants in IO primitives' port connections
  • Loading branch information
manadher authored Oct 31, 2024
2 parents 1a5dc93 + 93e9e16 commit 2542810
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(VERSION_MINOR 0)



set(VERSION_PATCH 379)
set(VERSION_PATCH 380)



Expand Down
41 changes: 28 additions & 13 deletions design_edit/src/rs_design_edit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,8 @@ struct DesignEditRapidSilicon : public ScriptPass {
for (auto conn : cell->connections()) {
IdString portName = conn.first;
RTLIL::SigSpec actual = conn.second;
bool unset_port = true;
RTLIL::SigSpec sigspec;
if (actual.is_chunk()) {
RTLIL::Wire *wire = actual.as_chunk().wire;
if (wire != NULL) {
Expand All @@ -1585,19 +1587,6 @@ struct DesignEditRapidSilicon : public ScriptPass {
}
}
}
} else {
RTLIL::SigSpec const_sig = actual;
if (GetSize(const_sig) != 0)
{
RTLIL::SigSig new_conn;
RTLIL::Wire *new_wire = original_mod->addWire(NEW_ID, GetSize(const_sig));
cell->unsetPort(portName);
cell->setPort(portName, new_wire);
new_conn.first = new_wire;
new_conn.second = const_sig;
original_mod->connect(new_conn);
process_wire(cell, portName, new_wire);
}
}
} else {
for (auto it = actual.chunks().rbegin();
Expand All @@ -1623,6 +1612,32 @@ struct DesignEditRapidSilicon : public ScriptPass {
}
}
}
for (SigBit bit : conn.second)
{
// Route constant bits through fabric
if (bit.wire == nullptr)
{
if (unset_port)
{
cell->unsetPort(portName);
unset_port = false;
}
RTLIL::SigSig new_conn;
RTLIL::Wire *new_wire = original_mod->addWire(NEW_ID, 1);
new_conn.first = new_wire;
new_conn.second = bit;
original_mod->connect(new_conn);
new_outs.insert(new_wire->name.str());
sigspec.append(new_wire);
} else {
sigspec.append(bit);
}
}

if (!unset_port)
{
cell->setPort(portName, sigspec);
}
}
} else {
for (auto conn : cell->connections()) {
Expand Down

0 comments on commit 2542810

Please sign in to comment.