diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/chiselTests/BitwiseOps.scala | 8 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Counter.scala | 6 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/MulLookup.scala | 6 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Stack.scala | 2 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Tbl.scala | 4 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/TesterDriverSpec.scala | 2 | ||||
| -rw-r--r-- | src/test/scala/chiselTests/Vec.scala | 8 |
7 files changed, 18 insertions, 18 deletions
diff --git a/src/test/scala/chiselTests/BitwiseOps.scala b/src/test/scala/chiselTests/BitwiseOps.scala index b8efaccf..1292222c 100644 --- a/src/test/scala/chiselTests/BitwiseOps.scala +++ b/src/test/scala/chiselTests/BitwiseOps.scala @@ -11,10 +11,10 @@ class BitwiseOpsTester(w: Int, _a: Int, _b: Int) extends BasicTester { val mask = (1 << w) - 1 val a = _a.asUInt(w.W) val b = _b.asUInt(w.W) - assert(~a === UInt(mask & ~_a)) - assert((a & b) === UInt(_a & _b)) - assert((a | b) === UInt(_a | _b)) - assert((a ^ b) === UInt(_a ^ _b)) + assert(~a === (mask & ~_a).asUInt) + assert((a & b) === (_a & _b).asUInt) + assert((a | b) === (_a | _b).asUInt) + assert((a ^ b) === (_a ^ _b).asUInt) stop() } diff --git a/src/test/scala/chiselTests/Counter.scala b/src/test/scala/chiselTests/Counter.scala index cccd8c0e..55c07772 100644 --- a/src/test/scala/chiselTests/Counter.scala +++ b/src/test/scala/chiselTests/Counter.scala @@ -12,7 +12,7 @@ import chisel3.util._ class CountTester(max: Int) extends BasicTester { val cnt = Counter(max) when(true.B) { cnt.inc() } - when(cnt.value === UInt(max-1)) { + when(cnt.value === (max-1).asUInt) { stop() } } @@ -25,7 +25,7 @@ class EnableTester(seed: Int) extends BasicTester { val (_, done) = Counter(true.B, 33) when(done) { - assert(cntEnVal === UInt(popCount(seed))) + assert(cntEnVal === popCount(seed).asUInt) stop() } } @@ -33,7 +33,7 @@ class EnableTester(seed: Int) extends BasicTester { class WrapTester(max: Int) extends BasicTester { val (cnt, wrap) = Counter(true.B, max) when(wrap) { - assert(cnt === UInt(max - 1)) + assert(cnt === (max - 1).asUInt) stop() } } diff --git a/src/test/scala/chiselTests/MulLookup.scala b/src/test/scala/chiselTests/MulLookup.scala index f0b2aa21..936f3a45 100644 --- a/src/test/scala/chiselTests/MulLookup.scala +++ b/src/test/scala/chiselTests/MulLookup.scala @@ -11,13 +11,13 @@ class MulLookup(val w: Int) extends Module { val io = IO(new Bundle { val x = Input(UInt(w.W)) val y = Input(UInt(w.W)) - val z = Output(UInt.width(2 * w)) + val z = Output(UInt((2 * w).W)) }) val tbl = Vec( for { i <- 0 until 1 << w j <- 0 until 1 << w - } yield UInt(i * j, 2 * w) + } yield (i * j).asUInt((2 * w).W) ) io.z := tbl(((io.x << w) | io.y)) } @@ -26,7 +26,7 @@ class MulLookupTester(w: Int, x: Int, y: Int) extends BasicTester { val dut = Module(new MulLookup(w)) dut.io.x := x.asUInt dut.io.y := y.asUInt - assert(dut.io.z === UInt(x * y)) + assert(dut.io.z === (x * y).asUInt) stop() } diff --git a/src/test/scala/chiselTests/Stack.scala b/src/test/scala/chiselTests/Stack.scala index ce8fd9fc..58a05937 100644 --- a/src/test/scala/chiselTests/Stack.scala +++ b/src/test/scala/chiselTests/Stack.scala @@ -17,7 +17,7 @@ class ChiselStack(val depth: Int) extends Module { }) val stack_mem = Mem(depth, UInt(32.W)) - val sp = Reg(init = UInt(0, width = log2Up(depth + 1))) + val sp = Reg(init = 0.U(log2Up(depth+1).W)) val out = Reg(init = 0.U(32.W)) when (io.en) { diff --git a/src/test/scala/chiselTests/Tbl.scala b/src/test/scala/chiselTests/Tbl.scala index ccfba499..03b08709 100644 --- a/src/test/scala/chiselTests/Tbl.scala +++ b/src/test/scala/chiselTests/Tbl.scala @@ -11,8 +11,8 @@ import chisel3.util._ class Tbl(w: Int, n: Int) extends Module { val io = IO(new Bundle { - val wi = Input(UInt.width(log2Up(n))) - val ri = Input(UInt.width(log2Up(n))) + val wi = Input(UInt(log2Up(n).W)) + val ri = Input(UInt(log2Up(n).W)) val we = Input(Bool()) val d = Input(UInt(w.W)) val o = Output(UInt(w.W)) diff --git a/src/test/scala/chiselTests/TesterDriverSpec.scala b/src/test/scala/chiselTests/TesterDriverSpec.scala index c0d64a43..e32368e9 100644 --- a/src/test/scala/chiselTests/TesterDriverSpec.scala +++ b/src/test/scala/chiselTests/TesterDriverSpec.scala @@ -21,7 +21,7 @@ class FinishTester extends BasicTester { stop() } - val test_wire = Wire(init=UInt(1, test_wire_width)) + val test_wire = Wire(init=1.U(test_wire_width.W)) // though we just set test_wire to 1, the assert below will pass because // the finish will change its value diff --git a/src/test/scala/chiselTests/Vec.scala b/src/test/scala/chiselTests/Vec.scala index c621c1e1..4822d892 100644 --- a/src/test/scala/chiselTests/Vec.scala +++ b/src/test/scala/chiselTests/Vec.scala @@ -19,9 +19,9 @@ class ValueTester(w: Int, values: List[Int]) extends BasicTester { } class TabulateTester(n: Int) extends BasicTester { - val v = Vec(Range(0, n).map(i => UInt(i * 2))) - val x = Vec(Array.tabulate(n){ i => UInt(i * 2) }) - val u = Vec.tabulate(n)(i => UInt(i*2)) + val v = Vec(Range(0, n).map(i => (i*2).asUInt)) + val x = Vec(Array.tabulate(n){ i => (i*2).asUInt }) + val u = Vec.tabulate(n)(i => (i*2).asUInt) assert(v.asUInt() === x.asUInt()) assert(v.asUInt() === u.asUInt()) @@ -32,7 +32,7 @@ class TabulateTester(n: Int) extends BasicTester { class ShiftRegisterTester(n: Int) extends BasicTester { val (cnt, wrap) = Counter(true.B, n*2) - val shifter = Reg(Vec(n, UInt.width(log2Up(n)))) + val shifter = Reg(Vec(n, UInt(log2Up(n).W))) (shifter, shifter drop 1).zipped.foreach(_ := _) shifter(n-1) := cnt when (cnt >= n.asUInt) { |
