aboutsummaryrefslogtreecommitdiffstats
path: root/passes/techmap/alumacc.cc
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-09-15 13:56:07 -0700
committerGitHub <noreply@github.com>2019-09-15 13:56:07 -0700
commit2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726 (patch)
tree5389b83070c6430560fed254e7ee5d642a74299b /passes/techmap/alumacc.cc
parent09ac36da601aab607f01ccf6e2baa29296877877 (diff)
parent9a84e4711cfa7a6ee82b8d67a48be96064659651 (diff)
downloadyosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.tar.gz
yosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.tar.bz2
yosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.zip
Merge pull request #1374 from YosysHQ/eddie/fix1371
Fix two non-deterministic behaviours that cause divergence between compilers
Diffstat (limited to 'passes/techmap/alumacc.cc')
-rw-r--r--passes/techmap/alumacc.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/passes/techmap/alumacc.cc b/passes/techmap/alumacc.cc
index 5b168d524..034731b87 100644
--- a/passes/techmap/alumacc.cc
+++ b/passes/techmap/alumacc.cc
@@ -48,14 +48,25 @@ struct AlumaccWorker
RTLIL::SigSpec cached_cf, cached_of, cached_sf;
RTLIL::SigSpec get_lt() {
- if (GetSize(cached_lt) == 0)
- cached_lt = is_signed ? alu_cell->module->Xor(NEW_ID, get_of(), get_sf()) : get_cf();
+ if (GetSize(cached_lt) == 0) {
+ if (is_signed) {
+ get_of();
+ get_sf();
+ cached_lt = alu_cell->module->Xor(NEW_ID, cached_of, cached_sf);
+ }
+ else
+ cached_lt = get_cf();
+ }
return cached_lt;
}
RTLIL::SigSpec get_gt() {
- if (GetSize(cached_gt) == 0)
- cached_gt = alu_cell->module->Not(NEW_ID, alu_cell->module->Or(NEW_ID, get_lt(), get_eq()), false, alu_cell->get_src_attribute());
+ if (GetSize(cached_gt) == 0) {
+ get_lt();
+ get_eq();
+ SigSpec Or = alu_cell->module->Or(NEW_ID, cached_lt, cached_eq);
+ cached_gt = alu_cell->module->Not(NEW_ID, Or, false, alu_cell->get_src_attribute());
+ }
return cached_gt;
}