From 0111620c918f7d6227a36988d285b1036e497c76 Mon Sep 17 00:00:00 2001 From: Jesse Cirimelli-Low Date: Fri, 11 Aug 2023 13:45:24 -0700 Subject: [PATCH] deepcopy overide for instance --- compiler/base/geometry.py | 10 +++++++++- compiler/base/hierarchy_layout.py | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/base/geometry.py b/compiler/base/geometry.py index 0f26f02e..e8589266 100644 --- a/compiler/base/geometry.py +++ b/compiler/base/geometry.py @@ -200,9 +200,17 @@ class instance(geometry): self.width = round_to_grid(mod.width) self.height = round_to_grid(mod.height) self.compute_boundary(offset, mirror, rotate) - debug.info(4, "creating instance: " + self.name) + def __deepcopy__(original, memo): + new_inst = instance(original.name+"_copy", original.mod) + new_inst.rotate = original.rotate + new_inst.offset = original.offset + new_inst.mirror = original.mirror + new_inst.is_bitcell = original.is_bitcell + return new_inst + + def get_blockages(self, lpp, top=False): """ Retrieve blockages of all modules in this instance. Apply the transform of the instance placement to give absolute blockages.""" diff --git a/compiler/base/hierarchy_layout.py b/compiler/base/hierarchy_layout.py index 7965f87c..2b636d47 100644 --- a/compiler/base/hierarchy_layout.py +++ b/compiler/base/hierarchy_layout.py @@ -479,7 +479,6 @@ class layout(): def add_existing_inst(self, inst, name): new_inst = deepcopy(inst) - new_inst.mod = inst.mod self.mods.add(new_inst.mod) if name: new_inst.name = name