summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorRichard Lin2017-04-26 17:52:29 -0700
committerGitHub2017-04-26 17:52:29 -0700
commit36718cf6040990f2be9ab143adb1d3c519e9d983 (patch)
tree34ae121faf999bb962f5257c26de651bd08ecf04 /src/test/scala/chiselTests
parent7449fdc9043708e426aeb8b12b30226db9e47a80 (diff)
Deprecate fromBits and clock/reset constructors (#583)
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/BundleSpec.scala2
-rw-r--r--src/test/scala/chiselTests/FixedPointSpec.scala6
-rw-r--r--src/test/scala/chiselTests/FromBitsTester.scala10
-rw-r--r--src/test/scala/chiselTests/ModuleExplicitResetSpec.scala16
-rw-r--r--src/test/scala/chiselTests/RecordSpec.scala2
-rw-r--r--src/test/scala/chiselTests/ReinterpretCast.scala2
6 files changed, 11 insertions, 27 deletions
diff --git a/src/test/scala/chiselTests/BundleSpec.scala b/src/test/scala/chiselTests/BundleSpec.scala
index 0a6866d3..bb1393bc 100644
--- a/src/test/scala/chiselTests/BundleSpec.scala
+++ b/src/test/scala/chiselTests/BundleSpec.scala
@@ -43,7 +43,7 @@ trait BundleSpecUtils {
assert(uint.getWidth == 32) // elaboration time
assert(uint === "h12345678".asUInt(32.W))
// Back to Bundle
- val bundle2 = (new BundleFooBar).fromBits(uint)
+ val bundle2 = uint.asTypeOf(new BundleFooBar)
assert(0x1234.U === bundle2.foo)
assert(0x5678.U === bundle2.bar)
stop()
diff --git a/src/test/scala/chiselTests/FixedPointSpec.scala b/src/test/scala/chiselTests/FixedPointSpec.scala
index 76a89e6a..28c3aa55 100644
--- a/src/test/scala/chiselTests/FixedPointSpec.scala
+++ b/src/test/scala/chiselTests/FixedPointSpec.scala
@@ -32,9 +32,9 @@ class FixedPointFromBitsTester extends BasicTester {
val sint_result = FixedPoint.fromDouble(-1.5, 4.W, 1.BP)
val fp_result = FixedPoint.fromDouble(1.5, 4.W, 1.BP)
- val uint2fp = fp_tpe.fromBits(uint)
- val sint2fp = fp_tpe.fromBits(sint)
- val fp2fp = fp_tpe.fromBits(fp)
+ val uint2fp = uint.asTypeOf(fp_tpe)
+ val sint2fp = sint.asTypeOf(fp_tpe)
+ val fp2fp = fp.asTypeOf(fp_tpe)
val uintToFp = uint.asFixedPoint(1.BP)
val sintToFp = sint.asFixedPoint(1.BP)
diff --git a/src/test/scala/chiselTests/FromBitsTester.scala b/src/test/scala/chiselTests/FromBitsTester.scala
index 63e8afe5..39d6a4fe 100644
--- a/src/test/scala/chiselTests/FromBitsTester.scala
+++ b/src/test/scala/chiselTests/FromBitsTester.scala
@@ -19,17 +19,17 @@ class FromBitsBundleTester extends BasicTester {
val bun = new MultiTypeBundle
- val bunFromBits = bun.fromBits( ((4 << 8) + (15 << 4) + (12 << 0)).U )
+ val bunFromBits = ((4 << 8) + (15 << 4) + (12 << 0)).U.asTypeOf(bun)
assert(bunFromBits.u === 4.U)
assert(bunFromBits.s === -1.S)
- assert(bunFromBits.fp === FixedPoint.fromDouble(-0.5, width=4, binaryPoint=3))
+ assert(bunFromBits.fp === FixedPoint.fromDouble(-0.5, 4.W, 3.BP))
stop()
}
class FromBitsVecTester extends BasicTester {
- val vec = Vec(4, SInt(4.W)).fromBits( ((15 << 12) + (0 << 8) + (1 << 4) + (2 << 0)).U )
+ val vec = ((15 << 12) + (0 << 8) + (1 << 4) + (2 << 0)).U.asTypeOf(Vec(4, SInt(4.W)))
assert(vec(0) === 2.S)
assert(vec(1) === 1.S)
@@ -40,8 +40,8 @@ class FromBitsVecTester extends BasicTester {
}
class FromBitsTruncationTester extends BasicTester {
- val truncate = UInt(3.W).fromBits( (64 + 3).U )
- val expand = UInt(3.W).fromBits( 1.U )
+ val truncate = (64 + 3).U.asTypeOf(UInt(3.W))
+ val expand = 1.U.asTypeOf(UInt(3.W))
assert( DataMirror.widthOf(truncate).get == 3 )
assert( truncate === 3.U )
diff --git a/src/test/scala/chiselTests/ModuleExplicitResetSpec.scala b/src/test/scala/chiselTests/ModuleExplicitResetSpec.scala
index 27cf4a5f..af2db95f 100644
--- a/src/test/scala/chiselTests/ModuleExplicitResetSpec.scala
+++ b/src/test/scala/chiselTests/ModuleExplicitResetSpec.scala
@@ -19,20 +19,4 @@ class ModuleExplicitResetSpec extends ChiselFlatSpec {
new ModuleExplicitReset(myReset)
}
}
-
- "A Module with an explicit reset in non-compatibility mode" should "elaborate" in {
- import chisel3._
- val myReset = true.B
- class ModuleExplicitReset(reset: Bool) extends Module(_reset = reset) {
- val io = IO(new Bundle {
- val done = Output(Bool())
- })
-
- io.done := false.B
- }
-
- elaborate {
- new ModuleExplicitReset(myReset)
- }
- }
}
diff --git a/src/test/scala/chiselTests/RecordSpec.scala b/src/test/scala/chiselTests/RecordSpec.scala
index 3a2b3910..3358d506 100644
--- a/src/test/scala/chiselTests/RecordSpec.scala
+++ b/src/test/scala/chiselTests/RecordSpec.scala
@@ -45,7 +45,7 @@ trait RecordSpecUtils {
assert(uint.getWidth == 32) // elaboration time
assert(uint === "hbeefdead".U)
// Back to Record
- val record2 = recordType.fromBits(uint)
+ val record2 = uint.asTypeOf(recordType)
assert("hdead".U === record2("fizz").asUInt)
assert("hbeef".U === record2("buzz").asUInt)
stop()
diff --git a/src/test/scala/chiselTests/ReinterpretCast.scala b/src/test/scala/chiselTests/ReinterpretCast.scala
index d4aecbe1..cd0d1fa9 100644
--- a/src/test/scala/chiselTests/ReinterpretCast.scala
+++ b/src/test/scala/chiselTests/ReinterpretCast.scala
@@ -22,7 +22,7 @@ class AsBundleTester extends BasicTester {
assert(bunFromBits.u === 4.U)
assert(bunFromBits.s === -1.S)
- assert(bunFromBits.fp === FixedPoint.fromDouble(-0.5, width=4, binaryPoint=3))
+ assert(bunFromBits.fp === FixedPoint.fromDouble(-0.5, 4.W, 3.BP))
stop()
}