Namespace the complete DRAMSys library
This commit is contained in:
@@ -84,7 +84,7 @@ int sc_main(int argc, char **argv)
|
||||
dramSys = std::make_unique<DRAMSys::DRAMSys>("DRAMSys", configuration);
|
||||
}
|
||||
|
||||
bool storageEnabled = dramSys->getConfig().storeMode == Configuration::StoreMode::Store;
|
||||
bool storageEnabled = dramSys->getConfig().storeMode == DRAMSys::Configuration::StoreMode::Store;
|
||||
MemoryManager memoryManager(storageEnabled);
|
||||
|
||||
std::vector<std::unique_ptr<Initiator>> initiators;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
using namespace sc_core;
|
||||
using namespace tlm;
|
||||
|
||||
EccModule::EccModule(sc_module_name name, AddressDecoder const &addressDecoder) :
|
||||
EccModule::EccModule(sc_module_name name, DRAMSys::AddressDecoder const &addressDecoder) :
|
||||
sc_core::sc_module(name),
|
||||
payloadEventQueue(this, &EccModule::peqCallback),
|
||||
addressDecoder(addressDecoder),
|
||||
@@ -88,7 +88,7 @@ void EccModule::peqCallback(tlm::tlm_generic_payload &cbPayload, const tlm::tlm_
|
||||
tlm_phase tPhase = BEGIN_REQ;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
|
||||
DecodedAddress decodedAddress = addressDecoder.decodeAddress(cbPayload.get_address());
|
||||
DRAMSys::DecodedAddress decodedAddress = addressDecoder.decodeAddress(cbPayload.get_address());
|
||||
decodedAddress = calculateOffsetAddress(decodedAddress);
|
||||
|
||||
// Update the original address to account for the offsets
|
||||
@@ -129,7 +129,7 @@ void EccModule::peqCallback(tlm::tlm_generic_payload &cbPayload, const tlm::tlm_
|
||||
else if (cbPhase == END_REQ) // from target
|
||||
{
|
||||
// Send payload to inititator in case it is not an ECC transaction
|
||||
if (cbPayload.get_extension<EccExtension>() == nullptr)
|
||||
if (cbPayload.get_extension<DRAMSys::EccExtension>() == nullptr)
|
||||
{
|
||||
tlm_phase tPhase = END_REQ;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
@@ -158,7 +158,7 @@ void EccModule::peqCallback(tlm::tlm_generic_payload &cbPayload, const tlm::tlm_
|
||||
tlm_phase tPhase = BEGIN_REQ;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
|
||||
DecodedAddress decodedAddress = addressDecoder.decodeAddress(tPayload.get_address());
|
||||
DRAMSys::DecodedAddress decodedAddress = addressDecoder.decodeAddress(tPayload.get_address());
|
||||
decodedAddress = calculateOffsetAddress(decodedAddress);
|
||||
auto currentBlock = alignToBlock(decodedAddress.column);
|
||||
#ifdef ECC_ENABLE
|
||||
@@ -195,7 +195,7 @@ void EccModule::peqCallback(tlm::tlm_generic_payload &cbPayload, const tlm::tlm_
|
||||
else if (cbPhase == BEGIN_RESP) // from memory controller
|
||||
{
|
||||
// Send payload to inititator in case it is not an ECC transaction
|
||||
if (cbPayload.get_extension<EccExtension>() == nullptr)
|
||||
if (cbPayload.get_extension<DRAMSys::EccExtension>() == nullptr)
|
||||
{
|
||||
tlm_phase tPhase = BEGIN_RESP;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
@@ -241,7 +241,7 @@ void EccModule::peqCallback(tlm::tlm_generic_payload &cbPayload, const tlm::tlm_
|
||||
}
|
||||
}
|
||||
|
||||
tlm::tlm_generic_payload *EccModule::generateEccPayload(DecodedAddress decodedAddress)
|
||||
tlm::tlm_generic_payload *EccModule::generateEccPayload(DRAMSys::DecodedAddress decodedAddress)
|
||||
{
|
||||
unsigned int eccAtom = decodedAddress.column / 512;
|
||||
uint64_t eccColumn = 1792 + eccAtom * 32;
|
||||
@@ -258,7 +258,7 @@ tlm::tlm_generic_payload *EccModule::generateEccPayload(DecodedAddress decodedAd
|
||||
payload.set_data_length(32);
|
||||
payload.set_streaming_width(32);
|
||||
payload.set_command(tlm::TLM_READ_COMMAND);
|
||||
payload.set_extension<EccExtension>(new EccExtension);
|
||||
payload.set_extension<DRAMSys::EccExtension>(new DRAMSys::EccExtension);
|
||||
|
||||
return &payload;
|
||||
}
|
||||
@@ -268,13 +268,13 @@ unsigned int EccModule::alignToBlock(unsigned column)
|
||||
return column & ~(512 - 1);
|
||||
}
|
||||
|
||||
DecodedAddress EccModule::calculateOffsetAddress(DecodedAddress decodedAddress)
|
||||
DRAMSys::DecodedAddress EccModule::calculateOffsetAddress(DRAMSys::DecodedAddress decodedAddress)
|
||||
{
|
||||
unsigned int newRow =
|
||||
std::floor((decodedAddress.row * 256 + decodedAddress.column) / 1792) + decodedAddress.row;
|
||||
unsigned int newColumn = (decodedAddress.row * 256 + decodedAddress.column) % 1792;
|
||||
|
||||
DecodedAddress offsetAddress(decodedAddress);
|
||||
DRAMSys::DecodedAddress offsetAddress(decodedAddress);
|
||||
offsetAddress.row = newRow;
|
||||
offsetAddress.column = newColumn;
|
||||
return offsetAddress;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
tlm_utils::simple_initiator_socket<EccModule> iSocket;
|
||||
tlm_utils::simple_target_socket<EccModule> tSocket;
|
||||
|
||||
EccModule(sc_core::sc_module_name name, AddressDecoder const &addressDecoder);
|
||||
EccModule(sc_core::sc_module_name name, DRAMSys::AddressDecoder const &addressDecoder);
|
||||
SC_HAS_PROCESS(EccModule);
|
||||
|
||||
private:
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
using EccIdentifier = std::pair<Block, Row>;
|
||||
using EccQueue = std::deque<EccIdentifier>;
|
||||
|
||||
static DecodedAddress calculateOffsetAddress(DecodedAddress decodedAddress);
|
||||
static DRAMSys::DecodedAddress calculateOffsetAddress(DRAMSys::DecodedAddress decodedAddress);
|
||||
static sc_core::sc_time roundLatency(sc_core::sc_time latency);
|
||||
bool activeEccBlock(Bank bank, Row row, Block block) const;
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
tlm::tlm_phase &phase,
|
||||
sc_core::sc_time &bwDelay);
|
||||
|
||||
tlm::tlm_generic_payload *generateEccPayload(DecodedAddress decodedAddress);
|
||||
tlm::tlm_generic_payload *generateEccPayload(DRAMSys::DecodedAddress decodedAddress);
|
||||
|
||||
static unsigned int alignToBlock(unsigned int column);
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
|
||||
const sc_core::sc_time tCK;
|
||||
MemoryManager memoryManager;
|
||||
AddressDecoder const &addressDecoder;
|
||||
DRAMSys::AddressDecoder const &addressDecoder;
|
||||
|
||||
std::unordered_map<Bank, EccQueue> activeEccBlocks;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user