From a567dbbf771c9781a362e9a1c8d274dec242da74 Mon Sep 17 00:00:00 2001 From: Ana Mativi Date: Fri, 23 Feb 2018 17:59:04 +0100 Subject: [PATCH] Improved readability of Flexible Refresh tests --- DRAMSys/library/src/common/TlmRecorder.cpp | 18 ++++++++---------- DRAMSys/traceAnalyzer/scripts/memUtil.py | 14 ++++++++++++++ DRAMSys/traceAnalyzer/scripts/tests.py | 17 ++++------------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 30587582..092d2f92 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -319,22 +319,20 @@ void TlmRecorder::insertGeneralInfo() sqlite3_bind_text(insertGeneralInfoStatement, 6, mcconfig.c_str(), mcconfig.length(), NULL); sqlite3_bind_text(insertGeneralInfoStatement, 7, memspec.c_str(), memspec.length(), NULL); sqlite3_bind_text(insertGeneralInfoStatement, 8, traces.c_str(), traces.length(), NULL); - if(!Configuration::getInstance().EnableWindowing) + if (!Configuration::getInstance().EnableWindowing) sqlite3_bind_int64(insertGeneralInfoStatement, 9, 0); else sqlite3_bind_int64(insertGeneralInfoStatement, 9, (Configuration::getInstance().memSpec.clk*Configuration::getInstance().WindowSize).value()); - if(Configuration::getInstance().ControllerCoreEnableRefPostpone || Configuration::getInstance().ControllerCoreEnableRefPullIn) - sqlite3_bind_int(insertGeneralInfoStatement, 10, 1); + if (Configuration::getInstance().ControllerCoreEnableRefPostpone || Configuration::getInstance().ControllerCoreEnableRefPullIn) + { + sqlite3_bind_int(insertGeneralInfoStatement, 10, 1); + sqlite3_bind_int(insertGeneralInfoStatement, 11, std::max(Configuration::getInstance().ControllerCoreMaxPulledInARCmd, Configuration::getInstance().ControllerCoreMaxPostponedARCmd)); + } else { - sqlite3_bind_int(insertGeneralInfoStatement, 10, 0); - sqlite3_bind_int(insertGeneralInfoStatement, 11, 0); + sqlite3_bind_int(insertGeneralInfoStatement, 10, 0); + sqlite3_bind_int(insertGeneralInfoStatement, 11, 0); } - if (Configuration::getInstance().ControllerCoreMaxPulledInARCmd > Configuration::getInstance().ControllerCoreMaxPostponedARCmd) - sqlite3_bind_int64(insertGeneralInfoStatement, 11, Configuration::getInstance().ControllerCoreMaxPulledInARCmd); - else - sqlite3_bind_int64(insertGeneralInfoStatement, 11, Configuration::getInstance().ControllerCoreMaxPostponedARCmd); - executeSqlStatement(insertGeneralInfoStatement); } diff --git a/DRAMSys/traceAnalyzer/scripts/memUtil.py b/DRAMSys/traceAnalyzer/scripts/memUtil.py index eed3fe2b..3779a315 100755 --- a/DRAMSys/traceAnalyzer/scripts/memUtil.py +++ b/DRAMSys/traceAnalyzer/scripts/memUtil.py @@ -76,3 +76,17 @@ def maximum_data_rate(connection): rate = memspec.getValue("dataRate") maxDataRate = float(clk)*float(width)*float(rate) return maxDataRate + + +def getFlexibleRef(connection): + cursor = connection.cursor() + cursor.execute(" SELECT FlexibleRefresh FROM GeneralInfo ") + result = cursor.fetchone() + return result[0] + + +def getMaxRefBurst(connection): + cursor = connection.cursor() + cursor.execute(" SELECT MaxRefBurst FROM GeneralInfo ") + result = cursor.fetchone() + return result[0] diff --git a/DRAMSys/traceAnalyzer/scripts/tests.py b/DRAMSys/traceAnalyzer/scripts/tests.py index d4d93993..35d84f8b 100755 --- a/DRAMSys/traceAnalyzer/scripts/tests.py +++ b/DRAMSys/traceAnalyzer/scripts/tests.py @@ -479,22 +479,16 @@ def max_number_ref_burst(connection): """Checks that the maximum number of REFA commands in a burst is not exceeded""" cursor = connection.cursor() query = """SELECT PhaseBegin, PhaseEnd FROM phases WHERE PhaseName = 'REFA' """ - query2 = """SELECT FlexibleRefresh, MaxRefBurst FROM GeneralInfo""" prevrow = [0] * 2 cnt = 0 - maxRefBurst = 0 # If flexible refresh is not enabled there shouldn't be any refreshes in sequence + flexibleRef = getFlexibleRef(connection) + maxRefBurst = getMaxRefBurst(connection) cursor.execute(query); result = cursor.fetchall(); - cursor.execute(query2); - result2 = cursor.fetchall(); - maxRefBurst = result2[0][1] - flexibleRef = result2[0][0] if (flexibleRef): maxRefBurst = maxRefBurst - 1 # Since the intersections will be used for this test, use -1 from the max - else: - maxRefBurst = 0 for row in result: if (prevrow[1] == row[0]): @@ -512,15 +506,12 @@ def max_time_without_ref(connection): """Checks that the maximum time allowed between REFA commands""" cursor = connection.cursor() query = """SELECT PhaseBegin, PhaseEnd FROM phases WHERE PhaseName = 'REFA' """ - query2 = """SELECT FlexibleRefresh, MaxRefBurst FROM GeneralInfo""" prevrow = [0] * 2 + flexibleRef = getFlexibleRef(connection) + maxRefBurst = getMaxRefBurst(connection) cursor.execute(query); result = cursor.fetchall(); - cursor.execute(query2); - result2 = cursor.fetchall(); - maxRefBurst = result2[0][1] - flexibleRef = result2[0][0] if (flexibleRef): maxTimeWithoutRef = ((maxRefBurst + 1) * dramconfig.tREFI) + dramconfig.tRP # Bursts are possible, so max should be the possible burst size + 1