disasm/sim: changed interface, added readline to sim
[calu.git] / 3b_sim / cmem.hpp
1 #ifndef __CMEM_H__
2 #define __CMEM_H__
3
4 #include "cdat.hpp"
5 #include <vector>
6 #include <stdexcept>
7
8
9 typedef int MEMORY_ADDRESS;
10
11
12 /**
13  * Name:    CMem
14  * Purpose: Class representing the memory of our emulated machine
15  */
16 template <typename T>
17 class CMem
18 {
19 private:
20         //MAX_MEMORY-1 zugreifbare Speicherzellen
21         const int MAX_MEMORY;
22         std::vector<T> m_memory;
23 public:
24         void set(const MEMORY_ADDRESS address, const T data);
25         T get(const MEMORY_ADDRESS address) const;
26         CMem(int size) : MAX_MEMORY(size), m_memory(size) {};
27 };
28
29 #endif