You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
650 B
29 lines
650 B
/* |
|
* Copyright (C) 2022 Riyyi |
|
* Copyright (C) 2022 Th3FrankXD |
|
* |
|
* SPDX-License-Identifier: MIT |
|
*/ |
|
|
|
#pragma once |
|
|
|
#include <cstdint> // uint32_t |
|
#include <string_view> |
|
#include <unordered_map> |
|
|
|
class ProcessingUnit { |
|
public: |
|
ProcessingUnit(uint32_t frequency); |
|
virtual ~ProcessingUnit(); |
|
|
|
virtual void update() = 0; |
|
|
|
// ------------------------------------- |
|
|
|
uint32_t frequency() const { return m_frequency; }; |
|
uint32_t* sharedRegister(std::string_view shared_register) const { return m_shared_registers.at(shared_register); } |
|
|
|
protected: |
|
uint32_t m_frequency { 0 }; |
|
std::unordered_map<std::string_view, uint32_t*> m_shared_registers; |
|
};
|
|
|