diff options
| author | Jack Koenig | 2018-07-31 13:32:15 -0700 |
|---|---|---|
| committer | GitHub | 2018-07-31 13:32:15 -0700 |
| commit | fea4f3a80d2ed5d4735ef33558bebbab290290fb (patch) | |
| tree | 4d3f7fa475f208a14a955c55e25fd0229ce4334f /src/test/scala/chiselTests/FixedPointSpec.scala | |
| parent | 566d181837715605ec1681e71856ff1fca1e4e3e (diff) | |
Revert removal of bit extraction const prop for literals (#857)
See https://github.com/freechipsproject/chisel3/issues/867 for future API discussion
Diffstat (limited to 'src/test/scala/chiselTests/FixedPointSpec.scala')
| -rw-r--r-- | src/test/scala/chiselTests/FixedPointSpec.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/FixedPointSpec.scala b/src/test/scala/chiselTests/FixedPointSpec.scala index ff4b42a0..137ffc76 100644 --- a/src/test/scala/chiselTests/FixedPointSpec.scala +++ b/src/test/scala/chiselTests/FixedPointSpec.scala @@ -116,6 +116,21 @@ class SBPTester extends BasicTester { stop() } +class FixedPointLitExtractTester extends BasicTester { + assert(-4.75.F(2.BP)(1) === false.B) + assert(-4.75.F(2.BP)(2) === true.B) + assert(-4.75.F(2.BP)(100) === true.B) + assert(-4.75.F(2.BP)(3, 0) === "b1101".U) + assert(-4.75.F(2.BP)(9, 0) === "b1111101101".U) + + assert(-4.75.F(6.W, 2.BP)(1) === false.B) + assert(-4.75.F(6.W, 2.BP)(2) === true.B) + assert(-4.75.F(6.W, 2.BP)(100) === true.B) + assert(-4.75.F(6.W, 2.BP)(3, 0) === "b1101".U) + assert(-4.75.F(6.W, 2.BP)(9, 0) === "b1111101101".U) + stop() +} + class FixedPointSpec extends ChiselPropSpec { property("should allow set binary point") { assertTesterPasses { new SBPTester } @@ -129,4 +144,7 @@ class FixedPointSpec extends ChiselPropSpec { property("Negative shift amounts are invalid") { a [ChiselException] should be thrownBy { elaborate(new NegativeShift(FixedPoint(1.W, 0.BP))) } } + property("Bit extraction on literals should work for all non-negative indices") { + assertTesterPasses(new FixedPointLitExtractTester) + } } |
