From 3b62a23705e93f3786402157fc95fd256d850041 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Thu, 17 Nov 2022 08:17:04 -0600 Subject: Implement sim test: descifrador --- tb/const.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tb/const.hpp (limited to 'tb/const.hpp') 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 +#include + +#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 -- cgit v1.2.3