26 #ifndef ORCASIM_MODELING_INCLUDE_MEMORY_HPP_ 27 #define ORCASIM_MODELING_INCLUDE_MEMORY_HPP_ 43 #ifdef MEMORY_ENABLE_COUNTERS 82 #ifdef MEMORY_ENABLE_COUNTERS 91 #ifdef MEMORY_ENABLE_COUNTERS 113 Memory(std::string name, uint32_t size, uint32_t base = 0,
114 bool wipe =
false, std::string binname =
"");
177 void Dump(uint32_t base, uint32_t length);
193 return _mem[_base + addr];
229 #ifdef MEMORY_ENABLE_COUNTERS 238 #ifdef MEMORY_ENABLE_COUNTERS 249 #endif // ORCASIM_MODELING_INCLUDE_MEMORY_HPP_
MemoryType * GetMap(MemoryAddr addr)
Gets a pointer of MemoryType type that points to the cell in address <addr>.
void Write(uint32_t addr, MemoryType *data, uint32_t length)
Writes data to the memory.
MemoryAddr _length
The _length attribute denotes the number of cells of the memory module.
MemoryType & operator[](MemoryAddr addr)
Shorthand access for the Read method using operator overloading on '[]' operator. ...
MemoryType * _mem
The _mem attribute is an array of MemoryType elements, where MemoryType is the smalled memory unit th...
void Wipe()
Write zeroes to the whole addressable memory space.
void Dump()
Display the contents of the whole memory on the output.
Memory(std::string name, uint32_t size, uint32_t base=0, bool wipe=false, std::string binname="")
Construct a new Memory object.
void SaveBin(std::string filename, MemoryAddr base, uint32_t size)
Write the contents of memory cells into a binary file.
void LoadBin(std::string filename, MemoryAddr base, uint32_t size)
Loads the content of a given file to the memory.
MemoryAddr GetLastAddr()
Get the address of the last addressable memory cell.
MemoryAddr _base
The _base attribute indicates the first address of the memory module, an offset.
MemoryAddr GetBase()
(getter) Gets the base address, which is the first addressable memory cell in the module...
void Read(uint32_t addr, MemoryType *buffer, uint32_t length)
Reads data from a given memory location.
Untimed models represent hardware models whose clock period is irrelevant for the simulation...
This class models a memory module.
~Memory()
Destroy the Memory object.
MemoryAddr GetSize()
(getter) Gets the size (alternatively, length) of the memory module, representing the number of addre...