Example #1
0
    def create_modules(self):
        """ create module """
        self.replica_bitcell = self.mod_replica_bitcell()
        self.add_mod(self.replica_bitcell)

        # This is the replica bitline load column that is the same height as our array
        self.bitline_load = bitcell_array(name="bitline_load",
                                          cols=1,
                                          rows=self.rows)
        self.add_mod(self.bitline_load)

        # FIXME: This just creates 3 1x inverters
        self.delay_chain = self.mod_delay_chain("delay_chain", [1, 1, 1])
        self.add_mod(self.delay_chain)

        self.inv = pinv(name="RBL_inv", nmos_width=drc["minwidth_tx"])
        self.add_mod(self.inv)

        # These aren't for instantiating, but we use them to get the dimensions
        self.poly_contact = contact(layer_stack=("poly", "contact", "metal1"))
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        self.m2m3_via = contact(layer_stack=("metal2", "via2", "metal3"))

        self.nor = nor_2(name="replica_bitline_nor2",
                         nmos_width=drc["minwidth_tx"])
        self.add_mod(self.nor)

        self.access_tx = ptx(width=drc["minwidth_tx"], mults=1, tx_type="pmos")
        self.add_mod(self.access_tx)
def main():
    src = img_read()

    print("name: {}\n".format(src.name))

    # img_show('-FACE-    continue = (Press eny key)', cv.resize(src.img, (540, 720)))

    # 中心判定
    detection(src)

    # 調節
    adjustment(src)

    # コンタクト貼り付け
    contact(src)

    key = img_show(
        '-RESULT-    save = (Press < s >),  end = (Press other key)',
        cv.resize(src.result, (540, 720)))

    if key == ord('s') or key == ord('S'):
        cv.imwrite("result_" + src.name + ".jpg", src.result)
        print("\n保存しました")

    cv.destroyAllWindows()
Example #3
0
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))
        OPTS.check_lvsdrc = False

        import contact

        for layer_stack in [("poly", "contact", "metal1"),
                            ("metal1", "via1", "metal2")]:
            stack_name = ":".join(map(str, layer_stack))

            # Check single 1 x 1 contact"
            debug.info(2, "1 x 1 {} test".format(stack_name))
            c = contact.contact(layer_stack, (1, 1))
            self.local_check(c)

            # check vertical array with one in the middle and two ends
            debug.info(2, "1 x 3 {} test".format(stack_name))
            c = contact.contact(layer_stack, (1, 3))
            self.local_check(c)

            # check horizontal array with one in the middle and two ends
            debug.info(2, "3 x 1 {} test".format(stack_name))
            c = contact.contact(layer_stack, (3, 1))
            self.local_check(c)

            # check 3x3 array for all possible neighbors
            debug.info(2, "3 x 3 {} test".format(stack_name))
            c = contact.contact(layer_stack, (3, 3))
            self.local_check(c)

        OPTS.check_lvsdrc = True
        globals.end_openram()
Example #4
0
    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)

        # Compute the other pmos2 location, but determining offset to overlap the
        # source and drain pins
        self.overlap_offset = self.pmos.get_pin("D").ll() - self.pmos.get_pin(
            "S").ll()

        # Two PMOS devices and a well contact. Separation between each.
        # Enclosure space on the sides.
        self.well_width = 2*self.pmos.active_width + self.pmos.active_contact.width \
                          + 2*drc["active_to_body_active"] + 2*drc["well_enclosure_active"]

        self.width = self.well_width
        # Height is an input parameter, so it is not recomputed.

        # This is the extra space needed to ensure DRC rules to the active contacts
        extra_contact_space = max(-self.nmos.get_pin("D").by(), 0)
        # This is a poly-to-poly of a flipped cell
        self.top_bottom_space = max(
            0.5 * self.m1_width + self.m1_space + extra_contact_space,
            drc["poly_extend_active"], self.poly_space)
Example #5
0
    def create_layout(self):
        """Calls all functions related to the generation of the layout(gds)"""

        # These aren't for instantiating, but we use them to get the dimensions
        self.poly_contact = contact.contact(("poly", "contact", "metal1"))
        self.m1m2_via = contact.contact(("metal1", "via1", "metal2"))

        self.determine_tx_mults()
        self.create_ptx()
        self.setup_layout_constants()
        self.add_rails()
        self.add_ptx()

        # These aren't for instantiating, but we use them to get the dimensions
        self.nwell_contact = contact.contact(
            layer_stack=("active", "contact", "metal1"),
            dimensions=(1, self.pmos.num_of_tacts))
        self.pwell_contact = contact.contact(
            layer_stack=("active", "contact", "metal1"),
            dimensions=(1, self.nmos.num_of_tacts))

        self.extend_wells()
        self.extend_active()
        self.add_well_contacts()
        self.connect_well_contacts()
        self.connect_rails()
        self.connect_tx()
        self.route_pins()
        self.setup_layout_offsets()
Example #6
0
def main():
    mask = make_mask()

    src = Src(camera(mask))

    cv.imshow('-FACE-  continue-(Press eny key)',
              cv.resize(src.img, (540, 720)))
    cv.waitKey(0)
    cv.destroyAllWindows()

    # 中心判定
    detection(src)

    # 調節
    adjustment(src)

    print("left<y: {},  x: {}>,  right<y: {},  x: {}>".format(
        src.left.y, src.left.x, src.right.y, src.right.x))
    print("l_length: {},  r_length: {}".format(src.left.length,
                                               src.right.length))

    contact(src)

    # 拡大
    # img = cv.resize(src.result, (540, 720))
    # cv.imshow('-RESULT-  continue-(Press eny key)', img)

    # 通常
    cv.imshow('-RESULT-  continue-(Press eny key)', src.result)

    cv.waitKey(0)

    cv.imwrite("result.jpg", src.result)
Example #7
0
    def runTest(self):
        globals.init_AMC("config_20_{0}".format(OPTS.tech_name))

        global calibre
        import calibre
        OPTS.check_lvsdrc = False

        import contact

        for layer_stack in [("poly", "contact", "metal1"),
                            ("metal1", "via1", "metal2")]:

            # Check single 1 x 1 contact"
            debug.info(2, "1 x 1 {} test".format(layer_stack))
            c1 = contact.contact(layer_stack, (1, 1))
            self.local_drc_check(c1)

            # check vertical array with one in the middle and two ends
            debug.info(2, "1 x 3 {} test".format(layer_stack))
            c2 = contact.contact(layer_stack, (1, 3))
            self.local_drc_check(c2)

            # check horizontal array with one in the middle and two ends
            debug.info(2, "3 x 1 {} test".format(layer_stack))
            c3 = contact.contact(layer_stack, (3, 1))
            self.local_drc_check(c3)

            # check 3x3 array for all possible neighbors
            debug.info(2, "3 x 3 {} test".format(layer_stack))
            c4 = contact.contact(layer_stack, (3, 3))
            self.local_drc_check(c4)

        # return it back to it's normal state
        OPTS.check_lvsdrc = True
        globals.end_AMC()
Example #8
0
 def create_contacts(self):
     """Initializes all required contacts/vias for this module"""
     # These aren't for instantiating, but we use them to get the dimensions
     self.nwell_contact = contact(layer_stack=("active", "contact",
                                               "metal1"))
     self.poly_contact = contact(layer_stack=("poly", "contact", "metal1"))
     self.upper_dimensions = self.upper_pmos.active_contact.dimensions
     self.lower_dimensions = self.lower_pmos.active_contact.dimensions
     self.upper_contact = contact(layer_stack=("metal1", "via1", "metal2"),
                                  dimensions=self.upper_dimensions)
     self.lower_contact = contact(layer_stack=("metal1", "via1", "metal2"),
                                  dimensions=self.lower_dimensions)
Example #9
0
    def create_layout(self):

        # This is not instantiated and used for calculations only.
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        self.pwell_contact = contact(layer_stack=("active", "contact",
                                                  "metal1"))

        self.create_ptx()
        self.add_ptx()
        self.connect_poly()
        self.connect_to_bitlines()
        self.add_gnd_rail()
        self.add_well_contacts()
        self.setup_layout_constants()
Example #10
0
    def create_layout(self):

        # This is not instantiated and used for calculations only.
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        self.well_contact = contact(layer_stack=("active", "contact",
                                                 "metal1"))

        self.create_ptx()

        self.width = self.bitcell.width
        # The height is bigger than necessary.
        self.height = 2 * self.nmos.height
        self.connect_poly()
        self.connect_to_bitlines()
        self.add_gnd_rail()
        self.add_well_contacts()
Example #11
0
    def setup_layout_offsets(self):
        """ Setup layout offsets, determine the size of the busses etc """
        # This isn't for instantiating, but we use it to get the dimensions
        m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))

        # Vertical metal rail gap definition
        self.metal2_extend_contact = (m1m2_via.second_layer_height - m1m2_via.contact_width) / 2
        self.gap_between_rails = self.metal2_extend_contact + drc["metal2_to_metal2"]
        self.gap_between_rail_offset = self.gap_between_rails + drc["minwidth_metal2"]
        self.via_shift = (m1m2_via.second_layer_width - m1m2_via.first_layer_width) / 2

        # used to shift contact when connecting to NAND3 C pin down
        self.contact_shift = (m1m2_via.first_layer_width - m1m2_via.contact_width) / 2

        # Common parameters for rails
        self.rail_width = drc["minwidth_metal2"]
        self.rail_gap = 2 * drc["metal2_to_metal2"]
        self.rail_offset_gap = self.rail_width + self.rail_gap

        # First RAIL Parameters
        self.num_rails_1 = 6
        self.overall_rail_1_gap = (self.num_rails_1 + 1) * self.rail_offset_gap
        self.rail_1_x_offsets = []

        # Second RAIL Parameters
        self.num_rails_2 = 4
        self.overall_rail_2_gap = (self.num_rails_2 + 1) * self.rail_offset_gap
        self.rail_2_x_offsets = []

        # GAP between main control and REPLICA BITLINE
        self.replica_bitline_gap = self.rail_offset_gap * 2

        self.output_port_gap = 3 * drc["minwidth_metal3"]
        self.logic_height = max(self.replica_bitline.width, 4 * self.inv.height)
Example #12
0
    def set_layers(self, layers):
        """Allows us to change the layers that we are routing on. First layer
        is always horizontal, middle is via, and last is always
        vertical.
        """
        self.layers = layers
        (horiz_layer, via_layer, vert_layer) = self.layers

        self.vert_layer_name = vert_layer
        self.vert_layer_width = tech.drc["minwidth_{0}".format(vert_layer)]
        self.vert_layer_spacing = tech.drc[str(self.vert_layer_name) + "_to_" +
                                           str(self.vert_layer_name)]
        self.vert_layer_number = tech.layer[vert_layer]

        self.horiz_layer_name = horiz_layer
        self.horiz_layer_width = tech.drc["minwidth_{0}".format(horiz_layer)]
        self.horiz_layer_spacing = tech.drc[str(self.horiz_layer_name) +
                                            "_to_" +
                                            str(self.horiz_layer_name)]
        self.horiz_layer_number = tech.layer[horiz_layer]

        # Contacted track spacing.
        via_connect = contact(self.layers, (1, 1))
        self.max_via_size = max(via_connect.width, via_connect.height)
        self.horiz_track_width = self.max_via_size + self.horiz_layer_spacing
        self.vert_track_width = self.max_via_size + self.vert_layer_spacing

        # We'll keep horizontal and vertical tracks the same for simplicity.
        self.track_width = max(self.horiz_track_width, self.vert_track_width)
        debug.info(1, "Track width: " + str(self.track_width))

        self.track_widths = [self.track_width] * 2
        self.track_factor = [1 / self.track_width] * 2
        debug.info(1, "Track factor: {0}".format(self.track_factor))
Example #13
0
    def __init__(self, layers, rail_track_width):
        """
        Allows us to change the layers that we are routing on. First layer
        is always horizontal, middle is via, and last is always
        vertical.
        """
        self.layers = layers
        self.rail_track_width = rail_track_width

        if len(self.layers) == 1:
            self.horiz_layer_name = self.vert_layer_name = self.layers[0]
            self.horiz_layer_number = self.vert_layer_number = layer[
                self.layers[0]]

            (self.vert_layer_minwidth,
             self.vert_layer_spacing) = self.get_supply_layer_width_space(1)
            (self.horiz_layer_minwidth,
             self.horiz_layer_spacing) = self.get_supply_layer_width_space(0)

            self.horiz_track_width = self.horiz_layer_minwidth + self.horiz_layer_spacing
            self.vert_track_width = self.vert_layer_minwidth + self.vert_layer_spacing
        else:
            (self.horiz_layer_name, self.via_layer_name,
             self.vert_layer_name) = self.layers

            via_connect = contact(self.layers, (1, 1))
            max_via_size = max(via_connect.width, via_connect.height)

            self.horiz_layer_number = layer[self.horiz_layer_name]
            self.vert_layer_number = layer[self.vert_layer_name]

            (self.vert_layer_minwidth,
             self.vert_layer_spacing) = self.get_supply_layer_width_space(1)
            (self.horiz_layer_minwidth,
             self.horiz_layer_spacing) = self.get_supply_layer_width_space(0)

            # For supplies, we will make the wire wider than the vias
            self.vert_layer_minwidth = max(self.vert_layer_minwidth,
                                           max_via_size)
            self.horiz_layer_minwidth = max(self.horiz_layer_minwidth,
                                            max_via_size)

            self.horiz_track_width = self.horiz_layer_minwidth + self.horiz_layer_spacing
            self.vert_track_width = self.vert_layer_minwidth + self.vert_layer_spacing

        # We'll keep horizontal and vertical tracks the same for simplicity.
        self.track_width = max(self.horiz_track_width, self.vert_track_width)
        debug.info(1, "Track width: {:.3f}".format(self.track_width))
        self.track_space = max(self.horiz_layer_spacing,
                               self.vert_layer_spacing)
        debug.info(1, "Track space: {:.3f}".format(self.track_space))
        self.track_wire = self.track_width - self.track_space
        debug.info(1, "Track wire width: {:.3f}".format(self.track_wire))

        self.track_widths = vector([self.track_width] * 2)
        self.track_factor = vector([1 / self.track_width] * 2)
        debug.info(2, "Track factor: {}".format(self.track_factor))

        # When we actually create the routes, make them the width of the track (minus 1/2 spacing on each side)
        self.layer_widths = [self.track_wire, 1, self.track_wire]
Example #14
0
    def add_modules(self):
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        # Vertical metal rail gap definition
        self.metal2_extend_contact = (self.m1m2_via.second_layer_height -
                                      self.m1m2_via.contact_width) / 2
        self.gap_between_rails = self.metal2_extend_contact + drc[
            "metal2_to_metal2"]
        self.gap_between_rail_offset = self.gap_between_rails + drc[
            "minwidth_metal2"]
        self.via_shift = (self.m1m2_via.second_layer_width -
                          self.m1m2_via.first_layer_width) / 2
        # used to shift contact when connecting to NAND3 C pin down
        self.contact_shift = (self.m1m2_via.first_layer_width -
                              self.m1m2_via.contact_width) / 2

        self.inv = pinv(name="pinverter",
                        nmos_width=drc["minwidth_tx"],
                        beta=2,
                        height=self.bitcell_height)
        self.add_mod(self.inv)
        self.nand2 = nand_2(name="pnand2",
                            nmos_width=self.nand2_nmos_width,
                            height=self.bitcell_height)
        self.add_mod(self.nand2)
        self.nand3 = nand_3(name="pnand3",
                            nmos_width=self.nand3_nmos_width,
                            height=self.bitcell_height)
        self.add_mod(self.nand3)

        # CREATION OF PRE-DECODER
        self.pre2_4 = pre2x4(self.nand2_nmos_width, "pre2x4")
        self.add_mod(self.pre2_4)
        self.pre3_8 = pre3x8(self.nand3_nmos_width, "pre3x8")
        self.add_mod(self.pre3_8)
Example #15
0
    def create_vias(self):
        """ Add a via and corner square at every corner of the path."""
        self.c = contact(self.layer_stack, (1, 1))
        c_width = self.c.width
        c_height = self.c.height

        from itertools import tee, islice
        nwise = lambda g, n=2: zip(*(islice(g, i, None)
                                     for i, g in enumerate(tee(g, n))))
        threewise = nwise(self.position_list, 3)

        for (a, offset, c) in list(threewise):
            # add a exceptions to prevent a via when we don't change directions
            if a[0] == c[0]:
                continue
            if a[1] == c[1]:
                continue
            via_offset = [
                offset[0] + 0.5 * c_height, offset[1] - 0.5 * c_width
            ]
            self.obj.add_via(layers=self.layer_stack,
                             offset=via_offset,
                             rotate=90)
            corner_offset = [
                offset[0] - 0.5 * (c_height + self.vert_layer_width),
                offset[1] + 0.5 * (c_width - self.horiz_layer_width)
            ]
    def setup_layout_constants(self):
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        # Vertical metal rail gap definition
        self.metal2_extend_contact = (self.m1m2_via.second_layer_height -
                                      self.m1m2_via.contact_width) / 2
        self.metal2_spacing = self.metal2_extend_contact + drc[
            "metal2_to_metal2"]
        self.metal2_pitch = self.metal2_spacing + drc["minwidth_metal2"]
        self.via_shift = (self.m1m2_via.second_layer_width -
                          self.m1m2_via.first_layer_width) / 2

        self.predec_groups = []  # This array is a 2D array.

        # Distributing vertical rails to different groups. One group belongs to one pre-decoder.
        # For example, for two 2:4 pre-decoder and one 3:8 pre-decoder, we will
        # have total 16 output lines out of these 3 pre-decoders and they will
        # be distributed as [ [0,1,2,3] ,[4,5,6,7], [8,9,10,11,12,13,14,15] ]
        # in self.predec_groups
        index = 0
        for i in range(self.no_of_pre2x4):
            lines = []
            for j in range(4):
                lines.append(index)
                index = index + 1
            self.predec_groups.append(lines)

        for i in range(self.no_of_pre3x8):
            lines = []
            for j in range(8):
                lines.append(index)
                index = index + 1
            self.predec_groups.append(lines)

        self.calculate_dimensions()
Example #17
0
    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)
        height = via.height
        width = via.width
        debug.check(mirror=="R0","Use rotate to rotate vias instead of mirror.")
        
        if rotate==0:
            corrected_offset = offset + vector(-0.5*width,-0.5*height)
        elif rotate==90:
            corrected_offset = offset + vector(0.5*height,-0.5*width)
        elif rotate==180:
            corrected_offset = offset + vector(0.5*width,0.5*height)
        elif rotate==270:
            corrected_offset = offset + vector(-0.5*height,0.5*width)
        else:
            debug.error("Invalid rotation argument.",-1)
            

        #print(rotate,offset,"->",corrected_offset)
        self.add_mod(via)
        inst=self.add_inst(name=via.name, 
                           mod=via, 
                           offset=corrected_offset,
                           mirror=mirror,
                           rotate=rotate)
        # We don't model the logical connectivity of wires/paths
        self.connect_inst([])
        return inst
Example #18
0
    def setup_layout_offsets(self):
        """ Setup layout offsets, determine the size of the busses etc """
        # These aren't for instantiating, but we use them to get the dimensions
        self.poly_contact = contact(layer_stack=("poly", "contact", "metal1"))
        self.poly_contact_offset = vector(0.5 * self.poly_contact.width,
                                          0.5 * self.poly_contact.height)
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        self.m2m3_via = contact(layer_stack=("metal2", "via2", "metal3"))

        # For different layer width vias
        self.m1m2_offset_fix = vector(
            0, 0.5 * (drc["minwidth_metal2"] - drc["minwidth_metal1"]))

        # M1/M2 routing pitch is based on contacted pitch
        self.m1_pitch = max(self.m1m2_via.width, self.m1m2_via.height) + max(
            drc["metal1_to_metal1"], drc["metal2_to_metal2"])
        self.m2_pitch = max(self.m2m3_via.width, self.m2m3_via.height) + max(
            drc["metal2_to_metal2"], drc["metal3_to_metal3"])

        # Have the cell gap leave enough room to route an M2 wire.
        # Some cells may have pwell/nwell spacing problems too when the wells are different heights.
        self.cell_gap = max(self.m2_pitch, drc["pwell_to_nwell"])

        # Amount to shift a 90 degree rotated via from center-line path routing to it's offset
        self.m1m2_via_offset = vector(self.m1m2_via.first_layer_height,
                                      -0.5 * drc["minwidth_metal2"])
        self.m2m3_via_offset = vector(self.m2m3_via.first_layer_height,
                                      -0.5 * drc["minwidth_metal3"])

        # First RAIL Parameters: gnd, oe, oebar, cs, we, clk_buf, clk_bar
        self.rail_1_start_x = 0
        self.num_rails_1 = 8
        self.rail_1_names = [
            "clk_buf", "gnd", "oe_bar", "cs", "we", "vdd", "oe", "clk_bar"
        ]
        self.overall_rail_1_gap = (self.num_rails_1 + 2) * self.m2_pitch
        self.rail_1_x_offsets = {}

        # Second RAIL Parameters: vdd
        self.rail_2_start_x = 0
        self.num_rails_2 = 0
        self.rail_2_names = ["vdd"]
        self.overall_rail_2_gap = (self.num_rails_2 + 2) * self.m2_pitch
        self.rail_2_x_offsets = {}

        # GAP between main control and replica bitline
        self.replica_bitline_gap = 2 * self.m2_pitch
Example #19
0
    def add_modules(self):
        self.mux = single_level_column_mux(name="single_level_column_mux",
                                           tx_size=8)
        self.single_mux = self.mux
        self.add_mod(self.mux)

        # This is not instantiated and used for calculations only.
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
Example #20
0
def contact(request):
    if request.method == 'POST':
        email = request.POST.get('email')
        password = request.POST.get('password')
        address = request.address.POST.get('address')
        contact = contact(email=email, password=password, address=address)
        contact.save()
    return render(request, 'contact.html')
Example #21
0
    def create_layout(self):
        """ create layout """
        self.create_ptx()
        self.setup_layout_constants()
        self.add_rails()
        self.add_ptx()
        self.add_well_contacts()

        # These aren't for instantiating, but we use them to get the dimensions
        self.poly_contact = contact.contact(("poly", "contact", "metal1"))
        self.m1m2_via = contact.contact(("metal1", "via1", "metal2"))

        self.connect_tx()
        self.connect_well_contacts()
        self.extend_wells()
        self.extend_active()
        self.connect_rails()
        self.route_pins()
Example #22
0
def main():
    last = "Trentwood OR 94701"
    delivery = "1402 SW Alder st."
    second = "APT 11"
    testAddress = address(last, delivery, second)
    testRecipient = "John Doe"

    last2 = "Oakland CA 94501"
    delivery2 = "1244 Broadway st."
    second2 = "APT 11"
    testAddress2 = address(last2, delivery2, second2)
    testRecipient2 = "Lucas Rondenet"

    testContact = contact(testRecipient)
    testContact2 = contact(testRecipient2)

    testEmail = "*****@*****.**"
    testEmail2 = "*****@*****.**"
    testPhoneNumber = "542-345-6745"
    testEmail3 = "*****@*****.**"
    testEmail4 = "*****@*****.**"
    testPhoneNumber2 = "545-565-7889"

    testContact.addAddress(testAddress)
    testContact.addEmail(testEmail)
    testContact.addEmail(testEmail2)
    testContact.addPhoneNumber(testPhoneNumber)
    testContact2.addAddress(testAddress2)
    testContact2.addEmail(testEmail3)
    testContact2.addEmail(testEmail4)
    testContact2.addPhoneNumber(testPhoneNumber2)

    print(testContact)
    #testContact.removeAddress(testAddress)
    print(testContact)
    print
    print(testContact2)

    testContact.addField("age", "32")
    testContact3 = contact("John Newhall")
    print(testContact.age)
    print(vars(testContact))
    print(vars(testContact2))
    print(vars(testContact3))
 def create_modules(self):
     layer_stack = ("metal1", "via1", "metal2")
     self.m1m2_via = contact(layer_stack=layer_stack)
     self.inv = pinv(nmos_width=drc["minwidth_tx"],
                     beta=2,
                     height=self.bitcell_height)
     self.add_mod(self.inv)
     # create_nand redefine in sub class based on number of inputs
     self.create_nand()
     self.add_mod(self.nand)
Example #24
0
class taxudromio(object):
    "desrciption of the object"

    import contact
    import dema
    import epistoli

    demalist = []
    epistolist = []

    pelatis1 = contact.contact('Bla', 'Black', 'Petmeza 14', 12244,
                               '123456789')
    pelatis2 = contact.contact('Blu', 'Blue', 'Skopeftirio 45', 16644,
                               '987654321')
    demataki = dema.dema(2.70, pelatis1, pelatis2, 'small', 'foam', 1.0)

    tyepistoli = epistoli(1.00, pelatis2, pelatis1, 'low')
    epistolist.append(tyepistoli)
    epistolist.pop(0)
Example #25
0
    def calculate_module_offsets(self):
        """ Calculate all the module offsets """

        # These aren't for instantiating, but we use them to get the dimensions
        self.active_contact = contact(layer_stack=("active", "contact",
                                                   "poly"))
        self.poly_contact = contact(layer_stack=("poly", "contact", "metal1"))
        self.poly_contact_offset = vector(0.5 * self.poly_contact.width,
                                          0.5 * self.poly_contact.height)
        self.m1m2_via = contact(layer_stack=("metal1", "via1", "metal2"))
        self.m2m3_via = contact(layer_stack=("metal2", "via2", "metal3"))

        # M1/M2 routing pitch is based on contacted pitch
        self.m1_pitch = max(self.m1m2_via.width, self.m1m2_via.height) + max(
            drc["metal1_to_metal1"], drc["metal2_to_metal2"])
        self.m2_pitch = max(self.m2m3_via.width, self.m2m3_via.height) + max(
            drc["metal2_to_metal2"], drc["metal3_to_metal3"])

        # This corrects the offset pitch difference between M2 and M1
        self.offset_fix = vector(
            0.5 * (drc["minwidth_metal2"] - drc["minwidth_metal1"]), 0)

        # delay chain will be rotated 90, so move it over a width
        # we move it up a inv height just for some routing room
        self.rbl_inv_offset = vector(self.delay_chain.height, self.inv.width)
        # access TX goes right on top of inverter, leave space for an inverter which is
        # about the same as a TX. We'll need to add rails though.
        self.access_tx_offset = vector(1.5 * self.inv.height,
                                       self.rbl_inv_offset.y) + vector(
                                           0, 2.25 * self.inv.width)
        self.delay_chain_offset = self.rbl_inv_offset + vector(
            0, 4 * self.inv.width)

        # Replica bitline and such are not rotated, but they must be placed far enough
        # away from the delay chain/inverter with space for three M2 tracks
        self.bitcell_offset = self.rbl_inv_offset + vector(
            2 * self.m2_pitch, 0) + vector(
                0, self.bitcell.height + self.inv.width)

        self.rbl_offset = self.bitcell_offset

        self.height = self.rbl_offset.y + self.rbl.height + self.m2_pitch
        self.width = self.rbl_offset.x + self.bitcell.width
def run_iters(num_iterations):
    all_hospitals = create_hospitals()
    all_people = create_people()
    all_hospital_full = False

    for i in range(num_iterations):
        for j in range(NUM_PERSONS):
            all_people[j].move()
            all_people[j].are_symptoms_visible(i)
            if all_people[j].shows_symptom:

                # Checking if there is any space left in hospital
                all_hospital_full = True
                for a_hospital in all_hospitals:
                    if not a_hospital.is_full:
                        all_hospital_full = False
                        break

                # If all hospitals are not full then
                if not all_hospital_full:
                    for a_hospital in all_hospitals:
                        if not a_hospital.is_full:
                            hospital_location = a_hospital.location
                            a_hospital.occupy_bed()
                            break
                    all_people[j].hospitalize(hospital_location)

                # otherwise quarantine the person
                else:
                    all_people[j].no_hospital_quarantine()

        for j in range(NUM_PERSONS):
            for k in range(NUM_PERSONS):
                if j != k:
                    contact(all_people[j], all_people[k], i)

        for j in range(NUM_PERSONS):
            if all_people[j].status == NO_HOSPITAL_QUARANTINED or all_people[
                    j].is_hospitalized:
                all_people[j].dead_immune_delay(i)

        get_people_stats(all_people, i)
Example #27
0
def __main__():
    parser = argparse.ArgumentParser(
        description='OpenContact')
    parser.add_argument(
        '-a', '--protA', default=None,
        help='Path to proteinA.pdb')
    parser.add_argument(
        '-b', '--protB', default=None,
        help='Path to proteinB.pdb')
    parser.add_argument(
        '-A', '--protA_chain', default=None,
        help='proteinA chain')
    parser.add_argument(
        '-B', '--protB_chain', default=None,
        help='proteinB chain')
    parser.add_argument(
        '-t', '--tabular', default=False,
        action='store_true',
        help='Create tab separated map files')
    args = parser.parse_args()

    if not all([args.protA, args.protB, args.protA_chain, args.protB_chain]):
        parser.print_usage()
        sys.exit(1)

    # resource files need to be in working directory
    resource_path = os.path.abspath(os.path.dirname(sys.argv[0]))
    resource_files = ['ctresc03.pdb', 'ctresc03n.pdb', 'residc03n.pdb', 'residc03.pdb', 'ntresc03n.pdb', 'ntresc03.pdb', 'ljresidn', 'ljresid']
    for f in resource_files:
        shutil.copyfile(resource_path+os.sep+f, "."+os.sep+f)
    start_time = time.time()
    # opencontact has hard coded input filenames
    shutil.copyfile(args.protA, "."+os.sep+"prota.pdb")
    shutil.copyfile(args.protB, "."+os.sep+"protb.pdb")

    inpututil(args.protA_chain, args.protB_chain)
    contact()
    end_time = time.time()
    print('Done %s' % (end_time - start_time))
    if args.tabular:
        convert_to_tsv('coarsedata.txt', 'coarsedata.tsv')
        convert_to_tsv('finedata.txt', 'finedata.tsv')
Example #28
0
    def setup_layers(self):
        (horiz_layer, via_layer, vert_layer) = self.layer_stack
        self.via_layer_name = via_layer

        self.vert_layer_name = vert_layer
        self.vert_layer_width = drc["minwidth_{0}".format(vert_layer)]

        self.horiz_layer_name = horiz_layer
        self.horiz_layer_width = drc["minwidth_{0}".format(horiz_layer)]
        # offset this by 1/2 the via size
        self.c = contact(self.layer_stack, (1, 1))
Example #29
0
    def create_layout(self):
        # These aren't for instantiating, but we use them to get the dimensions
        self.poly_contact = contact.contact(("poly", "contact", "metal1"))
        self.m1m2_via = contact.contact(("metal1", "via1", "metal2"))

        self.determine_sizes()
        self.create_modules()

        # These aren't for instantiating, but we use them to get the dimensions
        self.nwell_contact = contact.contact(layer_stack=("active", "contact", "metal1"),
                                                     dimensions=(1, self.pmos.num_contacts))
        self.pwell_contact = contact.contact(layer_stack=("active", "contact", "metal1"),
                                                     dimensions=(1, self.nmos.num_contacts))

        self.setup_layout_constants()
        self.add_rails()
        self.add_ptx()
        self.add_well_contacts()
        self.extend_wells()
        self.extend_active()
        self.route()
Example #30
0
    def add_route(self, cell):
        """ 
        Add the current wire route to the given design instance.
        """
        # First, simplify the path for
        #debug.info(1,str(self.path))
        contracted_path = self.contract_path(self.path)
        debug.info(1, str(contracted_path))

        # Make sure there's a pin enclosure on the source and dest
        src_shape = self.convert_track_to_shape(contracted_path[0])
        cell.add_rect(layer=self.layers[2 * contracted_path[0].z],
                      offset=src_shape[0],
                      width=src_shape[1].x - src_shape[0].x,
                      height=src_shape[1].y - src_shape[0].y)

        dest_shape = self.convert_track_to_shape(contracted_path[-1])
        cell.add_rect(layer=self.layers[2 * contracted_path[-1].z],
                      offset=dest_shape[0],
                      width=dest_shape[1].x - dest_shape[0].x,
                      height=dest_shape[1].y - dest_shape[0].y)

        # convert the path back to absolute units from tracks
        abs_path = map(self.convert_point_to_units, contracted_path)
        debug.info(1, str(abs_path))
        cell.add_route(self.layers, abs_path)

        # Check if a via is needed at the start point
        if (contracted_path[0].z != self.source_pin_zindex):
            # offset this by 1/2 the via size
            c = contact(self.layers, (1, 1))
            via_offset = vector(-0.5 * c.width, -0.5 * c.height)
            cell.add_via(self.layers, abs_path[0] + via_offset)

        # Check if a via is needed at the end point
        if (contracted_path[-1].z != self.target_pin_zindex):
            # offset this by 1/2 the via size
            c = contact(self.layers, (1, 1))
            via_offset = vector(-0.5 * c.width, -0.5 * c.height)
            cell.add_via(self.layers, abs_path[-1] + via_offset)
Example #31
0
 def add_via(self, layers, offset, size=[1, 1], mirror="R0", rotate=0):
     """ Add a three layer via structure. """
     import contact
     via = contact.contact(layer_stack=layers, dimensions=size)
     self.add_mod(via)
     self.add_inst(name=via.name,
                   mod=via,
                   offset=offset,
                   mirror=mirror,
                   rotate=rotate)
     # We don't model the logical connectivity of wires/paths
     self.connect_inst([])
     return via
Example #32
0
 def addressBookImport(self, fileName, app):
     if os.path.exists(fileName):
         f = open(fileName, 'r')
         data = utils.importParse(f)
         for element in data:
             newContact = contact(element['Recipient'])
             newAddress = address(element['Last'], element['Delivery'], element['Second'])
             newContact.addAddress(newAddress)
             if 'Phone' in element:
                 newContact.addPhoneNumber(element['Phone'])
             if 'Email' in element:
                 newContact.addEmail(element['Email'])
             self.addContact(newContact)
             app.cmdUpdateListbox(self.contacts)
Example #33
0
 def findContactByName(self, recipient):
     """
     Finds all contacts by recipient which includes both the first name and last name. If more than one contact
     with the same recipient is found then both are added to the contactList to be returned. If no contacts are
     found then alert window pops up and displays contact not found
     """
     tmp = contact(recipient)
     indices = [i for i, val in enumerate(self.contacts) if val == tmp]
     contactList = []
     if (len(indices) > 1):
         for i in indices:
             contactList.append(self.contacts[i])
         return contactList
     elif (len(indices) == 1):
         contactList.append(self.contacts[indices[0]])
         return contactList
     else:
         tkMessageBox.showinfo("Alert", "Contact Not Found!", icon='warning')
Example #34
0
    def cmdAdd(self):
        """create a new contact based on the contact's name"""
        self.tempContact = contact.contact(self.entryName.get())
        """build a temp address"""
        self.tempAddress = address.address(self.entryAddressLast.get(),self.entryAddressDelivery.get(),self.entryAddressSecond.get())
        """add the address to the contact object"""
        self.tempContact.addAddress(self.tempAddress)
        """add the email address to the contact object"""
        self.tempContact.addEmail(self.entryEmail.get())
        """get and add the phone number to the contact object"""
        self.tempContact.addPhoneNumber(self.entryPhone.get())
        """add the contact to the address book"""
        self.logic.addContact(self.tempContact)
        """update the listbox"""
        self.cmdUpdateListbox(self.logic.contacts)

        """set the addressbook state to unsaved"""
        self.unSavedChanges = 1
Example #35
0
def main():
    testAddressBook = addressbook()

    testContact1 = contact("John Doe")
    testLast1 = "San Diego CA 94501"
    testDelivery1 = "1401 SW Main St."
    testSecond1 = ""
    testAddr1 = address(testLast1, testDelivery1, testSecond1)
    testEmail1 = "*****@*****.**"
    testEmail2 = "*****@*****.**"
    testPhoneNumber1 = "542-345-6745"
    testContact1.addAddress(testAddr1)
    testContact1.addEmail(testEmail1)
    testContact1.addEmail(testEmail2)
    testContact1.addPhoneNumber(testPhoneNumber1)
    print(testContact1)
    print(testContact1.mailingFormat())
    #print(testContact1.city)
    #print(testContact1.state)
    #print(testContact1.zip)

    '''testContact2 = contact("Mary Sue")