diff --git a/compiler/base/hierarchy_layout.py b/compiler/base/hierarchy_layout.py index 532b0f7d..4fd42635 100644 --- a/compiler/base/hierarchy_layout.py +++ b/compiler/base/hierarchy_layout.py @@ -236,7 +236,7 @@ class layout(): # This is commented out for runtime reasons # debug.info(4, "instance list: " + ",".join(x.name for x in self.insts)) return self.insts[-1] - + def get_inst(self, name): """ Retrieve an instance by name """ for inst in self.insts: @@ -244,6 +244,19 @@ class layout(): return inst return None + def add_flat_inst(self, name, mod, offset=[0, 0]): + """ Copies all of the items in instance into this module """ + for item in mod.objs: + item.offset += offset + self.objs.append(item) + for item in mod.insts: + item.offset += offset + self.insts.append(item) + debug.check(len(item.mod.pins) == 0, "Cannot add flat instance with subinstances.") + self.connect_inst([]) + debug.info(3, "adding flat instance {}".format(name)) + return None + def add_rect(self, layer, offset, width=None, height=None): """ Adds a rectangle on a given layer,offset with width and height @@ -1078,18 +1091,24 @@ class layout(): """ import channel_route cr = channel_route.channel_route(netlist, offset, layer_stack, directions, vertical=True, parent=self) - self.add_inst(cr.name, cr) - self.connect_inst([]) - + # This causes problem in magic since it sometimes cannot extract connectivity of isntances + # with no active devices. + # self.add_inst(cr.name, cr) + # self.connect_inst([]) + self.add_flat_inst(cr.name, cr) + def create_horizontal_channel_route(self, netlist, offset, layer_stack, directions=None): """ Wrapper to create a horizontal channel route """ import channel_route cr = channel_route.channel_route(netlist, offset, layer_stack, directions, vertical=False, parent=self) - self.add_inst(cr.name, cr) - self.connect_inst([]) - + # This causes problem in magic since it sometimes cannot extract connectivity of isntances + # with no active devices. + # self.add_inst(cr.name, cr) + # self.connect_inst([]) + self.add_flat_inst(cr.name, cr) + def add_boundary(self, ll=vector(0, 0), ur=None): """ Add boundary for debugging dimensions """ if OPTS.netlist_only: diff --git a/compiler/sram/sram_1bank.py b/compiler/sram/sram_1bank.py index 55ea7527..c8dd7601 100644 --- a/compiler/sram/sram_1bank.py +++ b/compiler/sram/sram_1bank.py @@ -414,8 +414,11 @@ class sram_1bank(sram_base): layer_stack=self.m1_stack, parent=self) if add_routes: - self.add_inst(cr.name, cr) - self.connect_inst([]) + # This causes problem in magic since it sometimes cannot extract connectivity of isntances + # with no active devices. + # self.add_inst(cr.name, cr) + # self.connect_inst([]) + self.add_flat_inst(cr.name, cr) else: self.col_addr_bus_size[port] = cr.height