Himbaechel xilinx : DSP packing : Fix identification of cascaded ports and share identification code

This commit is contained in:
Adrien Prost-Boucle 2024-09-17 16:11:48 +02:00 committed by myrtle
parent ad9a54cc69
commit 9bea22ed1e

View File

@ -26,6 +26,17 @@
NEXTPNR_NAMESPACE_BEGIN 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) void XC7Packer::walk_dsp(CellInfo *root, CellInfo *current_cell, int constr_z)
{ {
CellInfo *cascaded_cell = nullptr; 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 // see if any cascade outputs are connected
for (auto port : current_cell->ports) { 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; NetInfo *cout_net = port.second.net;
if (cout_net == nullptr || cout_net->users.empty()) continue; if (cout_net == nullptr || cout_net->users.empty()) continue;
@ -108,21 +119,8 @@ void XC7Packer::pack_dsps()
for (auto &port : ci->ports) { for (auto &port : ci->ports) {
std::string n = port.first.str(ctx); std::string n = port.first.str(ctx);
// According to ug479 : // Cascading inputs do not use routing resources, so disconnect them if constants
// These signals are dedicated routing paths internal to the DSP48E1 column. They are not accessible via fabric routing resources. if (is_cascade_input(n)) {
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") {
if (port.second.net == nullptr) if (port.second.net == nullptr)
continue; continue;
if (port.second.net->name == ctx->id("$PACKER_GND_NET")) if (port.second.net->name == ctx->id("$PACKER_GND_NET"))
@ -157,7 +155,7 @@ void XC7Packer::pack_dsps()
for (auto ci : all_dsps) { for (auto ci : all_dsps) {
bool cascade_input_used = false; bool cascade_input_used = false;
for (auto port : ci->ports) { 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) { if (port.second.net != nullptr) {
cascade_input_used = true; cascade_input_used = true;
break; break;