Minor formatting.

This commit is contained in:
Lukas Steiner
2023-06-22 10:19:34 +02:00
parent c833471480
commit 413921f420
4 changed files with 64 additions and 82 deletions

View File

@@ -338,12 +338,8 @@ bool operator <(const Bank &lhs, const Bank &rhs)
}
//ROW
const Row Row::NO_ROW;
bool operator ==(const Row &lhs, const Row &rhs)
{
if (lhs.isNoRow != rhs.isNoRow)
return false;
return lhs.ID() == rhs.ID();
}
@@ -352,7 +348,6 @@ bool operator !=(const Row &lhs, const Row &rhs)
return !(lhs == rhs);
}
//COLUMN
bool operator ==(const Column &lhs, const Column &rhs)
{

View File

@@ -48,157 +48,143 @@ namespace DRAMSys
class Thread
{
public:
explicit Thread(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit Thread(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class Channel
{
public:
explicit Channel(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit Channel(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class Rank
{
public:
explicit Rank(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit Rank(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class LogicalRank
{
public:
explicit LogicalRank(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit LogicalRank(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class PhysicalRank
{
public:
explicit PhysicalRank(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit PhysicalRank(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class DimmRank
{
public:
explicit DimmRank(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit DimmRank(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class BankGroup
{
public:
explicit BankGroup(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit BankGroup(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
class Bank
{
public:
explicit Bank(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit Bank(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
std::string toString() const
{
return std::to_string(id);
}
private:
unsigned int id;
};
class Row
{
private:
std::size_t id;
public:
static const Row NO_ROW;
explicit Row(std::size_t id) : id(id) {}
Row() : id(0), isNoRow(true) {}
explicit Row(unsigned int id) : id(id), isNoRow(false) {}
unsigned int ID() const
std::size_t ID() const
{
return id;
}
Row operator++();
private:
unsigned int id;
bool isNoRow;
friend bool operator==(const Row &lhs, const Row &rhs);
};
class Column
{
public:
explicit Column(unsigned int id) : id(id) {}
private:
std::size_t id;
unsigned int ID() const
public:
explicit Column(std::size_t id) : id(id) {}
std::size_t ID() const
{
return id;
}
private:
unsigned int id;
};
template<typename IndexType, typename ValueType>

View File

@@ -72,7 +72,7 @@ protected:
tlm::tlm_generic_payload* currentPayload = nullptr;
const SchedulerIF& scheduler;
Command nextCommand = Command::NOP;
Row openRow;
Row openRow = Row(0);
const Bank bank;
const BankGroup bankgroup;
const Rank rank;

View File

@@ -281,18 +281,19 @@ void Controller::controllerMethod()
for (unsigned rankID = 0; rankID < memSpec.ranksPerChannel; rankID++)
{
// (4.1) Check for power-down commands (PDEA/PDEP/SREFEN or PDXA/PDXP/SREFEX)
commandTuple = powerDownManagers[Rank(rankID)]->getNextCommand();
Rank rank(rankID);
commandTuple = powerDownManagers[rank]->getNextCommand();
if (std::get<CommandTuple::Command>(commandTuple) != Command::NOP)
readyCommands.emplace_back(commandTuple);
else
{
// (4.2) Check for refresh commands (PREXX or REFXX)
commandTuple = refreshManagers[Rank(rankID)]->getNextCommand();
commandTuple = refreshManagers[rank]->getNextCommand();
if (std::get<CommandTuple::Command>(commandTuple) != Command::NOP)
readyCommands.emplace_back(commandTuple);
// (4.3) Check for bank commands (PREPB, ACT, RD/RDA or WR/WRA)
for (auto it : bankMachinesOnRank[Rank(rankID)])
for (auto it : bankMachinesOnRank[rank])
{
commandTuple = it->getNextCommand();
if (std::get<CommandTuple::Command>(commandTuple) != Command::NOP)