summaryrefslogtreecommitdiff
path: root/tb/const.hpp
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-11-17 08:17:04 -0600
committerAlejandro Soto <alejandro@34project.org>2022-11-17 08:53:38 -0600
commit3b62a23705e93f3786402157fc95fd256d850041 (patch)
treebccc8e2a835fccaee23804fe2028ee05efa454ae /tb/const.hpp
parent61bf2100fbd5e0a5f4bd1f013d70d8027604bbba (diff)
Implement sim test: descifrador
Diffstat (limited to 'tb/const.hpp')
-rw-r--r--tb/const.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tb/const.hpp b/tb/const.hpp
new file mode 100644
index 0000000..4ccad3e
--- /dev/null
+++ b/tb/const.hpp
@@ -0,0 +1,38 @@
+#ifndef TALLER_CONST_HPP
+#define TALLER_CONST_HPP
+
+#include <cstdint>
+#include <memory>
+
+#include "avalon.hpp"
+
+namespace taller::avalon
+{
+ class const_map : public slave
+ {
+ public:
+ inline const_map(std::uint32_t addr, std::uint32_t value, std::uint32_t size = 4) noexcept
+ : slave(addr, size, 4),
+ value(value)
+ {}
+
+ inline virtual bool read(std::uint32_t addr, std::uint32_t &data) final override
+ {
+ data = value;
+ return true;
+ }
+
+ inline virtual bool write
+ (
+ std::uint32_t addr, std::uint32_t data, unsigned byte_enable = 0b1111
+ ) final override
+ {
+ return true;
+ }
+
+ private:
+ std::uint32_t value;
+ };
+}
+
+#endif