summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorjackkoenig2016-11-28 16:59:31 -0800
committerJack Koenig2017-02-02 22:53:03 -0800
commitb0a328492383108509c322189ed2803f671d7a59 (patch)
tree27a1f157d6b3fca5cbf221c428fef1af19e8d9ed /src/test
parent24ad38ab28b888e73217a5532cac2f0d2b9a4bc2 (diff)
Bring cookbook up to date with chisel3 API
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/cookbook/Bundle2UInt.scala2
-rw-r--r--src/test/scala/cookbook/CookbookSpec.scala5
-rw-r--r--src/test/scala/cookbook/UInt2Bundle.scala2
-rw-r--r--src/test/scala/cookbook/UInt2VecOfBool.scala2
-rw-r--r--src/test/scala/cookbook/VecOfBool2UInt.scala2
5 files changed, 5 insertions, 8 deletions
diff --git a/src/test/scala/cookbook/Bundle2UInt.scala b/src/test/scala/cookbook/Bundle2UInt.scala
index cb9498d1..bab5edb3 100644
--- a/src/test/scala/cookbook/Bundle2UInt.scala
+++ b/src/test/scala/cookbook/Bundle2UInt.scala
@@ -8,7 +8,7 @@ import chisel3._
*
* Call asUInt on the Bundle instance
*/
-class Bundle2UInt extends CookbookTester(0) {
+class Bundle2UInt extends CookbookTester(1) {
// Example
class MyBundle extends Bundle {
val foo = UInt(4.W)
diff --git a/src/test/scala/cookbook/CookbookSpec.scala b/src/test/scala/cookbook/CookbookSpec.scala
index 6ecea446..554a415f 100644
--- a/src/test/scala/cookbook/CookbookSpec.scala
+++ b/src/test/scala/cookbook/CookbookSpec.scala
@@ -15,10 +15,7 @@ import chiselTests.ChiselFlatSpec
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(true.B, length)
+ val (cycle, done) = Counter(true.B, length + 1) // + 1 cycle because done is actually wrap
when (done) { stop() }
}
diff --git a/src/test/scala/cookbook/UInt2Bundle.scala b/src/test/scala/cookbook/UInt2Bundle.scala
index 3ce4eebf..acbccc97 100644
--- a/src/test/scala/cookbook/UInt2Bundle.scala
+++ b/src/test/scala/cookbook/UInt2Bundle.scala
@@ -8,7 +8,7 @@ import chisel3._
*
* On an instance of the Bundle, call the method fromBits with the UInt as the argument
*/
-class UInt2Bundle extends CookbookTester(0) {
+class UInt2Bundle extends CookbookTester(1) {
// Example
class MyBundle extends Bundle {
val foo = UInt(4.W)
diff --git a/src/test/scala/cookbook/UInt2VecOfBool.scala b/src/test/scala/cookbook/UInt2VecOfBool.scala
index 09d538f9..96b2da5a 100644
--- a/src/test/scala/cookbook/UInt2VecOfBool.scala
+++ b/src/test/scala/cookbook/UInt2VecOfBool.scala
@@ -9,7 +9,7 @@ import chisel3._
* Use the builtin function [[chisel3.core.Bits.toBools]] to create a Scala Seq of Bool,
* then wrap the resulting Seq in Vec(...)
*/
-class UInt2VecOfBool extends CookbookTester(0) {
+class UInt2VecOfBool extends CookbookTester(1) {
// Example
val uint = 0xc.U
val vec = Vec(uint.toBools)
diff --git a/src/test/scala/cookbook/VecOfBool2UInt.scala b/src/test/scala/cookbook/VecOfBool2UInt.scala
index 531e4e68..40faca30 100644
--- a/src/test/scala/cookbook/VecOfBool2UInt.scala
+++ b/src/test/scala/cookbook/VecOfBool2UInt.scala
@@ -8,7 +8,7 @@ import chisel3._
*
* Use the builtin function asUInt
*/
-class VecOfBool2UInt extends CookbookTester(0) {
+class VecOfBool2UInt extends CookbookTester(1) {
// Example
val vec = Vec(true.B, false.B, true.B, true.B)
val uint = vec.asUInt