示例#1
0
def quadrants():
    mod = codegen.Module()
    cst = codegen.Constraints()
    ibuf(mod, cst, true_pins[2], clk="myclk")
    pnr = tiled_fuzzer.run_pnr(mod, cst, {})

    modules = []
    constrs = []
    idxes = []
    for i in range(2, db.cols):
        for j in [2, db.rows - 3]:  # avoid bram
            if "DFF0" not in db.grid[j - 1][i - 1].bels:
                print(i, j)
                continue
            mod = codegen.Module()
            cst = codegen.Constraints()

            ibuf(mod, cst, true_pins[0], clk="myclk")
            dff(mod, cst, j, i, clk="myclk")

            modules.append(mod)
            constrs.append(cst)
            idxes.append((j, i))

    for i in [2, db.cols - 2]:
        for j in range(2, db.rows):
            if "DFF0" not in db.grid[j - 1][i - 1].bels:
                print(i, j)
                continue
            mod = codegen.Module()
            cst = codegen.Constraints()

            ibuf(mod, cst, true_pins[0], clk="myclk")
            dff(mod, cst, j, i, clk="myclk")

            modules.append(mod)
            constrs.append(cst)
            idxes.append((j, i))

    pnr_res = pool.map(lambda param: tiled_fuzzer.run_pnr(*param, {}),
                       zip(modules, constrs))

    res = {}
    for (row, col), (mybs, *_) in zip(idxes, pnr_res):
        sweep_tiles = fuse_h4x.tile_bitmap(fse, mybs ^ pnr.bitmap)

        # find which tap was used
        taps = [
            r for (r, c, typ), t in sweep_tiles.items()
            if typ in {13, 14, 15, 16, 18, 19}
        ]

        # find which center tile was used
        t8x = [(r, c) for (r, c, typ), t in sweep_tiles.items()
               if typ >= 80 and typ < 90]
        rows, cols, _ = res.setdefault(t8x[0], (set(), set(), taps[0]))
        rows.add(row - 1)
        cols.add(col - 1)

    return res
示例#2
0
    type_re = re.compile(r"inst\d+_([A-Z]+)_([A-Z]+)")

    empty, hdr, ftr, posp, config = run_pnr(codegen.Module(),
                                            codegen.Constraints(), {})
    db.cmd_hdr = hdr
    db.cmd_ftr = ftr
    db.template = empty
    p = Pool()
    pnr_res = p.map(lambda param: run_pnr(*param),
                    zip(modules, constrs, configs))

    for bitmap, hdr, ftr, posp, config in pnr_res:
        seen = {}
        diff = bitmap ^ empty
        bm = fuse_h4x.tile_bitmap(fse, diff)
        for cst_type, name, *info in posp:
            bel_type, cell_type = type_re.match(name).groups()
            if cst_type == "cst":
                row, col, cls, lut = info
                print(name, row, col, cls, lut)
                row = row - 1
                col = col - 1
            elif cst_type == "place":
                side, num, pin = info
                if side == 'T':
                    row = 0
                    col = num - 1
                elif side == 'B':
                    row = len(fse['header']['grid'][61]) - 1
                    col = num - 1