summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorjackkoenig2017-02-06 18:12:26 -0800
committerAndrew Waterman2017-02-24 05:10:52 -0800
commitab083035655cbe1b1d73fc1d36db08cce8811fec (patch)
treeed17858a5a1142bf6d22be7ced064a3d9babb87f /src/test
parent55c2bd293473d92f8df1ef83bb627992b173ce8e (diff)
Test that large Vecs can have widths inferred
Test for ucb-bar/firrtl#407
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/chiselTests/Vec.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Vec.scala b/src/test/scala/chiselTests/Vec.scala
index 132bfcdc..e14ec3d9 100644
--- a/src/test/scala/chiselTests/Vec.scala
+++ b/src/test/scala/chiselTests/Vec.scala
@@ -109,6 +109,16 @@ class ShiftRegisterTester(n: Int) extends BasicTester {
}
}
+class HugeVecTester(n: Int) extends BasicTester {
+ require(n > 0)
+ val myVec = Wire(Vec(n, UInt()))
+ myVec.foreach { x =>
+ x := 123.U
+ assert(x === 123.U)
+ }
+ stop()
+}
+
class VecSpec extends ChiselPropSpec {
// Disable shrinking on error.
implicit val noShrinkListVal = Shrink[List[Int]](_ => Stream.empty)
@@ -154,4 +164,8 @@ class VecSpec extends ChiselPropSpec {
property("Regs of vecs should be usable as shift registers") {
forAll(smallPosInts) { (n: Int) => assertTesterPasses{ new ShiftRegisterTester(n) } }
}
+
+ property("Infering widths on huge Vecs should not cause a stack overflow") {
+ assertTesterPasses { new HugeVecTester(10000) }
+ }
}