53 #include "DRAMSim2/MultiChannelMemorySystem.h"
65 const std::string& system_file,
66 const std::string& working_dir,
67 const std::string& trace_file,
68 unsigned int memory_size_mb,
70 dramsim(new
DRAMSim::MultiChannelMemorySystem(config_file, system_file,
71 working_dir, trace_file,
72 memory_size_mb, NULL, NULL)),
73 _clockPeriod(0.0), _queueSize(0), _burstSize(0)
85 working_dir +
'/' + config_file);
88 fatal(
"DRAMSim2 wrapper failed to get clock\n");
92 _queueSize = extractConfig<unsigned int>(
"TRANS_QUEUE_DEPTH=",
93 working_dir +
'/' + system_file);
96 fatal(
"DRAMSim2 wrapper failed to get queue size\n");
101 unsigned int dataBusBits =
102 extractConfig<unsigned int>(
"JEDEC_DATA_BUS_BITS=",
103 working_dir +
'/' + system_file);
104 unsigned int burstLength =
105 extractConfig<unsigned int>(
"BL=", working_dir +
'/' + config_file);
107 if (!dataBusBits || !burstLength)
108 fatal(
"DRAMSim22 wrapper failed to get burst size\n");
118 template <
typename T>
121 const std::string& file_name)
const
123 std::ifstream file_stream(file_name.c_str(), ios::in);
125 if (!file_stream.good())
126 fatal(
"DRAMSim2 wrapper could not open %s for reading\n", file_name);
131 while (!found && file_stream) {
132 getline(file_stream, line);
133 if (line.substr(0, field_name.size()) == field_name) {
135 istringstream iss(line.substr(field_name.size()));
143 fatal(
"DRAMSim2 wrapper could not find %s in %s\n", field_name,
157 DRAMSim::TransactionCompleteCB* write_callback)
160 dramsim->RegisterCallbacks(read_callback, write_callback, NULL);
166 return dramsim->willAcceptTransaction();
172 bool success M5_VAR_USED =
dramsim->addTransaction(is_write,
addr);