bankgroup integration. act map stores scheduled command instead of bank now
This commit is contained in:
@@ -170,7 +170,8 @@ void setUpDummy(tlm::tlm_generic_payload& payload, Bank& bank)
|
||||
payload.set_dmi_allowed(false);
|
||||
payload.set_byte_enable_length(0);
|
||||
payload.set_streaming_width(0);
|
||||
payload.set_extension(new DramExtension(Thread(0), bank, bank.getBankGroup(), Row(0), Column(0))); //payload takes ownership
|
||||
payload.set_extension(new DramExtension(Thread(0), bank, BankGroup(0), Row(0), Column(0))); //payload takes ownership
|
||||
//TODO .. Dummies muessen noch banggruppe und rank sauber bekommen .. noch was ueberlegen!!!
|
||||
}
|
||||
|
||||
std::string getFileName(std::string uri)
|
||||
|
||||
@@ -112,27 +112,6 @@ GenerationExtension& GenerationExtension::getExtension(const tlm::tlm_generic_pa
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
//TODO remove this nonsense, put it in xml
|
||||
BankGroup Bank::getBankGroup()
|
||||
{
|
||||
static std::map<Bank, BankGroup> bankgroups;
|
||||
if (bankgroups.size() == 0)
|
||||
{
|
||||
core::Configuration& config = core::Configuration::getInstance();
|
||||
sc_assert(config.NumberOfBanks % config.NumberOfBankGroups == 0);
|
||||
|
||||
for (unsigned int bank = 0; bank < config.NumberOfBanks; bank++)
|
||||
{
|
||||
unsigned int group = bank % config.NumberOfBankGroups;
|
||||
bankgroups.insert(std::pair<Bank, BankGroup>(Bank(bank), BankGroup(group)));
|
||||
}
|
||||
}
|
||||
|
||||
return getElementFromMap(bankgroups, *this);
|
||||
}
|
||||
|
||||
|
||||
//THREAD
|
||||
bool operator ==(const Thread& lhs, const Thread& rhs)
|
||||
{
|
||||
|
||||
@@ -76,8 +76,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
BankGroup getBankGroup();
|
||||
|
||||
private:
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
@@ -30,10 +30,13 @@ xmlAddressDecoder::xmlAddressDecoder(string addressConfigURI)
|
||||
|
||||
DecodedAddress xmlAddressDecoder::decodeAddress(sc_dt::uint64 addr)
|
||||
{
|
||||
DecodedAddress n;
|
||||
n.channel = 0;
|
||||
n.row = (addr & masks["row"]) >> shifts["row"];
|
||||
n.bank = (addr & masks["bank"]) >> shifts["bank"];
|
||||
n.column = (addr & masks["column"]) >> shifts["column"];
|
||||
return n;
|
||||
DecodedAddress result;
|
||||
result.channel = (addr & masks["channel"]) >> shifts["channel"];
|
||||
result.rank = (addr & masks["rank"]) >> shifts["rank"];
|
||||
result.bankgroup = (addr & masks["bankgroup"]) >> shifts["bankgroup"];
|
||||
result.row = (addr & masks["row"]) >> shifts["row"];
|
||||
result.bank = (addr & masks["bank"]) >> shifts["bank"];
|
||||
result.column = (addr & masks["column"]) >> shifts["column"];
|
||||
result.bytes = (addr & masks["bytes"]) >> shifts["bytes"];
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void ControllerState::change(const ScheduledCommand& scheduledCommand)
|
||||
break;
|
||||
case Command::Activate:
|
||||
rowBufferStates.openRowInRowBuffer(scheduledCommand.getBank(), scheduledCommand.getRow());
|
||||
lastActivates.emplace(scheduledCommand.getStart(), scheduledCommand.getBank());
|
||||
lastActivates.emplace(scheduledCommand.getStart(), scheduledCommand);
|
||||
break;
|
||||
case Command::Precharge:
|
||||
rowBufferStates.closeRowBuffer(scheduledCommand.getBank());
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
Slots bus;
|
||||
std::vector<ScheduledCommand> lastDataStrobeCommands;
|
||||
std::map<sc_time, Bank> lastActivates;
|
||||
std::map<sc_time, ScheduledCommand> lastActivates;
|
||||
|
||||
private:
|
||||
Configuration* config;
|
||||
|
||||
@@ -94,8 +94,8 @@ bool ActivateChecker::satisfies_nActivateWindow(ScheduledCommand& command) const
|
||||
*/
|
||||
if (state.lastActivates.size() >= config.nActivate)
|
||||
{
|
||||
map<sc_time, Bank> lastActivates = state.lastActivates;
|
||||
lastActivates.emplace(command.getStart(), command.getBank());
|
||||
map<sc_time, ScheduledCommand> lastActivates = state.lastActivates;
|
||||
lastActivates.emplace(command.getStart(), command);
|
||||
auto upper = lastActivates.begin();
|
||||
advance(upper, config.nActivate);
|
||||
auto lower = lastActivates.begin();
|
||||
|
||||
@@ -135,9 +135,9 @@ private:
|
||||
void appendDramExtension(int socketId, tlm_generic_payload& payload)
|
||||
{
|
||||
unsigned int burstlength = payload.get_streaming_width();
|
||||
DecodedAddress n = xmlAddressDecoder::getInstance().decodeAddress(payload.get_address());
|
||||
Bank bank(n.bank);
|
||||
DramExtension* extension = new DramExtension(Thread(socketId+1), Channel(n.channel), bank, bank.getBankGroup(), Row(n.row), Column(n.column),burstlength);
|
||||
DecodedAddress decodedAddress = xmlAddressDecoder::getInstance().decodeAddress(payload.get_address());
|
||||
DramExtension* extension = new DramExtension(Thread(socketId+1), Channel(decodedAddress.channel), Bank(decodedAddress.bank),
|
||||
BankGroup(decodedAddress.bankgroup), Row(decodedAddress.row), Column(decodedAddress.column),burstlength);
|
||||
payload.set_auto_extension(extension);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -83,10 +83,10 @@ void Simulation::instantiateModules(const string &pathToResources, const std::ve
|
||||
arbiter = new Arbiter<NumberOfTracePlayers, 128>("arbiter");
|
||||
controller = new Controller<>("controller");
|
||||
|
||||
player1 = new TracePlayer<>("player1", pathToResources + string("traces/") + devices[0].trace, devices[0].burstLength, devices[0].clk, this);
|
||||
player2 = new TracePlayer<>("player2", pathToResources + string("traces/") + devices[1].trace, devices[1].burstLength, devices[1].clk, this);
|
||||
player3 = new TracePlayer<>("player3", pathToResources + string("traces/") + devices[2].trace, devices[2].burstLength, devices[2].clk, this);
|
||||
player4 = new TracePlayer<>("player4", pathToResources + string("traces/") + devices[3].trace, devices[3].burstLength, devices[3].clk, this);
|
||||
player1 = new TracePlayer<>("player1", pathToResources + string("traces/") + devices[0].trace, devices[0].burstLength, devices[0].clkMhz, this);
|
||||
player2 = new TracePlayer<>("player2", pathToResources + string("traces/") + devices[1].trace, devices[1].burstLength, devices[1].clkMhz, this);
|
||||
player3 = new TracePlayer<>("player3", pathToResources + string("traces/") + devices[2].trace, devices[2].burstLength, devices[2].clkMhz, this);
|
||||
player4 = new TracePlayer<>("player4", pathToResources + string("traces/") + devices[3].trace, devices[3].burstLength, devices[3].clkMhz, this);
|
||||
}
|
||||
|
||||
void Simulation::bindSockets()
|
||||
|
||||
@@ -30,11 +30,11 @@ struct DramSetup
|
||||
struct Device
|
||||
{
|
||||
Device():trace("empty.stl"), burstLength(0){}
|
||||
Device(std::string trace, sc_time clk, unsigned int burstLength = 8) : trace(trace), clk (clk), burstLength(burstLength)
|
||||
Device(std::string trace, unsigned int clkMhz, unsigned int burstLength = 8) : trace(trace), clkMhz (clkMhz), burstLength(burstLength)
|
||||
{
|
||||
}
|
||||
std::string trace;
|
||||
sc_time clk;
|
||||
unsigned int clkMhz;
|
||||
unsigned int burstLength;
|
||||
};
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void SimulationManager::addTraceSetup(SimulationBatch& batch, tinyxml2::XMLEleme
|
||||
vector<Device> devices;
|
||||
for (XMLElement* device = element->FirstChildElement("device"); device != NULL; device = device->NextSiblingElement("device"))
|
||||
{
|
||||
devices.push_back(Device(device->GetText(), FrequencyToClk(device->DoubleAttribute("clkMhz")), device->IntAttribute("bl")));
|
||||
devices.push_back(Device(device->GetText(), device->IntAttribute("clkMhz"), device->IntAttribute("bl")));
|
||||
}
|
||||
while (devices.size() < Simulation::NumberOfTracePlayers)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../common/xmlAddressdecoder.h"
|
||||
#include "../common/TlmRecorder.h"
|
||||
#include "../common/dramExtension.h"
|
||||
#include "../controller/core/TimingCalculation.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
@@ -31,7 +32,7 @@ struct TracePlayer: public sc_module
|
||||
{
|
||||
public:
|
||||
tlm_utils::simple_initiator_socket<TracePlayer, BUSWIDTH, tlm::tlm_base_protocol_types> iSocket;
|
||||
TracePlayer(sc_module_name /*name*/, string pathToTrace, unsigned int burstLength, sc_time clk,
|
||||
TracePlayer(sc_module_name /*name*/, string pathToTrace, unsigned int burstLength, unsigned int clkMhz,
|
||||
simulation::ISimulation* simulationManager);
|
||||
|
||||
void start();
|
||||
@@ -55,13 +56,18 @@ private:
|
||||
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
TracePlayer<BUSWIDTH>::TracePlayer(sc_module_name, string pathToTrace, unsigned int burstLength, sc_time clk, simulation::ISimulation *simulationManager) :
|
||||
payloadEventQueue(this, &TracePlayer<BUSWIDTH>::peqCallback), file(pathToTrace), burstlenght(burstLength), clk(clk),
|
||||
TracePlayer<BUSWIDTH>::TracePlayer(sc_module_name, string pathToTrace, unsigned int burstLength, unsigned int clkMhz, simulation::ISimulation *simulationManager) :
|
||||
payloadEventQueue(this, &TracePlayer<BUSWIDTH>::peqCallback), file(pathToTrace), burstlenght(burstLength),
|
||||
numberOfPendingTransactions(0), transactionsSent(0), transactionsReceived(0), simulationManager(simulationManager)
|
||||
{
|
||||
if (!file.is_open())
|
||||
SC_REPORT_FATAL(0, (string("Could not open trace ") + pathToTrace).c_str());
|
||||
|
||||
if(clkMhz == 0)
|
||||
clk = core::Configuration::getInstance().Timings.clk;
|
||||
else
|
||||
clk = core::FrequencyToClk(clkMhz);
|
||||
|
||||
this->burstlenght = core::Configuration::getInstance().BurstLength;
|
||||
iSocket.register_nb_transport_bw(this, &TracePlayer<BUSWIDTH>::nb_transport_bw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user