aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange
diff options
context:
space:
mode:
authorMaciej Dudek <mdudek@antmicro.com>2021-09-21 20:48:50 +0200
committerMaciej Dudek <mdudek@antmicro.com>2021-09-23 17:15:09 +0200
commit44def159cc1babb18a29f71e4961df85d230afef (patch)
tree311202a28a94e4fd66300a249440c037dcd00890 /fpga_interchange
parentb12119d8e88bf99a801e12e947c170d3a0ae6e40 (diff)
downloadnextpnr-44def159cc1babb18a29f71e4961df85d230afef.tar.gz
nextpnr-44def159cc1babb18a29f71e4961df85d230afef.tar.bz2
nextpnr-44def159cc1babb18a29f71e4961df85d230afef.zip
Fix AC-3 algorithm
Signed-off-by: Maciej Dudek <mdudek@antmicro.com>
Diffstat (limited to 'fpga_interchange')
-rw-r--r--fpga_interchange/arch_pack_clusters.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/fpga_interchange/arch_pack_clusters.cc b/fpga_interchange/arch_pack_clusters.cc
index b7892fa2..74823b8e 100644
--- a/fpga_interchange/arch_pack_clusters.cc
+++ b/fpga_interchange/arch_pack_clusters.cc
@@ -505,23 +505,28 @@ bool reduce(uint32_t x, uint32_t y, const ClusterPOD *cluster, dict<uint32_t, po
for (const auto &x_cell : domain[x]){
bool found = false;
for (const auto &y_cell : domain[y]){
+ found = true;
for (const auto edge : cluster->connection_graph[x].connections[counter].edges){
- if (!x_cell->ports.count(IdString(edge.cell_pin)) || !y_cell->ports.count(IdString(edge.other_cell_pin)))
+ if (!x_cell->ports.count(IdString(edge.cell_pin)) || !y_cell->ports.count(IdString(edge.other_cell_pin))){
+ found = false;
break;
+ }
const auto x_net = x_cell->ports[IdString(edge.cell_pin)].net;
const auto y_net = y_cell->ports[IdString(edge.other_cell_pin)].net;
- if (x_net != y_net)
+ if (x_net != y_net){
+ found = false;
break;
+ }
bool x_driver = x_net->driver.cell == x_cell;
bool y_driver = y_net->driver.cell == y_cell;
- if ((edge.dir != 0 || !y_driver) && (edge.dir != 1 || !x_driver) && (edge.dir != 2 || y_driver || x_driver))
+ if ((edge.dir != 0 || !y_driver) && (edge.dir != 1 || !x_driver) && (edge.dir != 2 || y_driver || x_driver)){
+ found = false;
break;
- found = true;
+ }
}
- if (found){
+ if (found)
break;
- }
}
if (!found)
remove_cell.push_back(x_cell);
@@ -544,9 +549,12 @@ void binary_constraint_check(const ClusterPOD *cluster,
uint32_t x,y;
x = arc.first; y = arc.second;
if (reduce(x, y, cluster, idx_to_cells, ctx)){
- for (const auto &connection : cluster->connection_graph[arc.first].connections)
- if (connection.target_idx != y)
- workqueue.push(std::pair<uint32_t, uint32_t>(arc.first, connection.target_idx));
+ for (const auto &node : cluster->connection_graph){
+ if (node.idx != arc.first)
+ for (const auto &connection : node.connections)
+ if (connection.target_idx == arc.first)
+ workqueue.push(std::pair<uint32_t, uint32_t>(node.idx, arc.first));
+ }
}
}
}