LAZY SYNCHRONIZATION WITH INTERPOLATED STATE FOR DISCRETE–CONTINUOUS CO-SIMULATION OF MICROCONTROLLER-DRIVEN CIRCUITS

Ergashev A. .


Annotatsiya

Cycle-accurate co-simulation of a microcontroller and the circuit it drives is dominated by the cost of advancing peripheral models on every instruction, which precludes interactive speed on commodity hardware. We model the problem as the synchronous product of a timed transition system (the CPU) and a constraint-graph solver (the circuit), coupled by explicit state-lifting functions, and formalize a two-tier scheduler that evaluates peripherals only once per N CPU cycles. We define a peripheral monotonicity condition and prove that under it the lazy schedule is observationally equivalent to the per-cycle eager schedule at synchronization boundaries (Theorem 1). For high-read-frequency timer registers, the main source of firmware-visible drift, we give a closed-form interpolation algorithm and prove it returns the eager value while the timer configuration is unchanged (Theorem 2). A cost model predicts a throughput knee near N = t_s / (t_δ − t_δf), and a circuit solver and a multi-MCU topology binder are shown to meet the per-synchronization budget with proven complexity bounds. A six-workload drift benchmark confirms zero architectural-state drift on monotone-read workloads across N up to 4096 and event drift bounded by N (worst case 258 cycles at N = 512); the scheduler yields an 11.7–43.6× speedup over per-cycle evaluation. The methods are implemented in the Logiclabuz platform [1].


Adabiyotlar

  1. A. Ergashev, “Logiclabuz: A browser-native co-simulation platform for the virtualization of multi-MCU robotic systems.”.
  2. J.-M. Pollet, “Simavr: A lean, mean and hackable AVR simulator for linux & co.” https://github.com/buserror/simavr.
  3. U. Wasserman, “avr8js: AVR 8-bit simulator written in TypeScript.” https://github.com/wokwi/avr8js.
  4. N. Bruschi, G. Haugou, G. Tagliavini, F. Conti, L. Benini, and D. Rossi, “GVSoC: A highly configurable, fast and accurate full-platform simulator for RISC-V based IoT processors,” in Proceedings of the 39th IEEE international conference on computer design (ICCD), 2021, pp. 409–416. doi: 10.1109/ICCD53106.2021.00071.
  5. C. Lei et al., “FlexEmu: Towards flexible MCU peripheral emulation,” in Proceedings of the 2025 ACM SIGSAC conference on computer and communications security (CCS), 2025. doi: 10.1145/3719027.3765086.
  6. W. Zhou, L. Zhang, L. Guan, P. Liu, and Y. Zhang, “What your firmware tells you is not how you should emulate it: A specification-guided approach for firmware emulation,” in Proceedings of the 2022 ACM SIGSAC conference on computer and communications security (CCS), 2022. doi: 10.1145/3548606.3559386.
  7. F. Bellard, “QEMU, a fast and portable dynamic translator,” in Proceedings of the USENIX annual technical conference, 2005, pp. 41–46.
  8. N. Binkert et al., “The gem5 simulator,” ACM SIGARCH Computer Architecture News, vol. 39, no. 2, pp. 1–7, 2011, doi: 10.1145/2024716.2024718.
  9. L. W. Nagel, “SPICE: A computer program to simulate semiconductor circuits,” University of California, Berkeley, Memorandum No. ERL-M520, 1975.
  10. T. Blochwitz et al., “The functional mockup interface for tool-independent exchange of simulation models,” in Proceedings of the 8th international modelica conference, in Linköping electronic conference proceedings no. 63. Dresden, Germany: Linköping University Electronic Press, 2011, pp. 105–114. doi: 10.3384/ecp11063105.
  11. M. A. Hamdi et al., “Integrating SystemC-AMS power modeling with a RISC-V ISS for virtual prototyping of battery-operated embedded devices,” in Proceedings of the 21st ACM international conference on computing frontiers: Workshops and special sessions (CF companion), 2024. doi: 10.1145/3637543.3652873.
  12. J. Eker, J. W. Janneck, E. A. Lee, et al., “Taming heterogeneity — the ptolemy approach,” in Proceedings of the IEEE, 2003, pp. 127–144.
  13. R. M. Fujimoto, Parallel and distributed simulation systems. Wiley, 1999.
  14. R. E. Tarjan, “Efficiency of a good but not linear set union algorithm,” Journal of the ACM, vol. 22, no. 2, pp. 215–225, 1975.