summaryrefslogtreecommitdiffstats
path: root/simulator/include
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2019-04-06 14:28:16 -0600
committerEvan Lojewski <github@meklort.com>2019-04-06 14:28:16 -0600
commit49b5649ff0a28fcefad944afbc229eac47b7124c (patch)
treeff9accd5c044d92bd8002b0f670b0f190781061d /simulator/include
parent3c6ca801d30e0c3ffcfcdcaa58276002df72f904 (diff)
downloadbcm5719-ortega-49b5649ff0a28fcefad944afbc229eac47b7124c.tar.gz
bcm5719-ortega-49b5649ff0a28fcefad944afbc229eac47b7124c.zip
Clean up CXXregister code slightly to prepare for initial APE-indirect access code.
Diffstat (limited to 'simulator/include')
-rw-r--r--simulator/include/CXXRegister.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/simulator/include/CXXRegister.h b/simulator/include/CXXRegister.h
index eca905a..b25c29e 100644
--- a/simulator/include/CXXRegister.h
+++ b/simulator/include/CXXRegister.h
@@ -55,6 +55,7 @@ class CXXRegisterBase
public:
CXXRegisterBase(unsigned int offset, unsigned int width)
{
+ mComponentOffset = 0;
mMask = 0;
mBaseRegister = NULL;
mBitWidth = width;
@@ -84,16 +85,26 @@ public:
return mName;
}
+ void setComponentOffset(unsigned int offset)
+ {
+ mComponentOffset = offset;
+ }
+
+ unsigned int getComponentOffset(void)
+ {
+ return mComponentOffset;
+ }
+
void print(unsigned int value, int indent = false)
{
unsigned int masked = value & mMask;
if(indent)
{
- std::cout << std::setw(30) << mName << ": " << std::hex << (masked >> mBitPosition) << std::endl;
+ std::cout << std::setw(30) << mName << ": 0x" << std::hex << (masked >> mBitPosition) << std::endl;
}
else
{
- std::cout << std::endl << mName << ": " << std::hex << (masked >> mBitPosition) << std::endl;
+ std::cout << std::endl << mName << ": 0x" << std::hex << (masked >> mBitPosition) << std::endl;
}
}
@@ -108,6 +119,7 @@ public:
protected:
+ unsigned int mComponentOffset;
unsigned int mBitPosition;
unsigned int mBitWidth;
unsigned int mMask;
@@ -204,7 +216,7 @@ protected:
template<typename T, unsigned int OFFSET, unsigned int WIDTH> class CXXRegister : public CXXRegisterBase
{
private:
- typedef T (*callback_t)(T val, void*);
+ typedef T (*callback_t)(T val, unsigned int, void*);
std::vector< std::pair<callback_t, void*> > mReadCallback;
std::vector< std::pair<callback_t, void*> > mWriteCallback;
@@ -222,7 +234,7 @@ private:
callback = (*it).first;
if(callback)
{
- val = callback(val, (*it).second);
+ val = callback(val, mComponentOffset, (*it).second);
}
}
mValue = val;
@@ -239,7 +251,7 @@ private:
callback = (*it).first;
if(callback)
{
- val = callback(val, (*it).second);
+ val = callback(val, mComponentOffset, (*it).second);
}
}
OpenPOWER on IntegriCloud