def my_minimize(chip, table):
    sys.stdout.write("({:3d}, {:3d})\t{:4d}\t".format(chip[0], chip[1],
                                                      len(table)))

    new_table = minimise(table, None)
    assert table_is_subset_of(table, new_table)

    sys.stdout.write("\033[{}m{:4d}\033[39m\t{:.2f}%\n".format(
        32 if len(new_table) < 1024 else 31, len(new_table),
        100. * float(len(table) - len(new_table)) / len(table)))

    return chip, new_table
def my_minimize(chip, table):
    sys.stdout.write("({:3d}, {:3d})\t{:4d}\t".format(chip[0], chip[1], len(table)))

    new_table = minimise(table, None)
    assert table_is_subset_of(table, new_table)

    sys.stdout.write(
        "\033[{}m{:4d}\033[39m\t{:.2f}%\n".format(
            32 if len(new_table) < 1024 else 31, len(new_table), 100.0 * float(len(table) - len(new_table)) / len(table)
        )
    )

    return chip, new_table
Esempio n. 3
0
def my_minimize(chip, table, whole_table, provide_offset, remove_default_entries, times=list()):
    sys.stdout.write("({:3d}, {:3d})\t{:4d}\t".format(
        chip[0], chip[1], len(table)))
    sys.stdout.flush()

    table_ = table

    if remove_default_entries:
        table_ = rde_minimise(table, None)

    if whole_table:
        new_table = use_espresso_on_entire_table(table_, provide_offset)
    else:
        new_table = use_espresso(table_, times, provide_offset)

    assert table_is_subset_of(table, new_table)

    sys.stdout.write("\033[{}m{:4d}\033[39m\t{:.2f}%\n".format(
        32 if len(new_table) < 1024 else 31,
        len(new_table),
        100. * float(len(table) - len(new_table)) / len(table)
    ))

    return chip, new_table
Esempio n. 4
0
import argparse
import common
from rig.routing_table import table_is_subset_of
from six import iteritems
import sys

if __name__ == "__main__":
    # Parse the arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("original_table")
    parser.add_argument("compressed_table")
    args = parser.parse_args()

    # Load and test all routing tables
    print("Loading...")
    with open(args.original_table, "rb") as f:
        original = common.read_routing_tables(f)

    with open(args.compressed_table, "rb") as f:
        compressed = common.read_routing_tables(f)

    print("Testing...")
    for chip, table in iteritems(original):
        print("\t{}".format(chip))
        assert table_is_subset_of(table, compressed[chip])