def test_device_rapidyaml(self):
        return
        phys_netlist = example_physical_netlist()

        interchange = Interchange(
            schema_directory=os.environ['INTERCHANGE_SCHEMA_PATH'])

        with open(
                os.path.join(os.environ['DEVICE_RESOURCE_PATH'],
                             phys_netlist.part + '.device'), 'rb') as f:
            dev_message = interchange.read_device_resources_raw(f)

        self.round_trip_rapidyaml('device', dev_message)
Exemple #2
0
    def test_simple_placement(self):
        netlist = example_logical_netlist()
        cells = create_constraint_cells_from_netlist(
            netlist, filtered_out={'GND', 'VCC'})

        phys_netlist = example_physical_netlist()

        interchange = Interchange(
            schema_directory=os.environ['INTERCHANGE_SCHEMA_PATH'])

        with open(
                os.path.join(os.environ['DEVICE_RESOURCE_PATH'],
                             phys_netlist.part + '.device'), 'rb') as f:
            dev_message = interchange.read_device_resources_raw(f)

        dev_message = dev_message.as_builder()

        path = os.path.join(__dir__, 'data', 'series7_constraints.yaml')
        with open(path, 'rb') as f:
            patch_capnp(dev_message, ['constraints'], 'yaml', f)

        device = DeviceResources(dev_message)

        allowed_sites = {
            'IOB_X0Y0',
            'IOB_X0Y1',
            'IOB_X0Y2',
            'SLICE_X0Y0',
            'BUFGCTRL_X0Y0',
        }

        model, placement_oracle, placements = make_problem_from_device(
            device, allowed_sites)

        solver = model.build_sat(placements, cells, placement_oracle)
        clauses = solver.prepare_for_sat()

        with Solver() as sat:
            for clause in clauses:
                sat.add_clause(clause)

            solved = sat.solve()
            self.assertTrue(solved)
Exemple #3
0
    def test_patch_series7_constraints(self):
        phys_netlist = example_physical_netlist()

        interchange = Interchange(
            schema_directory=os.environ['INTERCHANGE_SCHEMA_PATH'])

        with open(
                os.path.join(os.environ['DEVICE_RESOURCE_PATH'],
                             phys_netlist.part + '.device'), 'rb') as f:
            dev_message = interchange.read_device_resources_raw(f)

        dev_message = dev_message.as_builder()

        path = os.path.join(__dir__, 'data', 'series7_constraints.yaml')
        with open(path, 'rb') as f:
            patch_capnp(dev_message, ['constraints'], 'yaml', f)

        schema = get_schema(os.environ['INTERCHANGE_SCHEMA_PATH'], 'device',
                            'Device.Constraints')
        with open(path, 'rb') as f:
            series7 = read_format(schema, 'yaml', f)

        compare_capnp(self, series7, dev_message.constraints)