This commit is contained in:
robert
2014-04-11 12:44:17 +02:00
12 changed files with 109 additions and 240 deletions

View File

@@ -1,169 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.513647443">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.513647443" moduleId="org.eclipse.cdt.core.settings" name="build-simulation">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.513647443" name="build-simulation" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.513647443." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.784929216" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.2061818651" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/dram}/build-simulation" cleanBuildTarget="clean" enableAutoBuild="false" id="org.eclipse.cdt.build.core.internal.builder.1698165306" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1509734096" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="/opt/gcc/bin/g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.789860529" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.2041174282" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.2092267417" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1823643375" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/systemc/include"/>
<listOptionValue builtIn="false" value="/opt/gmock-1.7.0/include"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.2096973106" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="SC_INCLUDE_DYNAMIC_PROCESSES"/>
<listOptionValue builtIn="false" value="TIXML_USE_STL"/>
</option>
<option id="gnu.cpp.compiler.option.other.other.1339801369" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++11 -fprofile-arcs -ftest-coverage" valueType="string"/>
<option id="gnu.cpp.compiler.option.debugging.prof.523954048" name="Generate prof information (-p)" superClass="gnu.cpp.compiler.option.debugging.prof" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.debugging.gprof.1932984572" name="Generate gprof information (-pg)" superClass="gnu.cpp.compiler.option.debugging.gprof" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.dialect.std.739859284" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1847876781" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool command="/opt/gcc/bin/g++" id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.151665950" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1290346028" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.1471334523" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1530954752" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/systemc-2.3.0/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/dram/dram/src}&quot;"/>
<listOptionValue builtIn="false" value="/opt/gmock-1.7.0/include"/>
<listOptionValue builtIn="false" value="../dram/dram/src"/>
</option>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.886802157" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="SC_INCLUDE_DYNAMIC_PROCESSES"/>
<listOptionValue builtIn="false" value="TIXML_USE_STL"/>
</option>
<option id="gnu.c.compiler.option.dialect.std.544879672" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1721222219" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.699525857" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool command="/opt/gcc/bin/g++" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.403667757" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.1753762098" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="systemc"/>
<listOptionValue builtIn="false" value="sqlite3"/>
<listOptionValue builtIn="false" value="gcov"/>
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.paths.1916142213" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="/opt/systemc/lib-linux64"/>
</option>
<option id="gnu.cpp.link.option.debugging.prof.631946268" name="Generate prof information (-p)" superClass="gnu.cpp.link.option.debugging.prof" value="false" valueType="boolean"/>
<option id="gnu.cpp.link.option.debugging.gprof.1817867753" name="Generate gprof information (-pg)" superClass="gnu.cpp.link.option.debugging.gprof" value="false" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1335058803" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.exe.debug.876145438" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<option id="gnu.both.asm.option.include.paths.1893217579" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/opt/systemc-2.3.0/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/dram/dram/src}&quot;"/>
<listOptionValue builtIn="false" value="/opt/gmock-1.7.0/include"/>
<listOptionValue builtIn="false" value="../dram/dram/src"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.207521263" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="testing|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/common"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/core"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/scheduler"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/simulation"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="DRAM.cdt.managedbuild.target.gnu.exe.355512678" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="unit_test"/>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/DRAM-Model"/>
</configuration>
<configuration configurationName="platformArchitect">
<resource resourceType="PROJECT" workspacePath="/DRAM"/>
</configuration>
<configuration configurationName="build-simulation"/>
<configuration configurationName="testing"/>
<configuration configurationName="simulation-build">
<resource resourceType="PROJECT" workspacePath="/dram"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/DRAM-Model"/>
</configuration>
<configuration configurationName="standalone"/>
<configuration configurationName="simulation"/>
<configuration configurationName="build-testing"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
<doc-comment-owner id="org.eclipse.cdt.internal.ui.text.doctools.NullDocCommentOwner">
<path value=""/>
</doc-comment-owner>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="standalone" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>standalone</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858;cdt.managedbuild.config.gnu.exe.debug.1370040858.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1266973934;cdt.managedbuild.tool.gnu.cpp.compiler.input.643453324">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.868838098;cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.868838098.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2055122253;cdt.managedbuild.tool.gnu.c.compiler.input.1427026929">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858;cdt.managedbuild.config.gnu.exe.debug.1370040858.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1190872096;cdt.managedbuild.tool.gnu.c.compiler.input.953626288">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1948932292;cdt.managedbuild.config.gnu.exe.release.1948932292.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1398731634;cdt.managedbuild.tool.gnu.c.compiler.input.1992326299">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296;cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.440486336;cdt.managedbuild.tool.gnu.c.compiler.input.940566522">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.513647443;cdt.managedbuild.config.gnu.exe.debug.513647443.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.789860529;cdt.managedbuild.tool.gnu.cpp.compiler.input.1847876781">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1948932292;cdt.managedbuild.config.gnu.exe.release.1948932292.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1633668164;cdt.managedbuild.tool.gnu.cpp.compiler.input.1777926483">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.868838098;cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.868838098.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.192908432;cdt.managedbuild.tool.gnu.cpp.compiler.input.830919281">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.513647443;cdt.managedbuild.config.gnu.exe.debug.513647443.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.151665950;cdt.managedbuild.tool.gnu.c.compiler.input.1721222219">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296;cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.743207946;cdt.managedbuild.tool.gnu.cpp.compiler.input.1014131258">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>dram</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View File

@@ -1,7 +1,7 @@
echo "Cleaning Up:"
echo " -->remove *.txt"
rm *.txt
echo " -->remove *.tdb-journal"
echo " -->remove *.tdb"
rm *.tdb
echo " -->remove *.tdb-journal"
rm *.tdb-journal

View File

@@ -0,0 +1 @@
memconfig.xml

View File

@@ -28,7 +28,8 @@
<!--<parameter id="XPDLL" type="uint" value="2" />-->
<parameter id="XS" type="uint" value="20" /><!--tRFC+2clk-->
<!--<parameter id="XSDLL" type="uint" value="20" />-->
<parameter id="REFI" type="uint" value="1300" />
<parameter id="REFI" type="uint" value="1300" />
<!--<parameter id="CL" type="uint" value="3" />-->
<parameter id="TAW" type="uint" value="10" />
<parameter id="RRD" type="uint" value="2" />
<parameter id="CCD" type="uint" value="1" />

View File

@@ -99,8 +99,8 @@ void MemSpecLoader::loadDDR4(Configuration& config, XMLElement* memspec)
config.Timings.refreshTimings.clear();
for (unsigned int i = 0; i < config.NumberOfBanks; ++i)
{
config.Timings.refreshTimings.push_back(
RefreshTiming(config.Timings.tRFC, config.Timings.tREFI));
config.Timings.refreshTimings[Bank(i)] = RefreshTiming(config.Timings.tRFC,
config.Timings.tREFI);
}
}
@@ -148,8 +148,8 @@ void MemSpecLoader::loadWideIO(Configuration& config, XMLElement* memspec)
config.Timings.refreshTimings.clear();
for (unsigned int i = 0; i < config.NumberOfBanks; ++i)
{
config.Timings.refreshTimings.push_back(
RefreshTiming(config.Timings.tRFC, config.Timings.tREFI));
config.Timings.refreshTimings[Bank(i)] = RefreshTiming(config.Timings.tRFC,
config.Timings.tREFI);
}
}

View File

@@ -10,12 +10,14 @@
#include <systemc.h>
#include "../utils/Utils.h"
#include <map>
namespace core{
struct RefreshTiming
{
RefreshTiming(sc_time tRFC, sc_time tREFI) : tRFC(tRFC), tREFI(tREFI) {}
RefreshTiming() {};
RefreshTiming(sc_time tRFC, sc_time tREFI) : tRFC(tRFC), tREFI(tREFI) {};
sc_time tRFC;
sc_time tREFI;
};
@@ -51,7 +53,7 @@ struct TimingConfiguration
sc_time tRFC; //min ref->act delay
sc_time tREFI; //auto refresh must be issued at an average periodic interval tREFI
std::vector<RefreshTiming> refreshTimings;
std::map<Bank, RefreshTiming> refreshTimings;//ensure that map is populated completely in memspecloader
//act and read/write commands remain for this timespan in history
sc_time tActHistory(){return tNAW;}

View File

@@ -13,8 +13,8 @@ using namespace tlm;
namespace core {
RefreshManager::RefreshManager(ControllerCore& controller) :
controller(controller), timing(controller.config.Timings.refreshTimings.at(0)), nextPlannedRefresh(
SC_ZERO_TIME), refreshPayloads(controller.config.NumberOfBanks)
controller(controller), timing(controller.config.Timings.refreshTimings[Bank(0)]), nextPlannedRefresh(
SC_ZERO_TIME)
{
setupTransactions();
planNextRefresh();
@@ -34,18 +34,19 @@ void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time
sc_assert(!isInvalidated(payload, time));
ScheduledCommand nextRefresh(Command::AutoRefresh, time, timing.tRFC,
DramExtension::getExtension(refreshPayloads.at(0)));
DramExtension::getExtension(refreshPayloads[Bank(0)]));
if (!controller.state.bankStates.allRowBuffersAreClosed())
{
ScheduledCommand precharge(Command::PrechargeAll, time, controller.config.Timings.tRP,
DramExtension::getExtension(refreshPayloads.at(0)));
DramExtension::getExtension(refreshPayloads[Bank(0)]));
controller.getCommandChecker(Command::PrechargeAll).delayToSatisfyConstraints(precharge);
nextRefresh.setStart(precharge.getEnd());
for (tlm::tlm_generic_payload& payload : refreshPayloads)
for (Bank bank : controller.getBanks())
{
tlm_generic_payload& payload = refreshPayloads[bank];
ScheduledCommand prechargeToSend(Command::PrechargeAll, precharge.getStart(),
controller.config.Timings.tRP, DramExtension::getExtension(payload));
controller.state.change(prechargeToSend);
@@ -57,8 +58,9 @@ void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time
//no precharge all
controller.state.bus.moveCommandToNextFreeSlot(nextRefresh);
}
for (tlm::tlm_generic_payload& payload : refreshPayloads)
for (Bank bank : controller.getBanks())
{
tlm_generic_payload& payload = refreshPayloads[bank];
Row currentrow = DramExtension::getExtension(payload).getRow();
DramExtension::getExtension(payload).setRow(Row((currentrow.ID()+1)%Configuration::getInstance().NumberOfBanks));
ScheduledCommand refreshToSend(Command::AutoRefresh, nextRefresh.getStart(), timing.tRFC,
@@ -75,7 +77,7 @@ void RefreshManager::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time
void RefreshManager::planNextRefresh()
{
nextPlannedRefresh += timing.tREFI;
controller.wrapper.send(RefreshTrigger, nextPlannedRefresh, refreshPayloads.at(0));
controller.wrapper.send(RefreshTrigger, nextPlannedRefresh, refreshPayloads[Bank(0)]);
}
void RefreshManager::reInitialize(tlm::tlm_generic_payload& payload, sc_time time)
@@ -93,7 +95,7 @@ void RefreshManager::setupTransactions()
{
for (Bank bank : controller.getBanks())
{
setUpDummy(refreshPayloads.at(bank.ID()), bank);
setUpDummy(refreshPayloads[bank], bank);
}
}

View File

@@ -32,7 +32,7 @@ private:
ControllerCore& controller;
RefreshTiming& timing;
sc_time nextPlannedRefresh;
std::vector<tlm::tlm_generic_payload> refreshPayloads;
std::map<Bank, tlm::tlm_generic_payload> refreshPayloads;
void planNextRefresh();
void setupTransactions();

View File

@@ -20,35 +20,35 @@ RefreshManagerBankwise::RefreshManagerBankwise(ControllerCore& controller) :
for (Bank bank : controller.getBanks())
{
refreshManagerForBanks.push_back(new RefreshManagerForBank(controller, bank));
refreshManagerForBanks[bank] = new RefreshManagerForBank(controller, bank);
}
}
RefreshManagerBankwise::~RefreshManagerBankwise()
{
for (RefreshManagerForBank* manager : refreshManagerForBanks)
for (Bank bank : controller.getBanks())
{
delete manager;
delete refreshManagerForBanks[bank];
}
}
bool RefreshManagerBankwise::hasCollision(const CommandSchedule& schedule)
{
RefreshManagerForBank& manager = *refreshManagerForBanks.at(schedule.getBank().ID());
RefreshManagerForBank& manager = *refreshManagerForBanks[schedule.getBank()];
return manager.hasCollision(schedule);
}
void RefreshManagerBankwise::scheduleRefresh(tlm::tlm_generic_payload& payload, sc_time time)
{
sc_assert(!isInvalidated(payload, time));
RefreshManagerForBank& manager = *refreshManagerForBanks.at(
DramExtension::getExtension(payload).getBank().ID());
RefreshManagerForBank& manager =
*refreshManagerForBanks[DramExtension::getExtension(payload).getBank()];
manager.scheduleRefresh(time);
}
RefreshManagerBankwise::RefreshManagerForBank::RefreshManagerForBank(ControllerCore& controller,
Bank bank) :
controller(controller), timing(controller.config.Timings.refreshTimings.at(bank.ID())), bank(
controller(controller), timing(controller.config.Timings.refreshTimings[bank]), bank(
bank), nextPlannedRefresh(SC_ZERO_TIME)
{
setupTransaction();
@@ -89,7 +89,8 @@ void RefreshManagerBankwise::RefreshManagerForBank::scheduleRefresh(sc_time time
controller.state.bus.moveCommandToNextFreeSlot(nextRefresh);
controller.state.change(nextRefresh);
Row currentrow = DramExtension::getExtension(refreshPayload).getRow();
DramExtension::getExtension(refreshPayload).setRow(Row((currentrow.ID()+1)%Configuration::getInstance().NumberOfBanks));
DramExtension::getExtension(refreshPayload).setRow(
Row((currentrow.ID() + 1) % Configuration::getInstance().NumberOfBanks));
controller.wrapper.send(nextRefresh, refreshPayload);
planNextRefresh();
@@ -121,14 +122,14 @@ void RefreshManagerBankwise::RefreshManagerForBank::setupTransaction()
void RefreshManagerBankwise::reInitialize(tlm::tlm_generic_payload& payload, sc_time time)
{
refreshManagerForBanks.at(DramExtension::getExtension(payload).getBank().ID())->reInitialize(
payload, time);
refreshManagerForBanks[DramExtension::getExtension(payload).getBank()]->reInitialize(payload,
time);
}
bool RefreshManagerBankwise::isInvalidated(tlm::tlm_generic_payload& payload, sc_time time)
{
RefreshManagerForBank& manager = *refreshManagerForBanks.at(
DramExtension::getExtension(payload).getBank().ID());
RefreshManagerForBank& manager =
*refreshManagerForBanks[DramExtension::getExtension(payload).getBank()];
return manager.isInvalidated(time);
}

View File

@@ -57,7 +57,7 @@ private:
};
ControllerCore& controller;
std::vector<RefreshManagerForBank*> refreshManagerForBanks;
std::map<Bank, RefreshManagerForBank*> refreshManagerForBanks;
};

View File

@@ -17,8 +17,8 @@ using namespace std;
namespace simulation {
Simulation::Simulation(sc_module_name name, string pathToResources, string traceName, DramSetup setup,
std::vector<Device> devices, bool silent) :
Simulation::Simulation(sc_module_name name, string pathToResources, string traceName,
DramSetup setup, std::vector<Device> devices, bool silent) :
traceName(traceName)
{
@@ -30,15 +30,18 @@ Simulation::Simulation(sc_module_name name, string pathToResources, string trace
Configuration::memconfigUri = pathToResources + string("configs/memconfigs/") + setup.memconfig;
Configuration::memspecUri = pathToResources + string("configs/memspecs/") + setup.memspec;
TlmRecorder::getInstance().recordTracenames(devices[0].trace + "," + devices[1].trace);
TlmRecorder::getInstance().recordMemspec(Configuration::memspecUri);
TlmRecorder::getInstance().recordMemconfig(loadTextFileContents(Configuration::memconfigUri));
//setup dram
dram = new Dram<>("dram");
arbiter = new Arbiter<numberOfTracePlayers, 128>("arbiter");
controller = new Controller<>("controller");
//setup devices
for (auto& d : devices)
{
if (d.burstLength == 0)
d.burstLength = Configuration::getInstance().BurstLength;
}
player1 = new TracePlayer<>("player1", pathToResources + string("traces/") + devices[0].trace,
devices[0].burstLength, this);
player2 = new TracePlayer<>("player2", pathToResources + string("traces/") + devices[1].trace,
@@ -64,6 +67,11 @@ Simulation::Simulation(sc_module_name name, string pathToResources, string trace
auto& dbg = DebugManager::getInstance();
dbg.addToWhiteList(whiteList);
dbg.setDebugFile(traceName + ".txt");
if (silent)
{
dbg.writeToConsole = false;
dbg.writeToFile = false;
}
}
Simulation::~Simulation()
@@ -77,8 +85,10 @@ Simulation::~Simulation()
void Simulation::startSimulation()
{
clock_t begin = clock();
cout<<"Starting simulation"<<endl;
DebugManager::getInstance().printDebugMessage(name(), "Starting simulation");
player1->start();
player2->start();
@@ -88,6 +98,7 @@ void Simulation::startSimulation()
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
DebugManager::getInstance().printDebugMessage(name(),
"Simulation took " + to_string(elapsed_secs) + " seconds");
cout<<"took "<<(elapsed_secs)<<endl;
}
void Simulation::tracePlayerFinishedCallback(string name)

View File

@@ -19,7 +19,6 @@ using namespace std;
using namespace simulation;
string resources;
bool silent = false;
string pathOfFile(string file)
{
@@ -33,13 +32,13 @@ void startTraceAnalyzer(string traceName)
system(run_tpr.c_str());
}
bool runSimulation(string traceName, DramSetup setup, vector<Device> devices)
bool runSimulation(string resources, string traceName, DramSetup setup, vector<Device> devices)
{
int pid = fork();
int status = 0;
if (pid == 0)
{
Simulation simulation("sim", resources, traceName, setup, devices,silent);
Simulation simulation("sim", resources, traceName, setup, devices, true);
simulation.startSimulation();
return true;
}
@@ -53,8 +52,8 @@ bool batchTraces(DramSetup setup, vector<pair<string, string>> tracePairs)
for (pair<string, string> pair : tracePairs)
{
id++;
string traceName = "traceBatch" + to_string(id) + ".tdb";
if (runSimulation(traceName, setup, { Device(pair.first), Device(pair.second) }))
string traceName = "batch" + to_string(id) + ".tdb";
if (runSimulation(resources, traceName, setup, { Device(pair.first), Device(pair.second) }))
return true; //kill child
}
return false;
@@ -66,8 +65,8 @@ bool batchSetups(pair<string, string> tracePair, vector<DramSetup> setups)
for (auto& setup : setups)
{
id++;
string traceName = "setupBatch" + to_string(id) + ".tdb";
if (runSimulation(traceName, setup,
string traceName = "batch0" + to_string(id) + ".tdb";
if (runSimulation(resources, traceName, setup,
{ Device(tracePair.first), Device(tracePair.second) }))
return true; //kill child
}
@@ -76,40 +75,34 @@ bool batchSetups(pair<string, string> tracePair, vector<DramSetup> setups)
int sc_main(int argc, char **argv)
{
sc_set_time_resolution(1, SC_PS);
resources = pathOfFile(argv[0]) + string("/../resources/");
// DramSetup setup;
// setup.memconfig = "memconfig.xml";
// //setup.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml";
// setup.memspec = "MatzesWideIO.xml";
//
// vector<pair<string, string>> tracePairs;
// tracePairs.push_back(pair<string, string>("chstone-mips_32.stl", "chstone-motion_32.stl"));
//
// batchTraces(setup, tracePairs);
DramSetup setup;
setup.memconfig = "memconfig.xml";
setup.memspec = "MatzesWideIO.xml";
//setup.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml";
// DramSetup setup2;
// setup2.memconfig = "memconfig.xml";
// setup2.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml";
//batchSetups(tracePairs[0], { setup, setup2 });
DramSetup setup2;
setup2.memconfig = "memconfig.xml";
setup2.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml";
Device d1("chstone-motion_32.stl",4);
Device d2("empty.stl",4);
string dramSpec = "MatzesWideIO.xml";
vector<pair<string, string>> tracePairs;
tracePairs.push_back(pair<string, string>("trace.stl", "empty.stl"));
tracePairs.push_back(pair<string, string>("trace2.stl", "empty.stl"));
if(runSimulation("fifo.tdb",DramSetup("fifo.xml",dramSpec),{d1,d2}))
return 0;
if(runSimulation("fr_fcfs.tdb",DramSetup("fr_fcfs.xml",dramSpec),{d1,d2}))
return 0;
// if(runSimulation("fr_fcfs_unaware.tdb",DramSetup("fr_fcfs_unaware.xml",dramSpec),{d1,d2}))
// return 0;
// if(runSimulation("par_bs.tdb",DramSetup("par_bs.xml",dramSpec),{d1,d2}))
// return 0;
// if(runSimulation("par_bs_unaware.tdb",DramSetup("par_bs_unaware.xml",dramSpec),{d1,d2}))
// return 0;
//
// startTraceAnalyzer("fifo.tdb fr_fcfs.tdb fr_fcfs_unaware.tdb par_bs.tdb par_bs_unaware.tdb");
//batchTraces(setup, tracePairs);
//batchSetups(tracePairs[0], {setup});
string traceName("tpr.tdb");
string trace2 = "empty.stl";
string trace1 = "chstone-jpeg_32.stl";
trace1 = "trace.stl";
if (runSimulation(resources, traceName, setup, { Device(trace1), Device(trace2) }))
startTraceAnalyzer(traceName);
return 0;
}