buserror/simavr — pull request #83 by bsekisser (2014-09-09 22:23:34+00:00)
Title: Changes to allow the core to free run between cycle timers with per inte...

...rval limiting.

Average cycle times drop by about 15-25 cycles per emulated cycle.

sim_avr.c: avr_callback_run_raw() changed.
loop put around call to run core while status is cpu_Running
with cycles available to run and no pending interrupts.

sim_avr.h: struct avr_t changed.
added members run_cycle_count and run_cycle_limit.
run_cycle_count is number of cycles till next cycle timer.
run_cycle_limit is maximum number of cycles to run per interval.

sim_cycle_timers.c:
* static avr_cycle_timer_return_sleep_run_cycles_limited() added.
run_cycle_count is bounded to run_cycle_limit,
but not less than one.
returns sleep count unbounded, preserving original behavior.

* static avr_cycle_timer_reset_sleep_run_cycles_limited() added.
sets new run_cycle_count based on present list of cycle timers.

>> avr_cycle_timer_reset() changed.
run_cycle_count and run_cycle_limit is set to default values.

>> avr_cycle_timer_register()
>> avr_cycle_timer_cancel()
>> avr_cycle_timer_process()
call the relevant function to set/maintain run_cycle_count.

modified: sim/sim_avr.c
modified: sim/sim_avr.h
modified: sim/sim_cycle_timers.c