diff --git a/himbaechel/uarch/xilinx/pack_dsp_xc7.cc b/himbaechel/uarch/xilinx/pack_dsp_xc7.cc index 03878ff3..13bfc3c7 100644 --- a/himbaechel/uarch/xilinx/pack_dsp_xc7.cc +++ b/himbaechel/uarch/xilinx/pack_dsp_xc7.cc @@ -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; @@ -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; @@ -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")) @@ -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;