Emu: Add clock divider support for PUs
This commit is contained in:
+10
-3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user