diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-11-19 19:36:21 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-11-19 19:36:27 -0600 |
| commit | 8ec66f50c64501e30ed6adae94f89b90b48de7f0 (patch) | |
| tree | df0cd1fdd699d179ff87aa40410cabb047f9a9f1 /tb/interval_timer.hpp | |
| parent | 0aabf3cb8e11409506bf90d6cd0c1125f3df7c04 (diff) | |
Implement interval timer simulation
Diffstat (limited to '')
| -rw-r--r-- | tb/interval_timer.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tb/interval_timer.hpp b/tb/interval_timer.hpp new file mode 100644 index 0000000..7cce265 --- /dev/null +++ b/tb/interval_timer.hpp @@ -0,0 +1,31 @@ +#ifndef TALLER_INTERVAL_TIMER_HPP +#define TALLER_INTERVAL_TIMER_HPP + +#include <cstdint> + +#include "avalon.hpp" + +namespace taller::avalon +{ + class interval_timer : public slave + { + public: + interval_timer(std::uint32_t base) noexcept; + + void tick() noexcept; + + virtual bool read(std::uint32_t addr, std::uint32_t &data) noexcept final override; + virtual bool write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) noexcept final override; + + private: + std::uint32_t count; + std::uint32_t period; + std::uint32_t snap; + bool status_to = false; + bool status_run = false; + bool control_ito = false; + bool control_cont = false; + }; +} + +#endif |
