ExampleInitiator: added function to initialize the memory
This commit is contained in:
@@ -65,8 +65,6 @@ struct Dram : sc_module
|
||||
{
|
||||
std::vector<unsigned char> ZEROES;
|
||||
|
||||
// FIXME: double check every field initialized here that depends on config
|
||||
// XXX: let's separate in a CPP + H files
|
||||
unsigned int burstLength = Configuration::getInstance().memSpec.BurstLength;
|
||||
unsigned int busWidth = Configuration::getInstance().memSpec.BusWidth * Configuration::getInstance().NumberOfDevicesOnDIMM;
|
||||
unsigned int bytesPerBurst = burstLength * (busWidth / 8);
|
||||
|
||||
@@ -31,6 +31,10 @@ struct ExampleInitiator: sc_module
|
||||
tlm::tlm_phase phase;
|
||||
sc_time delay;
|
||||
|
||||
dump_mem();
|
||||
init_mem();
|
||||
dump_mem();
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
data[i] = 0x55;
|
||||
|
||||
@@ -102,22 +106,25 @@ struct ExampleInitiator: sc_module
|
||||
sc_stop();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void init_mem()
|
||||
{
|
||||
for (int addr = 0; addr < 256; addr += 256)
|
||||
unsigned char buffer[64];
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
buffer[i] = 0xff;
|
||||
}
|
||||
|
||||
for (int addr = 0; addr < 128; addr += 64)
|
||||
{
|
||||
int buffer[64] = {0, };
|
||||
tlm::tlm_generic_payload trans;
|
||||
trans.set_command( tlm::TLM_WRITE_COMMAND );
|
||||
trans.set_address( addr );
|
||||
trans.set_data_ptr( reinterpret_cast<unsigned char*>(buffer) );
|
||||
trans.set_data_length( 256 );
|
||||
trans.set_data_ptr( buffer );
|
||||
trans.set_data_length( 64 );
|
||||
|
||||
socket->transport_dbg( trans );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void dump_mem()
|
||||
{
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
#include "../simulation/TemperatureController.h"
|
||||
#include "../controller/Controller.h"
|
||||
|
||||
#define USE_EXAMPLE_INITIATOR 0
|
||||
|
||||
using namespace std;
|
||||
|
||||
Simulation::Simulation(sc_module_name __attribute__((unused)) name, string pathToResources, string traceName, DramSetup setup,
|
||||
@@ -114,7 +116,9 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
|
||||
// The same instance will be accessed by all other modules.
|
||||
TemperatureController::getInstance();
|
||||
|
||||
#if 1
|
||||
#if USE_EXAMPLE_INITIATOR
|
||||
init = new ExampleInitiator("init");
|
||||
#else
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfTracePlayers; i++) {
|
||||
std::string playerStr = "tracePlayer" + std::to_string(i);
|
||||
TracePlayer *player;
|
||||
@@ -146,7 +150,6 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
|
||||
arbiter = new Arbiter("arbiter");
|
||||
arbiter->setTlmRecorders(tlmRecorders);
|
||||
|
||||
//init = new ExampleInitiator("init");
|
||||
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
std::string str = "controller" + std::to_string(i);
|
||||
@@ -163,11 +166,13 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
|
||||
|
||||
void Simulation::bindSockets()
|
||||
{
|
||||
#if USE_EXAMPLE_INITIATOR
|
||||
init->socket.bind(arbiter->tSocket);
|
||||
#else
|
||||
for (auto player : players) {
|
||||
player->iSocket.bind(arbiter->tSocket);
|
||||
}
|
||||
|
||||
//init->socket.bind(arbiter->tSocket);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfMemChannels; i++) {
|
||||
arbiter->iSocket.bind(controllers[i]->tSocket);
|
||||
|
||||
Reference in New Issue
Block a user