From f8cffe757064de9822dd42e7285ee0f71f3d6d4c Mon Sep 17 00:00:00 2001 From: Aditya Naik Date: Mon, 14 Feb 2022 16:32:51 -0800 Subject: [PATCH] More sanitization tests --- .../experimental/hierarchy/InstanceSpec.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala b/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala index 3a19d439345..0a0e703675a 100644 --- a/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala +++ b/src/test/scala/chiselTests/experimental/hierarchy/InstanceSpec.scala @@ -1229,7 +1229,7 @@ class InstanceSpec extends ChiselFunSpec with Utils { val (chirrtl, _) = getFirrtlAndAnnos(new Top) chirrtl.serialize should include("inst potato of AddOne") } - it("11.2 suggestName with sanitization") { + it("11.3 suggestName with sanitization") { class Top extends Module { val definition = Definition(new AddOne) val inst0 = Instance(definition) @@ -1241,4 +1241,13 @@ class InstanceSpec extends ChiselFunSpec with Utils { chirrtl.serialize should include("inst potato of AddOne") chirrtl.serialize should include("inst potato_1 of AddOne") } + it("11.4 suggestName with multi-def collision sanitization") { + class Top extends Module { + val inst0 = Module(new AddOne()).suggestName("potato") + val inst1 = Instance(Definition(new AddOne)).suggestName("potato") + } + val (chirrtl, _) = getFirrtlAndAnnos(new Top) + chirrtl.serialize should include("inst potato of AddOne") + chirrtl.serialize should include("inst potato_1 of AddOne_1") + } }