-
Notifications
You must be signed in to change notification settings - Fork 146
/
memory_system.h
47 lines (38 loc) · 1.43 KB
/
memory_system.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __MEMORY_SYSTEM__H
#define __MEMORY_SYSTEM__H
#include <functional>
#include <string>
#include "configuration.h"
#include "dram_system.h"
#include "hmc.h"
namespace dramsim3 {
// This should be the interface class that deals with CPU
class MemorySystem {
public:
MemorySystem(const std::string &config_file, const std::string &output_dir,
std::function<void(uint64_t)> read_callback,
std::function<void(uint64_t)> write_callback);
~MemorySystem();
void ClockTick();
void RegisterCallbacks(std::function<void(uint64_t)> read_callback,
std::function<void(uint64_t)> write_callback);
double GetTCK() const;
int GetBusBits() const;
int GetBurstLength() const;
int GetQueueSize() const;
void PrintStats() const;
void ResetStats();
bool WillAcceptTransaction(uint64_t hex_addr, bool is_write) const;
bool AddTransaction(uint64_t hex_addr, bool is_write);
private:
// These have to be pointers because Gem5 will try to push this object
// into container which will invoke a copy constructor, using pointers
// here is safe
Config *config_;
BaseDRAMSystem *dram_system_;
};
MemorySystem* GetMemorySystem(const std::string &config_file, const std::string &output_dir,
std::function<void(uint64_t)> read_callback,
std::function<void(uint64_t)> write_callback);
} // namespace dramsim3
#endif