Ejemplo n.º 1
0
    def apply_combination(vpr_args, io_grid, grid1, grid2, seed=None):
        with Silence():
            vpr_context = VPRContext(vpr_args)
            p1 = vpr_context.get_random_placement()
        p1.set_io(io_grid)
        p1.set_grid(grid1)
        p2 = p1.copy()
        p2.set_grid(grid2)

        c = ConstrainedSwapPlacementCombination(p1, p2)
        best_grid, min_id, costs = c.swaps_min_placement(seed=None)
        return best_grid, min_id, costs
Ejemplo n.º 2
0
    
    return args


if __name__ == '__main__':
    import sys

    args = _parse_args()

    vpr_context = VPRContext.annealer_context(args.netlist_file,
            args.arch_file, args.seed)

    # Note that each repeated call to get_random_placement() will return a
    # unique placement.
    placement1 = vpr_context.get_random_placement()
    placement2 = vpr_context.get_random_placement()

    # Since we currently do not process I/O placement in the anneal, for our
    # comparison between placements, we want to start all placements with the
    # same I/O positions.  Therefore, we will use the positions from placement1
    # to apply to placement2.
    placement2.set_io(placement1.get_io_grid())

    c = ConstrainedSwapPlacementCombination(placement1, placement2)

    # Perform all swaps between placement1 and placement2, recording the fitness
    # of each placement along the way.  Note that the 'seed' parameter below may
    # be used to generate different orderings of swaps between placement1 and
    # placement2.
    best_grid, min_id, costs = c.swaps_min_placement(seed=None)