summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/SwitchSpec.scala
diff options
context:
space:
mode:
authorDaniel Kasza2020-11-16 14:21:01 -0500
committerGitHub2020-11-16 14:21:01 -0500
commit87916d55490ff04691bc59454086c82ed09646b2 (patch)
treea0f2a95adbff6016af74717bf240e810ae738606 /src/test/scala/chiselTests/SwitchSpec.scala
parente6192ea75ce0d840b4b51a376921c2feecaa3b46 (diff)
Improve source locators for switch statements. (#1669)
* Improve source locators for switch statements.
Diffstat (limited to 'src/test/scala/chiselTests/SwitchSpec.scala')
-rw-r--r--src/test/scala/chiselTests/SwitchSpec.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/SwitchSpec.scala b/src/test/scala/chiselTests/SwitchSpec.scala
index 78e5d59e..12bbb9e7 100644
--- a/src/test/scala/chiselTests/SwitchSpec.scala
+++ b/src/test/scala/chiselTests/SwitchSpec.scala
@@ -32,4 +32,22 @@ class SwitchSpec extends ChiselFlatSpec with Utils {
})
}
}
+ it should "provide useful source locators" in {
+ val chirrtl = ChiselStage.emitChirrtl(new Module {
+ val io = IO(new Bundle {
+ val in = Input(UInt(2.W))
+ val out = Output(UInt(2.W))
+ })
+
+ io.out := 0.U
+ switch (io.in) {
+ is (0.U) { io.out := 3.U }
+ is (1.U) { io.out := 0.U }
+ is (2.U) { io.out := 1.U }
+ is (3.U) { io.out := 3.U }
+ }
+ })
+
+ chirrtl should not include "Conditional.scala"
+ }
}