diff options
| author | Albert Magyar | 2020-03-16 11:22:04 -0700 |
|---|---|---|
| committer | GitHub | 2020-03-16 11:22:04 -0700 |
| commit | d0500b33167cad060a9325d68b939d41279f6c9c (patch) | |
| tree | 19e29be01e09822c44473d3184277ed24b3158f9 /src/test/scala/firrtlTests | |
| parent | 44f0112c7a9d9e9fa7f87fa6e5f68916e76a3b19 (diff) | |
| parent | e41936d5283ba8caae2a23602e8e1a2baea391cb (diff) | |
Merge pull request #1437 from freechipsproject/name-conflicts
Check for name collisions of Modules
Diffstat (limited to 'src/test/scala/firrtlTests')
| -rw-r--r-- | src/test/scala/firrtlTests/CheckSpec.scala | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala index 9a384d21..aa154bab 100644 --- a/src/test/scala/firrtlTests/CheckSpec.scala +++ b/src/test/scala/firrtlTests/CheckSpec.scala @@ -307,6 +307,49 @@ class CheckSpec extends FlatSpec with Matchers { } } } + + s"Duplicate module names" should "throw an exception" in { + val input = + s"""|circuit bar : + | module bar : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | module dup : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | module dup : + | input i : UInt<8> + | output o : UInt<8> + | o <= not(i) + |""".stripMargin + assertThrows[CheckHighForm.ModuleNameNotUniqueException] { + try { + checkHighInput(input) + } catch { + case e: firrtl.passes.PassExceptions => throw e.exceptions.head + } + } + } + + s"Defnames that conflict with pure-FIRRTL module names" should "throw an exception" in { + val input = + s"""|circuit bar : + | module bar : + | input i : UInt<8> + | output o : UInt<8> + | o <= i + | extmodule dup : + | input i : UInt<8> + | output o : UInt<8> + | defname = bar + |""".stripMargin + assertThrows[CheckHighForm.DefnameConflictException] { + checkHighInput(input) + } + } + } object CheckSpec { |
