From 5e9be183f98d32164332fa0548fe80686f50c851 Mon Sep 17 00:00:00 2001 From: Henry Cook Date: Fri, 14 Aug 2015 00:53:57 -0700 Subject: added MulLookup and Tbl tests --- src/test/scala/chiselTests/ChiselSpec.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/test/scala/chiselTests/ChiselSpec.scala') 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) } -- cgit v1.2.3