diff --git a/compiler/base/contact.py b/compiler/base/contact.py index db415179..f5cfcb0b 100644 --- a/compiler/base/contact.py +++ b/compiler/base/contact.py @@ -16,7 +16,9 @@ class contact(hierarchy_design.hierarchy_design): hierarchy as the contact. """ - def __init__(self, layer_stack, dimensions=[1,1], implant_type=None, well_type=None): + def __init__(self, layer_stack, dimensions=[1,1], implant_type=None, well_type=None, name=""): + # This will ignore the name parameter since we can guarantee a unique name here + if implant_type or well_type: name = "{0}_{1}_{2}_{3}x{4}_{5}{6}".format(layer_stack[0], layer_stack[1], @@ -164,13 +166,13 @@ class contact(hierarchy_design.hierarchy_design): """ Get total power of a module """ return self.return_power() - +from sram_factory import factory # This is not instantiated and used for calculations only. # These are static 1x1 contacts to reuse in all the design modules. -well = contact(layer_stack=("active", "contact", "metal1")) -active = contact(layer_stack=("active", "contact", "poly")) -poly = contact(layer_stack=("poly", "contact", "metal1")) -m1m2 = contact(layer_stack=("metal1", "via1", "metal2")) -m2m3 = contact(layer_stack=("metal2", "via2", "metal3")) -m3m4 = contact(layer_stack=("metal3", "via3", "metal4")) +well = factory.create(module_type="contact", layer_stack=("active", "contact", "metal1")) +active = factory.create(module_type="contact", layer_stack=("active", "contact", "poly")) +poly = factory.create(module_type="contact", layer_stack=("poly", "contact", "metal1")) +m1m2 = factory.create(module_type="contact", layer_stack=("metal1", "via1", "metal2")) +m2m3 = factory.create(module_type="contact", layer_stack=("metal2", "via2", "metal3")) +m3m4 = factory.create(module_type="contact", layer_stack=("metal3", "via3", "metal4")) diff --git a/compiler/base/hierarchy_layout.py b/compiler/base/hierarchy_layout.py index c35f0709..60a596bb 100644 --- a/compiler/base/hierarchy_layout.py +++ b/compiler/base/hierarchy_layout.py @@ -378,11 +378,12 @@ class layout(): def add_via(self, layers, offset, size=[1,1], mirror="R0", rotate=0, implant_type=None, well_type=None): """ Add a three layer via structure. """ - import contact - via = contact.contact(layer_stack=layers, - dimensions=size, - implant_type=implant_type, - well_type=well_type) + from sram_factory import factory + via = factory.create(module_type="contact", + layer_stack=layers, + dimensions=size, + implant_type=implant_type, + well_type=well_type) self.add_mod(via) inst=self.add_inst(name=via.name, mod=via, @@ -395,11 +396,12 @@ class layout(): def add_via_center(self, layers, offset, size=[1,1], mirror="R0", rotate=0, implant_type=None, well_type=None): """ Add a three layer via structure by the center coordinate accounting for mirroring and rotation. """ - import contact - via = contact.contact(layer_stack=layers, - dimensions=size, - implant_type=implant_type, - well_type=well_type) + from sram_factory import factory + via = factory.create(module_type="contact", + layer_stack=layers, + dimensions=size, + implant_type=implant_type, + well_type=well_type) height = via.height width = via.width debug.check(mirror=="R0","Use rotate to rotate vias instead of mirror.") @@ -1039,9 +1041,11 @@ class layout(): # Find the number of vias for this pitch self.supply_vias = 1 - import contact + from sram_factory import factory while True: - c=contact.contact(("metal1","via1","metal2"), (self.supply_vias, self.supply_vias)) + c=factory.create(module_type="contact", + layer_stack=("metal1","via1","metal2"), + dimensions=(self.supply_vias, self.supply_vias)) if c.second_layer_width < self.supply_rail_width and c.second_layer_height < self.supply_rail_width: self.supply_vias += 1 else: diff --git a/compiler/base/route.py b/compiler/base/route.py index 09925e07..c6ce906b 100644 --- a/compiler/base/route.py +++ b/compiler/base/route.py @@ -1,10 +1,10 @@ from tech import drc import debug from design import design -from contact import contact from itertools import tee from vector import vector from vector3d import vector3d +from sram_factory import factory class route(design): """ @@ -45,7 +45,9 @@ class route(design): self.horiz_layer_width = drc("minwidth_{0}".format(self.horiz_layer_name)) # offset this by 1/2 the via size - self.c=contact(self.layer_stack, (self.num_vias, self.num_vias)) + self.c=factory.create(module_type="contact", + layer_stack=self.layer_stack, + dimensions=(self.num_vias, self.num_vias)) def create_wires(self): diff --git a/compiler/base/wire.py b/compiler/base/wire.py index 1565d10e..8500e502 100644 --- a/compiler/base/wire.py +++ b/compiler/base/wire.py @@ -1,7 +1,7 @@ from tech import drc import debug -from contact import contact from path import path +from sram_factory import factory class wire(path): """ @@ -37,15 +37,18 @@ class wire(path): self.horiz_layer_name = horiz_layer self.horiz_layer_width = drc("minwidth_{0}".format(horiz_layer)) - via_connect = contact(self.layer_stack, - (1, 1)) + via_connect = factory.create(module_type="contact", + layer_stack=self.layer_stack, + dimensions=(1, 1)) self.node_to_node = [drc("minwidth_" + str(self.horiz_layer_name)) + via_connect.width, drc("minwidth_" + str(self.horiz_layer_name)) + via_connect.height] # create a 1x1 contact def create_vias(self): """ Add a via and corner square at every corner of the path.""" - self.c=contact(self.layer_stack, (1, 1)) + self.c=factory.create(module_type="contact", + layer_stack=self.layer_stack, + dimensions=(1, 1)) c_width = self.c.width c_height = self.c.height diff --git a/compiler/options.py b/compiler/options.py index d1a9d7d8..fc1eb7d1 100644 --- a/compiler/options.py +++ b/compiler/options.py @@ -82,6 +82,7 @@ class options(optparse.Values): dff_array = "dff_array" dff = "dff" precharge_array = "precharge_array" + ptx = "ptx" replica_bitcell = "replica_bitcell" replica_bitline = "replica_bitline" sense_amp_array = "sense_amp_array" diff --git a/compiler/pgates/pnor2.py b/compiler/pgates/pnor2.py index b28d4cd1..93a0fd36 100644 --- a/compiler/pgates/pnor2.py +++ b/compiler/pgates/pnor2.py @@ -1,9 +1,9 @@ -import contact import pgate import debug from tech import drc, parameter, spice from vector import vector from globals import OPTS +import contact from sram_factory import factory class pnor2(pgate.pgate): @@ -72,15 +72,11 @@ class pnor2(pgate.pgate): def setup_layout_constants(self): """ Pre-compute some handy layout parameters. """ - poly_contact = contact.contact(("poly","contact","metal1")) - m1m2_via = contact.contact(("metal1","via1","metal2")) - m2m3_via = contact.contact(("metal2","via2","metal3")) - # metal spacing to allow contacts on any layer - self.input_spacing = max(self.poly_space + poly_contact.first_layer_width, - self.m1_space + m1m2_via.first_layer_width, - self.m2_space + m2m3_via.first_layer_width, - self.m3_space + m2m3_via.second_layer_width) + self.input_spacing = max(self.poly_space + contact.poly.first_layer_width, + self.m1_space + contact.m1m2.first_layer_width, + self.m2_space + contact.m2m3.first_layer_width, + self.m3_space + contact.m2m3.second_layer_width) # Compute the other pmos2 location, but determining offset to overlap the # source and drain pins diff --git a/compiler/pgates/ptx.py b/compiler/pgates/ptx.py index 6c81aaee..3d7ce296 100644 --- a/compiler/pgates/ptx.py +++ b/compiler/pgates/ptx.py @@ -2,9 +2,9 @@ import design import debug from tech import drc, spice from vector import vector -from contact import contact from globals import OPTS import path +from sram_factory import factory class ptx(design.design): """ @@ -97,8 +97,9 @@ class ptx(design.design): # This is not actually instantiated but used for calculations - self.active_contact = contact(layer_stack=("active", "contact", "metal1"), - dimensions=(1, self.num_contacts)) + self.active_contact = factory.create(module_type="contact", + layer_stack=("active", "contact", "metal1"), + dimensions=(1, self.num_contacts)) # The contacted poly pitch (or uncontacted in an odd technology)