mfld-fr / emu86

Intel IA16 emulator for embedded development
35 stars 6 forks source link

Adaptative IPS #79

Open mfld-fr opened 3 years ago

mfld-fr commented 3 years ago

First ELKS port to 8018X revealed that a better timing accuracy is needed to predict the target responsiveness. As the main loop frequency is already measured, the idea is to compute ratios for timer frequency and CPU IPS, and adapt the emulator IPS to match the emulator timer frequency.

Example for the R8810: Tfreq = 5 MHz, Efreq = 3 MHz -> Rf = 0.6 Tips = 1.3 M -> Eips = 0,78 M -> Ri = 0.26 The emulator should execute 26 instructions per 100 iterations.

@cocus : what would be the OR566 frequencies ?

ghaerr commented 3 years ago

Not sure if you're thinking of slowing down IPS to match real-time target, or possibly using similar math to adjust timer IRQ to real time (or a separate option for that). Both would be interesting enhancements if emulation is indeed accurate. In either case, please consider adding this as an option, as other use case for EMU86 is to run quickly/normally, for use in debugging ELKS or other kernel code unrelated to timing.

Unfortunately, EMU86 already has issue in this area, as 8018X emulation with serial port has become unusable on my machine, due to spurious serial overrun messages with no runtime option yet to remove printf nor operate allowing normal typing. Thus, cannot easily use EMU86 to debug kernel port for other reasons not related to exact timing, unless user types maximum two keystrokes/second. Not sure whether serial emulation is even accurate in this area, as most UARTs have holding buffer which allows another character to be received before overrun. This is not currently emulated, instead unwanted message is displayed.

Thank you!