Merge branch 'work/hbm_rfm_fixes' into 'develop'

HBM and RFM fixes

See merge request ems/astdm/modeling.dram/dram.sys.5!17
This commit is contained in:
Lukas Steiner
2023-04-26 08:36:08 +00:00
35 changed files with 79 additions and 125 deletions

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2021, Technische Universität Kaiserslautern
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors:
* Derek Christ
*/
#include "McConfig.h"
namespace DRAMSys::Config
{
void to_json(json_t &j, const RefreshPolicyType &r)
{
if (r == RefreshPolicyType::NoRefresh)
j = "NoRefresh";
else if (r == RefreshPolicyType::AllBank)
j = "AllBank";
else if (r == RefreshPolicyType::PerBank)
j = "PerBank";
else if (r == RefreshPolicyType::Per2Bank)
j = "Per2Bank";
else if (r == RefreshPolicyType::SameBank)
j = "SameBank";
else
j = nullptr;
}
void from_json(const json_t &j, RefreshPolicyType &r)
{
if (j == "NoRefresh")
r = RefreshPolicyType::NoRefresh;
else if (j == "AllBank" || j == "Rankwise")
r = RefreshPolicyType::AllBank;
else if (j == "PerBank" || j == "Bankwise")
r = RefreshPolicyType::PerBank;
else if (j == "SameBank" || j == "Groupwise")
r = RefreshPolicyType::SameBank;
else if (j == "Per2Bank")
r = RefreshPolicyType::Per2Bank;
else
r = RefreshPolicyType::Invalid;
}
} // namespace DRAMSys::Config

View File

@@ -123,6 +123,19 @@ enum class RefreshPolicyType
Invalid = -1
};
NLOHMANN_JSON_SERIALIZE_ENUM(RefreshPolicyType, {{RefreshPolicyType::Invalid, nullptr},
{RefreshPolicyType::NoRefresh, "NoRefresh"},
{RefreshPolicyType::AllBank, "AllBank"},
{RefreshPolicyType::PerBank, "PerBank"},
{RefreshPolicyType::Per2Bank, "Per2Bank"},
{RefreshPolicyType::SameBank, "SameBank"},
// Alternative conversions to provide backwards-compatibility
// when deserializing. Will not be used for serializing.
{RefreshPolicyType::AllBank, "Rankwise"},
{RefreshPolicyType::PerBank, "Bankwise"},
{RefreshPolicyType::SameBank, "Groupwise"}})
enum class PowerDownPolicyType
{
NoPowerDown,
@@ -202,12 +215,6 @@ NLOHMANN_JSONIFY_ALL_THINGS(McConfig,
BlockingReadDelay,
BlockingWriteDelay)
void to_json(json_t &j, const RefreshPolicyType &r);
void from_json(const json_t &j, RefreshPolicyType &r);
// void from_dump(const std::string &dump, McConfig &c);
// std::string dump(const McConfig &c, unsigned int indentation = -1);
} // namespace Configuration
#endif // DRAMSYSCONFIGURATION_MCCONFIG_H

View File

@@ -122,7 +122,7 @@ unsigned MemSpec::getPer2BankOffset() const
return 0;
}
unsigned MemSpec::getRAACDR() const
unsigned MemSpec::getRAADEC() const
{
SC_REPORT_FATAL("MemSpec", "Refresh Management not supported");
return 0;

View File

@@ -92,7 +92,7 @@ public:
virtual unsigned getRAAIMT() const;
virtual unsigned getRAAMMT() const;
virtual unsigned getRAACDR() const;
virtual unsigned getRAADEC() const;
virtual bool hasRasAndCasBus() const;

View File

@@ -85,8 +85,8 @@ void BankMachine::update(Command command)
if (refreshManagement)
{
if (refreshManagementCounter > memSpec.getRAACDR())
refreshManagementCounter -= memSpec.getRAACDR();
if (refreshManagementCounter > memSpec.getRAADEC())
refreshManagementCounter -= memSpec.getRAADEC();
else
refreshManagementCounter = 0;
}

View File

@@ -56,6 +56,12 @@ AddressDecoder::AddressDecoder(const DRAMSys::Config::AddressMapping &addressMap
std::copy(rankBits->begin(), rankBits->end(), std::back_inserter(vRankBits));
}
// HBM pseudo channels are internally modelled as ranks
if (const auto &pseudoChannelBits = addressMapping.PSEUDOCHANNEL_BIT)
{
std::copy(pseudoChannelBits->begin(), pseudoChannelBits->end(), std::back_inserter(vRankBits));
}
if (const auto& bankGroupBits = addressMapping.BANKGROUP_BIT)
{
std::copy(bankGroupBits->begin(), bankGroupBits->end(), std::back_inserter(vBankGroupBits));