From bd125e2ed30a9e471eefe679dda1d45c9a0854e5 Mon Sep 17 00:00:00 2001 From: mrg Date: Thu, 1 Oct 2020 07:17:16 -0700 Subject: [PATCH] Check for duplicate instance names. --- compiler/base/hierarchy_layout.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/base/hierarchy_layout.py b/compiler/base/hierarchy_layout.py index 0cbe6e8c..b565e424 100644 --- a/compiler/base/hierarchy_layout.py +++ b/compiler/base/hierarchy_layout.py @@ -211,6 +211,12 @@ class layout(): def add_inst(self, name, mod, offset=[0, 0], mirror="R0", rotate=0): """ Adds an instance of a mod to this module """ + # Contacts are not really instances, so skip them + if "contact" not in mod.name: + # Check that the instance name is unique + for inst in self.insts: + debug.check(name != inst.name, "Duplicate named instance in {0}: {1}".format(self.name, name)) + self.insts.append(geometry.instance(name, mod, offset, mirror, rotate)) debug.info(3, "adding instance {}".format(self.insts[-1])) # This is commented out for runtime reasons