diff options
Diffstat (limited to 'src/test/scala/chiselTests')
| -rw-r--r-- | src/test/scala/chiselTests/CompatibiltySpec.scala | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/test/scala/chiselTests/CompatibiltySpec.scala b/src/test/scala/chiselTests/CompatibiltySpec.scala index dc55527c..cc14be5e 100644 --- a/src/test/scala/chiselTests/CompatibiltySpec.scala +++ b/src/test/scala/chiselTests/CompatibiltySpec.scala @@ -35,17 +35,13 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks } it should "map utility objects into the package object" in { - { - val value: Int = Gen.choose(0, 2048).sample.get - log2Up(value) shouldBe (1 max BigInt(value - 1).bitLength) - log2Ceil(value) shouldBe (BigInt(value - 1).bitLength) - log2Down(value) shouldBe ((1 max BigInt(value - 1).bitLength) - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) - log2Floor(value) shouldBe (BigInt(value - 1).bitLength - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) - if (value > 0) { - isPow2(1 << value) shouldBe true - isPow2((1 << value) - 1) shouldBe false - } - } + val value: Int = Gen.choose(2, 2048).sample.get + log2Up(value) shouldBe (1 max BigInt(value - 1).bitLength) + log2Ceil(value) shouldBe (BigInt(value - 1).bitLength) + log2Down(value) shouldBe ((1 max BigInt(value - 1).bitLength) - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) + log2Floor(value) shouldBe (BigInt(value - 1).bitLength - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) + isPow2(BigInt(1) << value) shouldBe true + isPow2((BigInt(1) << value) - 1) shouldBe false } it should "make BitPats available" in { |
