Add EccModule to simulator
This commit is contained in:
@@ -288,4 +288,18 @@ public:
|
||||
static bool notifyChildTransCompletion(tlm::tlm_generic_payload& trans);
|
||||
};
|
||||
|
||||
class EccExtension : public tlm::tlm_extension<EccExtension>
|
||||
{
|
||||
public:
|
||||
tlm_extension_base* clone() const override
|
||||
{
|
||||
return new EccExtension;
|
||||
}
|
||||
|
||||
void copy_from(tlm_extension_base const &ext) override
|
||||
{
|
||||
auto const &cpyFrom = static_cast<EccExtension const &>(ext);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DRAMEXTENSIONS_H
|
||||
|
||||
@@ -515,7 +515,10 @@ void Controller::manageResponses()
|
||||
tlm_generic_payload* nextTransInRespQueue = respQueue->nextPayload();
|
||||
if (nextTransInRespQueue != nullptr)
|
||||
{
|
||||
numberOfBeatsServed += ControllerExtension::getBurstLength(*nextTransInRespQueue);
|
||||
// Ignore ECC requests
|
||||
if (nextTransInRespQueue->get_extension<EccExtension>() == nullptr)
|
||||
numberOfBeatsServed += ControllerExtension::getBurstLength(*nextTransInRespQueue);
|
||||
|
||||
if (ChildExtension::isChildTrans(*nextTransInRespQueue))
|
||||
{
|
||||
tlm_generic_payload& parentTrans = ChildExtension::getParentTrans(*nextTransInRespQueue);
|
||||
|
||||
@@ -37,13 +37,14 @@
|
||||
*/
|
||||
|
||||
#include "AddressDecoder.h"
|
||||
#include "DRAMSys/configuration/Configuration.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <bitset>
|
||||
|
||||
AddressDecoder::AddressDecoder(const Configuration& config, const DRAMSys::Config::AddressMapping& addressMapping)
|
||||
AddressDecoder::AddressDecoder(const DRAMSys::Config::AddressMapping &addressMapping, const MemSpec &memSpec)
|
||||
{
|
||||
if (const auto &channelBits = addressMapping.CONGEN.CHANNEL_BIT)
|
||||
{
|
||||
@@ -113,8 +114,6 @@ AddressDecoder::AddressDecoder(const Configuration& config, const DRAMSys::Confi
|
||||
SC_REPORT_FATAL("AddressDecoder", "Not all address bits occur exactly once");
|
||||
}
|
||||
|
||||
const MemSpec& memSpec = *config.memSpec;
|
||||
|
||||
unsigned highestByteBit = *std::max_element(vByteBits.begin(), vByteBits.end());
|
||||
|
||||
for (unsigned bitPosition = 0; bitPosition <= highestByteBit; bitPosition++)
|
||||
@@ -213,6 +212,41 @@ unsigned AddressDecoder::decodeChannel(uint64_t encAddr) const
|
||||
return channel;
|
||||
}
|
||||
|
||||
uint64_t AddressDecoder::encodeAddress(DecodedAddress decodedAddress) const
|
||||
{
|
||||
// Convert absoulte addressing for bank, bankgroup to relative
|
||||
decodedAddress.bankgroup = decodedAddress.bankgroup % bankgroupsPerRank;
|
||||
decodedAddress.bank = decodedAddress.bank % banksPerGroup;
|
||||
|
||||
uint64_t address = 0;
|
||||
|
||||
for (unsigned i = 0; i < vChannelBits.size(); i++)
|
||||
address |= ((decodedAddress.channel >> i) & 0x1) << vChannelBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vRankBits.size(); i++)
|
||||
address |= ((decodedAddress.rank >> i) & 0x1) << vRankBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vBankGroupBits.size(); i++)
|
||||
address |= ((decodedAddress.bankgroup >> i) & 0x1) << vBankGroupBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vBankBits.size(); i++)
|
||||
address |= ((decodedAddress.bank >> i) & 0x1) << vBankBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vRowBits.size(); i++)
|
||||
address |= ((decodedAddress.row >> i) & 0x1) << vRowBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vColumnBits.size(); i++)
|
||||
address |= ((decodedAddress.column >> i) & 0x1) << vColumnBits[i];
|
||||
|
||||
for (unsigned i = 0; i < vByteBits.size(); i++)
|
||||
address |= ((decodedAddress.byte >> i) & 0x1) << vByteBits[i];
|
||||
|
||||
// TODO: XOR encoding
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
void AddressDecoder::print() const
|
||||
{
|
||||
std::cout << headline << std::endl;
|
||||
|
||||
@@ -39,9 +39,8 @@
|
||||
#ifndef ADDRESSDECODER_H
|
||||
#define ADDRESSDECODER_H
|
||||
|
||||
#include "DRAMSys/configuration/Configuration.h"
|
||||
|
||||
#include "DRAMSys/config/DRAMSysConfiguration.h"
|
||||
#include "DRAMSys/configuration/Configuration.h"
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
@@ -69,9 +68,10 @@ struct DecodedAddress
|
||||
class AddressDecoder
|
||||
{
|
||||
public:
|
||||
AddressDecoder(const Configuration& config, const DRAMSys::Config::AddressMapping& addressMapping);
|
||||
AddressDecoder(const DRAMSys::Config::AddressMapping &addressMapping, const MemSpec &memSpec);
|
||||
[[nodiscard]] DecodedAddress decodeAddress(uint64_t encAddr) const;
|
||||
[[nodiscard]] unsigned decodeChannel(uint64_t encAddr) const;
|
||||
[[nodiscard]] uint64_t encodeAddress(DecodedAddress decodedAddress) const;
|
||||
void print() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -157,7 +157,7 @@ void DRAMSys::setupDebugManager(NDEBUG_UNUSED(const std::string& traceName)) con
|
||||
|
||||
void DRAMSys::instantiateModules(const ::DRAMSys::Config::AddressMapping& addressMapping)
|
||||
{
|
||||
addressDecoder = std::make_unique<AddressDecoder>(config, addressMapping);
|
||||
addressDecoder = std::make_unique<AddressDecoder>(addressMapping, *config.memSpec);
|
||||
addressDecoder->print();
|
||||
|
||||
// Create arbiter
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
const ::DRAMSys::Config::Configuration& configLib);
|
||||
|
||||
const Configuration& getConfig() const;
|
||||
const AddressDecoder &getAddressDecoder() const { return *addressDecoder; }
|
||||
|
||||
protected:
|
||||
DRAMSys(const sc_core::sc_module_name& name,
|
||||
|
||||
@@ -120,7 +120,7 @@ void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName,
|
||||
void DRAMSysRecordable::instantiateModules(const std::string& traceName,
|
||||
const ::DRAMSys::Config::Configuration& configLib)
|
||||
{
|
||||
addressDecoder = std::make_unique<AddressDecoder>(config, configLib.addressmapping);
|
||||
addressDecoder = std::make_unique<AddressDecoder>(configLib.addressmapping, *config.memSpec);
|
||||
addressDecoder->print();
|
||||
|
||||
// Create and properly initialize TLM recorders.
|
||||
|
||||
@@ -102,7 +102,7 @@ Request StlPlayer::nextRequest()
|
||||
delay -= sc_core::sc_time_stamp();
|
||||
}
|
||||
|
||||
Request request(std::move(*readoutIt));
|
||||
Request request(*readoutIt);
|
||||
request.delay = delay;
|
||||
|
||||
readoutIt++;
|
||||
|
||||
Reference in New Issue
Block a user