summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/MultiAssign.scala
diff options
context:
space:
mode:
authorJim Lawson2016-08-18 12:35:34 -0700
committerJim Lawson2016-08-18 12:35:34 -0700
commitd18274e307271809db2c27676f1dca40a49c9627 (patch)
tree2632a0e409bea3f9069c5ebfb555cc1ec04caa4f /src/test/scala/chiselTests/MultiAssign.scala
parentddb7278760029be9d960ba8bf2b06ac8a8aac767 (diff)
parent7922f8d4998dd902ee18a6e85e4a404a1f29eb3f (diff)
Merge branch 'sdtwigg_connectwrap_renamechisel3' into gsdt_tests
Revive support for firrtl flip direction. Remove compileOptions.internalConnectionToInputOk
Diffstat (limited to 'src/test/scala/chiselTests/MultiAssign.scala')
-rw-r--r--src/test/scala/chiselTests/MultiAssign.scala25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/test/scala/chiselTests/MultiAssign.scala b/src/test/scala/chiselTests/MultiAssign.scala
index c22a5e30..fa4c4898 100644
--- a/src/test/scala/chiselTests/MultiAssign.scala
+++ b/src/test/scala/chiselTests/MultiAssign.scala
@@ -11,30 +11,35 @@ import chisel3.util._
class LastAssignTester() extends BasicTester {
val cnt = Counter(2)
- val test = Wire(UInt(width=4))
- assert(test === UInt(7)) // allow read references before assign references
+ val test = Wire(UInt.width(4))
+ assert(test === 7.U) // allow read references before assign references
- test := UInt(13)
- assert(test === UInt(7)) // output value should be position-independent
+ test := 13.U
+ assert(test === 7.U) // output value should be position-independent
- test := UInt(7)
- assert(test === UInt(7)) // this obviously should work
+ test := 7.U
+ assert(test === 7.U) // this obviously should work
- when(cnt.value === UInt(1)) {
+ when(cnt.value === 1.U) {
stop()
}
}
class ReassignmentTester() extends BasicTester {
- val test = UInt(15)
- test := UInt(7)
+ val test = 15.U
+ test := 7.U
}
class MultiAssignSpec extends ChiselFlatSpec {
"The last assignment" should "be used when multiple assignments happen" in {
assertTesterPasses{ new LastAssignTester }
}
+}
+
+class IllegalAssignSpec extends ChiselFlatSpec {
"Reassignments to non-wire types" should "be disallowed" in {
- assertTesterFails{ new ReassignmentTester }
+ intercept[chisel3.internal.ChiselException] {
+ assertTesterFails{ new ReassignmentTester }
+ }
}
}