summaryrefslogtreecommitdiffstats
path: root/simulator/include
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2018-05-15 07:24:50 -0600
committerEvan Lojewski <github@meklort.com>2018-05-15 19:06:53 -0600
commit138b40dbe81e245cdff3766526a6bb3c82aadb99 (patch)
tree4281f21edce936453a23b6d92f2f0429a044a1d3 /simulator/include
parent1256c66174fd87b58862e0c0732bae480a63325a (diff)
downloadbcm5719-ortega-138b40dbe81e245cdff3766526a6bb3c82aadb99.tar.gz
bcm5719-ortega-138b40dbe81e245cdff3766526a6bb3c82aadb99.zip
Update cxx register wraper to only copy base register. Ensure write callback is only called once.
Diffstat (limited to 'simulator/include')
-rw-r--r--simulator/include/CXXRegister.h14
-rw-r--r--simulator/include/bitfields.h58
2 files changed, 12 insertions, 60 deletions
diff --git a/simulator/include/CXXRegister.h b/simulator/include/CXXRegister.h
index 84e4d34..9428639 100644
--- a/simulator/include/CXXRegister.h
+++ b/simulator/include/CXXRegister.h
@@ -104,11 +104,14 @@ protected:
unsigned int base = getRawValue();
base &= ~(source->mMask);
unsigned int tempValue = base | source->getRawValue();
- // printf("Updating base from %x & %x to %x (new wite: %x)\n", getRawValue(), ~source->mMask, tempValue, source->getRawValue());
+ // printf("Updating base from %x & %x to %x (new write: %x)\n", getRawValue(), ~source->mMask, tempValue, source->getRawValue());
setTempValue(tempValue);
// Call the write callbacks. This may update the raw value as needed.
- doWriteCallbacks();
+ if(this != source)
+ {
+ doWriteCallbacks();
+ }
}
void doRelatedWrites()
@@ -292,6 +295,13 @@ public:
return mValue;
}
+ T operator=(CXXRegister<T,OFFSET,WIDTH> val)
+ {
+ // Write
+ doWrite((T)val);
+ return mValue;
+ }
+
operator T()
{
// Read
diff --git a/simulator/include/bitfields.h b/simulator/include/bitfields.h
deleted file mode 100644
index d30a512..0000000
--- a/simulator/include/bitfields.h
+++ /dev/null
@@ -1,58 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// @file bitfield.h
-///
-/// @project simulator
-///
-/// @brief Bitfield support routines for C++
-///
-/// @classification Confidential
-///
-////////////////////////////////////////////////////////////////////////////////
-///
-////////////////////////////////////////////////////////////////////////////////
-///
-/// @copyright Copyright (c) 2018, Evan Lojewski
-/// @cond
-///
-/// All rights reserved.
-///
-/// Redistribution and use in source and binary forms, with or without
-/// modification, are permitted provided that the following conditions are met:
-/// 1. Redistributions of source code must retain the above copyright notice,
-/// this list of conditions and the following disclaimer.
-/// 2. Redistributions in binary form must reproduce the above copyright notice,
-/// this list of conditions and the following disclaimer in the documentation
-/// and/or other materials provided with the distribution.
-/// 3. Neither the name of the <organization> nor the
-/// names of its contributors may be used to endorse or promote products
-/// derived from this software without specific prior written permission.
-///
-////////////////////////////////////////////////////////////////////////////////
-///
-/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-/// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-/// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-/// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-/// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-/// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-/// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-/// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-/// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-/// POSSIBILITY OF SUCH DAMAGE.
-/// @endcond
-////////////////////////////////////////////////////////////////////////////////
-#ifndef BITFIELD_H
-#define BITFIELD_H
-
-#define BITFIELD_BEGIN(__type__, __name__) \
-struct {
-
-#define BITFIELD_MEMBER(__type__, __name__, __offset__, __bits__)\
- __type__##_bitfield(__offset__, __bits__) __name__; /* FIXME */
-
-#define BITFIELD_END(__type__, __name__) \
-} __name__;
-
-#endif /* BITFIELD_H */ \ No newline at end of file
OpenPOWER on IntegriCloud