This commit is contained in:
robert
2014-03-16 19:37:22 +01:00
parent f6504a0634
commit 7fc688a02d
20 changed files with 239 additions and 282 deletions

View File

@@ -3,18 +3,23 @@
<storageModule moduleId="org.eclipse.cdt.core.settings"> <storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1370040858"> <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1370040858">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1370040858" moduleId="org.eclipse.cdt.core.settings" name="standalone"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1370040858" moduleId="org.eclipse.cdt.core.settings" name="standalone">
<externalSettings/> <externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/dram"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/dram/standalone"/>
<entry flags="RESOLVED" kind="libraryFile" name="dram" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions> <extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <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.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"/> <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <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.1370040858" name="standalone" parent="cdt.managedbuild.config.gnu.exe.debug"> <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" 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.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1370040858" name="standalone" parent="cdt.managedbuild.config.gnu.exe.debug" postbuildStep="cd ..;rm -rf ${PWD}/include;find src -name &quot;*.h&quot;|cpio -pdvm ${PWD}/include;cd ${PWD}/include;rm -rf dram;mv src dram">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1370040858." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1370040858." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.885929366" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.885929366" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1576653236" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1576653236" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
@@ -25,8 +30,8 @@
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.251136752" 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.exe.debug.option.debugging.level.251136752" 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.files.360537680" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files"/> <option id="gnu.cpp.compiler.option.include.files.360537680" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files"/>
<option id="gnu.cpp.compiler.option.include.paths.1915081878" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> <option id="gnu.cpp.compiler.option.include.paths.1915081878" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/home/gernhard/gmock-1.7.0/include"/> <listOptionValue builtIn="false" value="/opt/gmock-1.7.0/include"/>
<listOptionValue builtIn="false" value="/home/gernhard/systemc-2.3.0/include"/> <listOptionValue builtIn="false" value="/opt/systemc-2.3.0/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc}/../common/common/standalone/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc}/../common/common/standalone/include&quot;"/>
</option> </option>
@@ -64,7 +69,6 @@
<sourceEntries> <sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DRAM"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DRAM"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="testing"/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@@ -143,6 +147,75 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration> </cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296" moduleId="org.eclipse.cdt.core.settings" name="testing">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<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="Unit tests" id="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296" name="testing" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1679325511" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.920623995" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/DRAM-Model}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.324112209" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1898487355" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} " id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.743207946" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1693229524" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1000276575" 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.files.38350815" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files"/>
<option id="gnu.cpp.compiler.option.include.paths.747337371" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/home/gernhard/gmock-1.7.0/include"/>
<listOptionValue builtIn="false" value="/home/gernhard/systemc-2.3.0/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc}/../common/common/standalone/include&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.other.other.1232220868" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++11" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1014131258" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.440486336" 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.1931718566" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.802536594" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.940566522" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.450892971" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.59366217" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.paths.168641100" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="/home/gernhard/gmock-1.7.0/lib"/>
<listOptionValue builtIn="false" value="/home/gernhard/systemc-2.3.0/lib-linux64"/>
<listOptionValue builtIn="false" value="${workspace_loc}/../common/common/standalone"/>
</option>
<option id="gnu.cpp.link.option.libs.240894874" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="common"/>
<listOptionValue builtIn="false" value="gmock"/>
<listOptionValue builtIn="false" value="systemc"/>
<listOptionValue builtIn="false" value="pthread"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1342695433" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.677886577" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.91434351" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DRAM"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="testing"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="DRAM.cdt.managedbuild.target.gnu.exe.355512678" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> <project id="DRAM.cdt.managedbuild.target.gnu.exe.355512678" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
@@ -170,6 +243,7 @@
<configuration configurationName="platformArchitect"> <configuration configurationName="platformArchitect">
<resource resourceType="PROJECT" workspacePath="/DRAM"/> <resource resourceType="PROJECT" workspacePath="/DRAM"/>
</configuration> </configuration>
<configuration configurationName="testing"/>
<configuration configurationName="Debug"> <configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/DRAM-Model"/> <resource resourceType="PROJECT" workspacePath="/DRAM-Model"/>
</configuration> </configuration>

View File

@@ -20,4 +20,14 @@
</provider> </provider>
</extension> </extension>
</configuration> </configuration>
<configuration id="cdt.managedbuild.config.gnu.exe.debug.1370040858.2044251296" name="testing">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-64906255729110141" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot; -std=c++11">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project> </project>

View File

@@ -14,7 +14,8 @@ void CommandBus::schedule(const CommandSchedule& schedule)
{ {
const std::vector<ScheduledCommand>& commands = schedule.getScheduledCommands(); const std::vector<ScheduledCommand>& commands = schedule.getScheduledCommands();
for(std::vector<ScheduledCommand>::const_iterator it = commands.begin();it != commands.end();++it) for (std::vector<ScheduledCommand>::const_iterator it = commands.begin(); it != commands.end();
++it)
{ {
scheduleCommand(*it); scheduleCommand(*it);
} }
@@ -27,112 +28,132 @@ void CommandBus::scheduleCommand(const ScheduledCommand& command)
changeControllerState(command); changeControllerState(command);
pendingBusCommands.insert(command.getStart()); pendingBusCommands.insert(command.getStart());
wrapper.sendCommand(command.getStart(),command.getTransaction(),command.getCommand()); notifyAllCheckersAboutScheduledCommand(command);
wrapper.sendCommand(command.getStart(), command.getTransaction(), command.getCommand());
lastCommandsOnBus[command.getCommand()][command.getBank()] = command; lastCommandsOnBus[command.getCommand()][command.getBank()] = command;
lastCommandsOnBus[command.getCommand()][command.getBank()].invalidateTransaction(); lastCommandsOnBus[command.getCommand()][command.getBank()].invalidateTransaction();
}
void CommandBus::notifyAllCheckersAboutScheduledCommand(const ScheduledCommand& command)
{
for (std::vector<ICommandChecker*>::iterator it = checker.begin(); it != checker.end(); ++it)
{
(*it)->notifyAboutScheduledCommand(command);
}
} }
void CommandBus::scheduleTrigger(const Trigger command, sc_time time) void CommandBus::scheduleTrigger(const Trigger command, sc_time time)
{ {
wrapper.sendTrigger(time,command); wrapper.sendTrigger(time, command);
} }
ScheduledCommand& CommandBus::getLastCommand(Command command, Bank bank) ScheduledCommand CommandBus::getLastCommand(Command command, Bank bank)
{ {
return lastCommandsOnBus[command][bank]; return lastCommandsOnBus[command][bank];
} }
ScheduledCommand& CommandBus::getLastCommand(Command command) ScheduledCommand CommandBus::getLastCommand(Command command)
{ {
ScheduledCommand* max = &getLastCommand(command, Bank(0)); ScheduledCommand max;
for (unsigned int i = 0; i < config.numberOfBanks; ++i) for (unsigned int i = 0; i < config.numberOfBanks; ++i)
{ {
ScheduledCommand* current = &getLastCommand(command, Bank(i)); const ScheduledCommand& current = getLastCommand(command, Bank(i));
if (current->getStart() > max->getStart()) if (current.getStart() > max.getStart())
max = current; max = current;
} }
return *max; return max;
}
ScheduledCommand CommandBus::getLastCommand(Bank bank)
{
ScheduledCommand lastCommand;
for(std::map<Command, std::map<Bank, ScheduledCommand> >::iterator it = lastCommandsOnBus.begin(); it != lastCommandsOnBus.end(); ++it)
{
ScheduledCommand& current = lastCommandsOnBus[it->first][bank];
if(current.getStart() > lastCommand.getStart())
lastCommand = current;
}
return lastCommand;
} }
bool CommandBus::notYetScheduled(Command command) const bool CommandBus::notYetScheduled(Command command) const
{ {
return (lastCommandsOnBus.count(command) == 0); return (lastCommandsOnBus.count(command) == 0);
} }
bool CommandBus::notYetScheduled(Command command, Bank bank) const bool CommandBus::notYetScheduled(Command command, Bank bank) const
{ {
return (notYetScheduled(command) || lastCommandsOnBus.find(command)->second.count(bank) == 0); return (notYetScheduled(command) || lastCommandsOnBus.find(command)->second.count(bank) == 0);
} }
sc_time CommandBus::getEarliestStartTime(const ScheduledCommand& command) const sc_time CommandBus::getEarliestStartTime(const ScheduledCommand& command) const
{ {
sc_time newStart = command.getStart(); sc_time newStart = command.getStart();
assert(isClkAligned(newStart, config.Timings.clk)); assert(isClkAligned(newStart, config.Timings.clk));
std::set<sc_time>::iterator it = pendingBusCommands.begin(); std::set<sc_time>::iterator it = pendingBusCommands.begin();
while (it != pendingBusCommands.end() && *it <= newStart) while (it != pendingBusCommands.end() && *it <= newStart)
{ {
if (*it == newStart) if (*it == newStart)
newStart += config.Timings.clk; newStart += config.Timings.clk;
++it; ++it;
} }
return newStart; return newStart;
} }
void CommandBus::cleanUpBus(sc_time currentTime) void CommandBus::cleanUpBus(sc_time currentTime)
{ {
pendingBusCommands.erase(pendingBusCommands.begin(), pendingBusCommands.erase(pendingBusCommands.begin(), pendingBusCommands.lower_bound(currentTime));
pendingBusCommands.lower_bound(currentTime));
} }
void CommandBus::changeControllerState(const ScheduledCommand& command) void CommandBus::changeControllerState(const ScheduledCommand& command)
{ {
switch (command.getCommand()) switch (command.getCommand())
{ {
case Refresh: case Refresh:
refresh(command); refresh(command);
break; break;
case Activate: case Activate:
activate(command); activate(command);
break; break;
case Precharge: case Precharge:
precharge(command); precharge(command);
default: default:
break; break;
} }
} }
void CommandBus::refresh(const ScheduledCommand& command) void CommandBus::refresh(const ScheduledCommand& command)
{ {
if(config.RefreshBankwise) if (config.RefreshBankwise)
{ {
state.bankStates.closeRowBuffer(command.getBank()); state.bankStates.closeRowBuffer(command.getBank());
} }
else else
{ {
state.bankStates.closeAllRowBuffers(); state.bankStates.closeAllRowBuffers();
} }
} }
void CommandBus::precharge(const ScheduledCommand& command) void CommandBus::precharge(const ScheduledCommand& command)
{ {
if(command.getCommand() == Precharge) if (command.getCommand() == Precharge)
{ {
state.bankStates.closeRowBuffer(command.getBank()); state.bankStates.closeRowBuffer(command.getBank());
} }
else if(command.getCommand() == PrechargeAll) else if (command.getCommand() == PrechargeAll)
{ {
state.bankStates.closeAllRowBuffers(); state.bankStates.closeAllRowBuffers();
} }
} }
void CommandBus::activate(const ScheduledCommand& command) void CommandBus::activate(const ScheduledCommand& command)
{ {
if(command.getCommand() == Activate) if (command.getCommand() == Activate)
{ {
state.bankStates.openRowInRowBuffer(command.getBank(), command.getRow()); state.bankStates.openRowInRowBuffer(command.getBank(), command.getRow());
} }
} }
} /* namespace controller */ } /* namespace controller */

View File

@@ -35,8 +35,10 @@ public:
void cleanUpBus(sc_time currentTime); void cleanUpBus(sc_time currentTime);
ScheduledCommand& getLastCommand(Command command, Bank bank); //TODO simple way to make it const? ScheduledCommand getLastCommand(Command command, Bank bank); //TODO simple way to make it const?
ScheduledCommand& getLastCommand(Command command); ScheduledCommand getLastCommand(Command command);
ScheduledCommand getLastCommand(Bank bank);
bool notYetScheduled(Command command) const; bool notYetScheduled(Command command) const;
bool notYetScheduled(Command command, Bank bank) const; bool notYetScheduled(Command command, Bank bank) const;
sc_time getEarliestStartTime(const ScheduledCommand& command) const; sc_time getEarliestStartTime(const ScheduledCommand& command) const;
@@ -55,6 +57,7 @@ private:
std::map<Command, std::map<Bank, ScheduledCommand> > lastCommandsOnBus; std::map<Command, std::map<Bank, ScheduledCommand> > lastCommandsOnBus;
std::set<sc_time> pendingBusCommands; std::set<sc_time> pendingBusCommands;
void notifyAllCheckersAboutScheduledCommand(const ScheduledCommand& command);
void changeControllerState(const ScheduledCommand& command); void changeControllerState(const ScheduledCommand& command);
void refresh(const ScheduledCommand& command); void refresh(const ScheduledCommand& command);
void precharge(const ScheduledCommand& command); void precharge(const ScheduledCommand& command);

View File

@@ -15,14 +15,14 @@ namespace core{
struct Configuration struct Configuration
{ {
Configuration(): numberOfBanks(8),Timings(numberOfBanks), RefreshBankwise(false), Configuration(): numberOfBanks(8),Timings(numberOfBanks), RefreshBankwise(false),buswidth(128),
nActivate(4) nActivate(2)
{} {}
unsigned int numberOfBanks; unsigned int numberOfBanks;
TimingConfiguration Timings; TimingConfiguration Timings;
bool RefreshBankwise; bool RefreshBankwise;
unsigned int buswidth;
unsigned int nActivate; unsigned int nActivate;
}; };

View File

@@ -38,9 +38,11 @@ struct TimingConfiguration
tRC = tRP + tRAS; //RAS-cycle-time (min time bw 2 succesive ACT to same bank) tRC = tRP + tRAS; //RAS-cycle-time (min time bw 2 succesive ACT to same bank)
tRRD = 2*clk; //(min time bw 2 succesive ACT to different banks) tRRD = 2*clk; //(min time bw 2 succesive ACT to different banks)
tRCD = 5*clk; //act -> read/write tRCD = 3*clk; //act -> read/write
tTAW = clkAlign(sc_time(50, SC_NS), clk); tRL = 3*clk; //read latency (read command start to data strobe)
tTAW = clkAlign(sc_time(50, SC_NS), clk); //two activate window
} }
sc_time clk; sc_time clk;
@@ -50,6 +52,7 @@ struct TimingConfiguration
sc_time tRRD; sc_time tRRD;
sc_time tRCD; sc_time tRCD;
sc_time tTAW; sc_time tTAW;
sc_time tRL;
std::vector<RefreshTiming> refreshTimings; std::vector<RefreshTiming> refreshTimings;

View File

@@ -18,11 +18,11 @@ namespace core {
class ScheduledCommand class ScheduledCommand
{ {
public: public:
static const ScheduledCommand NoCommand;
ScheduledCommand(tlm::tlm_generic_payload& transaction, Command command, sc_time time, ScheduledCommand(tlm::tlm_generic_payload& transaction, Command command, sc_time time,
sc_time executionTime) : sc_time executionTime) :
transaction(&transaction), command(command), start(time), executionTime(executionTime), extension(DramExtension::getExtension(&transaction)) transaction(&transaction), command(command), start(time), executionTime(executionTime), extension(
DramExtension::getExtension(&transaction))
{ {
} }
@@ -33,7 +33,12 @@ public:
bool isNoCommand() const bool isNoCommand() const
{ {
return (*this == NoCommand); return (command == NOP && start == SC_ZERO_TIME && executionTime == SC_ZERO_TIME);
}
bool isValidCommand() const
{
return !isNoCommand();
} }
const sc_time getStart() const const sc_time getStart() const

View File

@@ -10,7 +10,6 @@
#include "core/utils/Utils.h" #include "core/utils/Utils.h"
#include "core/scheduling/checker/ActivateChecker.h" #include "core/scheduling/checker/ActivateChecker.h"
namespace core { namespace core {
void ActivateChecker::check(ScheduledCommand& command) const void ActivateChecker::check(ScheduledCommand& command) const
@@ -34,12 +33,17 @@ void ActivateChecker::check_activateToActivate(ScheduledCommand& command) const
if (bus.notYetScheduled(Activate)) if (bus.notYetScheduled(Activate))
return; return;
sc_time lastActivate = bus.getLastCommand(Activate).getStart(); ScheduledCommand lastActivate = bus.getLastCommand(Activate);
sc_time lastActivateOnBank = bus.getLastCommand(Activate, command.getBank()).getStart(); if (lastActivate.isValidCommand())
command.delayStart(
delayByConstraint(lastActivate.getStart(), command.getStart(),
config.Timings.tRRD));
command.delayStart(delayByConstraint(lastActivate, command.getStart(), config.Timings.tRRD)); ScheduledCommand lastActivateOnBank = bus.getLastCommand(Activate, command.getBank());
command.delayStart( if (lastActivateOnBank.isValidCommand())
delayByConstraint(lastActivateOnBank, command.getStart(), config.Timings.tRC)); command.delayStart(
delayByConstraint(lastActivateOnBank.getStart(), command.getStart(),
config.Timings.tRC));
} }
void ActivateChecker::check_prechargeToActivate(ScheduledCommand& command) const void ActivateChecker::check_prechargeToActivate(ScheduledCommand& command) const
@@ -65,7 +69,7 @@ void ActivateChecker::check_bus(ScheduledCommand& command) const
command.delayStart(bus.getEarliestStartTime(command) - command.getStart()); command.delayStart(bus.getEarliestStartTime(command) - command.getStart());
} }
void ActivateChecker::cb_IInternalScheduler(const ScheduledCommand& command) void ActivateChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
{ {
if (command.getCommand() == Activate) if (command.getCommand() == Activate)
{ {

View File

@@ -19,12 +19,12 @@ namespace core {
class ActivateChecker: public core::ICommandChecker class ActivateChecker: public core::ICommandChecker
{ {
public: public:
ActivateChecker(Configuration& config, CommandBus& commandBus) : config(config), bus(commandBus), nActivateWindow(config.nActivate - 1){} ActivateChecker(Configuration& config, CommandBus& commandBus) : config(config), bus(commandBus), nActivateWindow(config.nActivate){}
virtual ~ActivateChecker(){} virtual ~ActivateChecker(){}
virtual void check(ScheduledCommand& command) const; virtual void check(ScheduledCommand& command) const;
virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const; virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const;
virtual void cb_IInternalScheduler(const ScheduledCommand& command); virtual void notifyAboutScheduledCommand(const ScheduledCommand& command);
private: private:
const Configuration& config; const Configuration& config;
CommandBus& bus;//TODO should be const .. but fucking map access operator!!!! CommandBus& bus;//TODO should be const .. but fucking map access operator!!!!

View File

@@ -20,7 +20,7 @@ public:
virtual void check(ScheduledCommand& command) const = 0; virtual void check(ScheduledCommand& command) const = 0;
virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const = 0; virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const = 0;
virtual void cb_IInternalScheduler(const ScheduledCommand& command) = 0; virtual void notifyAboutScheduledCommand(const ScheduledCommand& command) = 0;
}; };
} /* namespace controller */ } /* namespace controller */

View File

@@ -11,6 +11,11 @@ namespace core {
void PrechargeChecker::check(ScheduledCommand& command) const void PrechargeChecker::check(ScheduledCommand& command) const
{ {
ScheduledCommand lastCommand = bus.getLastCommand(command.getBank());
if(lastCommand.isValidCommand() && lastCommand.getEnd() > command.getStart())
{
command.delayStart(lastCommand.getEnd()-command.getStart());
}
} }
sc_time PrechargeChecker::getExecutionTime(const tlm::tlm_generic_payload& transaction, sc_time PrechargeChecker::getExecutionTime(const tlm::tlm_generic_payload& transaction,
@@ -19,7 +24,7 @@ sc_time PrechargeChecker::getExecutionTime(const tlm::tlm_generic_payload& trans
assert(command == Precharge || command == PrechargeAll); assert(command == Precharge || command == PrechargeAll);
return config.Timings.tRP; return config.Timings.tRP;
} }
void PrechargeChecker::cb_IInternalScheduler(const ScheduledCommand& command) void PrechargeChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
{ {
} }

View File

@@ -17,15 +17,15 @@ namespace core {
class PrechargeChecker: public core::ICommandChecker class PrechargeChecker: public core::ICommandChecker
{ {
public: public:
PrechargeChecker(const Configuration& config, const CommandBus& commandBus) : config(config), bus(commandBus) {} PrechargeChecker(const Configuration& config, CommandBus& commandBus) : config(config), bus(commandBus) {}
virtual ~PrechargeChecker() {} virtual ~PrechargeChecker() {}
virtual void check(ScheduledCommand& command) const; virtual void check(ScheduledCommand& command) const;
virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const; virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const;
virtual void cb_IInternalScheduler(const ScheduledCommand& command); virtual void notifyAboutScheduledCommand(const ScheduledCommand& command);
private: private:
const Configuration& config; const Configuration& config;
const CommandBus& bus; CommandBus& bus;
}; };
} /* namespace controller */ } /* namespace controller */

View File

@@ -6,21 +6,28 @@
*/ */
#include <core/scheduling/checker/ReadChecker.h> #include <core/scheduling/checker/ReadChecker.h>
#include "core/utils/Utils.h"
namespace core { namespace core {
void ReadChecker::check(ScheduledCommand& command) const void ReadChecker::check(ScheduledCommand& command) const
{ {
ScheduledCommand lastCommand = bus.getLastCommand(command.getBank());
if(lastCommand.isValidCommand() && lastCommand.getEnd() > command.getStart())
{
command.delayStart(lastCommand.getEnd()-command.getStart());
}
} }
sc_time ReadChecker::getExecutionTime(const tlm::tlm_generic_payload& transaction, sc_time ReadChecker::getExecutionTime(const tlm::tlm_generic_payload& transaction,
Command command) const Command command) const
{ {
assert(command == Read || command == ReadA); assert(command == Read || command == ReadA);
return config.Timings.clk*8; //return config.Timings.tRL + config.Timings.clk*getBurstLengthInBytes(transaction, config.buswidth);
return config.Timings.tRL + config.Timings.clk*2;
} }
void ReadChecker::cb_IInternalScheduler(const ScheduledCommand& command) void ReadChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
{ {
} }

View File

@@ -17,15 +17,15 @@ namespace core {
class ReadChecker: public core::ICommandChecker class ReadChecker: public core::ICommandChecker
{ {
public: public:
ReadChecker(const Configuration& config, const CommandBus& commandBus) : config(config), bus(commandBus) {} ReadChecker(const Configuration& config, CommandBus& commandBus) : config(config), bus(commandBus) {}
virtual ~ReadChecker() {} virtual ~ReadChecker() {}
virtual void check(ScheduledCommand& command) const; virtual void check(ScheduledCommand& command) const;
virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const; virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const;
virtual void cb_IInternalScheduler(const ScheduledCommand& command); virtual void notifyAboutScheduledCommand(const ScheduledCommand& command);
private: private:
const Configuration& config; const Configuration& config;
const CommandBus& bus; CommandBus& bus;
}; };
} /* namespace controller */ } /* namespace controller */

View File

@@ -20,7 +20,7 @@ sc_time WriteChecker::getExecutionTime(const tlm::tlm_generic_payload& transacti
return config.Timings.clk*8; return config.Timings.clk*8;
} }
void WriteChecker::cb_IInternalScheduler(const ScheduledCommand& command) void WriteChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
{ {
} }

View File

@@ -22,7 +22,7 @@ public:
virtual void check(ScheduledCommand& command) const; virtual void check(ScheduledCommand& command) const;
virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const; virtual sc_time getExecutionTime(const tlm::tlm_generic_payload& transaction, Command command) const;
virtual void cb_IInternalScheduler(const ScheduledCommand& command); virtual void notifyAboutScheduledCommand(const ScheduledCommand& command);
private: private:
const Configuration& config; const Configuration& config;
const CommandBus& bus; const CommandBus& bus;

View File

@@ -12,6 +12,10 @@ unsigned int getStartAddress(Bank bank)
return 0; return 0;
} }
unsigned int getBurstLengthInBytes(const tlm::tlm_generic_payload& payload, unsigned int buswidth)
{
return payload.get_data_length() / (buswidth/8);
}
sc_time delayByConstraint(sc_time previous, sc_time start, sc_time constraint) sc_time delayByConstraint(sc_time previous, sc_time start, sc_time constraint)
{ {
if (previous + constraint > start) if (previous + constraint > start)

View File

@@ -10,8 +10,10 @@
#include "common/dramExtension.h" #include "common/dramExtension.h"
#include <systemc.h> #include <systemc.h>
#include <tlm.h>
unsigned int getStartAddress(Bank bank); unsigned int getStartAddress(Bank bank);
unsigned int getBurstLengthInBytes(const tlm::tlm_generic_payload& payload, unsigned int buswidth);
sc_time delayByConstraint(sc_time previous, sc_time start, sc_time constraint); sc_time delayByConstraint(sc_time previous, sc_time start, sc_time constraint);

View File

@@ -1,188 +0,0 @@
///*
// * ControllerWrapper.h
// *
// * Created on: Mar 15, 2014
// * Author: gernhard
// */
//
//#ifndef CONTROLLERWRAPPER_H_
//#define CONTROLLERWRAPPER_H_
//
//#include <tlm.h>
//#include <systemc.h>
//#include <tlm_utils/simple_target_socket.h>
//#include <tlm_utils/simple_initiator_socket.h>
//#include <tlm_utils/peq_with_cb_and_phase.h>
//
//#include "common/protocol.h"
//#include "IControllerWrapper.h"
//#include "core/Controller.h"
//
//using namespace std;
//using namespace tlm;
//using namespace controller;
//
//template<unsigned int BUSWIDTH = 128>
//struct ControllerWrapper: public sc_module, public IControllerWrapper
//{
//public:
//
// tlm_utils::simple_initiator_socket<ControllerWrapper, BUSWIDTH, tlm::tlm_base_protocol_types> iSocket;
// tlm_utils::simple_target_socket<ControllerWrapper, BUSWIDTH, tlm::tlm_base_protocol_types> tSocket;
//
// SC_CTOR(ControllerWrapper) :
// controller(*this), frontendPEQ(this, &ControllerWrapper::frontendPEQCallback), dramPEQ(
// this, &ControllerWrapper::dramPEQCallback), controllerPEQ(this,
// &ControllerWrapper::controllerPEQCallback), inputBufferDelay(
// controller.config.Timings.clk)
// {
// iSocket.register_nb_transport_bw(this, &ControllerWrapper::nb_transport_bw);
// tSocket.register_nb_transport_fw(this, &ControllerWrapper::nb_transport_fw);
// }
//
// ~ControllerWrapper()
// {
// }
//
// virtual void sendCommand(sc_time startTime, tlm::tlm_generic_payload& payload,
// controller::Command command)
// {
// assert(startTime >= sc_time_stamp());
// sc_time delay = startTime - sc_time_stamp();
// tlm::tlm_phase phase;
// switch (command)
// {
// case Read:
// phase = BEGIN_RD;
// break;
// case Write:
// phase = BEGIN_WR;
// break;
// case Refresh:
// phase = BEGIN_REFA;
// break;
// case Activate:
// phase = BEGIN_ACT;
// break;
// case Precharge:
// phase = BEGIN_PRE;
// break;
// default:
// SC_REPORT_FATAL(0, "unsupported command in controller wrapper");
// break;
// }
//
// dramPEQ.notify(payload, phase, delay);
// }
//
// virtual void sendTrigger(sc_time time, controller::Trigger trigger)
// {
// assert(time >= sc_time_stamp());
// sc_time delay = time - sc_time_stamp();
//
// }
//private:
// Controller controller;
// tlm_utils::peq_with_cb_and_phase<ControllerWrapper> frontendPEQ;
// tlm_utils::peq_with_cb_and_phase<ControllerWrapper> dramPEQ;
// tlm_utils::peq_with_cb_and_phase<ControllerWrapper> controllerPEQ;
//
// sc_time inputBufferDelay;
// tlm::tlm_generic_payload triggerDummyPayload;
//
// // Initiated by dram
// tlm_sync_enum nb_transport_bw(tlm_generic_payload& payload, tlm_phase& phase, sc_time& bwDelay)
// {
// dramPEQ.notify(payload, phase, bwDelay);
// return TLM_ACCEPTED;
// }
//
// // Initiated by dram frontend
// tlm_sync_enum nb_transport_fw(tlm_generic_payload& payload, tlm_phase& phase, sc_time& fwDelay)
// {
// if (phase == BEGIN_REQ)
// payload.acquire();
// else if (phase == END_RESP)
// payload.release();
//
// frontendPEQ.notify(payload, phase, fwDelay);
// return TLM_ACCEPTED;
// }
//
// void frontendPEQCallback(tlm_generic_payload& payload, const tlm_phase& phase)
// {
// //todo : RECORDER
//
// if (phase == BEGIN_REQ)
// {
// controller.schedule(sc_time_stamp() + inputBufferDelay, payload);
// sendToFrontend(payload, END_REQ, inputBufferDelay);
// }
// else if (phase == BEGIN_RESP)
// {
// sendToFrontend(payload, phase, SC_ZERO_TIME);
// }
// else if (phase == END_RESP)
// {
// }
//
// else
// {
// SC_REPORT_FATAL(0,
// "Payload event queue in controller wrapper was triggered with unknown phase");
// }
// }
//
// void dramPEQCallback(tlm_generic_payload& payload, const tlm_phase& phase)
// {
// //todo : RECORDER
// if (phase == BEGIN_RD || phase == BEGIN_WR || phase == BEGIN_REFA || phase == BEGIN_ACT
// || phase == BEGIN_PRE)
// {
// sendToDram(payload, phase, SC_ZERO_TIME);
// }
// else if (phase == END_RD || phase == END_WR)
// {
// frontendPEQ.notif(payload, BEGIN_RESP, SC_ZERO_TIME);
// }
// else if (phase == END_PRE || phase == END_ACT || phase == END_REFA)
// {
//
// }
// else
// {
// SC_REPORT_FATAL(0,
// "dramPEQCallback queue in controller wrapper was triggered with unknown phase");
// }
// }
//
// void controllerPEQCallback(tlm_generic_payload& payload, const tlm_phase& phase)
// {
// if (phase == REFRESH_TRIGGER)
// {
// controller.refreshManager.scheduleRefresh(sc_time_stamp());
// }
// else
// {
// SC_REPORT_FATAL(0,
// "controllerPEQCallback queue in controller wrapper was triggered with unknown phase");
// }
// }
//
// void sendToDram(tlm_generic_payload& payload, const tlm_phase& phase, const sc_time& delay)
// {
// tlm_phase TPhase = phase;
// sc_time TDelay = delay;
// iSocket->nb_transport_fw(payload, TPhase, TDelay);
// }
//
// void sendToFrontend(tlm_generic_payload& payload, const tlm_phase& phase, const sc_time& delay)
// {
// tlm_phase TPhase = phase;
// sc_time TDelay = delay;
// tSocket->nb_transport_bw(payload, TPhase, TDelay);
// }
//
//};
//
//#endif /* CONTROLLERWRAPPER_H_ */

View File

@@ -72,5 +72,12 @@ TEST(UtilsTest, RingBufferWorks)
EXPECT_TRUE(buffer.isFull()); EXPECT_TRUE(buffer.isFull());
} }
TEST(UtilsTest,getBurstLengthInBytesWorks)
{
tlm::tlm_generic_payload payload;
payload.set_data_length(4);
EXPECT_EQ(4,getBurstLengthInBytes(payload,128));
}
} /* namespace controller */ } /* namespace controller */