def test_master_hardmacro(self) -> None: d = { "type": "hardmacro", "path": "path/to/placement", "x": Decimal(4), "y": Decimal(6), "master": "foo", "orientation": "mx" } masters = [ MacroSize.from_setting(x) for x in [{ "name": "foo", "library": "none", "width": "1234", "height": "2345" }, { "name": "bar", "library": "none", "width": "2222", "height": "4444" }] ] tc = PlacementConstraint.from_masters_and_dict(masters, d) self.assertEqual(tc.type, PlacementConstraintType.HardMacro) self.assertEqual(tc.path, "path/to/placement") self.assertEqual(tc.x, Decimal(4)) self.assertEqual(tc.y, Decimal(6)) self.assertEqual(tc.width, Decimal(1234)) self.assertEqual(tc.height, Decimal(2345)) self.assertEqual(tc.orientation, "mx") self.assertEqual(tc.master, "foo")
def test_master_hierarchical(self) -> None: d = {"type": "hierarchical", "path": "path/to/placement", "x": Decimal(4), "y": Decimal(6), "master": "bar", "orientation": "mx"} masters = [MacroSize.from_setting(x) for x in [ {"name": "foo", "library": "none", "width": "1234", "height": "2345"}, {"name": "bar", "library": "none", "width": "2222", "height": "4444"} ]] with self.assertRaises(ValueError): # This should assert because width and height are missing tc = PlacementConstraint.from_dict(d) tc = PlacementConstraint.from_masters_and_dict(masters, d) self.assertEqual(tc.type, PlacementConstraintType.Hierarchical) self.assertEqual(tc.path, "path/to/placement") self.assertEqual(tc.x, Decimal(4)) self.assertEqual(tc.y, Decimal(6)) self.assertEqual(tc.width, Decimal(2222)) self.assertEqual(tc.height, Decimal(4444)) self.assertEqual(tc.orientation, "mx") self.assertEqual(tc.master, "bar")
def test_master_hardmacro(self) -> None: d = {"type": "hardmacro", "path": "path/to/placement", "x": Decimal(4), "y": Decimal(6), "master": "foo", "orientation": "mx"} masters = [MacroSize.from_setting(x) for x in [ {"name": "foo", "library": "none", "width": "1234", "height": "2345"}, {"name": "bar", "library": "none", "width": "2222", "height": "4444"} ]] tc = PlacementConstraint.from_masters_and_dict(masters, d) self.assertEqual(tc.type, PlacementConstraintType.HardMacro) self.assertEqual(tc.path, "path/to/placement") self.assertEqual(tc.x, Decimal(4)) self.assertEqual(tc.y, Decimal(6)) self.assertEqual(tc.width, Decimal(1234)) self.assertEqual(tc.height, Decimal(2345)) self.assertEqual(tc.orientation, "mx") self.assertEqual(tc.master, "foo")