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
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)
def test_destroy_swire(self): swire = odb.dbSWire_create(self.n4, 'ROUTED') self.assertNotEqual(self.n4.getSWires(), []) self.assertEqual(swire.getNet().getName(), self.n4.getName()) swire.destroy(swire) self.assertEqual(self.n4.getSWires(), [])