Beispiel #1
0
 if o == "-s":
     strip_comments = True
 elif o == "-S":
     strip_interconn = True
 elif o == "-l":
     lookup_pins = True
 elif o == "-L":
     lookup_symbols = True
 elif o == "-n":
     modname = a
 elif o == "-a":
     pass  # ignored for backward compatibility
 elif o in ("-p", "-P"):
     with open(a, "r") as f:
         for line in f:
             if o == "-P" and not re_search_cached(" # ICE_(GB_)?IO", line):
                 continue
             line = re_sub_cached(r"#.*", "", line.strip()).split()
             if "--warn-no-port" in line:
                 line.remove("--warn-no-port")
             if len(line) and line[0] == "set_io":
                 p = line[1]
                 if o == "-P":
                     p = p.lower()
                     p = re_sub_cached(r"_ibuf$", "", p)
                     p = re_sub_cached(r"_obuft$", "", p)
                     p = re_sub_cached(r"_obuf$", "", p)
                     p = re_sub_cached(r"_gb_io$", "", p)
                     p = re_sub_cached(r"_pad(_[0-9]+|)$", r"\1", p)
                 portnames.add(p)
                 if not re_match_cached(r"[a-zA-Z_][a-zA-Z0-9_]*$", p):
Beispiel #2
0
def print_tile(stmt, ic, x, y, tile, db):
    if single_tile is not None and single_tile != (x, y):
        return

    bits = set()
    mapped_bits = set()
    for k, line in enumerate(tile):
        for i in range(len(line)):
            if line[i] == "1":
                bits.add("B%d[%d]" % (k, i))
            else:
                bits.add("!B%d[%d]" % (k, i))

    if re_search_cached(r"logic_tile", stmt):
        active_luts = set([i for i in range(8) if "1" in icebox.get_lutff_bits(tile, i)])

    text = set()
    used_lc = set()
    text_default_mask = 0
    for entry in db:
        if re_match_cached(r"LC_", entry[1]):
            continue
        if entry[1] in ("routing", "buffer"):
            if not ic.tile_has_net(x, y, entry[2]): continue
            if not ic.tile_has_net(x, y, entry[3]): continue
        match = True
        for bit in entry[0]:
            if not bit in bits:
                match = False
        if match:
            for bit in entry[0]:
                mapped_bits.add(bit)
            if entry[1] == "IoCtrl" and entry[2] == "IE_0":
                text_default_mask |= 1
            if entry[1] == "IoCtrl" and entry[2] == "IE_1":
                text_default_mask |= 2
            if entry[1] == "RamConfig" and entry[2] == "PowerUp":
                text_default_mask |= 4
            if print_bits:
                text.add("<%s> %s" % (" ".join(entry[0]), " ".join(entry[1:])))
            else:
                text.add(" ".join(entry[1:]))
    bitinfo = list()
    print_bitinfo = False
    for k, line in enumerate(tile):
        bitinfo.append("")
        extra_text = ""
        for i in range(len(line)):
            if 36 <= i <= 45 and re_search_cached(r"(logic_tile|dsp\d_tile|ipcon_tile)", stmt):
                lutff_idx = k // 2
                lutff_bitnum = (i-36) + 10*(k%2)
                if line[i] == "1":
                    used_lc.add(lutff_idx)
                    bitinfo[-1] += "*"
                else:
                    bitinfo[-1] += "-"
            elif line[i] == "1" and "B%d[%d]" % (k, i) not in mapped_bits:
                print_bitinfo = True
                extra_text += " B%d[%d]" % (k, i)
                bitinfo[-1] += "?"
            else:
                bitinfo[-1] += "+" if line[i] == "1" else "-"
        bitinfo[-1] += extra_text
    for lcidx in sorted(used_lc):
        lutff_options = "".join(icebox.get_lutff_seq_bits(tile, lcidx))
        if lutff_options[0] == "1": lutff_options += " CarryEnable"
        if lutff_options[1] == "1": lutff_options += " DffEnable"
        if lutff_options[2] == "1": lutff_options += " Set_NoReset"
        if lutff_options[3] == "1": lutff_options += " AsyncSetReset"
        text.add("LC_%d %s %s" % (lcidx, "".join(icebox.get_lutff_lut_bits(tile, lcidx)), lutff_options))
    if not print_bitinfo and not print_all:
        if text_default_mask == 3 and len(text) == 2:
            return
        if text_default_mask == 4 and len(text) == 1:
            return
    if len(text) or print_bitinfo or print_all:
        print("\n%s" % stmt)
        if print_bitinfo:
            print("Warning: No DB entries for some bits:")
        if print_bitinfo or print_map:
            for k, line in enumerate(bitinfo):
                print("%4s %s" % ("B%d" % k, line))
        for line in sorted(text):
            print(line)