Emu: Add clock divider support for PUs

This commit is contained in:
Frank
2022-08-18 00:43:41 +02:00
parent 175227cca5
commit 265bf09845
11 changed files with 57 additions and 20 deletions
+10 -3
View File
@@ -1,14 +1,21 @@
#include "emu.h"
#include "cpu.h"
#include <iostream>
void Emu::init(unsigned int frequency) {
m_frequency = frequency;
}
void Emu::update() {
for (auto unit : m_processing_units) {
if (m_cycle % int(m_frequency / unit.frequency()) == 0) {
unit.update();
if (m_cycle % (m_frequency / unit->frequency()) == 0) {
unit->update();
}
}
m_cycle++;
}
void Emu::addProcessingUnit(ProcessingUnit processing_unit) {
void Emu::addProcessingUnit(ProcessingUnit* processing_unit) {
m_processing_units.push_back(processing_unit);
}