53 #include "DRAMSim2/MultiChannelMemorySystem.h"
71 const std::string& system_file,
72 const std::string& working_dir,
73 const std::string& trace_file,
74 unsigned int memory_size_mb,
76 dramsim(new
DRAMSim::MultiChannelMemorySystem(config_file, system_file,
77 working_dir, trace_file,
78 memory_size_mb, NULL, NULL)),
79 _clockPeriod(0.0), _queueSize(0), _burstSize(0)
91 working_dir +
'/' + config_file);
94 fatal(
"DRAMSim2 wrapper failed to get clock\n");
98 _queueSize = extractConfig<unsigned int>(
"TRANS_QUEUE_DEPTH=",
99 working_dir +
'/' + system_file);
102 fatal(
"DRAMSim2 wrapper failed to get queue size\n");
107 unsigned int dataBusBits =
108 extractConfig<unsigned int>(
"JEDEC_DATA_BUS_BITS=",
109 working_dir +
'/' + system_file);
110 unsigned int burstLength =
111 extractConfig<unsigned int>(
"BL=", working_dir +
'/' + config_file);
113 if (!dataBusBits || !burstLength)
114 fatal(
"DRAMSim22 wrapper failed to get burst size\n");
124 template <
typename T>
127 const std::string& file_name)
const
129 std::ifstream file_stream(file_name.c_str(), ios::in);
131 if (!file_stream.good())
132 fatal(
"DRAMSim2 wrapper could not open %s for reading\n", file_name);
137 while (!found && file_stream) {
138 getline(file_stream, line);
139 if (line.substr(0, field_name.size()) == field_name) {
141 istringstream
iss(line.substr(field_name.size()));
149 fatal(
"DRAMSim2 wrapper could not find %s in %s\n", field_name,
163 DRAMSim::TransactionCompleteCB* write_callback)
166 dramsim->RegisterCallbacks(read_callback, write_callback, NULL);
172 return dramsim->willAcceptTransaction();
178 [[maybe_unused]]
bool success =
dramsim->addTransaction(is_write,
addr);