Exemplo n.º 1
0
def create2LevelBlock(db, lib, parent):
    
    blockName = '2LevelBlock'
    block = odb.dbBlock_create(parent, blockName, ',')
    
    and2 = lib.findMaster('and2')
    or2 = lib.findMaster('or2')
    #creating instances
    i1 = odb.dbInst.create(block, and2, "i1")
    i2 = odb.dbInst.create(block, and2, "i2")
    i3 = odb.dbInst.create(block, or2, "i3")
    #creating nets and block terms
    n1 = odb.dbNet.create(block, "n1")
    n2 = odb.dbNet.create(block, "n2")
    n3 = odb.dbNet.create(block, "n3")
    n4 = odb.dbNet.create(block, "n4")
    n5 = odb.dbNet.create(block, "n5")
    n6 = odb.dbNet.create(block, "n6")
    n7 = odb.dbNet.create(block, "n7")
    
    IN1 = odb.dbBTerm.create(n1, 'IN1')
    IN1.setIoType('INPUT')
    IN2 = odb.dbBTerm.create(n2, 'IN2')
    IN2.setIoType('INPUT')
    IN3 = odb.dbBTerm.create(n3, 'IN3')
    IN3.setIoType('INPUT')
    IN4 = odb.dbBTerm.create(n4, 'IN4')
    IN4.setIoType('INPUT')
    OUT = odb.dbBTerm.create(n7, 'OUT')
    OUT.setIoType('OUTPUT')
    #connecting nets
    odb.dbITerm.connect(i1, n1, i1.getMaster().findMTerm('a'))
    odb.dbITerm.connect(i1, n2, i1.getMaster().findMTerm('b'))
    odb.dbITerm.connect(i1, n5, i1.getMaster().findMTerm('o'))
    
    odb.dbITerm.connect(i2, n3, i2.getMaster().findMTerm('a'))
    odb.dbITerm.connect(i2, n4, i2.getMaster().findMTerm('b'))
    odb.dbITerm.connect(i2, n6, i2.getMaster().findMTerm('o'))
    
    odb.dbITerm.connect(i3, n5, i3.getMaster().findMTerm('a'))
    odb.dbITerm.connect(i3, n6, i3.getMaster().findMTerm('b'))
    odb.dbITerm.connect(i3, n7, i3.getMaster().findMTerm('o'))
    
    P1 = odb.dbBPin_create(IN1)
    P2 = odb.dbBPin_create(IN2)
    P3 = odb.dbBPin_create(IN3)
    P4 = odb.dbBPin_create(IN4)
    P5 = odb.dbBPin_create(OUT)
    
    return block
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)
Exemplo n.º 3
0
            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")
            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))