コード例 #1
0
def test_netname_translation(ic):
    sys.stderr.write("testing forward netname translation "
                     "for the `%s' device...\n" % ic.device)
    all_tiles = set()
    for x in range(ic.max_x + 1):
        for y in range(ic.max_y + 1):
            if ic.tile(x, y) is not None:
                all_tiles.add((x, y))

    netnames = set()
    failed = False

    for group in ic.group_segments(all_tiles, connect_gb=False):
        is_span = set(net.startswith('sp') for x, y, net in group)
        assert len(is_span) == 1
        if True not in is_span:
            # only span nets are interesting here
            continue

        s = set()
        for seg in group:
            s.add(
                translate_netname(seg[0], seg[1], ic.max_x - 1, ic.max_y - 1,
                                  seg[2]))
        if len(s) != 1:
            failed = True
            print("translated netnames don't match")
            for seg in group:
                print(
                    "%d %d %s" % seg, "->",
                    translate_netname(seg[0], seg[1], ic.max_x - 1,
                                      ic.max_y - 1, seg[2]))
            print()

        for dulpicate_netname in netnames.intersection(s):
            failed = True
            print("duplicate netname: %s" % dulpicate_netname)
            for seg in group:
                print(
                    "%d %d %s" % seg, "->",
                    translate_netname(seg[0], seg[1], ic.max_x - 1,
                                      ic.max_y - 1, seg[2]))
            print()

        netnames.update(s)

    if failed:
        sys.stderr.write("ERROR\n")
        sys.exit(1)
コード例 #2
0
def group_hlc_name(group):
    """Get the HLC "global name" from a group local names."""
    assert_type(group, list)
    global ic
    hlcnames = defaultdict(int)
    hlcnames_details = []
    for ipos, localnames in group:
        for name in localnames:
            assert_type(ipos, PositionIcebox)
            hlcname = icebox_asc2hlc.translate_netname(*ipos, ic.max_x-1, ic.max_y-1, name)

            if hlcname != name:
                hlcnames_details.append((ipos, name, hlcname))

            hlcnames[hlcname] += 1

    if not hlcnames:
        return None

    if len(hlcnames) > 1:
        logging.warn("Multiple HLC names (%s) found group %s", hlcnames, group)
        filtered_hlcnames = {k: v for k,v in hlcnames.items() if v > 1}
        if not filtered_hlcnames:
            return None
        if len(filtered_hlcnames) != 1:
            logging.warn("Skipping as conflicting names for %s (%s)", hlcnames, hlcnames_details)
            return None
        hlcnames = filtered_hlcnames
    assert len(hlcnames) == 1, (hlcnames, hlcnames_details)
    return list(hlcnames.keys())[0]
コード例 #3
0
ファイル: tc_rxlat_netnames.py プロジェクト: drudru/icestorm
def test_netname_translation(ic):
    sys.stderr.write("testing backward netname translation "
                     "for the `%s' device...\n" % ic.device)
    all_tiles = set()
    for x in range(ic.max_x + 1):
        for y in range(ic.max_y + 1):
            if ic.tile(x, y) is not None:
                all_tiles.add((x, y))

    netnames = set()
    failed = False

    for group in ic.group_segments(all_tiles, connect_gb = False):
        is_span = set(net.startswith('sp') for x, y, net in group)
        assert len(is_span) == 1
        if True not in is_span:
            # only span nets are interesting here
            continue

        netname = translate_netname(group[0][0], group[0][1],
                                    ic.max_x - 1, ic.max_y - 1, group[0][2])
        if netname in netnames:
            failed = True
            print("duplicate netname: %s" % netname)
        netnames.add(netname)

        for x, y, net in group:
            s = untranslate_netname(x, y, ic.max_x - 1, ic.max_y - 1, netname)
            if s != net:
                failed = True
                print("%-20s %s -> %s" % ("%d %d %s" % (x, y, net), netname, s))

    if failed:
        sys.stderr.write("ERROR\n")
        sys.exit(1)
コード例 #4
0
ファイル: tc_xlat_netnames.py プロジェクト: drudru/icestorm
def test_netname_translation(ic):
    sys.stderr.write("testing forward netname translation "
                     "for the `%s' device...\n" % ic.device)
    all_tiles = set()
    for x in range(ic.max_x + 1):
        for y in range(ic.max_y + 1):
            if ic.tile(x, y) is not None:
                all_tiles.add((x, y))

    netnames = set()
    failed = False

    for group in ic.group_segments(all_tiles, connect_gb = False):
        is_span = set(net.startswith('sp') for x, y, net in group)
        assert len(is_span) == 1
        if True not in is_span:
            # only span nets are interesting here
            continue

        s = set()
        for seg in group:
            s.add(translate_netname(seg[0], seg[1],
                                    ic.max_x - 1, ic.max_y - 1, seg[2]))
        if len(s) != 1:
            failed = True
            print("translated netnames don't match")
            for seg in group:
                print("%d %d %s" % seg, "->",
                      translate_netname(seg[0], seg[1],
                                        ic.max_x - 1, ic.max_y - 1, seg[2]))
            print()

        for dulpicate_netname in netnames.intersection(s):
            failed = True
            print("duplicate netname: %s" % dulpicate_netname)
            for seg in group:
                print("%d %d %s" % seg, "->",
                      translate_netname(seg[0], seg[1],
                                        ic.max_x - 1, ic.max_y - 1, seg[2]))
            print()

        netnames.update(s)

    if failed:
        sys.stderr.write("ERROR\n")
        sys.exit(1)
コード例 #5
0
def test_netname_translation(ic):
    sys.stderr.write("testing backward netname translation "
                     "for the `%s' device...\n" % ic.device)
    all_tiles = set()
    for x in range(ic.max_x + 1):
        for y in range(ic.max_y + 1):
            if ic.tile(x, y) is not None:
                all_tiles.add((x, y))

    netnames = set()
    failed = False

    for group in ic.group_segments(all_tiles, connect_gb=False):
        is_span = set(net.startswith('sp') for x, y, net in group)
        assert len(is_span) == 1
        if True not in is_span:
            # only span nets are interesting here
            continue

        netname = translate_netname(group[0][0], group[0][1], ic.max_x - 1,
                                    ic.max_y - 1, group[0][2])
        if netname in netnames:
            failed = True
            print("duplicate netname: %s" % netname)
        netnames.add(netname)

        for x, y, net in group:
            s = untranslate_netname(x, y, ic.max_x - 1, ic.max_y - 1, netname)
            if s != net:
                failed = True
                print("%-20s %s -> %s" % ("%d %d %s" %
                                          (x, y, net), netname, s))

    if failed:
        sys.stderr.write("ERROR\n")
        sys.exit(1)