diff options
Diffstat (limited to 'src/test/scala/chiselTests/ChiselSpec.scala')
| -rw-r--r-- | src/test/scala/chiselTests/ChiselSpec.scala | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala index 1f1b5399..3485b398 100644 --- a/src/test/scala/chiselTests/ChiselSpec.scala +++ b/src/test/scala/chiselTests/ChiselSpec.scala @@ -40,10 +40,21 @@ class ChiselPropSpec extends PropSpec with PropertyChecks { def popCount(n: Long) = n.toBinaryString.count(_=='1') - val smallPosInts = Gen.choose(1, 8) + val smallPosInts = Gen.choose(1, 7) val safeUIntWidth = Gen.choose(1, 31) val safeUInts = Gen.choose(0, (1 << 30)) val vecSizes = Gen.choose(0, 4) - def enSequence(n: Int) = Gen.containerOfN[List,Boolean](n,Gen.oneOf(true,false)) val binaryString = for(i <- Arbitrary.arbitrary[Int]) yield "b" + i.toBinaryString + def enSequence(n: Int) = Gen.containerOfN[List,Boolean](n,Gen.oneOf(true,false)) + + def safeUIntN(n: Int) = for { + w <- smallPosInts + i <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) + } yield (w, i) + + def safeUIntPairN(n: Int) = for { + w <- smallPosInts + i <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) + j <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) + } yield (w, i zip j) } |
