Skip to content

Commit

Permalink
Himbaechel xilinx : DSP packing : Fix identification of cascaded port…
Browse files Browse the repository at this point in the history
…s and share identification code
  • Loading branch information
marzoul authored and gatecat committed Sep 24, 2024
1 parent ad9a54c commit 9bea22e
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions himbaechel/uarch/xilinx/pack_dsp_xc7.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@

NEXTPNR_NAMESPACE_BEGIN

static bool is_cascade_input(const std::string& port_name)
{
return boost::starts_with(port_name, "ACIN") || boost::starts_with(port_name, "BCIN") || boost::starts_with(port_name, "PCIN") ||
port_name == "CARRYCASCIN" || port_name == "MULTSIGNIN";
}
static bool is_cascade_output(const std::string& port_name)
{
return boost::starts_with(port_name, "ACOUT") || boost::starts_with(port_name, "BCOUT") || boost::starts_with(port_name, "PCOUT") ||
port_name == "CARRYCASCOUT" || port_name == "MULTSIGNOUT";
}

void XC7Packer::walk_dsp(CellInfo *root, CellInfo *current_cell, int constr_z)
{
CellInfo *cascaded_cell = nullptr;
Expand All @@ -42,7 +53,7 @@ void XC7Packer::walk_dsp(CellInfo *root, CellInfo *current_cell, int constr_z)

// see if any cascade outputs are connected
for (auto port : current_cell->ports) {
if (!boost::contains(port.first.str(ctx), "COUT")) continue;
if (!is_cascade_output(port.first.str(ctx))) continue;
NetInfo *cout_net = port.second.net;

if (cout_net == nullptr || cout_net->users.empty()) continue;
Expand Down Expand Up @@ -108,21 +119,8 @@ void XC7Packer::pack_dsps()
for (auto &port : ci->ports) {
std::string n = port.first.str(ctx);

// According to ug479 :
// These signals are dedicated routing paths internal to the DSP48E1 column. They are not accessible via fabric routing resources.
if (boost::starts_with(n, "ACIN") || boost::starts_with(n, "BCIN") || boost::starts_with(n, "PCIN")) {
if (port.second.net == nullptr)
continue;
if (port.second.net->name == ctx->id("$PACKER_GND_NET"))
ci->disconnectPort(port.first);
}
if (n == "CARRYCASCIN") {
if (port.second.net == nullptr)
continue;
if (port.second.net->name == ctx->id("$PACKER_GND_NET"))
ci->disconnectPort(port.first);
}
if (n == "MULTSIGNIN") {
// Cascading inputs do not use routing resources, so disconnect them if constants
if (is_cascade_input(n)) {
if (port.second.net == nullptr)
continue;
if (port.second.net->name == ctx->id("$PACKER_GND_NET"))
Expand Down Expand Up @@ -157,7 +155,7 @@ void XC7Packer::pack_dsps()
for (auto ci : all_dsps) {
bool cascade_input_used = false;
for (auto port : ci->ports) {
if (!boost::contains(port.first.str(ctx), "CIN")) continue;
if (!is_cascade_input(port.first.str(ctx))) continue;
if (port.second.net != nullptr) {
cascade_input_used = true;
break;
Expand Down

0 comments on commit 9bea22e

Please sign in to comment.