예제 #1
0
            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)
예제 #2
0
# print(to_connect)

nets_macro = block_macro.getNets()
created_macros = {}
for net in nets_macro:
    iterms = net.getITerms()  # asssumption: no pins (bterms) on top level
    if not keep_flag:
        for iterm in iterms:
            odb.dbITerm_disconnect(iterm)
    if net.getName() in to_connect:
        for node_iterm in to_connect[net.getName()]:
            node_master = node_iterm.getMTerm().getMaster()
            node_inst = node_iterm.getInst()
            node_inst_name = node_iterm.getInst().getName()
            if node_inst_name not in created_macros:
                created_macros[node_inst_name] = 1
                print("Creating: ", node_master.getName(), node_inst_name)
                new_inst = odb.dbInst_create(block_macro, node_master,
                                             node_inst_name)
                new_inst.setOrient(node_inst.getOrient())
                new_inst.setLocation(
                    node_inst.getLocation()[0] - MACRO_TOP_PLACEMENT_X,
                    node_inst.getLocation()[1] - MACRO_TOP_PLACEMENT_Y)
                new_inst.setPlacementStatus("FIRM")
            else:
                new_inst = block_macro.findInst(node_inst_name)
            odb.dbITerm_connect(
                new_inst.findITerm(node_iterm.getMTerm().getName()), net)

odb.write_def(block_macro, output_def_file_name)
예제 #3
0
                    required=True,
                    help='Output placed DEF file')

args = parser.parse_args()
input_lef_file_names = args.lef
input_def_file_name = args.input_def
output_def_file_name = args.output_def

# Load
db_design = odb.dbDatabase.create()

for lef in input_lef_file_names:
    odb.read_lef(db_design, lef)
odb.read_def(db_design, input_def_file_name)

chip_design = db_design.getChip()
block_design = chip_design.getBlock()
top_design_name = block_design.getName()
print("Design name:", top_design_name)

cfg = {
    'diode_cell_true': 'sky130_fd_sc_hd__diode_2',
    'diode_cell_fake': 'sky130_ef_sc_hd__fakediode_2',
    'diode_cell_pin': 'DIODE',
}
di = DiodeInserter(block_design, cfg)
di.execute()

# Write result
odb.write_def(block_design, output_def_file_name)
예제 #4
0
    block_power = chip_power.getBlock()
    assert block_power.getName() == design_name
    print("Successfully created a new database")
    POWER_GROUND_PORT_NAMES = [port.getName() for port in VDD_PORTS+GND_PORTS]

    # using get_power_ground_ports doesn't work since the pins weren't
    # created using pdngen
    power_ground_ports = [port for port in block_power.getBTerms()\
                          if port.getName() in POWER_GROUND_PORT_NAMES]

    for port in power_ground_ports:
        iterms = port.getNet().getITerms()
        for iterm in iterms:
            inst_name = iterm.getInst().getName()
            pin_name = iterm.getMTerm().getName()

            original_inst = block.findInst(inst_name)
            assert original_inst is not None, "Instance " + inst_name + " not found in the original netlist. Perhaps it was optimized out during synthesis?"

            original_iterm = original_inst.findITerm(pin_name)
            assert original_iterm is not None, inst_name + " doesn't have a pin named " + pin_name

            original_port = find_power_ground_port(port.getName(), VDD_PORTS+GND_PORTS)
            assert original_port is not None, port.getName() + " not found in the original netlist."

            odb.dbITerm_disconnect(original_iterm)
            odb.dbITerm_connect(original_iterm, original_port.getNet())
            print("Modified connections between", port.getName(), "and", inst_name)

odb.write_def(block, output_file_name)
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()
odb.read_lef(
    db, os.path.join(data_dir, "Nangate45", "NangateOpenCellLibrary.mod.lef"))
odb.read_lef(db, os.path.join(data_dir, "ICEWall", "dummy_pads.lef"))
odb.read_def(db, os.path.join(data_dir, "ICEWall", "octilinear.def"))
chip = db.getChip()
if chip == None:
    exit("Read DEF Failed")
result = odb.write_def(
    chip.getBlock(),
    os.path.join(opendb_dir, "build", "generated_octilinear.def"))
assert result == 1, "DEF not written"

db_file = os.path.join(opendb_dir, "build", "export_oct.db")
export_result = odb.write_db(db, db_file)
if export_result != 1:
    exit("Export DB Failed")

new_db = odb.dbDatabase.create()
new_db = odb.read_db(new_db, db_file)

if odb.db_diff(db, new_db):
    exit("Error: Difference found between exported and imported DB")
예제 #6
0
    print(net_name, ": drawing a special wire on layer",
          box["layer"].getName())
    rect = gridify(box["rect"])
    if isRoutingLayer(box["layer"]):
        odb.dbSBox_create(SPECIAL_NETS[net_name]["wire"], box["layer"],
                          *rect.ll(), *rect.ur(), "COREWIRE",
                          odb.dbSBox.UNDEFINED)
    else:
        odb.dbSBox_create(SPECIAL_NETS[net_name]["wire"], box["layer"],
                          (rect.xMin() + rect.xMax()) // 2,
                          (rect.yMin() + rect.yMax()) // 2, "COREWIRE")

    SPECIAL_NETS[net_name]["covered"] = True

uncovered_nets = [
    net_name for net_name in SPECIAL_NETS
    if not SPECIAL_NETS[net_name]["covered"]
]
if len(uncovered_nets) > 0:
    print("No routes created on the following nets:")
    print(uncovered_nets)
    print("Make sure the pads to be connected are facing the core rings")
    sys.exit(1)

# OUTPUT
odb.write_def(block_top, output_def_file_name)

odb.write_lef(odb.dbLib_getLib(db_top, 1), output_def_file_name + ".lef")

print("Done")
opendb_dir = os.path.abspath(os.path.join(tests_dir, os.pardir))
data_dir = os.path.join(tests_dir, "data")

db = odb.dbDatabase.create()
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()
block = chip.getBlock()
bterms = block.getBTerms()

assert (len(bterms) == 12)
pins = bterms[0].getBPins()
assert (len(pins) == 2)
boxes = pins[0].getBoxes()
assert (len(boxes) == 2)
box_0 = boxes[0]
box_1 = boxes[1]

assert (box_0.xMin() == 19950)
assert (box_0.yMin() == 10000)
assert (box_0.xMax() == 20050)
assert (box_0.yMax() == 10100)

assert (box_1.xMin() == 19980)
assert (box_1.yMin() == 10000)
assert (box_1.xMax() == 20020)
assert (box_1.yMax() == 10150)

result = odb.write_def(block, os.path.join(opendb_dir, "build/def.out"))

exit()
예제 #8
0
input_lef_file_names = args.lef
input_def_file_name = args.input_def
output_def_file_name = args.output_def

for lef in input_lef_file_names:
    odb.read_lef(db_design, lef)
odb.read_def(db_design, input_def_file_name)

chip_design = db_design.getChip()
block_design = chip_design.getBlock()
top_design_name = block_design.getName()
print("Design name:", top_design_name)

SRAMPower(block_design).process_all()

odb.write_def(block_design, output_def_file_name)

import sys
sys.exit(0)

import opendbpy as odb

db_design = odb.dbDatabase.create()

odb.read_lef(db_design, 'test_pwr2/tmp/floorplan/merged_unpadded.lef')
odb.read_def(db_design, 'test_pwr2/tmp/floorplan/pdn.def')

chip_design = db_design.getChip()
block_design = chip_design.getBlock()
top_design_name = block_design.getName()
예제 #9
0
for obs in obses:
    obs = obs.strip()
    m = re.match(RE_OBS, obs)
    assert m,\
        "Incorrectly formatted input (%s).\n Format: layer llx lly urx ury, ..." % (obs)
    layer = m.group('layer')
    bbox = [float(x) for x in m.group('bbox').split()]
    obs_list.append((layer, bbox))

design_db = odb.dbDatabase.create()

for lef in input_lef_file_names:
    odb.read_lef(design_db, lef)

odb.read_def(design_db, input_def_file_name)

design_chip = design_db.getChip()
design_block = design_chip.getBlock()
design_insts = design_block.getInsts()
design_tech = design_db.getTech()

for obs in obs_list:
    layer = obs[0]
    bbox = obs[1]
    dbu = design_tech.getDbUnitsPerMicron()
    bbox = [int(x * dbu) for x in bbox]
    print("Creating an obstruction on", layer, "at", *bbox, "(DBU)")
    odb.dbObstruction_create(design_block, design_tech.findLayer(layer), *bbox)

odb.write_def(design_block, output_def_file_name)
예제 #10
0
vias = tech.getVias()
via1 = vias[0]
layer1 = via1.getBottomLayer()
via2 = vias[1]
via3 = vias[2]
block = chip.getBlock()
net = odb.dbNet_create(block, "w1")
wire = odb.dbWire_create(net)
wire_encoder = odb.dbWireEncoder()

wire_encoder.begin(wire)
wire_encoder.newPath(layer1, "ROUTED")
wire_encoder.addPoint(2000, 2000)

jid1 = wire_encoder.addPoint(10000, 2000)
wire_encoder.addPoint(18000, 2000)
wire_encoder.newPath(jid1)
wire_encoder.addTechVia(via1)

jid2 = wire_encoder.addPoint(10000, 10000)
wire_encoder.addPoint(10000, 18000)
wire_encoder.newPath(jid2)

jid3 = wire_encoder.addTechVia(via2)
wire_encoder.end()

result = odb.write_def(block, os.path.join(opendb_dir,
                                           "build/wire_encoder.def"))
if (result != 1):
    exit("Write DEF failed")