diff options
author | Evan Lojewski <github@meklort.com> | 2019-11-29 13:48:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 13:48:45 -0700 |
commit | cd15d119ffb7cc9610290ea6fe2f154ded677dc1 (patch) | |
tree | 4bdd2e6c432ff3e660f00f37fc12efef577705b3 /simulator | |
parent | 74a4d23d583a69ba08f914c403b61d8bf0435df4 (diff) | |
download | bcm5719-ortega-cd15d119ffb7cc9610290ea6fe2f154ded677dc1.tar.gz bcm5719-ortega-cd15d119ffb7cc9610290ea6fe2f154ded677dc1.zip |
ipxact: Update ipxact to enable enum printouts on the simulator. (#6)
Add missing Req0-3 bits in the NVM software arbitration register.
Diffstat (limited to 'simulator')
-rw-r--r-- | simulator/include/CXXRegister.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/simulator/include/CXXRegister.h b/simulator/include/CXXRegister.h index 590c19a..754f0dd 100644 --- a/simulator/include/CXXRegister.h +++ b/simulator/include/CXXRegister.h @@ -49,9 +49,12 @@ #include <stdio.h> #include <utility> #include <vector> +#include <list> class CXXRegisterBase { +private: + std::list<std::pair<int, const char*>> mEnums; public: CXXRegisterBase(unsigned int offset, unsigned int width) { @@ -83,6 +86,28 @@ public: } } + const char* getEnum(int value) + { + std::list<std::pair<int, const char*>>::iterator it; + for (it = mEnums.begin(); it != mEnums.end(); + it++) + { + if(value == (*it).first) + { + return (*it).second; + } + } + return NULL; + } + + void addEnum(const char* name, int value) + { + if(!getEnum(value)) + { + mEnums.push_back(std::make_pair(value, name)); + } + } + const char *getName(void) { return mName; @@ -100,18 +125,24 @@ public: void print(unsigned int value, int indent = false) { - unsigned int masked = value & mMask; + unsigned int masked = (value & mMask) >> mBitPosition; + const char* enumstr = getEnum(masked); if (indent) { std::cout << std::right << std::setw(35) << mName << ": 0x" - << std::hex << (masked >> mBitPosition) << std::endl; + << std::hex << masked; } else { std::cout << std::endl << std::left << std::setw(36) << mName << " 0x" - << std::hex << (masked >> mBitPosition) << std::endl; + << std::hex << masked; + } + if(enumstr) + { + std::cout << " (" << enumstr << ")"; } + std::cout << std::endl; } void printAll(unsigned int value) |