The Sparta Modeling Framework
|
Container of register banks as a helper for RegisterSet. Instances of this class will be owned by a single RegisterSet. More...
#include <RegisterBankTable.hpp>
Public Types | |
typedef std::unordered_map< Register::group_idx_type, RegisterT * > | RegisterMap |
Vector of registers owned externally. Available for lookup within a group by Register::Definition::group_idx_type. | |
typedef std::vector< RegisterT * > | RegisterVector |
typedef std::vector< RegisterMap > | GroupVector |
Vector of RegisterMap's used for lookup by numeric group number of type Register::Definition::group_num_type. | |
typedef std::vector< GroupVector > | BankVector |
Vector of GroupVectors used for lookup by numeric bank index of type Register::Definition::bank_idx_type. | |
Public Member Functions | |
RegisterBankTable () | |
Constructor. | |
virtual | ~RegisterBankTable ()=default |
Destructor. | |
RegisterT::bank_idx_type | getNumBanks () const |
Gets the total number of banks instantiated (even if they contain have no actual registers accessible). Note that banks are created between 0 and the highest bank index requested by a register. | |
RegisterT::group_idx_type | getNumGroups () const |
Gets the number of register groups added to this table regardless of banks. | |
uint32_t | getGroupSize (typename RegisterT::group_num_type group_num, typename RegisterT::bank_idx_type bank_num) |
Gets the number of registers in a group by its group num and bank. | |
GroupVector & | operator[] (typename RegisterT::bank_idx_type bank_idx) |
GroupVector & | at (typename RegisterT::bank_idx_type bank_idx) |
uint32_t | getNumRegisters () const |
Returns number of registers in this table. This excludes any registers added having no group number. | |
void | setMinimumBankIndex (Register::bank_idx_type min_idx) |
Sets the minimum bank index for this register set, overriding the default of BANK_IDX_DEFAULT. | |
void | addRegister (RegisterT *r) |
Adds a register to this table unless it is not a member of a group (See Register::getGroupNum. | |
bool | canLookupRegister (typename RegisterT::group_num_type group_num, typename RegisterT::group_idx_type group_idx, typename RegisterT::bank_idx_type bank_idx) const noexcept |
RegisterT * | lookupRegister (typename RegisterT::group_num_type group_num, typename RegisterT::group_idx_type group_idx, typename RegisterT::bank_idx_type bank_idx) |
const RegisterT * | lookupRegister (typename RegisterT::group_num_type group_num, typename RegisterT::group_idx_type group_idx, typename RegisterT::bank_idx_type bank_idx) const |
RegisterT * | getRegister (typename RegisterT::group_num_type group_num, typename RegisterT::group_idx_type group_idx, typename RegisterT::bank_idx_type bank_idx) |
Gets a Register by group number and group index and throws an exception if it cannot be found. | |
virtual std::string | stringize (bool pretty=false) const |
void | dump (std::ostream &out, bool detailed=false) const |
Dump this register bank table to an out stream. Banks will be columns and group num/id will be rows. | |
Protected Member Functions | |
void | extendBanks_ (typename RegisterT::bank_idx_type num_banks) |
Extends the banks_ vector to contain num_banks entries. | |
void | insertRegisterInBank_ (RegisterT *r, GroupVector &bank) |
Insert a register in a specific bank. | |
Container of register banks as a helper for RegisterSet. Instances of this class will be owned by a single RegisterSet.
Contains a table of dimensions B (for each bank) and G (the number of groups in the register set which owns that instance of this object/ The number of registers in a group can vary between groups.
Banks and Groups effectively form a matrix of B,G dimensions.
This structure is not intended to be dynamic. It can be built, but does not expect changes to bank mappings at runtime
Definition at line 30 of file RegisterBankTable.hpp.
typedef std::vector<GroupVector> sparta::RegisterBankTable< RegisterT >::BankVector |
Vector of GroupVectors used for lookup by numeric bank index of type Register::Definition::bank_idx_type.
Definition at line 65 of file RegisterBankTable.hpp.
typedef std::vector<RegisterMap> sparta::RegisterBankTable< RegisterT >::GroupVector |
Vector of RegisterMap's used for lookup by numeric group number of type Register::Definition::group_num_type.
Definition at line 59 of file RegisterBankTable.hpp.
typedef std::unordered_map<Register::group_idx_type, RegisterT *> sparta::RegisterBankTable< RegisterT >::RegisterMap |
Vector of registers owned externally. Available for lookup within a group by Register::Definition::group_idx_type.
Definition at line 52 of file RegisterBankTable.hpp.
typedef std::vector<RegisterT *> sparta::RegisterBankTable< RegisterT >::RegisterVector |
Definition at line 53 of file RegisterBankTable.hpp.
|
inline |
Constructor.
Definition at line 70 of file RegisterBankTable.hpp.
|
inline |
Adds a register to this table unless it is not a member of a group (See Register::getGroupNum.
r | Register to add to the banking table |
SpartaException | if r is nullptr, the definition of r has a bank_membership field with an index at or exceeding ERROR_MAX_BANK_IDX, or on index in the bank_membership along with the group number and group index already point to an existing register. If the bank_membership field of the register definition is empty, any register existing in any bank having the same group and index will cause an exception. If register has a group_num of Register::GROUP_NUM_NONE and a non-empty bank membership set, throws |
Definition at line 189 of file RegisterBankTable.hpp.
|
inline |
Definition at line 139 of file RegisterBankTable.hpp.
|
inlinenoexcept |
Definition at line 292 of file RegisterBankTable.hpp.
|
inline |
Dump this register bank table to an out stream. Banks will be columns and group num/id will be rows.
Definition at line 382 of file RegisterBankTable.hpp.
|
inlineprotected |
Extends the banks_ vector to contain num_banks entries.
num_banks | number of banks that must be contained in extendBanks |
Definition at line 483 of file RegisterBankTable.hpp.
|
inline |
Gets the number of registers in a group by its group num and bank.
group_num | Number of group to get children from. If GROUP_NUM_NONE, will return 0. |
SpartaException | if referring to an invalid bank_num |
Definition at line 114 of file RegisterBankTable.hpp.
|
inline |
Gets the total number of banks instantiated (even if they contain have no actual registers accessible). Note that banks are created between 0 and the highest bank index requested by a register.
Definition at line 91 of file RegisterBankTable.hpp.
|
inline |
Gets the number of register groups added to this table regardless of banks.
Definition at line 100 of file RegisterBankTable.hpp.
|
inline |
Returns number of registers in this table. This excludes any registers added having no group number.
Definition at line 148 of file RegisterBankTable.hpp.
|
inline |
Gets a Register by group number and group index and throws an exception if it cannot be found.
group_num | Group identifier number. Corresponds to sparta::Register::Definition::group_num |
group_idx | Index within the given group. Corresponds to sparta::Register::Definition::group_idx |
SpartaExeption | if the register cannot be found. |
Definition at line 337 of file RegisterBankTable.hpp.
|
inlineprotected |
Insert a register in a specific bank.
r | Register to insert |
bank | GroupVector of the bank into which this register will be inserted. |
Must | not throw. Check that the register can be added first |
Definition at line 505 of file RegisterBankTable.hpp.
|
inline |
Definition at line 301 of file RegisterBankTable.hpp.
|
inline |
Definition at line 313 of file RegisterBankTable.hpp.
|
inline |
Definition at line 134 of file RegisterBankTable.hpp.
|
inline |
Sets the minimum bank index for this register set, overriding the default of BANK_IDX_DEFAULT.
min_idx | Minimum bank index to be accessible. This is an index, so the minimum number of banks required will be min_idx+1 |
This ensures that a minimum number of banks are instantiated in this RegisterSet. Register set definitions can cause more banks to be instantiated though.
This is required if banked operation is required, but for som reason all registers in the RegisterSet are unbanked (available in every bank) because all of their definitions' bank_membership list are empty.
Definition at line 168 of file RegisterBankTable.hpp.
|
inlinevirtual |
Definition at line 369 of file RegisterBankTable.hpp.