def labelITerm(iterm, pin_name, iotype, all_shapes_flag=False): net_name = pin_name net = chip_block.findNet(net_name) if net is None: net = odb.dbNet_create(chip_block, net_name) pin_bterm = chip_block.findBTerm(pin_name) if pin_bterm is None: pin_bterm = odb.dbBTerm_create(net, pin_name) assert pin_bterm is not None, "Failed to create or find " + pin_name pin_bterm.setIoType(iotype) pin_bpin = odb.dbBPin_create(pin_bterm) pin_bpin.setPlacementStatus("PLACED") if not all_shapes_flag: boxes = getBiggestBox(pad_iterm) else: boxes = getAllBoxes(pad_iterm) for box in boxes: layer, ll, ur = box odb.dbBox_create(pin_bpin, layer, ll.getX(), ll.getY(), ur.getX(), ur.getY()) odb.dbITerm_connect(pad_iterm, net) pin_bterm.connect(net)
def test_avgxy_R90(self): x = odb.new_int(0) y = odb.new_int(0) mterm_a = self.and2.findMTerm('a') mpin_a = odb.dbMPin_create(mterm_a) geo_box_a_1 = odb.dbBox_create(mpin_a, self.lib.getTech().getLayers()[0], 0, 0, 50, 50) geo_box_a_2 = odb.dbBox_create(mpin_a, self.lib.getTech().getLayers()[0], 0, 0, 100, 100) self.inst.setOrient('R90') self.assertTrue(self.iterm_a.getAvgXY(x, y)) self.assertEqual(odb.get_int(x), int(((0 + 50) + (0 + 100)) / 4) * -1) self.assertEqual(odb.get_int(y), int(((0 + 50) + (0 + 100)) / 4))
def test_avgxy_R0(self): x = odb.new_int(0) y = odb.new_int(0) self.assertFalse(self.iterm_a.getAvgXY(x, y)) #no mpin to work on mterm_a = self.and2.findMTerm('a') mpin_a = odb.dbMPin_create(mterm_a) self.assertFalse(self.iterm_a.getAvgXY(x, y)) #no boxes to work on geo_box_a_1 = odb.dbBox_create(mpin_a, self.lib.getTech().getLayers()[0], 0, 0, 50, 50) self.assertTrue(self.iterm_a.getAvgXY(x, y)) self.assertEqual(odb.get_int(x), int((0 + 50) / 2)) self.assertEqual(odb.get_int(y), int((0 + 50) / 2)) geo_box_a_2 = odb.dbBox_create(mpin_a, self.lib.getTech().getLayers()[0], 5, 10, 100, 100) self.assertTrue(self.iterm_a.getAvgXY(x, y)) self.assertEqual(odb.get_int(x), int(((0 + 50) + (5 + 100)) / 4)) self.assertEqual(odb.get_int(y), int(((0 + 50) + (10 + 100)) / 4))
def createMultiLayerDB(): db = odb.dbDatabase.create() tech = odb.dbTech.create(db) m1 = odb.dbTechLayer_create(tech, "M1", 'ROUTING') m1.setWidth(2000) m2 = odb.dbTechLayer_create(tech, "M2", 'ROUTING') m2.setWidth(2000) m3 = odb.dbTechLayer_create(tech, "M3", 'ROUTING') m3.setWidth(2000) v12 = odb.dbTechVia_create(tech, "VIA12") odb.dbBox_create(v12, m1, 0, 0, 2000, 2000) odb.dbBox_create(v12, m2, 0, 0, 2000, 2000) v23 = odb.dbTechVia_create(tech, "VIA23") odb.dbBox_create(v23, m2, 0, 0, 2000, 2000) odb.dbBox_create(v23, m3, 0, 0, 2000, 2000) return db, tech, m1, m2, m3, v12, v23
pin_bterm = chip_block.findBTerm(pin_name) if pin_bterm is None: pin_bterm = odb.dbBTerm_create(net, pin_name) assert pin_bterm is not None, "Failed to create or find " + pin_name pin_bterm.setIoType(iotype) # x = odb.new_intp(); y = odb.new_intp() # pad_iterm.getAvgXY(x, y); # crashes with clamps # x = odb.intp_value(x); y = odb.intp_value(y) pin_bpin = odb.dbBPin_create(pin_bterm) pin_bpin.setPlacementStatus("PLACED") odb.dbBox_create(pin_bpin, pad_pin_layer, ll.getX(), ll.getY(), ur.getX(), ur.getY()) odb.dbITerm_connect(pad_iterm, net) pin_bterm.connect(net) labeled.append(inst_name) assert labeled_count == pad_pins_to_label_count, ("Didn't label what I set out to label %d/%d" % (labeled_count, pad_pins_to_label_count), set(pad_pin_map.keys())-set(labeled)) print("Writing", output_def_file_name) odb.write_def(chip_block, output_def_file_name)
if VERBOSE: print(x, y) net = chip_block.findNet(net_name) if net is None: net = odb.dbNet_create(chip_block, net_name) pin_bterm = odb.dbBTerm_create(net, pin_name) if pin_bterm is None: print(pin_name, " not created; skipping...") continue pin_bterm.setIoType(iotype) # x = odb.new_intp(); y = odb.new_intp() # pad_iterm.getAvgXY(x, y); # crashes with clamps # x = odb.intp_value(x); y = odb.intp_value(y) pin_bpin = odb.dbBPin_create(pin_bterm) pin_bpin.setPlacementStatus("PLACED") odb.dbBox_create(pin_bpin, pad_pin_layer, x - BLOCK_PIN_SIZE * DEF_UNITS_PER_MICRON, y - BLOCK_PIN_SIZE * DEF_UNITS_PER_MICRON, x + BLOCK_PIN_SIZE * DEF_UNITS_PER_MICRON, y + BLOCK_PIN_SIZE * DEF_UNITS_PER_MICRON) odb.dbITerm_connect(pad_iterm, net) pin_bterm.connect(net) print("Writing", output_def_file_name) odb.write_def(chip_block, output_def_file_name)
pin_name = bterm.getName() pins = bterm.getBPins() if len(pins) > 0: print("Warning:", pin_name, "already has shapes. Modifying them") assert len(pins) == 1 pin_bpin = pins[0] else: pin_bpin = odb.dbBPin_create(bterm) pin_bpin.setPlacementStatus("PLACED") if side in ["#N", "#S"]: rect = odb.Rect(0, 0, V_WIDTH, LENGTH) if side == "#N": y = BLOCK_UR_Y - LENGTH else: y = BLOCK_LL_Y rect.moveTo(slot - V_WIDTH // 2, y) odb.dbBox_create(pin_bpin, V_LAYER, *rect.ll(), *rect.ur()) else: rect = odb.Rect(0, 0, LENGTH, H_WIDTH) if side == "#E": x = BLOCK_UR_X - LENGTH else: x = BLOCK_LL_X rect.moveTo(x, slot - H_WIDTH // 2) odb.dbBox_create(pin_bpin, H_LAYER, *rect.ll(), *rect.ur()) print("Writing", output_def_file_name) odb.write_def(block_top, output_def_file_name)
def placeBPin(bpin, layer, x1, y1, x2, y2): odb.dbBox_create(bpin, layer, x1, y1, x2, y2) bpin.setPlacementStatus('PLACED')