Hi everyone,

I am using the --repeat-switch option to switch the cpu's between O3 and timing 
modes every N cycles. Now I want to reproduce the same behavior but switching 
the cpu's every M instructions (instead of every N cycles). I hope someone 
could help me or give me a hint of what is better to do.

I did these few changes on Simulation.py

def repeatSwitch(testsys, repeat_switch_cpu_list, maxtick, switch_freq):
    print "starting switch loop"
    while True:
        exit_event = m5.simulate()
        exit_cause = exit_event.getCause()

        if exit_cause != "all threads reached the max instruction count":
            return exit_event

        m5.switchCpus(testsys, repeat_switch_cpu_list)

        tmp_cpu_list = []
        for old_cpu, new_cpu in repeat_switch_cpu_list:
            tmp_cpu_list.append((new_cpu, old_cpu))
        repeat_switch_cpu_list = tmp_cpu_list

        if (maxtick - m5.curTick()) <= switch_freq:
            exit_event = m5.simulate(maxtick - m5.curTick())
            return exit_event
...
...
def run(options, root, testsys, cpu_class):
...
...
        for i in xrange(np):
            repeat_switch_cpus[i].system = testsys
            repeat_switch_cpus[i].workload = testsys.cpu[i].workload
            repeat_switch_cpus[i].clk_domain = testsys.cpu[i].clk_domain
            repeat_switch_cpus[i].max_insts_all_threads = 100000 # Number of O3 
instructions
            testsys.cpu[i].max_insts_all_threads = 900000 # Number of timing 
instructions


My implementation works only in the first iteration, after that I don't have 
any control on the number of intruccions simulated by either cpu mode. This is 
because those events are scheduled only once in the constructor of the cpu.
I tried to schedule a new event rigth after the cpu's are switched ( 
comInstEventQueue[tid]->schedule(event, maxInst) ) but maxInst needs to be 
greater than curTick(), which is not the case.

Is this the right approach to do this? What am I doing wrong? Any other idea?

Any comments will be helpful and appreciated.

Thanks
-- 
Alberto Javier Naranjo-Carmona
M.S. Student Computer Engineering

_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to