Example #1
0
def main():
    options, args = parser.parse_args()
    if options.model is None:
        print('ERROR: no model specified')
        sys.exit(-1)
    with open(options.model) as f:
        m = model.parse_model(lex.Lexer(f))

    # Divide up the address space.
    total_size = 1 << m.machine.addr_bits
    fifo_size = sum(map(lambda f: f.total_size(), m.fifos))
    proc_size = total_size - fifo_size
    size = proc_size // len(m.benchmarks)

    dists = []
    ml = memory.MemoryList(m.memory)
    for b in m.benchmarks:
        dist = memdist.MemoryDistribution(1)
        dists.append(dist)
        ml.add_memory(stats.Stats(dist, m.memory))
    evaluate(m, ml, options.directory)

    for d in dists:
        min_addr = d.get_min_address()
        max_addr = d.get_max_address()
        size = d.get_size()
        access_count = d.get_access_count()
        print("{} accesses; [{}:{}): {}"
              .format(access_count, min_addr, max_addr, size))
Example #2
0
def simulate(experiment, mem, baseline, replace, directory, fast):
    mod = model.parse_model_file(experiment)
    db = database.get_instance()
    ml = get_memory_list(db, mem, mod, baseline, replace)
    time = db.get_result(mod, ml)
    if time is None:
        time, cost = evaluate(mod, ml, directory, fast)
        db.add_result(mod, ml, time, cost)
    print(get_experiment_name(experiment) + ',' + str(time))
Example #3
0
def generate_matrix(experiments, mem, baseline, replace, directory, fast):
    assert(mem == 'best')
    db = database.get_instance()
    for mem_model in experiments:
        mod = model.parse_model_file(mem_model)
        model_ml = get_best(db, mod)
        for experiment in experiments:
            mod = model.parse_model_file(experiment)
            time = db.get_result(mod, model_ml)
            if not time:
                time, cost = evaluate(mod, model_ml, directory, fast)
                db.add_result(mod, model_ml, time, cost)
            print(get_experiment_name(experiment) + ',' +
                  get_experiment_name(mem_model) + ',' + str(time))
Example #4
0
def run_simulation(mem, experiment):
    print("  Running", experiment)
    m = model.parse_model_file(experiment)
    if m.machine.target != mach.target:
        print("ERROR: wrong target for", experiment)
        sys.exit(-1)
    if m.machine.frequency != mach.frequency:
        print("ERROR: wrong frequency for", experiment)
        sys.exit(-1)
    if m.machine.technology != mach.technology:
        print("ERROR: wrong technology for", experiment)
        sys.exit(-1)
    if m.machine.max_path_length != mach.max_path_length:
        print("ERROR: wrong max path length for", experiment)
        sys.exit(-1)
    if m.machine.part != mach.part:
        print("ERROR: wrong part for", experiment)
        sys.exit(-1)
    if m.machine.word_size != mach.word_size:
        print("ERROR: wrong word size for", experiment)
        sys.exit(-1)
    if m.machine.addr_bits != mach.addr_bits:
        print("ERROR: wrong addr bits for", experiment)
        sys.exit(-1)
    if m.machine.max_cost != mach.max_cost:
        print("ERROR: wrong max cost for", experiment)
        sys.exit(-1)
    mem.set_main(m.memory)
    db = database.get_instance()
    result = db.get_result(m, mem)
    if result is None:
        ml = memory.MemoryList(m.memory)
        ml.add_memory(mem)
        result, cost = evaluate(m, ml, directory)
        db.add_result(m, mem, result, cost)
    return result