aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-10-11 21:07:41 +0100
committerGitHub <noreply@github.com>2021-10-11 21:07:41 +0100
commit4e1f2d7deb07c3119dcd1814273e2eb273fc19ef (patch)
tree73699027a87fe04436412e07aa9cb5505e26df33
parentdd2c5942a4c261fc26b16e19280490a2860020fa (diff)
parent15c10796bdf6d99d440d31f98dea3daca195a57d (diff)
downloadnextpnr-4e1f2d7deb07c3119dcd1814273e2eb273fc19ef.tar.gz
nextpnr-4e1f2d7deb07c3119dcd1814273e2eb273fc19ef.tar.bz2
nextpnr-4e1f2d7deb07c3119dcd1814273e2eb273fc19ef.zip
Merge pull request #845 from YosysHQ/gatecat/mlab-cluster-fix
mistral: Fix MLAB clustering
-rw-r--r--mistral/lab.cc6
-rw-r--r--mistral/pack.cc5
2 files changed, 9 insertions, 2 deletions
diff --git a/mistral/lab.cc b/mistral/lab.cc
index e78a815c..4f6b9b00 100644
--- a/mistral/lab.cc
+++ b/mistral/lab.cc
@@ -492,6 +492,12 @@ void Arch::update_alm_input_count(uint32_t lab, uint8_t alm)
for (int i = 0; i < 2; i++) {
if (!luts[i])
continue;
+ // MLAB that has been clustered with other MLABs (due to shared read port) costs no extra inputs
+ if (luts[i]->combInfo.mlab_group != -1 && luts[i]->constr_z > 2) {
+ alm_data.unique_input_count = 0;
+ return;
+ }
+
total_lut_inputs += luts[i]->combInfo.used_lut_input_count - luts[i]->combInfo.chain_shared_input_count;
}
int shared_lut_inputs = 0;
diff --git a/mistral/pack.cc b/mistral/pack.cc
index ef3b3887..4b434015 100644
--- a/mistral/pack.cc
+++ b/mistral/pack.cc
@@ -367,8 +367,9 @@ struct MistralPacker
CellInfo *ci = group.at(i);
CellInfo *base = group.at((i / cluster_size) * cluster_size);
int cell_index = int(i) % cluster_size;
- int alm = i / 2;
- int alm_cell = i % 2;
+ int alm = cell_index / 2;
+ int alm_cell = cell_index % 2;
+ ci->cluster = base->name;
ci->constr_abs_z = true;
ci->constr_z = alm * 6 + alm_cell;
if (cell_index != 0) {