diff options
| author | Kevin Laeufer | 2021-11-10 06:33:39 -0800 |
|---|---|---|
| committer | GitHub | 2021-11-10 09:33:39 -0500 |
| commit | 18b9a987552492928aa1199d8cf498fe561c2f03 (patch) | |
| tree | bffeadc7cad0aa3e552f945a6aa4f6e405e9a02d /src/test | |
| parent | 7ef3e1ba9d1a748bd39f8d4f279e8d4e34bb4cc7 (diff) | |
smt: fix handling of div primitive in formal backend (#2409)
We never tested the case where the width of the
numerator was less than the denominator.
This should fix any issue with this combination.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtl/backends/experimental/smt/FirrtlExpressionSemanticsSpec.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/scala/firrtl/backends/experimental/smt/FirrtlExpressionSemanticsSpec.scala b/src/test/scala/firrtl/backends/experimental/smt/FirrtlExpressionSemanticsSpec.scala index c9c1c943..7476b20c 100644 --- a/src/test/scala/firrtl/backends/experimental/smt/FirrtlExpressionSemanticsSpec.scala +++ b/src/test/scala/firrtl/backends/experimental/smt/FirrtlExpressionSemanticsSpec.scala @@ -113,6 +113,8 @@ class FirrtlExpressionSemanticsSpec extends AnyFlatSpec { assert(primop(false, "div", 8, List(8, 4), modelUndef = false) == "udiv(i0, zext(i1, 4))") assert(primop(true, "div", 8, List(7, 7), modelUndef = false) == "sdiv(sext(i0, 1), sext(i1, 1))") assert(primop(true, "div", 8, List(7, 4), modelUndef = false) == "sdiv(sext(i0, 1), sext(i1, 4))") + // result width is always the width of the numerator, even if the denominator is larger + assert(primop(false, "div", 1, List(1, 2), modelUndef = false) == "udiv(zext(i0, 1), i1)[0]") } it should "correctly translate the `rem` primitive operation" in { |
