diff options
| author | mergify[bot] | 2022-08-12 20:56:42 +0000 |
|---|---|---|
| committer | GitHub | 2022-08-12 20:56:42 +0000 |
| commit | d344e8a91bdbfedc28527c3fc7d6d243dff9e3e6 (patch) | |
| tree | 003d9475527f1f0ce193accfb0cda16f6b638c2d /src | |
| parent | 7bad3d2ec316f24f3da79d1dfef19e128cfe8bf5 (diff) | |
Show equivalent warnings/errors only once (#2673) (#2675)
(cherry picked from commit ae76ff4cb303a6646e48dc044be47051b67e7cbb)
Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/WarningSpec.scala | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/WarningSpec.scala b/src/test/scala/chiselTests/WarningSpec.scala new file mode 100644 index 00000000..bf3830d6 --- /dev/null +++ b/src/test/scala/chiselTests/WarningSpec.scala @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: Apache-2.0 + +package chiselTests + +import chisel3._ +import chisel3.util._ +import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage} +import chisel3.experimental.ChiselEnum +import chisel3.experimental.EnumType +import chiselTests.ChiselFlatSpec + +class WarningSpec extends ChiselFlatSpec with Utils { + behavior.of("Warnings") + + "Warnings" should "be de-duplicated" in { + object MyEnum extends ChiselEnum { + val e0, e1, e2 = Value + } + + class MyModule extends Module { + val in = IO(Input(UInt(2.W))) + val out1 = IO(Output(MyEnum())) + val out2 = IO(Output(MyEnum())) + def func(out: EnumType): Unit = { + out := MyEnum(in) + } + func(out1) + func(out2) + } + val (log, _) = grabLog(ChiselStage.elaborate(new MyModule)) + def countSubstring(s: String, sub: String) = + s.sliding(sub.length).count(_ == sub) + countSubstring(log, "Casting non-literal UInt") should be(1) + } +} |
