aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelina Kościelnicka <mwk@0x04.net>2021-05-25 15:34:12 +0200
committerMarcelina Kościelnicka <mwk@0x04.net>2021-05-25 16:28:33 +0200
commit96c7d60304e4e9e4cb4d85924efcafa546283c65 (patch)
tree5c880d5f9c12c104c09ed007f1623d8b251350a9
parent5628f5a88fa49c126af0149e302a8292229ab9df (diff)
downloadyosys-96c7d60304e4e9e4cb4d85924efcafa546283c65.tar.gz
yosys-96c7d60304e4e9e4cb4d85924efcafa546283c65.tar.bz2
yosys-96c7d60304e4e9e4cb4d85924efcafa546283c65.zip
memory_bram: Respect write port priority.
-rw-r--r--passes/memory/memory_bram.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/passes/memory/memory_bram.cc b/passes/memory/memory_bram.cc
index a860fc693..6ec3dc2e9 100644
--- a/passes/memory/memory_bram.cc
+++ b/passes/memory/memory_bram.cc
@@ -1071,6 +1071,20 @@ void handle_memory(Mem &mem, const rules_t &rules)
}
}
+ // This pass cannot deal with write port priority — we need to emulate it,
+ // if present. Since priority emulation will change the enable signals,
+ // which in turn may change enable grouping and mapping eligibility in
+ // pathological cases, we need to do this before checking mapping
+ // eligibility. This will create priority emulation logic for all
+ // memories in the design regardless of whether we end up mapping them
+ // or not, but since we never call Mem::emit(), the new priority masks
+ // and enables won't be commited to the design, and this logic will be
+ // unused (and removed by subsequent opt_clean) for unmapped memories.
+
+ for (int i = 0; i < GetSize(mem.wr_ports); i++)
+ for (int j = 0; j < i; j++)
+ mem.emulate_priority(j, i);
+
pool<pair<IdString, int>> failed_brams;
dict<pair<int, int>, tuple<int, int, int>> best_rule_cache;