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)
Esempio n. 2
0
 def setUp(self):
     self.db, self.tech, self.m1, self.m2, self.m3, self.v12, self.v23 = helper.createMultiLayerDB(
     )
     self.chip = odb.dbChip_create(self.db)
     self.block = odb.dbBlock_create(self.chip, "chip")
     self.net = odb.dbNet_create(self.block, "net")
     self.wire = odb.dbWire_create(self.net)
     self.pathsEnums = [
         "PATH", "JUNCTION", "SHORT", "VWIRE", "POINT", "POINT_EXT", "VIA",
         "TECH_VIA", "RECT", "ITERM", "BTERM", "RULE", "END_DECODE"
     ]
Esempio n. 3
0
 def test_connection_from_iterm(self):
     #Create net and Connect
     n = odb.dbNet_create(self.block, 'n1')
     self.assertEqual(n.getITermCount(), 0)
     self.assertEqual(n.getITerms(), [])
     self.iterm_a.connect(self.iterm_a, n)
     self.iterm_a.setConnected()
     self.assertEqual(self.iterm_a.getNet().getName(), 'n1')
     self.assertEqual(n.getITermCount(), 1)
     self.assertEqual(n.getITerms()[0].getMTerm().getName(), 'a')
     self.assertTrue(self.iterm_a.isConnected())
     #disconnect
     self.iterm_a.disconnect(self.iterm_a)
     self.iterm_a.clearConnected()
     self.assertEqual(n.getITermCount(), 0)
     self.assertEqual(n.getITerms(), [])
     self.assertIsNone(self.iterm_a.getNet())
     self.assertFalse(self.iterm_a.isConnected())
Esempio n. 4
0
 def block_placement(self, test_num, flag):
     if ((flag and test_num == 1) or (not flag and test_num >= 1)):
         if (flag):
             print("here")
         placeInst(self.block.findInst('i1'), 0, 3000)
         placeInst(self.block.findInst('i2'), -1000, 0)
         placeInst(self.block.findInst('i3'), 2000, -1000)
     if ((flag and test_num == 2) or (not flag and test_num >= 2)):
         placeBPin(
             self.block.findBTerm('OUT').getBPins()[0],
             self.lib.getTech().findLayer('L1'), 2500, -1000, 2550, -950)
     if ((flag and test_num == 3) or (not flag and test_num >= 3)):
         odb.dbObstruction_create(self.block,
                                  self.lib.getTech().findLayer('L1'), -1500,
                                  0, -1580, 50)
     if ((flag and test_num == 4) or (not flag and test_num >= 4)):
         n_s = odb.dbNet_create(self.block, 'n_s')
         swire = odb.dbSWire_create(n_s, 'NONE')
         odb.dbSBox_create(swire,
                           self.lib.getTech().findLayer('L1'), 0, 4000, 100,
                           4100, 'NONE')
     if ((flag and test_num == 5) or (not flag and test_num >= 5)):
         pass
Esempio n. 5
0
            main_mpin = biggest_mpin
            box = main_mpin.getGeometry()[0]
            ll = odb.Point(box.xMin(), box.yMin())
            ur = odb.Point(box.xMax(), box.yMax())
            transform.apply(ll)
            transform.apply(ur)
            x = (ll.getX() + ur.getX())//2
            y = (ll.getY() + ur.getY())//2
            pad_pin_layer = box.getTechLayer()

            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 = 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")
Esempio n. 6
0
import opendbpy as odb
import os

current_dir = os.path.dirname(os.path.realpath(__file__))
tests_dir = os.path.abspath(os.path.join(current_dir, os.pardir))
opendb_dir = os.path.abspath(os.path.join(tests_dir, os.pardir))
data_dir = os.path.join(tests_dir, "data")

db = odb.dbDatabase.create()
lib = odb.read_lef(db, os.path.join(data_dir, "gscl45nm.lef"))
odb.read_def(db, os.path.join(data_dir, "design.def"))
chip = db.getChip()
tech = db.getTech()

block = chip.getBlock()
net = odb.dbNet_create(block, "w1")

net.setSigType("POWER")
swire = odb.dbSWire_create(net, "ROUTED")
if (swire.getNet().getName() != net.getName()):
    exit("ERROR: Net and signal wire mismatch")

sites = lib.getSites()
site = sites[0]
row = odb.dbRow_create(block, "row0", site, 0, 0, "RO", "HORIZONTAL", 1, 10)
if row == None:
    exit("ERROR: Row not created")
print(net)
print(row)
print(swire)
Esempio n. 7
0
    return box


def getTechMaxSpacing(layers=tech.getLayers()):
    max_spacing = -1
    for layer in layers:
        max_spacing = max(max_spacing, layer.getSpacing())
    # print("Max spacing for", layers, "is", max_spacing)
    return max_spacing


print("Top-level design name:", top_design_name)

# create special nets
for special_net_name in SPECIAL_NETS:
    net = odb.dbNet_create(block_top, special_net_name)
    net.setSpecial()
    net.setWildConnected()

    wire = odb.dbSWire_create(net, "ROUTED")

    SPECIAL_NETS[special_net_name]["net"] = net
    SPECIAL_NETS[special_net_name]["wire"] = wire

ALL_BOXES = []

# disconnect all iterms from anywhere else !!! (is this even needed?)
for inst in block_top.getInsts():
    iterms = inst.getITerms()
    ALL_BOXES += getInstObs(inst)
    for iterm in iterms: