..
This commit is contained in:
@@ -3,18 +3,23 @@
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<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">
|
||||
<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>
|
||||
<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="" 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 "*.h"|cpio -pdvm ${PWD}/include;cd ${PWD}/include;rm -rf dram;mv src dram">
|
||||
<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">
|
||||
<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.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">
|
||||
<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="/opt/gmock-1.7.0/include"/>
|
||||
<listOptionValue builtIn="false" value="/opt/systemc-2.3.0/include"/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc}/../common/common/standalone/include""/>
|
||||
</option>
|
||||
@@ -64,7 +69,6 @@
|
||||
<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>
|
||||
@@ -143,6 +147,75 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</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=""${workspace_loc:/${ProjName}/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc}/../common/common/standalone/include""/>
|
||||
</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 moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="DRAM.cdt.managedbuild.target.gnu.exe.355512678" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
|
||||
@@ -170,6 +243,7 @@
|
||||
<configuration configurationName="platformArchitect">
|
||||
<resource resourceType="PROJECT" workspacePath="/DRAM"/>
|
||||
</configuration>
|
||||
<configuration configurationName="testing"/>
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/DRAM-Model"/>
|
||||
</configuration>
|
||||
|
||||
@@ -20,4 +20,14 @@
|
||||
</provider>
|
||||
</extension>
|
||||
</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 "${INPUTS}" -std=c++11">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
|
||||
@@ -14,7 +14,8 @@ void CommandBus::schedule(const CommandSchedule& schedule)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -27,112 +28,132 @@ void CommandBus::scheduleCommand(const ScheduledCommand& command)
|
||||
changeControllerState(command);
|
||||
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()].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)
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ScheduledCommand* current = &getLastCommand(command, Bank(i));
|
||||
if (current->getStart() > max->getStart())
|
||||
const ScheduledCommand& current = getLastCommand(command, Bank(i));
|
||||
if (current.getStart() > max.getStart())
|
||||
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
|
||||
{
|
||||
return (lastCommandsOnBus.count(command) == 0);
|
||||
return (lastCommandsOnBus.count(command) == 0);
|
||||
}
|
||||
|
||||
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 newStart = command.getStart();
|
||||
assert(isClkAligned(newStart, config.Timings.clk));
|
||||
std::set<sc_time>::iterator it = pendingBusCommands.begin();
|
||||
while (it != pendingBusCommands.end() && *it <= newStart)
|
||||
{
|
||||
if (*it == newStart)
|
||||
newStart += config.Timings.clk;
|
||||
++it;
|
||||
}
|
||||
return newStart;
|
||||
sc_time newStart = command.getStart();
|
||||
assert(isClkAligned(newStart, config.Timings.clk));
|
||||
std::set<sc_time>::iterator it = pendingBusCommands.begin();
|
||||
while (it != pendingBusCommands.end() && *it <= newStart)
|
||||
{
|
||||
if (*it == newStart)
|
||||
newStart += config.Timings.clk;
|
||||
++it;
|
||||
}
|
||||
return newStart;
|
||||
}
|
||||
|
||||
void CommandBus::cleanUpBus(sc_time currentTime)
|
||||
{
|
||||
pendingBusCommands.erase(pendingBusCommands.begin(),
|
||||
pendingBusCommands.lower_bound(currentTime));
|
||||
pendingBusCommands.erase(pendingBusCommands.begin(), pendingBusCommands.lower_bound(currentTime));
|
||||
}
|
||||
|
||||
void CommandBus::changeControllerState(const ScheduledCommand& command)
|
||||
{
|
||||
switch (command.getCommand())
|
||||
{
|
||||
case Refresh:
|
||||
refresh(command);
|
||||
break;
|
||||
case Activate:
|
||||
activate(command);
|
||||
break;
|
||||
case Precharge:
|
||||
precharge(command);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (command.getCommand())
|
||||
{
|
||||
case Refresh:
|
||||
refresh(command);
|
||||
break;
|
||||
case Activate:
|
||||
activate(command);
|
||||
break;
|
||||
case Precharge:
|
||||
precharge(command);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CommandBus::refresh(const ScheduledCommand& command)
|
||||
{
|
||||
if(config.RefreshBankwise)
|
||||
{
|
||||
state.bankStates.closeRowBuffer(command.getBank());
|
||||
}
|
||||
else
|
||||
{
|
||||
state.bankStates.closeAllRowBuffers();
|
||||
}
|
||||
if (config.RefreshBankwise)
|
||||
{
|
||||
state.bankStates.closeRowBuffer(command.getBank());
|
||||
}
|
||||
else
|
||||
{
|
||||
state.bankStates.closeAllRowBuffers();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CommandBus::precharge(const ScheduledCommand& command)
|
||||
{
|
||||
if(command.getCommand() == Precharge)
|
||||
{
|
||||
state.bankStates.closeRowBuffer(command.getBank());
|
||||
}
|
||||
else if(command.getCommand() == PrechargeAll)
|
||||
{
|
||||
state.bankStates.closeAllRowBuffers();
|
||||
}
|
||||
if (command.getCommand() == Precharge)
|
||||
{
|
||||
state.bankStates.closeRowBuffer(command.getBank());
|
||||
}
|
||||
else if (command.getCommand() == PrechargeAll)
|
||||
{
|
||||
state.bankStates.closeAllRowBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
void CommandBus::activate(const ScheduledCommand& command)
|
||||
{
|
||||
if(command.getCommand() == Activate)
|
||||
{
|
||||
state.bankStates.openRowInRowBuffer(command.getBank(), command.getRow());
|
||||
}
|
||||
if (command.getCommand() == Activate)
|
||||
{
|
||||
state.bankStates.openRowInRowBuffer(command.getBank(), command.getRow());
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace controller */
|
||||
|
||||
@@ -35,8 +35,10 @@ public:
|
||||
|
||||
void cleanUpBus(sc_time currentTime);
|
||||
|
||||
ScheduledCommand& getLastCommand(Command command, Bank bank); //TODO simple way to make it const?
|
||||
ScheduledCommand& getLastCommand(Command command);
|
||||
ScheduledCommand getLastCommand(Command command, Bank bank); //TODO simple way to make it const?
|
||||
ScheduledCommand getLastCommand(Command command);
|
||||
ScheduledCommand getLastCommand(Bank bank);
|
||||
|
||||
bool notYetScheduled(Command command) const;
|
||||
bool notYetScheduled(Command command, Bank bank) const;
|
||||
sc_time getEarliestStartTime(const ScheduledCommand& command) const;
|
||||
@@ -55,6 +57,7 @@ private:
|
||||
std::map<Command, std::map<Bank, ScheduledCommand> > lastCommandsOnBus;
|
||||
std::set<sc_time> pendingBusCommands;
|
||||
|
||||
void notifyAllCheckersAboutScheduledCommand(const ScheduledCommand& command);
|
||||
void changeControllerState(const ScheduledCommand& command);
|
||||
void refresh(const ScheduledCommand& command);
|
||||
void precharge(const ScheduledCommand& command);
|
||||
|
||||
@@ -15,14 +15,14 @@ namespace core{
|
||||
|
||||
struct Configuration
|
||||
{
|
||||
Configuration(): numberOfBanks(8),Timings(numberOfBanks), RefreshBankwise(false),
|
||||
nActivate(4)
|
||||
Configuration(): numberOfBanks(8),Timings(numberOfBanks), RefreshBankwise(false),buswidth(128),
|
||||
nActivate(2)
|
||||
{}
|
||||
unsigned int numberOfBanks;
|
||||
TimingConfiguration Timings;
|
||||
|
||||
bool RefreshBankwise;
|
||||
|
||||
unsigned int buswidth;
|
||||
unsigned int nActivate;
|
||||
};
|
||||
|
||||
|
||||
@@ -38,9 +38,11 @@ struct TimingConfiguration
|
||||
|
||||
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)
|
||||
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;
|
||||
@@ -50,6 +52,7 @@ struct TimingConfiguration
|
||||
sc_time tRRD;
|
||||
sc_time tRCD;
|
||||
sc_time tTAW;
|
||||
sc_time tRL;
|
||||
|
||||
std::vector<RefreshTiming> refreshTimings;
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace core {
|
||||
class ScheduledCommand
|
||||
{
|
||||
public:
|
||||
static const ScheduledCommand NoCommand;
|
||||
|
||||
ScheduledCommand(tlm::tlm_generic_payload& transaction, Command command, sc_time time,
|
||||
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
|
||||
{
|
||||
return (*this == NoCommand);
|
||||
return (command == NOP && start == SC_ZERO_TIME && executionTime == SC_ZERO_TIME);
|
||||
}
|
||||
|
||||
bool isValidCommand() const
|
||||
{
|
||||
return !isNoCommand();
|
||||
}
|
||||
|
||||
const sc_time getStart() const
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "core/utils/Utils.h"
|
||||
#include "core/scheduling/checker/ActivateChecker.h"
|
||||
|
||||
|
||||
namespace core {
|
||||
|
||||
void ActivateChecker::check(ScheduledCommand& command) const
|
||||
@@ -34,12 +33,17 @@ void ActivateChecker::check_activateToActivate(ScheduledCommand& command) const
|
||||
if (bus.notYetScheduled(Activate))
|
||||
return;
|
||||
|
||||
sc_time lastActivate = bus.getLastCommand(Activate).getStart();
|
||||
sc_time lastActivateOnBank = bus.getLastCommand(Activate, command.getBank()).getStart();
|
||||
ScheduledCommand lastActivate = bus.getLastCommand(Activate);
|
||||
if (lastActivate.isValidCommand())
|
||||
command.delayStart(
|
||||
delayByConstraint(lastActivate.getStart(), command.getStart(),
|
||||
config.Timings.tRRD));
|
||||
|
||||
command.delayStart(delayByConstraint(lastActivate, command.getStart(), config.Timings.tRRD));
|
||||
command.delayStart(
|
||||
delayByConstraint(lastActivateOnBank, command.getStart(), config.Timings.tRC));
|
||||
ScheduledCommand lastActivateOnBank = bus.getLastCommand(Activate, command.getBank());
|
||||
if (lastActivateOnBank.isValidCommand())
|
||||
command.delayStart(
|
||||
delayByConstraint(lastActivateOnBank.getStart(), command.getStart(),
|
||||
config.Timings.tRC));
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
void ActivateChecker::cb_IInternalScheduler(const ScheduledCommand& command)
|
||||
void ActivateChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
|
||||
{
|
||||
if (command.getCommand() == Activate)
|
||||
{
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace core {
|
||||
class ActivateChecker: public core::ICommandChecker
|
||||
{
|
||||
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 void check(ScheduledCommand& 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:
|
||||
const Configuration& config;
|
||||
CommandBus& bus;//TODO should be const .. but fucking map access operator!!!!
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
virtual void check(ScheduledCommand& 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 */
|
||||
|
||||
@@ -11,6 +11,11 @@ namespace core {
|
||||
|
||||
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,
|
||||
@@ -19,7 +24,7 @@ sc_time PrechargeChecker::getExecutionTime(const tlm::tlm_generic_payload& trans
|
||||
assert(command == Precharge || command == PrechargeAll);
|
||||
return config.Timings.tRP;
|
||||
}
|
||||
void PrechargeChecker::cb_IInternalScheduler(const ScheduledCommand& command)
|
||||
void PrechargeChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ namespace core {
|
||||
class PrechargeChecker: public core::ICommandChecker
|
||||
{
|
||||
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 void check(ScheduledCommand& 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:
|
||||
const Configuration& config;
|
||||
const CommandBus& bus;
|
||||
CommandBus& bus;
|
||||
};
|
||||
|
||||
} /* namespace controller */
|
||||
|
||||
@@ -6,21 +6,28 @@
|
||||
*/
|
||||
|
||||
#include <core/scheduling/checker/ReadChecker.h>
|
||||
|
||||
#include "core/utils/Utils.h"
|
||||
namespace core {
|
||||
|
||||
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,
|
||||
Command command) const
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ namespace core {
|
||||
class ReadChecker: public core::ICommandChecker
|
||||
{
|
||||
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 void check(ScheduledCommand& 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:
|
||||
const Configuration& config;
|
||||
const CommandBus& bus;
|
||||
CommandBus& bus;
|
||||
};
|
||||
|
||||
} /* namespace controller */
|
||||
|
||||
@@ -20,7 +20,7 @@ sc_time WriteChecker::getExecutionTime(const tlm::tlm_generic_payload& transacti
|
||||
return config.Timings.clk*8;
|
||||
}
|
||||
|
||||
void WriteChecker::cb_IInternalScheduler(const ScheduledCommand& command)
|
||||
void WriteChecker::notifyAboutScheduledCommand(const ScheduledCommand& command)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
virtual void check(ScheduledCommand& 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:
|
||||
const Configuration& config;
|
||||
const CommandBus& bus;
|
||||
|
||||
@@ -12,6 +12,10 @@ unsigned int getStartAddress(Bank bank)
|
||||
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)
|
||||
{
|
||||
if (previous + constraint > start)
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
|
||||
#include "common/dramExtension.h"
|
||||
#include <systemc.h>
|
||||
#include <tlm.h>
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
@@ -72,5 +72,12 @@ TEST(UtilsTest, RingBufferWorks)
|
||||
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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user