summaryrefslogtreecommitdiffstats
path: root/simulator/include/CXXRegister.h
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2019-11-30 18:50:50 -0700
committerGitHub <noreply@github.com>2019-11-30 18:50:50 -0700
commite0912558b571ce29e2d48cf2c9d7b97ded57ac42 (patch)
tree2b82fa153ac0cf128a89ec844d4d720ab72497bc /simulator/include/CXXRegister.h
parente838d001437ef9ec30ba285644533845dbec17fc (diff)
downloadbcm5719-ortega-e0912558b571ce29e2d48cf2c9d7b97ded57ac42.tar.gz
bcm5719-ortega-e0912558b571ce29e2d48cf2c9d7b97ded57ac42.zip
ipxact: Regnerate and fix a printout bug with undefined registers. (#8)
Diffstat (limited to 'simulator/include/CXXRegister.h')
-rw-r--r--simulator/include/CXXRegister.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/simulator/include/CXXRegister.h b/simulator/include/CXXRegister.h
index 754f0dd..dd5c1d1 100644
--- a/simulator/include/CXXRegister.h
+++ b/simulator/include/CXXRegister.h
@@ -58,7 +58,7 @@ private:
public:
CXXRegisterBase(unsigned int offset, unsigned int width)
{
- mName = "(undefined)";
+ mName = NULL;
mComponentOffset = 0;
mMask = 0;
mBaseRegister = NULL;
@@ -110,7 +110,14 @@ public:
const char *getName(void)
{
- return mName;
+ if(!mName)
+ {
+ return "(undefined)";
+ }
+ else
+ {
+ return mName;
+ }
}
void setComponentOffset(unsigned int offset)
@@ -125,17 +132,24 @@ public:
void print(unsigned int value, int indent = false)
{
+ const char* name = mName;
+ char addr_str[16];
+ if(!name)
+ {
+ snprintf(addr_str, sizeof(addr_str), "0x%X", mComponentOffset);
+ name = addr_str;
+ }
unsigned int masked = (value & mMask) >> mBitPosition;
const char* enumstr = getEnum(masked);
if (indent)
{
- std::cout << std::right << std::setw(35) << mName << ": 0x"
+ std::cout << std::right << std::setw(35) << name << ": 0x"
<< std::hex << masked;
}
else
{
std::cout << std::endl
- << std::left << std::setw(36) << mName << " 0x"
+ << std::left << std::setw(36) << name << " 0x"
<< std::hex << masked;
}
if(enumstr)
OpenPOWER on IntegriCloud