diff options
| author | ducky | 2016-11-17 13:01:03 -0800 |
|---|---|---|
| committer | ducky | 2016-11-21 13:31:12 -0800 |
| commit | 54d3f8dc054e55dfbd01d1aa034169a3dabe89f2 (patch) | |
| tree | 7f6f9de04de6eb08878ac46be339fefc2a71395f /src/test/scala/cookbook | |
| parent | cd904da0aa0e96ba679906a3ee5dbdc068eace48 (diff) | |
Restyle a lot of test code, mainly with regex
Diffstat (limited to 'src/test/scala/cookbook')
| -rw-r--r-- | src/test/scala/cookbook/Bundle2UInt.scala | 10 | ||||
| -rw-r--r-- | src/test/scala/cookbook/CookbookSpec.scala | 2 | ||||
| -rw-r--r-- | src/test/scala/cookbook/UInt2Bundle.scala | 10 | ||||
| -rw-r--r-- | src/test/scala/cookbook/UInt2VecOfBool.scala | 10 | ||||
| -rw-r--r-- | src/test/scala/cookbook/VecOfBool2UInt.scala | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/test/scala/cookbook/Bundle2UInt.scala b/src/test/scala/cookbook/Bundle2UInt.scala index d74218a8..cb9498d1 100644 --- a/src/test/scala/cookbook/Bundle2UInt.scala +++ b/src/test/scala/cookbook/Bundle2UInt.scala @@ -11,17 +11,17 @@ import chisel3._ class Bundle2UInt extends CookbookTester(0) { // Example class MyBundle extends Bundle { - val foo = UInt(width = 4) - val bar = UInt(width = 4) + val foo = UInt(4.W) + val bar = UInt(4.W) } val bundle = Wire(new MyBundle) - bundle.foo := UInt(0xc) - bundle.bar := UInt(0x3) + bundle.foo := 0xc.U + bundle.bar := 0x3.U val uint = bundle.asUInt printf(p"$uint") // 195 // Test - assert(uint === UInt(0xc3)) + assert(uint === 0xc3.U) } class Bundle2UIntSpec extends CookbookSpec { diff --git a/src/test/scala/cookbook/CookbookSpec.scala b/src/test/scala/cookbook/CookbookSpec.scala index b244f3cf..6ecea446 100644 --- a/src/test/scala/cookbook/CookbookSpec.scala +++ b/src/test/scala/cookbook/CookbookSpec.scala @@ -18,7 +18,7 @@ abstract class CookbookTester(length: Int) extends BasicTester { // No IO allowed, cookbook tests must be self-contained override final val io = new Bundle { } - val (cycle, done) = Counter(Bool(true), length) + val (cycle, done) = Counter(true.B, length) when (done) { stop() } } diff --git a/src/test/scala/cookbook/UInt2Bundle.scala b/src/test/scala/cookbook/UInt2Bundle.scala index fbf7fe8a..3ce4eebf 100644 --- a/src/test/scala/cookbook/UInt2Bundle.scala +++ b/src/test/scala/cookbook/UInt2Bundle.scala @@ -11,16 +11,16 @@ import chisel3._ class UInt2Bundle extends CookbookTester(0) { // Example class MyBundle extends Bundle { - val foo = UInt(width = 4) - val bar = UInt(width = 4) + val foo = UInt(4.W) + val bar = UInt(4.W) } - val uint = UInt(0xb4) + val uint = 0xb4.U val bundle = (new MyBundle).fromBits(uint) printf(p"$bundle") // Bundle(foo -> 11, bar -> 4) // Test - assert(bundle.foo === UInt(0xb)) - assert(bundle.bar === UInt(0x4)) + assert(bundle.foo === 0xb.U) + assert(bundle.bar === 0x4.U) } class UInt2BundleSpec extends CookbookSpec { diff --git a/src/test/scala/cookbook/UInt2VecOfBool.scala b/src/test/scala/cookbook/UInt2VecOfBool.scala index ad4a0334..09d538f9 100644 --- a/src/test/scala/cookbook/UInt2VecOfBool.scala +++ b/src/test/scala/cookbook/UInt2VecOfBool.scala @@ -11,15 +11,15 @@ import chisel3._ */ class UInt2VecOfBool extends CookbookTester(0) { // Example - val uint = UInt(0xc) + val uint = 0xc.U val vec = Vec(uint.toBools) printf(p"$vec") // Vec(0, 0, 1, 1) // Test - assert(vec(0) === Bool(false)) - assert(vec(1) === Bool(false)) - assert(vec(2) === Bool(true)) - assert(vec(3) === Bool(true)) + assert(vec(0) === false.B) + assert(vec(1) === false.B) + assert(vec(2) === true.B) + assert(vec(3) === true.B) } class UInt2VecOfBoolSpec extends CookbookSpec { diff --git a/src/test/scala/cookbook/VecOfBool2UInt.scala b/src/test/scala/cookbook/VecOfBool2UInt.scala index 5852120c..531e4e68 100644 --- a/src/test/scala/cookbook/VecOfBool2UInt.scala +++ b/src/test/scala/cookbook/VecOfBool2UInt.scala @@ -10,7 +10,7 @@ import chisel3._ */ class VecOfBool2UInt extends CookbookTester(0) { // Example - val vec = Vec(Bool(true), Bool(false), Bool(true), Bool(true)) + val vec = Vec(true.B, false.B, true.B, true.B) val uint = vec.asUInt printf(p"$uint") // 13 @@ -18,7 +18,7 @@ class VecOfBool2UInt extends CookbookTester(0) { * * (remember leftmost Bool in Vec is low order bit) */ - assert(UInt(0xd) === uint) + assert(0xd.U === uint) } class VecOfBool2UIntSpec extends CookbookSpec { |
