Go to the documentation of this file.
36 #include <boost/format.hpp>
57 littleEndian_(littleEndian),
58 start_(start), end_(end), MAUSize_(MAUSize),
61 const std::size_t maxMAUSize =
67 std::string msg =
"Maximum supported MAU width is ";
119 for (
int i = 0; i < count; ++i) {
120 write(address + i, MAUData[i]);
144 for (
int i = 0; i < count; ++i) {
145 write(address + i, MAUData[i]);
203 std::memcpy(request->
data_, MAUData, count*
sizeof(
MAU));
204 request->
size_ = count;
230 std::memcpy(request->
data_, MAUData, count*
sizeof(
MAU));
231 request->
size_ = count;
250 "Loading FloatWords works only with byte sized MAU at the moment.");
252 const std::size_t MAUS = 4;
263 for (std::size_t i = 0; i < MAUS; ++i) {
266 readBE(address + i, 1, data);
268 #if WORDS_BIGENDIAN == 1
271 cast.maus[MAUS - 1 - i] = data;
291 "Loading FloatWords works only with byte sized MAU at the moment.");
293 const std::size_t MAUS = 4;
304 for (std::size_t i = 0; i < MAUS; ++i) {
307 readLE(address + i, 1, data);
309 #if WORDS_BIGENDIAN == 0
312 cast.maus[MAUS - 1 - i] = data;
350 "Writing FloatWords works only with byte sized MAU at the moment.");
352 const std::size_t MAUS = 4;
366 request->
size_ = MAUS;
369 for (std::size_t i = 0; i < MAUS; ++i) {
372 #if WORDS_BIGENDIAN == 1
375 data = cast.maus[MAUS - 1 - i];
377 request->
data_[i] = data;
395 "Writing FloatWords works only with byte sized MAU at the moment.");
397 const std::size_t MAUS = 4;
411 request->
size_ = MAUS;
414 for (std::size_t i = 0; i < MAUS; ++i) {
417 #if WORDS_BIGENDIAN == 0
420 data = cast.maus[MAUS - 1 - i];
422 request->
data_[i] = data;
442 "LDD works only with byte sized MAU at the moment.");
444 const std::size_t MAUS = 8;
452 for (std::size_t i = 0; i < MAUS; ++i) {
454 readBE(address + i, 1, data);
456 #if WORDS_BIGENDIAN == 1
459 cast.maus[MAUS - 1 - i] = data;
479 "LDD works only with byte sized MAU at the moment.");
481 const std::size_t MAUS = 8;
489 for (std::size_t i = 0; i < MAUS; ++i) {
491 readLE(address + i, 1, data);
493 #if WORDS_BIGENDIAN == 0
496 cast.maus[MAUS - 1 - i] = data;
552 "LDD works only with byte sized MAU at the moment.");
554 const std::size_t MAUS = 8;
568 request->
size_ = MAUS;
571 for (std::size_t i = 0; i < MAUS; ++i) {
574 #if WORDS_BIGENDIAN == 1
577 data = cast.maus[MAUS - 1 - i];
579 request->
data_[i] = data;
597 "LDD works only with byte sized MAU at the moment.");
599 const std::size_t MAUS = 8;
613 request->
size_ = MAUS;
616 for (std::size_t i = 0; i < MAUS; ++i) {
619 #if WORDS_BIGENDIAN == 0
622 data = cast.maus[MAUS - 1 - i];
624 request->
data_[i] = data;
645 int shiftCount =
MAUSize_ * (size - 1);
646 for (
int i = 0; i < size; i++) {
647 data = data | (
read(address + i) << shiftCount);
665 readLE(address, size, data);
667 readBE(address, size, data);
688 for (
int i = 0; i < size; i++) {
690 data = data | (readByte << shiftCount);
705 for (std::size_t addr =
start_; addr <=
end_; ++addr) {
719 delete[] (*iter)->data_;
720 (*iter)->data_ = NULL;
740 int shiftCount =
MAUSize_ * (size - 1);
741 for (
int i = 0; i < size; i++) {
742 value = value | (data[i] << shiftCount);
761 for (
int i = 0; i < size; i++) {
762 value = value | (data[i] << shiftCount);
782 int shiftCount =
MAUSize_ * (size - 1);
783 for(
int i = 0; i < size; ++i) {
784 data[i] = ((value >> shiftCount) &
mask_);
805 for(
int i = 0; i < size; ++i) {
806 data[i] = ((value >> shiftCount) &
mask_);
824 for (
int i = 0; i < req->
size_; ++i) {
827 delete[] (*iter)->data_;
828 (*iter)->data_ = NULL;
846 unsigned int low =
start();
847 unsigned int high =
end();
849 if ((startAddress < low) || (startAddress > high - numberOfMAUs + 1)) {
853 "Memory access at %d of size %d is out of the address space.")
854 % startAddress % numberOfMAUs).str());
virtual void writeDirectlyLE(ULongWord address, int size, ULongWord data)
virtual void writeDirectlyBE(ULongWord address, int size, ULongWord data)
Word address_
Address to be written to.
void unpackLE(const ULongWord &value, int size, Memory::MAUTable data)
virtual ULongWord MAUSize()
virtual void fillWithZeros()
virtual void readBE(ULongWord address, int size, ULongWord &data)
static std::string toString(const T &source)
ULongWord MAUSize_
Size of the minimum adressable unit.
#define assert(condition)
#define abortWithError(message)
ULongWord start_
Starting point of the address space.
virtual void readLE(ULongWord address, int size, ULongWord &data)
Word MinimumAddressableUnit
Type for storing a MAU (must be unsigned type!). This limits the maximum size of the simulated minimu...
#define MAX_ACCESS_SIZE
Maximum number of MAUs in a single request supported by the interface.
Memory::MAUTable data_
Data to be written.
int mask_
Mask bit pattern for unpacking IntULongWord to MAUs.
int size_
Size of the data to be read/written.
virtual Memory::MAU read(ULongWord address)=0
MinimumAddressableUnit MAU
void checkRange(ULongWord startAddress, int numberOfMAUs)
ULongWord end_
End point of the address space.
void unpackBE(const ULongWord &value, int size, Memory::MAUTable data)
virtual void advanceClock()
virtual void write(ULongWord address, MAU data)=0
virtual void writeBE(ULongWord address, int size, ULongWord data)
virtual void writeLE(ULongWord address, int size, ULongWord data)
RequestQueue * writeRequests_
The uncommited write requests.
void packBE(const Memory::MAUTable data, int size, ULongWord &value)
void packLE(const Memory::MAUTable data, int size, ULongWord &value)
Memory(ULongWord start, ULongWord end, ULongWord MAUSize, bool littleEndian_)
virtual ULongWord start()