Exemplo n.º 1
0
import opendbpy as odb
import os
import re

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()
chip = odb.odb_read_design(db, [os.path.join(data_dir, "gscl45nm.lef")],
                           [os.path.join(data_dir, "design.def")])
tech = db.getTech()
block = chip.getBlock()

versions = [
    odb.defout.DEF_5_3, odb.defout.DEF_5_4, odb.defout.DEF_5_5,
    odb.defout.DEF_5_6
]
#result = odb.odb_write_def(block, 'test_out.def', DEF_5_6)
version_dict = {0: 'DEF_5_3', 1: 'DEF_5_4', 2: 'DEF_5_5', 3: 'DEF_5_6'}

for i, version in enumerate(versions):
    print(version)
    result = odb.odb_write_def(
        block, os.path.join(opendb_dir, "build", 'test_out.def'), version)
    if result == None:
        exit("DEF not written")
    db = odb.dbDatabase.create()
    def_parser = odb.defin(db)
    lef_parser = odb.lefin(db, True)
Exemplo n.º 2
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()
chip = odb.odb_read_design(
    db, [os.path.join(data_dir, "Nangate45/NangateOpenCellLibrary.mod.lef")],
    [os.path.join(data_dir, "gcd/gcd_pdn.def")])
block = chip.getBlock()
nets = block.getNets()
tech = db.getTech()
libs = db.getLibs()
lib = libs[0]

assert block.getName() == "gcd", "Block name mismatch"
units = block.getDefUnits()
assert units == 2000, "DEF units mismatch"

assert len(block.getChildren()) == 0, "Number of children mismatch"
assert len(block.getInsts()) == 0, "Number of instsances mismatch"
assert len(block.getBTerms()) == 0, "Number of B terms mismatch"
assert len(block.getObstructions()) == 0, "Number of obstructions mismatch"
assert len(block.getBlockages()) == 0, "NUmber of blockages mismatch"
assert len(block.getNets()) == 2, "Number of nets mismatch"
assert len(block.getVias()) == 6, "Number of vias mismatch"
assert len(block.getRows()) == 112, "Number of rows mismatch"
bbox = block.getBBox()