aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2023-02-01 12:34:35 +0100
committerJannis Harder <me@jix.one>2023-02-01 12:34:35 +0100
commit5e8263840824bc5113efdeb03d066f0889e562c8 (patch)
treecdecb6c80489303e5a438a86184c9c23a3d445fb /backends
parent541fdffff243bccb410de13ae3ef91797060fcd4 (diff)
downloadyosys-5e8263840824bc5113efdeb03d066f0889e562c8.tar.gz
yosys-5e8263840824bc5113efdeb03d066f0889e562c8.tar.bz2
yosys-5e8263840824bc5113efdeb03d066f0889e562c8.zip
smt2: Fix operation width computation for boolean producing cells
The output width for the boolean value should not influence the operation width. The previous incorrect width extension would still produce correct results, but could produce invalid smt2 output for reduction operators when the output width was larger than the width of the vector to which the reduction was applied. This fixes #3654
Diffstat (limited to 'backends')
-rw-r--r--backends/smt2/smt2.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/backends/smt2/smt2.cc b/backends/smt2/smt2.cc
index 1ab39a405..48da3f4be 100644
--- a/backends/smt2/smt2.cc
+++ b/backends/smt2/smt2.cc
@@ -462,7 +462,10 @@ struct Smt2Worker
int width = GetSize(sig_y);
if (type == 's' || type == 'S' || type == 'd' || type == 'b') {
- width = max(width, GetSize(cell->getPort(ID::A)));
+ if (type == 'b')
+ width = GetSize(cell->getPort(ID::A));
+ else
+ width = max(width, GetSize(cell->getPort(ID::A)));
if (cell->hasPort(ID::B))
width = max(width, GetSize(cell->getPort(ID::B)));
}