summaryrefslogtreecommitdiff
path: root/src/test/scala/cookbook/CookbookSpec.scala
diff options
context:
space:
mode:
authorJim Lawson2016-10-06 11:15:08 -0700
committerJim Lawson2016-10-06 11:15:08 -0700
commitd9e46d06522102634b04a187d5e89fe84b94678a (patch)
tree3f44fc56acc334c1ffa7340583b29ad44ff8740b /src/test/scala/cookbook/CookbookSpec.scala
parentf98171296f821034cf66ace070bcf179183e833d (diff)
parent7aea39d4deac62d5477904f4bf4381c3482c41d0 (diff)
Merge branch 'master' into buildinfo
Diffstat (limited to 'src/test/scala/cookbook/CookbookSpec.scala')
-rw-r--r--src/test/scala/cookbook/CookbookSpec.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/scala/cookbook/CookbookSpec.scala b/src/test/scala/cookbook/CookbookSpec.scala
new file mode 100644
index 00000000..b244f3cf
--- /dev/null
+++ b/src/test/scala/cookbook/CookbookSpec.scala
@@ -0,0 +1,25 @@
+// See LICENSE for license details.
+
+package cookbook
+
+import chisel3._
+import chisel3.util._
+import chisel3.testers.BasicTester
+
+import chiselTests.ChiselFlatSpec
+
+/** Tester for concise cookbook tests
+ *
+ * Provides a length of test after which the test will pass
+ */
+abstract class CookbookTester(length: Int) extends BasicTester {
+ require(length >= 0, "Simulation length must be non-negative!")
+
+ // No IO allowed, cookbook tests must be self-contained
+ override final val io = new Bundle { }
+
+ val (cycle, done) = Counter(Bool(true), length)
+ when (done) { stop() }
+}
+
+abstract class CookbookSpec extends ChiselFlatSpec