Esempio n. 1
0
        self.db, self.lib = helper.createSimpleDB()
        self.block = helper.create2LevelBlock(self.db, self.lib, self.db.getChip())
        self.i1 = self.block.findInst('i1')
        
    def tearDown(self):
        self.db.destroy(self.db)
    def test_swap_master(self):
        self.assertEqual(self.i1.getMaster().getName(), 'and2')
        #testing with a gate with different mterm names
        gate = helper.createMaster2X1(self.lib, '_g2', 800, 800, '_a', '_b', '_o')
        self.assertFalse(self.i1.swapMaster(gate))
        self.assertNotEqual(self.i1.getMaster().getName(), '_g2')
        for iterm in self.i1.getITerms():
            self.assertNotIn(iterm.getMTerm().getName(), ['_a', '_b', '_o'])
        #testing with a gate with different mterms number
        gate = helper.createMaster3X1(self.lib, '_g3', 800, 800, '_a', '_b', '_c', '_o')
        self.assertFalse(self.i1.swapMaster(gate))
        self.assertNotEqual(self.i1.getMaster().getName(), '_g3')
        for iterm in self.i1.getITerms():
            self.assertNotIn(iterm.getMTerm().getName(), ['_a', '_b', '_c', '_o'])
        #testing with a gate with same mterm names
        gate = helper.createMaster2X1(self.lib, 'g2', 800, 800, 'a', 'b', 'o')
        self.assertTrue(self.i1.swapMaster(gate))
        self.assertEqual(self.i1.getMaster().getName(), 'g2')
        self.assertEqual(self.i1.getMaster().getWidth(), 800)
        self.assertEqual(self.i1.getMaster().getHeight(), 800)
        
if __name__=='__main__':
    odbUnitTest.mainParallel(TestInst)
#     odbUnitTest.main()
    
Esempio n. 2
0
        self.assertTrue(self.iterm_a.getAvgXY(x, y))
        self.assertEqual(odb.get_int(x), int((0 + 50) / 2))
        self.assertEqual(odb.get_int(y), int((0 + 50) / 2))
        geo_box_a_2 = odb.dbBox_create(mpin_a,
                                       self.lib.getTech().getLayers()[0], 5,
                                       10, 100, 100)
        self.assertTrue(self.iterm_a.getAvgXY(x, y))
        self.assertEqual(odb.get_int(x), int(((0 + 50) + (5 + 100)) / 4))
        self.assertEqual(odb.get_int(y), int(((0 + 50) + (10 + 100)) / 4))

    def test_avgxy_R90(self):
        x = odb.new_int(0)
        y = odb.new_int(0)
        mterm_a = self.and2.findMTerm('a')
        mpin_a = odb.dbMPin_create(mterm_a)
        geo_box_a_1 = odb.dbBox_create(mpin_a,
                                       self.lib.getTech().getLayers()[0], 0, 0,
                                       50, 50)
        geo_box_a_2 = odb.dbBox_create(mpin_a,
                                       self.lib.getTech().getLayers()[0], 0, 0,
                                       100, 100)
        self.inst.setOrient('R90')
        self.assertTrue(self.iterm_a.getAvgXY(x, y))
        self.assertEqual(odb.get_int(x), int(((0 + 50) + (0 + 100)) / 4) * -1)
        self.assertEqual(odb.get_int(y), int(((0 + 50) + (0 + 100)) / 4))


if __name__ == '__main__':
    odbUnitTest.mainParallel(TestITerm)
#     odbUnitTest.main()
Esempio n. 3
0
    def tearDown(self):
        self.db.destroy(self.db)
    def test_default(self):
        self.check(self.group,"getName","group")
        print("")
        self.assertEqual(self.block.findGroup("group").getName(),"group")
        self.assertEqual(len(self.block.getGroups()),3)
        self.assertEqual(self.domain.getBox().xMax(),100)
        self.group.addModInst(self.i1)
        self.assertEqual(self.group.getModInsts()[0].getName(),"i1")
        self.assertEqual(self.i1.getGroup().getName(),"group")
        self.group.removeModInst(self.i1)
        self.group.addInst(self.inst1)
        self.assertEqual(self.group.getInsts()[0].getName(),"inst")
        self.assertEqual(self.inst1.getGroup().getName(),"group")
        self.group.removeInst(self.inst1)
        self.group.addGroup(self.child)
        self.assertEqual(self.group.getGroups()[0].getName(),"child")
        self.assertEqual(self.child.getParentGroup().getName(),"group")
        self.group.removeGroup(self.child)
        self.group.addPowerNet(self.n1)
        self.assertEqual(self.group.getPowerNets()[0].getName(),"n1")
        self.group.addGroundNet(self.n1)
        self.assertEqual(self.group.getGroundNets()[0].getName(),"n1")
        self.group.removeNet(self.n1)
        self.assertEqual(self.group.getType(),"PHYSICAL_CLUSTER")
        self.group.setType("VOLTAGE_DOMAIN")
        self.group.destroy(self.group)
if __name__=='__main__':
    odbUnitTest.mainParallel(TestModule)     
Esempio n. 4
0
        self.assertEqual(childRegion.getParent().getName(),
                         parentRegion.getName())
        self.assertIsNone(parentRegion.getParent())

    def test_destroy_region_child(self):
        parentRegion, childRegion = self.setup_regions()
        childRegion.destroy(childRegion)
        self.assertIsNone(self.i1.getRegion())
        self.assertEqual(len(parentRegion.getChildren()), 0)
        self.assertEqual(len(self.block.getRegions()), 1)
        self.assertEqual(self.block.getRegions()[0].getName(),
                         parentRegion.getName())

    def test_destroy_region_parent(self):
        parentRegion, childRegion = self.setup_regions()
        parentRegion.destroy(parentRegion)
        self.assertEqual(len(self.block.getRegions()), 0)

    def test_destroy_trackgrid(self):
        tech = self.db.getLibs()[0].getTech()
        L1 = tech.findLayer("L1")
        grid = odb.dbTrackGrid_create(self.block, L1)
        self.assertIsNone(odb.dbTrackGrid_create(self.block, L1))
        grid.destroy(grid)
        self.assertIsNotNone(odb.dbTrackGrid_create(self.block, L1))


if __name__ == '__main__':
    odbUnitTest.mainParallel(TestDestroy)
#     odbUnitTest.main()
Esempio n. 5
0
        self.db.destroy(self.db)
        
    #each test case should start with the name "test"
    def test_naming(self):
        self.changeAndTest(self.n1, 'rename', 'getName', '_n1', '_n1')
        self.check(self.n1, 'getConstName', '_n1')
        self.assertFalse(self.change(self.n1, 'rename', 'n2'))
    def test_dbSetterAndGetter(self):
        self.changeAndTest(self.n1, 'setRCDisconnected', 'isRCDisconnected', False, False)
        self.changeAndTest(self.n1, 'setRCDisconnected', 'isRCDisconnected', True, True)
        self.changeAndTest(self.n1, 'setWeight', 'getWeight', 2, 2)
        self.changeAndTest(self.n1, 'setSourceType', 'getSourceType', 'NETLIST', 'NETLIST')
        self.changeAndTest(self.n1, 'setXTalkClass', 'getXTalkClass', 1, 1)
        self.changeAndTest(self.n1, 'setCcAdjustFactor', 'getCcAdjustFactor', 1, 1)
        self.changeAndTest(self.n1, 'setSigType', 'getSigType', 'RESET', 'RESET')
    def test_dbCc(self):
        self.changeAndTest(self.n1, 'setDbCc', 'getDbCc', 2, 2)
        self.changeAndTest(self.n1, 'addDbCc', 'getDbCc', 5, 3)
    def test_cc(self):
        node2 = odb.dbCapNode_create(self.n2, 0, False)
        node1 = odb.dbCapNode_create(self.n1, 1, False)
        node1.setInternalFlag()
        ccseg = odb.dbCCSeg_create(node1, node2)
        self.n1.calibrateCouplingCap()
        self.check(self.n1, 'maxInternalCapNum', 1)
        self.check(self.n1, 'groundCC', True, 1)
        self.check(self.n2, 'groundCC', False, 1)
        self.check(self.n1, 'getCcCount', 1)
if __name__=='__main__':
    odbUnitTest.mainParallel(TestNet)
Esempio n. 6
0
        point = decoder.getPoint()
        assert point == [3000, 10000]

        # Check tech via
        nextOp = decoder.next()
        assert nextOp == odb.dbWireDecoder.TECH_VIA
        tchVia = decoder.getTechVia()
        assert tchVia.getName() == self.v12.getName()

        # Check tech via
        nextOp = decoder.next()
        assert nextOp == odb.dbWireDecoder.TECH_VIA
        tchVia = decoder.getTechVia()
        assert tchVia.getName() == self.v23.getName()

        # Check next point
        nextOp = decoder.next()
        assert nextOp == odb.dbWireDecoder.POINT_EXT
        point = decoder.getPoint_ext()
        assert point == [3000, 10000, 4000]

        # Check next point
        nextOp = decoder.next()
        assert nextOp == odb.dbWireDecoder.POINT_EXT
        point = decoder.getPoint_ext()
        assert point == [3000, 18000, 6000]


if __name__ == '__main__':
    odbUnitTest.mainParallel(TestWireCodec)
Esempio n. 7
0
    def test_bbox2(self):
        box = self.block.getBBox()
        self.block_placement(2, False)
        self.check_box_rect(-1000, -1000, 2550, 4000)

    def test_bbox3(self):
        #         self.block_placement(2,False)
        #         box = self.block.getBBox()
        #         self.block_placement(3,True)
        placeInst(self.block.findInst('i1'), 0, 3000)
        placeInst(self.block.findInst('i2'), -1000, 0)
        placeInst(self.block.findInst('i3'), 2000, -1000)
        placeBPin(
            self.block.findBTerm('OUT').getBPins()[0],
            self.lib.getTech().findLayer('L1'), 2500, -1000, 2550, -950)
        box = self.block.getBBox()
        odb.dbObstruction_create(self.block,
                                 self.lib.getTech().findLayer('L1'), -1500, 0,
                                 -1580, 50)
        self.check_box_rect(-1580, -1000, 2550, 4000)

    def test_bbox4(self):
        box = self.block.getBBox()
        self.block_placement(4, False)
        self.check_box_rect(-1580, -1000, 2550, 4100)


if __name__ == '__main__':
    odbUnitTest.mainParallel(TestBlock)
#     odbUnitTest.main()