summaryrefslogtreecommitdiff
path: root/src/test/scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala')
-rw-r--r--src/test/scala/chiselTests/AsTypeOfTester.scala2
-rw-r--r--src/test/scala/chiselTests/Assert.scala6
-rw-r--r--src/test/scala/chiselTests/MultiClockSpec.scala2
-rw-r--r--src/test/scala/chiselTests/UIntOps.scala14
-rw-r--r--src/test/scala/cookbook/UInt2VecOfBool.scala4
-rw-r--r--src/test/scala/examples/VendingMachineGenerator.scala2
6 files changed, 20 insertions, 10 deletions
diff --git a/src/test/scala/chiselTests/AsTypeOfTester.scala b/src/test/scala/chiselTests/AsTypeOfTester.scala
index 75a2dc8a..3fe186b4 100644
--- a/src/test/scala/chiselTests/AsTypeOfTester.scala
+++ b/src/test/scala/chiselTests/AsTypeOfTester.scala
@@ -51,7 +51,7 @@ class AsTypeOfTruncationTester extends BasicTester {
}
class ResetAsTypeOfBoolTester extends BasicTester {
- assert(reset.asTypeOf(Bool()) === reset.toBool)
+ assert(reset.asTypeOf(Bool()) === reset.asBool)
stop()
}
diff --git a/src/test/scala/chiselTests/Assert.scala b/src/test/scala/chiselTests/Assert.scala
index 075cc4e2..fab6f87b 100644
--- a/src/test/scala/chiselTests/Assert.scala
+++ b/src/test/scala/chiselTests/Assert.scala
@@ -10,7 +10,7 @@ import chisel3.util._
class FailingAssertTester() extends BasicTester {
assert(false.B)
// Wait to come out of reset
- val (_, done) = Counter(!reset.toBool, 4)
+ val (_, done) = Counter(!reset.asBool, 4)
when (done) {
stop()
}
@@ -19,7 +19,7 @@ class FailingAssertTester() extends BasicTester {
class SucceedingAssertTester() extends BasicTester {
assert(true.B)
// Wait to come out of reset
- val (_, done) = Counter(!reset.toBool, 4)
+ val (_, done) = Counter(!reset.asBool, 4)
when (done) {
stop()
}
@@ -38,7 +38,7 @@ class PipelinedResetTester extends BasicTester {
module.reset := RegNext(RegNext(RegNext(reset)))
- val (_, done) = Counter(!reset.toBool, 4)
+ val (_, done) = Counter(!reset.asBool, 4)
when (done) {
stop()
}
diff --git a/src/test/scala/chiselTests/MultiClockSpec.scala b/src/test/scala/chiselTests/MultiClockSpec.scala
index 778806e3..88856009 100644
--- a/src/test/scala/chiselTests/MultiClockSpec.scala
+++ b/src/test/scala/chiselTests/MultiClockSpec.scala
@@ -55,7 +55,7 @@ class MultiClockSubModuleTest extends BasicTester {
/** Test withReset changing the reset of a Reg */
class WithResetTest extends BasicTester {
val reset2 = WireInit(false.B)
- val reg = withReset(reset2 || reset.toBool) { RegInit(0.U(8.W)) }
+ val reg = withReset(reset2 || reset.asBool) { RegInit(0.U(8.W)) }
reg := reg + 1.U
val (cycle, done) = Counter(true.B, 10)
diff --git a/src/test/scala/chiselTests/UIntOps.scala b/src/test/scala/chiselTests/UIntOps.scala
index d583c0bb..e5ab706f 100644
--- a/src/test/scala/chiselTests/UIntOps.scala
+++ b/src/test/scala/chiselTests/UIntOps.scala
@@ -80,7 +80,7 @@ class GoodBoolConversion extends Module {
val u = Input(UInt(1.W))
val b = Output(Bool())
})
- io.b := io.u.toBool
+ io.b := io.u.asBool
}
class BadBoolConversion extends Module {
@@ -88,7 +88,7 @@ class BadBoolConversion extends Module {
val u = Input(UInt(5.W))
val b = Output(Bool())
})
- io.b := io.u.toBool
+ io.b := io.u.asBool
}
class NegativeShift(t: => Bits) extends Module {
@@ -139,5 +139,15 @@ class UIntOpsSpec extends ChiselPropSpec with Matchers {
property("Bit extraction on literals should work for all non-negative indices") {
assertTesterPasses(new UIntLitExtractTester)
}
+
+ property("asBools should support chained apply") {
+ elaborate(new Module {
+ val io = IO(new Bundle {
+ val in = Input(UInt(8.W))
+ val out = Output(Bool())
+ })
+ io.out := io.in.asBools()(2)
+ })
+ }
}
diff --git a/src/test/scala/cookbook/UInt2VecOfBool.scala b/src/test/scala/cookbook/UInt2VecOfBool.scala
index f69c483a..10250ad5 100644
--- a/src/test/scala/cookbook/UInt2VecOfBool.scala
+++ b/src/test/scala/cookbook/UInt2VecOfBool.scala
@@ -6,13 +6,13 @@ import chisel3._
/* ### How do I create a Vec of Bools from a UInt?
*
- * Use the builtin function [[chisel3.core.Bits.toBools]] to create a Scala Seq of Bool,
+ * Use the builtin function [[chisel3.core.Bits.asBools]] to create a Scala Seq of Bool,
* then wrap the resulting Seq in Vec(...)
*/
class UInt2VecOfBool extends CookbookTester(1) {
// Example
val uint = 0xc.U
- val vec = VecInit(uint.toBools)
+ val vec = VecInit(uint.asBools)
printf(p"$vec") // Vec(0, 0, 1, 1)
// Test
diff --git a/src/test/scala/examples/VendingMachineGenerator.scala b/src/test/scala/examples/VendingMachineGenerator.scala
index c222ca07..48dabacd 100644
--- a/src/test/scala/examples/VendingMachineGenerator.scala
+++ b/src/test/scala/examples/VendingMachineGenerator.scala
@@ -93,7 +93,7 @@ class ParameterizedVendingMachineTester(
val (idx, done) = Counter(true.B, testLength + 1)
when (done) { stop(); stop() } // Two stops for Verilator
- dut.io.inputs := inputVec(idx).toBools
+ dut.io.inputs := inputVec(idx).asBools
assert(dut.io.dispense === expectedVec(idx))
}