Skip to content

Commit 846a97a

Browse files
committed
Moved Vdd to ini file, added megsOfStorage computation for TraceBasedSim, updated some system.ini defaults
1 parent 79731da commit 846a97a

18 files changed

+40
-50
lines changed

IniReader.cpp

+4-23
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ using namespace std;
3535

3636
uint64_t TOTAL_STORAGE;
3737
uint NUM_BANKS;
38-
uint NUM_RANKS;
3938
uint NUM_CHANS;
4039
uint NUM_ROWS;
4140
uint NUM_COLS;
4241
uint DEVICE_WIDTH;
4342

4443
uint REFRESH_PERIOD;
4544
float tCK;
45+
float Vdd;
4646
uint CL;
4747
uint AL;
4848
uint BL;
@@ -79,7 +79,7 @@ uint IDD7;
7979

8080

8181
//in bytes
82-
uint CACHE_LINE_SIZE; //4
82+
uint CACHE_LINE_SIZE;
8383

8484
uint JEDEC_DATA_BUS_WIDTH;
8585

@@ -162,9 +162,8 @@ static ConfigMap configMap[] =
162162
DEFINE_UINT_PARAM(IDD6,DEV_PARAM),
163163
DEFINE_UINT_PARAM(IDD6L,DEV_PARAM),
164164
DEFINE_UINT_PARAM(IDD7,DEV_PARAM),
165+
DEFINE_FLOAT_PARAM(Vdd,DEV_PARAM),
165166

166-
//DEFINE_UINT64_PARAM(TOTAL_STORAGE,SYS_PARAM),
167-
DEFINE_UINT_PARAM(NUM_RANKS,SYS_PARAM),
168167
DEFINE_UINT_PARAM(NUM_CHANS,SYS_PARAM),
169168
DEFINE_UINT_PARAM(CACHE_LINE_SIZE,SYS_PARAM),
170169
DEFINE_UINT_PARAM(JEDEC_DATA_BUS_WIDTH,SYS_PARAM),
@@ -187,7 +186,6 @@ static ConfigMap configMap[] =
187186
DEFINE_BOOL_PARAM(DEBUG_BUS,SYS_PARAM),
188187
DEFINE_BOOL_PARAM(DEBUG_BANKS,SYS_PARAM),
189188
DEFINE_BOOL_PARAM(DEBUG_POWER,SYS_PARAM),
190-
//modelsim output mode?
191189
DEFINE_BOOL_PARAM(VERIFICATION_OUTPUT,SYS_PARAM),
192190
{"", NULL, UINT, SYS_PARAM, false} // tracer value to signify end of list; if you delete it, epic fail will result
193191
};
@@ -601,21 +599,4 @@ void IniReader::InitEnumsFromStrings()
601599

602600
}
603601

604-
#if 0
605-
// Wrote it, but did not use it -- might be handy in the future
606-
void IniReader::Trim(string &str)
607-
{
608-
size_t begin,end;
609-
if ((begin = str.find_first_not_of(" ")) == string::npos)
610-
{
611-
begin = 0;
612-
}
613-
if ((end = str.find_last_not_of(" ")) == string::npos)
614-
{
615-
end = str.size()-1;
616-
}
617-
str = str.substr(begin,end-begin+1);
618-
}
619-
#endif
620-
621-
}
602+
} // namespace DRAMSim

IniReader.h

-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class IniReader
6868
static void InitEnumsFromStrings();
6969
static bool CheckIfAllSet();
7070
static void WriteValuesOut(std::ofstream &visDataOut);
71-
private:
72-
static void Trim(string &str);
7371
};
7472
}
7573

MemoryController.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ MemoryController::MemoryController(MemorySystem *parent, std::ofstream *outfile)
9090
*********************/
9191
//TODO:
9292

93-
//uint64_t total_storage64 = (uint64_t)TOTAL_STORAGE;
94-
//NUM_DEVICES = (total_storage64*8) / (NUM_ROWS * NUM_COLS * DEVICE_WIDTH * NUM_BANKS);
95-
NUM_DEVICES = ((TOTAL_STORAGE * 8) / ((long)NUM_ROWS * NUM_COLS * DEVICE_WIDTH * NUM_BANKS))/NUM_RANKS;
96-
97-
DEBUG ("NUM DEVICES="<<NUM_DEVICES);
9893

9994
//bus related fields
10095
outgoingCmdPacket = NULL;
@@ -1038,9 +1033,6 @@ void MemoryController::printStats(bool finalStats)
10381033
if (currentClockCycle == 0)
10391034
return;
10401035

1041-
//TODO: move Vdd to config file
1042-
float Vdd = 1.9;
1043-
10441036
//if we are not at the end of the epoch, make sure to adjust for the actual number of cycles elapsed
10451037

10461038
uint64_t cyclesElapsed = (currentClockCycle % EPOCH_COUNT == 0) ? EPOCH_COUNT : currentClockCycle % EPOCH_COUNT;

MemoryController.h

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class MemoryController : public SimulatorObject
123123

124124
uint refreshRank;
125125

126-
uint NUM_DEVICES;
127126
};
128127
}
129128

MemorySystem.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ using namespace std;
4141

4242
ofstream cmd_verify_out; //used in Rank.cpp and MemoryController.cpp if VERIFICATION_OUTPUT is set
4343

44+
unsigned NUM_DEVICES;
45+
unsigned NUM_RANKS;
46+
4447
namespace DRAMSim {
4548
#ifdef LOG_OUTPUT
4649
ofstream dramsim_log;
@@ -89,7 +92,7 @@ MemorySystem::MemorySystem(uint id, string deviceIniFilename, string systemIniFi
8992
//calculate the total storage based on the devices the user selected and the number of
9093

9194
// number of bytes per rank
92-
unsigned long megsOfStoragePerRank = (((NUM_ROWS * (NUM_COLS * DEVICE_WIDTH) * NUM_BANKS) * (JEDEC_DATA_BUS_WIDTH / DEVICE_WIDTH)) / 8) >> 20;
95+
unsigned long megsOfStoragePerRank = ((((long)NUM_ROWS * (NUM_COLS * DEVICE_WIDTH) * NUM_BANKS) * ((long)JEDEC_DATA_BUS_WIDTH / DEVICE_WIDTH)) / 8) >> 20;
9396

9497
// If this is set, effectively override the number of ranks
9598
if (megsOfMemory != 0)
@@ -102,9 +105,10 @@ MemorySystem::MemorySystem(uint id, string deviceIniFilename, string systemIniFi
102105
}
103106
}
104107

105-
TOTAL_STORAGE = (NUM_RANKS * megsOfStoragePerRank) << 10;
108+
NUM_DEVICES = 64/DEVICE_WIDTH;
109+
TOTAL_STORAGE = (NUM_RANKS * megsOfStoragePerRank);
106110

107-
DEBUG("TOTAL_STORAGE : "<<TOTAL_STORAGE);
111+
DEBUG("TOTAL_STORAGE : "<< TOTAL_STORAGE << "MB | "<<NUM_RANKS<<" Ranks | "<< NUM_DEVICES <<" Devices per rank");
108112

109113
IniReader::InitEnumsFromStrings();
110114
if (!IniReader::CheckIfAllSet())
@@ -284,7 +288,7 @@ string MemorySystem::SetOutputFileName(string traceFilename)
284288
}
285289

286290
/* I really don't see how "the C++ way" is better than snprintf() */
287-
out << (TOTAL_STORAGE>>30) << "GB." << NUM_CHANS << "Ch." << NUM_RANKS <<"R." <<ADDRESS_MAPPING_SCHEME<<"."<<ROW_BUFFER_POLICY<<"."<< TRANS_QUEUE_DEPTH<<"TQ."<<CMD_QUEUE_DEPTH<<"CQ."<<sched<<"."<<queue;
291+
out << (TOTAL_STORAGE>>10) << "GB." << NUM_CHANS << "Ch." << NUM_RANKS <<"R." <<ADDRESS_MAPPING_SCHEME<<"."<<ROW_BUFFER_POLICY<<"."<< TRANS_QUEUE_DEPTH<<"TQ."<<CMD_QUEUE_DEPTH<<"CQ."<<sched<<"."<<queue;
288292
if (sim_description)
289293
{
290294
out << "." << sim_description;

SystemConfiguration.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
extern std::ofstream cmd_verify_out; //used by BusPacket.cpp if VERIFICATION_OUTPUT is enabled
4646
//extern std::ofstream visDataOut;
4747

48+
//TODO: namespace these to DRAMSim::
4849
extern bool VERIFICATION_OUTPUT; // output suitable to feed to modelsim
4950

5051
extern bool DEBUG_TRANS_Q;
@@ -104,6 +105,8 @@ extern uint IDD5;
104105
extern uint IDD6;
105106
extern uint IDD6L;
106107
extern uint IDD7;
108+
extern float Vdd;
109+
extern unsigned NUM_DEVICES;
107110

108111
//same bank
109112
#define READ_TO_PRE_DELAY (AL+BL/2+max(((int)tRTP),2)-2)
@@ -115,7 +118,7 @@ extern uint IDD7;
115118
#define WRITE_TO_READ_DELAY_R (WL+BL/2+tRTRS-RL) //interrank
116119

117120
//in bytes
118-
extern uint CACHE_LINE_SIZE; //4
121+
extern uint CACHE_LINE_SIZE;
119122

120123
extern uint JEDEC_DATA_BUS_WIDTH;
121124

TraceBasedSim.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void usage()
5454
cout << "\t-q, --quiet \t\t\tflag to suppress simulation output (except final stats) [default=no]"<<endl;
5555
cout << "\t-o, --option=OPTION_A=234\t\t\toverwrite any ini file option from the command line"<<endl;
5656
cout << "\t-p, --pwd=DIRECTORY\t\tSet the working directory (i.e. usually DRAMSim directory where ini/ and results/ are)"<<endl;
57+
cout << "\t-S, --size=# \t\t\tSize of the memory system in megabytes"<<endl;
5758
}
5859
#endif
5960

@@ -241,14 +242,15 @@ int main(int argc, char **argv)
241242
string systemIniFilename = "ini/system.ini";
242243
string deviceIniFilename = "";
243244
string pwdString = "";
245+
unsigned megsOfMemory=2048;
244246

245247
bool overrideOpt = false;
246248
string overrideKey = "";
247249
string overrideVal = "";
248250
string tmp = "";
249251
size_t equalsign;
250252

251-
uint numCycles=30;
253+
uint numCycles=100;
252254
//getopt stuff
253255
while (1)
254256
{
@@ -262,10 +264,11 @@ int main(int argc, char **argv)
262264
{"option", required_argument, 0, 'o'},
263265
{"quiet", no_argument, &SHOW_SIM_OUTPUT, 'q'},
264266
{"help", no_argument, 0, 'h'},
267+
{"size", required_argument, 0, 'S'},
265268
{0, 0, 0, 0}
266269
};
267270
int option_index=0; //for getopt
268-
c = getopt_long (argc, argv, "t:s:c:d:o:p:bkq", long_options, &option_index);
271+
c = getopt_long (argc, argv, "t:s:c:d:o:p:S:bkq", long_options, &option_index);
269272
if (c == -1)
270273
{
271274
break;
@@ -301,6 +304,9 @@ int main(int argc, char **argv)
301304
case 'c':
302305
numCycles = atoi(optarg);
303306
break;
307+
case 'S':
308+
megsOfMemory=atoi(optarg);
309+
break;
304310
case 'p':
305311
pwdString = string(optarg);
306312
break;
@@ -366,8 +372,7 @@ int main(int argc, char **argv)
366372
string line;
367373

368374

369-
MemorySystem *memorySystem;
370-
memorySystem = new MemorySystem(0, deviceIniFilename, systemIniFilename, pwdString, traceFileName, 0);
375+
MemorySystem *memorySystem = new MemorySystem(0, deviceIniFilename, systemIniFilename, pwdString, traceFileName, megsOfMemory);
371376

372377
uint64_t addr;
373378
uint64_t clockCycle=0;

ini/DDR2_micron_16M_8b_x8_sg3E.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ IDD5=215;
4646
IDD6=7;
4747
IDD6L=5;
4848
IDD7=280;
49-
49+
Vdd=1.8 ; TODO: double check this

ini/DDR2_micron_32M_4B_x4_sg3E.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=240;
5555
;WRITE_AUTOPRE_DELAY=(WL+BL/2+tWR+tRP)
5656
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5757
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
58+
Vdd=1.8 ; TODO: double check this

ini/DDR2_micron_32M_8B_x4_sg25E.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=335;
5555
;WRITE_AUTOPRE_DELAY=(WL+BL/2+tWR+tRP)
5656
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5757
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
58+
Vdd=1.8 ; TODO: double check this

ini/DDR3_micron_16M_8B_x8_sg15.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=490;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_32M_8B_x4_sg125.ini

+1
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ IDD7=400 ; this is unused
5757
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5858
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5959

60+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_32M_8B_x4_sg15.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=315;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_32M_8B_x8_sg15.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=460;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_32M_8B_x8_sg25E.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=400;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_64M_8B_x4_sg15.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=415;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

ini/DDR3_micron_8M_8B_x16_sg15.ini

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ IDD7=420;
5555
;WRITE_TO_READ_DELAY_B=(WL+BL/2+tWTR);interbank
5656
;WRITE_TO_READ_DELAY_R=(WL+BL/2+tRTRS-RL);interrank
5757

58+
Vdd=1.5 ; TODO: double check this

system.ini.example

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
; COPY THIS FILE AND MODIFY IT TO SUIT YOUR NEEDS
22

3-
NUM_RANKS=2
43
NUM_CHANS=1 ; we haven't tested a whole lot with CHANS>1 so use at your own peril
54
JEDEC_DATA_BUS_WIDTH=64 ; will never change for DDR parts
6-
CACHE_LINE_SIZE=8 ; should never change for a normal CPU (in bytes)
7-
TRANS_QUEUE_DEPTH=8 ; transaction queue ex: READ 0xbeef
8-
CMD_QUEUE_DEPTH=8 ; command queue ex: RAS 4
5+
CACHE_LINE_SIZE=64 ; should never change for a normal CPU (in bytes)
6+
TRANS_QUEUE_DEPTH=512 ; transaction queue ex: READ 0xbeef
7+
CMD_QUEUE_DEPTH=512 ; command queue ex: RAS 4
98
EPOCH_COUNT=100000 ; length of an epoch in cycles (granularity of simulation)
109
ROW_BUFFER_POLICY=open_page ; close_page or open_page
11-
ADDRESS_MAPPING_SCHEME=scheme2 ;valid schemes 1-4
12-
SCHEDULING_POLICY=rank_then_bank_round_robin ; rank_then_bank_round_robin or rank_then_bank_round_robin
10+
ADDRESS_MAPPING_SCHEME=scheme2 ;valid schemes 1-6
11+
SCHEDULING_POLICY=rank_then_bank_round_robin ; bank_then_rank_round_robin or rank_then_bank_round_robin
1312
QUEUING_STRUCTURE=per_rank ;per_rank or per_rank_per_bank
1413

1514
;for true/false, please use all lowercase

0 commit comments

Comments
 (0)