diff options
author | Jannis Harder <me@jix.one> | 2023-02-01 12:34:35 +0100 |
---|---|---|
committer | Jannis Harder <me@jix.one> | 2023-02-01 12:34:35 +0100 |
commit | 5e8263840824bc5113efdeb03d066f0889e562c8 (patch) | |
tree | cdecb6c80489303e5a438a86184c9c23a3d445fb /backends/smt2 | |
parent | 541fdffff243bccb410de13ae3ef91797060fcd4 (diff) | |
download | yosys-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/smt2')
-rw-r--r-- | backends/smt2/smt2.cc | 5 |
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))); } |