summaryrefslogtreecommitdiff
path: root/tb/interrupt.cpp
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-10-05 06:31:27 -0600
committerAlejandro Soto <alejandro@34project.org>2023-10-05 13:07:57 -0600
commite2d82e8e18ebddc78a0c187c4b7501b9f3aaa9c5 (patch)
treeeb72ed72e33f3a5ef3d9843ddcff624156177647 /tb/interrupt.cpp
parent59caca686d4d7798b617ee2a9f9d4c5d1d27b8ff (diff)
tb: move most C++ source files to tb/top/conspiracion
Diffstat (limited to 'tb/interrupt.cpp')
-rw-r--r--tb/interrupt.cpp63
1 files changed, 0 insertions, 63 deletions
diff --git a/tb/interrupt.cpp b/tb/interrupt.cpp
deleted file mode 100644
index 4164bb7..0000000
--- a/tb/interrupt.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <cstdint>
-
-#include "avalon.hpp"
-
-namespace taller::avalon
-{
- interrupt_controller::interrupt_controller(std::uint32_t base) noexcept
- : slave(base, 8, 4)
- {}
-
- bool interrupt_controller::read(std::uint32_t addr, std::uint32_t &data) noexcept
- {
- switch(addr)
- {
- case 0:
- data = status();
- break;
-
- case 1:
- data = mask;
- break;
- }
-
- return true;
- }
-
- bool interrupt_controller::write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) noexcept
- {
- switch(addr)
- {
- case 0:
- break;
-
- case 1:
- mask = data;
- break;
- }
-
- return true;
- }
-
- bool interrupt_controller::irq() noexcept
- {
- return status() != 0;
- }
-
- std::uint32_t interrupt_controller::status() noexcept
- {
- std::uint32_t lines = 0;
-
- if(irqs.timer)
- {
- lines |= irqs.timer->irq() << 0;
- }
-
- if(irqs.jtaguart)
- {
- lines |= irqs.jtaguart->irq() << 1;
- }
-
- return lines & mask;
- }
-}