summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/MultiAssign.scala
diff options
context:
space:
mode:
authorJim Lawson2016-09-30 12:13:58 -0700
committerGitHub2016-09-30 12:13:58 -0700
commitdb25e8180a53fb8f4912fd37b7a613e15a01564f (patch)
tree8bb5597746002ac98641f394cee4c94e1d154aff /src/test/scala/chiselTests/MultiAssign.scala
parent785620b1403d827986bf60c2a001d8d6f71eed72 (diff)
parent6edbdf279257d656b5eac38d9de8645a068611bf (diff)
Merge pull request #265 from ucb-bar/gsdt
Gsdt - Fixup to Chisel connections and direction - PR 200 revisited.
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 }
+ }
}
}