From 87916d55490ff04691bc59454086c82ed09646b2 Mon Sep 17 00:00:00 2001 From: Daniel Kasza Date: Mon, 16 Nov 2020 14:21:01 -0500 Subject: Improve source locators for switch statements. (#1669) * Improve source locators for switch statements.--- src/test/scala/chiselTests/SwitchSpec.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/test') 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" + } } -- cgit v1.2.3