X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3b_sim%2Fcmem.hpp;h=09f42937dc899b305309ba6148cd197d04739df6;hb=e3e51aa23d772b1dd08da16f330a9f8616924226;hp=195fe6c1077cbda3e6e6dca735d233cab393d397;hpb=31d88f201bf427d70924b9737ecdb6e0611939d3;p=calu.git diff --git a/3b_sim/cmem.hpp b/3b_sim/cmem.hpp index 195fe6c..09f4293 100644 --- a/3b_sim/cmem.hpp +++ b/3b_sim/cmem.hpp @@ -5,13 +5,15 @@ #include #include + typedef int MEMORY_ADDRESS; + /** * Name: CMem * Purpose: Class representing the memory of our emulated machine */ -template +template class CMem { private: @@ -19,12 +21,14 @@ private: const int MAX_MEMORY; std::vector m_memory; public: - //wert aus referenz auslesen und in vetor speichern (index zugriff!) - //address 0 ist ProgramCounter - void set(const MEMORY_ADDRESS address, const T& data); - //retuniert referenz eines cdat objekts mit dem Wert von address - void get(const MEMORY_ADDRESS address, T& data) const; - CMem(int size) : MAX_MEMORY(size), m_memory(size) {}; + /* aligns to BIT_LEN words, aka. does calc direct memorycell from address */ + void set(const MEMORY_ADDRESS address, const T data); + T get(const MEMORY_ADDRESS address) const; + + /* doesn't align, user has to do */ + void setDirect(const MEMORY_ADDRESS address, const T data); + T getDirect(const MEMORY_ADDRESS address) const; + CMem(int size) : MAX_MEMORY(size), m_memory(size,(T)NULL) {}; }; #endif