summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/ChiselSpec.scala
diff options
context:
space:
mode:
authorHenry Cook2015-08-14 01:51:39 -0700
committerHenry Cook2015-08-14 01:51:39 -0700
commitc23943b41de55de9af249a3b231558ad23fc8087 (patch)
tree0d042d64c6b3e794bbdcae7241c79f83c721b917 /src/test/scala/chiselTests/ChiselSpec.scala
parent5e9be183f98d32164332fa0548fe80686f50c851 (diff)
Add Vec tests. Do a better job of generating widths.
Diffstat (limited to 'src/test/scala/chiselTests/ChiselSpec.scala')
-rw-r--r--src/test/scala/chiselTests/ChiselSpec.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala
index 3485b398..3d98d0a2 100644
--- a/src/test/scala/chiselTests/ChiselSpec.scala
+++ b/src/test/scala/chiselTests/ChiselSpec.scala
@@ -41,7 +41,7 @@ class ChiselPropSpec extends PropSpec with PropertyChecks {
def popCount(n: Long) = n.toBinaryString.count(_=='1')
val smallPosInts = Gen.choose(1, 7)
- val safeUIntWidth = Gen.choose(1, 31)
+ val safeUIntWidth = Gen.choose(1, 30)
val safeUInts = Gen.choose(0, (1 << 30))
val vecSizes = Gen.choose(0, 4)
val binaryString = for(i <- Arbitrary.arbitrary[Int]) yield "b" + i.toBinaryString
@@ -51,10 +51,19 @@ class ChiselPropSpec extends PropSpec with PropertyChecks {
w <- smallPosInts
i <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1))
} yield (w, i)
+ val safeUInt = for {
+ w <- smallPosInts
+ i <- 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)
+ val safeUIntPair= for {
+ w <- smallPosInts
+ i <- Gen.choose(0, (1 << w) - 1)
+ j <- Gen.choose(0, (1 << w) - 1)
+ } yield (w, i, j)
}