OpenASIP 2.2
Loading...
Searching...
No Matches
Memory.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file Memory.cc
26 *
27 * Non-inline definitions of Memory class.
28 *
29 * @author Pekka Jääskeläinen 2004,2014 (pekka.jaaskelainen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include <cstddef>
34#include <ios>
35
36#include <boost/format.hpp>
37#include "Memory.hh"
38#include "MemoryContents.hh"
39#include "Application.hh"
40#include "Conversion.hh"
41#include "WriteRequest.hh"
42
43//////////////////////////////////////////////////////////////////////////////
44// Memory
45//////////////////////////////////////////////////////////////////////////////
46
47/**
48 * Initializes the memory model.
49 *
50 * The created memory model is empty. No data is allocated for its contents.
51 *
52 * @param start First address of the memory.
53 * @param end Last address of the memory.
54 * @param MAUSize Bit width of the minimum addressable unit of the memory.
55 */
56Memory::Memory(ULongWord start, ULongWord end, ULongWord MAUSize, bool littleEndian) :
57 littleEndian_(littleEndian),
58 start_(start), end_(end), MAUSize_(MAUSize),
59 writeRequests_(new RequestQueue()) {
60
61 const std::size_t maxMAUSize =
62 static_cast<int>(sizeof(MinimumAddressableUnit) * BYTE_BITWIDTH);
63
64 if (MAUSize_ == maxMAUSize) {
65 mask_ = ~0;
66 } else if (MAUSize_ > maxMAUSize) {
67 std::string msg = "Maximum supported MAU width is ";
68 msg += Conversion::toString(maxMAUSize);
69 msg += " bits.";
70 throw OutOfRange(__FILE__, __LINE__, __func__, msg);
71 } else {
72 mask_ = ~0u << MAUSize_;
73 mask_ = ~mask_;
74 }
75}
76
77/**
78 * Destructor.
79 */
81 delete writeRequests_;
82 writeRequests_ = NULL;
83}
85/**
86 * Writes a single memory location.
87 *
88 * Must be implemented in the derived class. No range checking.
89 * The fastest way to write to the memory.
90 *
91 * @param address The target address.
92 * @param data The data to write.
93 */
94void
96 abortWithError("Must be implemented in the derived class.");
99/**
100 * Writes a single memory location directly without waiting to
101 * the end of the clock.
102 *
103 * This is used in case it's important for potential other
104 * memory operations in the same cycle to see the write.
105 * This is used (at the moment solely) to simulate Compare-and-swap (CAS).
106 *
107 * @param address The target address.
108 * @param count Number of MAUs to write.
109 * @param data The data to write.
110 */
111void
112Memory::writeDirectlyBE(ULongWord address, int count, ULongWord data) {
113
114 checkRange(address, count);
115
117 unpackBE(data, count, MAUData);
118
119 for (int i = 0; i < count; ++i) {
120 write(address + i, MAUData[i]);
121 }
122}
123
124/**
125 * Writes a single memory location directly without waiting to
126 * the end of the clock.
127 *
128 * This is used in case it's important for potential other
129 * memory operations in the same cycle to see the write.
130 * This is used (at the moment solely) to simulate Compare-and-swap (CAS).
131 *
132 * @param address The target address.
133 * @param count Number of MAUs to write.
134 * @param data The data to write.
135 */
136void
137Memory::writeDirectlyLE(ULongWord address, int count, ULongWord data) {
138
139 checkRange(address, count);
140
142 unpackLE(data, count, MAUData);
143
144 for (int i = 0; i < count; ++i) {
145 write(address + i, MAUData[i]);
146 }
147}
148
149
150/**
151 * Reads a single memory location.
152 *
153 * Must be implemented in the derived class. No range checking.
154 * The fastest way to read the memory.
155 *
156 * @param address The address to read.
157 * @return The data read.
158 */
161 return 0;
162}
163
164/**
165 * A convenience method for writing units of data to the memory.
166 *
167 * The data is stored in an UIntWord.
168 *
169 * @param address The address to write.
170 * @param count Number of MAUs to write.
171 * @param data The data to write.
172 * @exception OutOfRange in case the address is out of range of the memory.
173 */
174void
175Memory::write(ULongWord address, int count, ULongWord data) {
176 if (littleEndian_) {
177 writeLE(address, count, data);
178 } else {
179 writeBE(address, count, data);
180 }
181}
182
183/**
184 * A convenience method for writing units of data to the memory.
185 *
186 * The data is stored in an UIntWord.
187 *
188 * @param address The address to write.
189 * @param count Number of MAUs to write.
190 * @param data The data to write.
191 * @exception OutOfRange in case the address is out of range of the memory.
192 */
193void
194Memory::writeBE(ULongWord address, int count, ULongWord data) {
195
196 checkRange(address, count);
197
199 unpackBE(data, count, MAUData);
200
201 WriteRequest* request = new WriteRequest();
202 request->data_ = new MAU[count];
203 std::memcpy(request->data_, MAUData, count*sizeof(MAU));
204 request->size_ = count;
205 request->address_ = address;
206 writeRequests_->push_back(request);
207}
208
209
210/**
211 * A convenience method for writing units of data to the memory.
212 *
213 * The data is stored in an UIntWord.
214 *
215 * @param address The address to write.
216 * @param count Number of MAUs to write.
217 * @param data The data to write.
218 * @exception OutOfRange in case the address is out of range of the memory.
219 */
220void
221Memory::writeLE(ULongWord address, int count, ULongWord data) {
222
223 checkRange(address, count);
224
226 unpackLE(data, count, MAUData);
227
228 WriteRequest* request = new WriteRequest();
229 request->data_ = new MAU[count];
230 std::memcpy(request->data_, MAUData, count*sizeof(MAU));
231 request->size_ = count;
232 request->address_ = address;
233 writeRequests_->push_back(request);
234}
235
236/**
237 * A convenience method for reading data from the memory and
238 * interpreting it as a FloatWord in Big Endian Format
239 *
240 * @note Currently works only if MAU == 8 bits. asserts otherwise.
241 *
242 * @param address The address to read.
243 * @param data The data to write.
244 * @exception OutOfRange in case the address is out of range of the memory.
245 */
246void
248
249 assert(MAUSize() == sizeof(Byte)*8 &&
250 "Loading FloatWords works only with byte sized MAU at the moment.");
251
252 const std::size_t MAUS = 4;
253
254 checkRange(address, MAUS);
255
256 union castUnion {
257 FloatWord d;
258 Byte maus[MAUS];
259 };
260
261 castUnion cast;
262
263 for (std::size_t i = 0; i < MAUS; ++i) {
264 ULongWord data;
265 // one byte so endian does not matter
266 readBE(address + i, 1, data);
267 // Byte order must be reversed if host is not bigendian.
268 #if WORDS_BIGENDIAN == 1
269 cast.maus[i] = data;
270 #else
271 cast.maus[MAUS - 1 - i] = data;
272 #endif
273 }
274 data = cast.d;
275}
276
277/**
278 * A convenience method for reading data from the memory and
279 * interpreting it as a FloatWord in Little Endian Format
280 *
281 * @note Currently works only if MAU == 8 bits. asserts otherwise.
282 *
283 * @param address The address to read.
284 * @param data The data to write.
285 * @exception OutOfRange in case the address is out of range of the memory.
286 */
287void
289
290 assert(MAUSize() == sizeof(Byte)*8 &&
291 "Loading FloatWords works only with byte sized MAU at the moment.");
292
293 const std::size_t MAUS = 4;
294
295 checkRange(address, MAUS);
296
297 union castUnion {
298 FloatWord d;
299 Byte maus[MAUS];
300 };
301
302 castUnion cast;
303
304 for (std::size_t i = 0; i < MAUS; ++i) {
305 ULongWord data;
306 // one bytes so endian does not matter
307 readLE(address + i, 1, data);
308 // Byte order must be reversed if host is not little endian.
309 #if WORDS_BIGENDIAN == 0
310 cast.maus[i] = data;
311 #else
312 cast.maus[MAUS - 1 - i] = data;
313 #endif
314 }
315 data = cast.d;
316}
317
318/**
319 * A convenience method for reading data from the memory and
320 * interpreting it as a FloatWord in order set by the memory.
321 *
322 * @note Currently works only if MAU == 8 bits. asserts otherwise.
323 *
324 * @param address The address to read.
325 * @param data The data to write.
326 * @exception OutOfRange in case the address is out of range of the memory.
327 */
328void
330 if (littleEndian_) {
331 readLE(address, data);
332 } else {
333 readBE(address, data);
334 }
335}
336
337/**
338 * A convenience method for writing a FloatWord to the memory in Big Endian.
339 *
340 * @note Currently works only if MAU == 8 bits. asserts otherwise.
341 *
342 * @param address The address to write.
343 * @param data The data to write.
344 * @exception OutOfRange in case the address is out of range of the memory.
345 */
346void
348
349 assert(MAUSize() == sizeof(Byte)*8 &&
350 "Writing FloatWords works only with byte sized MAU at the moment.");
351
352 const std::size_t MAUS = 4;
353
354 checkRange(address, MAUS);
355
356 union castUnion {
357 FloatWord d;
358 Byte maus[MAUS];
359 };
360
361 castUnion cast;
362 cast.d = data;
363
364 WriteRequest* request = new WriteRequest();
365 request->data_ = new MAU[MAUS];
366 request->size_ = MAUS;
367 request->address_ = address;
368
369 for (std::size_t i = 0; i < MAUS; ++i) {
370 UIntWord data;
371 // Byte order must be reversed if host is not bigendian.
372 #if WORDS_BIGENDIAN == 1
373 data = cast.maus[i];
374 #else
375 data = cast.maus[MAUS - 1 - i];
376 #endif
377 request->data_[i] = data;
378 }
379 writeRequests_->push_back(request);
380}
381
382/**
383 * A convenience method for writing a FloatWord to the memory in Little Endian.
384 *
385 * @note Currently works only if MAU == 8 bits. asserts otherwise.
386 *
387 * @param address The address to write.
388 * @param data The data to write.
389 * @exception OutOfRange in case the address is out of range of the memory.
390 */
391void
393
394 assert(MAUSize() == sizeof(Byte)*8 &&
395 "Writing FloatWords works only with byte sized MAU at the moment.");
396
397 const std::size_t MAUS = 4;
398
399 checkRange(address, MAUS);
400
401 union castUnion {
402 FloatWord d;
403 Byte maus[MAUS];
404 };
405
406 castUnion cast;
407 cast.d = data;
408
409 WriteRequest* request = new WriteRequest();
410 request->data_ = new MAU[MAUS];
411 request->size_ = MAUS;
412 request->address_ = address;
413
414 for (std::size_t i = 0; i < MAUS; ++i) {
415 UIntWord data;
416 // Byte order must be reversed if host is not bigendian.
417 #if WORDS_BIGENDIAN == 0
418 data = cast.maus[i];
419 #else
420 data = cast.maus[MAUS - 1 - i];
421 #endif
422 request->data_[i] = data;
423 }
424 writeRequests_->push_back(request);
425}
426
427
428/**
429 * A convenience method for reading data from the memory and
430 * interpreting it as a DoubleWord in Big Endian.
431 *
432 * @note Currently works only if MAU == 8 bits. asserts otherwise.
433 *
434 * @param address The address to read.
435 * @param data The data to write.
436 * @exception OutOfRange in case the address is out of range of the memory.
437 */
438void
440
441 assert(MAUSize() == sizeof(Byte)*8 &&
442 "LDD works only with byte sized MAU at the moment.");
443
444 const std::size_t MAUS = 8;
445 union castUnion {
446 DoubleWord d;
447 Byte maus[MAUS];
448 };
449
450 castUnion cast;
451
452 for (std::size_t i = 0; i < MAUS; ++i) {
453 ULongWord data;
454 readBE(address + i, 1, data);
455 // Byte order must be reversed if host is not bigendian.
456 #if WORDS_BIGENDIAN == 1
457 cast.maus[i] = data;
458 #else
459 cast.maus[MAUS - 1 - i] = data;
460 #endif
461 }
462 data = cast.d;
463}
464
465/**
466 * A convenience method for reading data from the memory and
467 * interpreting it as a DoubleWord in Little Endian.
468 *
469 * @note Currently works only if MAU == 8 bits. asserts otherwise.
470 *
471 * @param address The address to read.
472 * @param data The data to write.
473 * @exception OutOfRange in case the address is out of range of the memory.
474 */
475void
477
478 assert(MAUSize() == sizeof(Byte)*8 &&
479 "LDD works only with byte sized MAU at the moment.");
480
481 const std::size_t MAUS = 8;
482 union castUnion {
483 DoubleWord d;
484 Byte maus[MAUS];
485 };
486
487 castUnion cast;
488
489 for (std::size_t i = 0; i < MAUS; ++i) {
490 ULongWord data;
491 readLE(address + i, 1, data);
492 // Byte order must be reversed if host is not bigendian.
493 #if WORDS_BIGENDIAN == 0
494 cast.maus[i] = data;
495 #else
496 cast.maus[MAUS - 1 - i] = data;
497 #endif
498 }
499 data = cast.d;
500}
501
502/**
503 * A convenience method for reading data from the memory and
504 * interpreting it as a DoubleWord in order set by endian bit of memory.
505 *
506 * @note Currently works only if MAU == 8 bits. asserts otherwise.
507 *
508 * @param address The address to read.
509 * @param data The data to write.
510 * @exception OutOfRange in case the address is out of range of the memory.
511 */
512void
514 if (littleEndian_) {
515 readLE(address, data);
516 } else {
517 readBE(address, data);
518 }
519}
520
521/**
522 * A convenience method for writing a DoubleWord to the memory.
523 *
524 * @note Currently works only if MAU == 8 bits. asserts otherwise.
525 *
526 * @param address The address to write.
527 * @param data The data to write.
528 * @exception OutOfRange in case the address is out of range of the memory.
529 */
530void
532 if (littleEndian_) {
533 writeLE(address, data);
534 } else {
535 writeBE(address, data);
536 }
537}
538
539/**
540 * A convenience method for writing a DoubleWord to the memory in Big Endian.
541 *
542 * @note Currently works only if MAU == 8 bits. asserts otherwise.
543 *
544 * @param address The address to write.
545 * @param data The data to write.
546 * @exception OutOfRange in case the address is out of range of the memory.
547 */
548void
550
551 assert(MAUSize() == sizeof(Byte)*8 &&
552 "LDD works only with byte sized MAU at the moment.");
553
554 const std::size_t MAUS = 8;
555
556 checkRange(address, MAUS);
557
558 union castUnion {
559 DoubleWord d;
560 Byte maus[MAUS];
561 };
562
563 castUnion cast;
564 cast.d = data;
565
566 WriteRequest* request = new WriteRequest();
567 request->data_ = new MAU[MAUS];
568 request->size_ = MAUS;
569 request->address_ = address;
570
571 for (std::size_t i = 0; i < MAUS; ++i) {
572 UIntWord data;
573 // Byte order must be reversed if host is not bigendian.
574 #if WORDS_BIGENDIAN == 1
575 data = cast.maus[i];
576 #else
577 data = cast.maus[MAUS - 1 - i];
578 #endif
579 request->data_[i] = data;
580 }
581 writeRequests_->push_back(request);
582}
583
584/**
585 * A convenience method for writing a DoubleWord to the memory in Litle Endian
586 *
587 * @note Currently works only if MAU == 8 bits. asserts otherwise.
588 *
589 * @param address The address to write.
590 * @param data The data to write.
591 * @exception OutOfRange in case the address is out of range of the memory.
592 */
593void
595
596 assert(MAUSize() == sizeof(Byte)*8 &&
597 "LDD works only with byte sized MAU at the moment.");
598
599 const std::size_t MAUS = 8;
600
601 checkRange(address, MAUS);
602
603 union castUnion {
604 DoubleWord d;
605 Byte maus[MAUS];
606 };
607
608 castUnion cast;
609 cast.d = data;
610
611 WriteRequest* request = new WriteRequest();
612 request->data_ = new MAU[MAUS];
613 request->size_ = MAUS;
614 request->address_ = address;
615
616 for (std::size_t i = 0; i < MAUS; ++i) {
617 UIntWord data;
618 // Byte order must be reversed if host is not bigendian.
619 #if WORDS_BIGENDIAN == 0
620 data = cast.maus[i];
621 #else
622 data = cast.maus[MAUS - 1 - i];
623 #endif
624 request->data_[i] = data;
625 }
626 writeRequests_->push_back(request);
627}
628
629/**
630 * A convenience method for reading units of data from the memory in Big Endian
631 *
632 * The data is written to an UIntWord.
633 *
634 * @param address The address to read.
635 * @param count Number of MAUs to read.
636 * @param data The data to write.
637 * @exception OutOfRange in case the address is out of range of the memory.
638 */
639void
640Memory::readBE(ULongWord address, int size, ULongWord& data) {
641
642 checkRange(address, size);
643
644 data = 0;
645 int shiftCount = MAUSize_ * (size - 1);
646 for (int i = 0; i < size; i++) {
647 data = data | (read(address + i) << shiftCount);
648 shiftCount -= MAUSize_;
649 }
650}
651
652/**
653 * A convenience method for reading units of data from the memory.
654 *
655 * The data is written to an UIntWord.
656 *
657 * @param address The address to read.
658 * @param count Number of MAUs to read.
659 * @param data The data to write.
660 * @exception OutOfRange in case the address is out of range of the memory.
661 */
662void
663Memory::read(ULongWord address, int size, ULongWord& data) {
664 if (littleEndian_) {
665 readLE(address, size, data);
666 } else {
667 readBE(address, size, data);
668 }
669}
670
671/**
672 * A convenience method for reading units of data from the memory in Little Endian
673 *
674 * The data is written to an UIntWord.
675 *
676 * @param address The address to read.
677 * @param count Number of MAUs to read.
678 * @param data The data to write.
679 * @exception OutOfRange in case the address is out of range of the memory.
680 */
681void
682Memory::readLE(ULongWord address, int size, ULongWord& data) {
683
684 checkRange(address, size);
685
686 data = 0;
687 long shiftCount = 0;
688 for (int i = 0; i < size; i++) {
689 ULongWord readByte = read(address+i);
690 data = data | (readByte << shiftCount);
691 shiftCount += MAUSize_;
692 }
693}
694
695/**
696 * Fills the whole memory with zeros.
697 *
698 * This is needed due to some buggy simulated programs which expect
699 * uninitialized data to be zero. The default implementation is a slow
700 * for-loop which can be overridden with a faster one depending on the
701 * storage used.
702 */
703void
705 for (std::size_t addr = start_; addr <= end_; ++addr) {
706 write(addr, MAU(0));
707 }
708}
709
710/**
711 * Resets the memory.
712 *
713 * Clears any pending write requests.
714 */
715void
717 RequestQueue::iterator iter = writeRequests_->begin();
718 while (iter != writeRequests_->end()) {
719 delete[] (*iter)->data_;
720 (*iter)->data_ = NULL;
721 delete (*iter);
722 ++iter;
723 }
724 writeRequests_->clear();
725}
726
727/**
728 * Packs MAUs to UIntWord.
729 *
730 * Version for static table.
731 *
732 * @param data Data to be packed.
733 * @param size The number of MAUs.
734 * @param value The target of the packing.
735 */
736void
737Memory::packBE(const Memory::MAUTable data, int size, ULongWord& value) {
738
739 value = 0;
740 int shiftCount = MAUSize_ * (size - 1);
741 for (int i = 0; i < size; i++) {
742 value = value | (data[i] << shiftCount);
743 shiftCount -= MAUSize_;
744 }
745}
746
747/**
748 * Packs MAUs to UIntWord.
749 *
750 * Version for static table.
751 *
752 * @param data Data to be packed.
753 * @param size The number of MAUs.
754 * @param value The target of the packing.
755 */
756void
757Memory::packLE(const Memory::MAUTable data, int size, ULongWord& value) {
758
759 value = 0;
760 int shiftCount = 0;
761 for (int i = 0; i < size; i++) {
762 value = value | (data[i] << shiftCount);
763 shiftCount += MAUSize_;
764 }
765}
766
767/**
768 * Unpack a given UIntWord to MAUs.
769 *
770 * Version for static table. Table is expected to be correct size, no checking
771 * is done!
772 *
773 * @param value Value to be unpacked.
774 * @param size The number of MAUs.
775 * @param data The target of unpacking.
776 */
777void
779 const ULongWord& value,
780 int size,
781 Memory::MAUTable data) {
782 int shiftCount = MAUSize_ * (size - 1);
783 for(int i = 0; i < size; ++i) {
784 data[i] = ((value >> shiftCount) & mask_);
785 shiftCount -= MAUSize_;
786 }
787}
788
789/**
790 * Unpack a given UIntWord to MAUs.
791 *
792 * Version for static table. Table is expected to be correct size, no checking
793 * is done!
794 *
795 * @param value Value to be unpacked.
796 * @param size The number of MAUs.
797 * @param data The target of unpacking.
798 */
799void
801 const ULongWord& value,
802 int size,
803 Memory::MAUTable data) {
804 int shiftCount = 0;
805 for(int i = 0; i < size; ++i) {
806 data[i] = ((value >> shiftCount) & mask_);
807 shiftCount += MAUSize_;
808 }
809}
810
811/**
812 * Advances clock for one cycle.
813 *
814 * Commits all pending write requests to the memory.
815 * Cannot throw an exception, request legality is checked when request
816 * is initiated.
817 */
818void
820
821 RequestQueue::iterator iter = writeRequests_->begin();
822 while (iter != writeRequests_->end()) {
823 WriteRequest* req = (*iter);
824 for (int i = 0; i < req->size_; ++i) {
825 write(req->address_ + i, req->data_[i]);
826 }
827 delete[] (*iter)->data_;
828 (*iter)->data_ = NULL;
829 delete (*iter);
830 ++iter;
831 }
832
833 writeRequests_->clear();
834}
835
836/**
837 * Helper for checking the legality of the memory access address range.
838 *
839 * Does nothing in case the address range is legal, throws otherwise.
840 *
841 * @exception OutOfRange in case the range is illegal.
842 */
843void
844Memory::checkRange(ULongWord startAddress, int numberOfMAUs) {
845
846 unsigned int low = start();
847 unsigned int high = end();
848
849 if ((startAddress < low) || (startAddress > high - numberOfMAUs + 1)) {
850 throw OutOfRange(
851 __FILE__, __LINE__, __func__,
852 (boost::format(
853 "Memory access at %d of size %d is out of the address space.")
854 % startAddress % numberOfMAUs).str());
855 }
856}
#define __func__
#define abortWithError(message)
#define assert(condition)
unsigned long ULongWord
Definition BaseType.hh:51
Word UIntWord
Definition BaseType.hh:144
Word MinimumAddressableUnit
Type for storing a MAU (must be unsigned type!). This limits the maximum size of the simulated minimu...
Definition BaseType.hh:184
float FloatWord
Definition BaseType.hh:160
const Byte BYTE_BITWIDTH
Definition BaseType.hh:136
unsigned char Byte
Definition BaseType.hh:116
double DoubleWord
Definition BaseType.hh:166
#define MAX_ACCESS_SIZE
Maximum number of MAUs in a single request supported by the interface.
Definition Memory.hh:152
static std::string toString(const T &source)
virtual void readLE(ULongWord address, int size, ULongWord &data)
Definition Memory.cc:682
virtual ULongWord end()
Definition Memory.hh:117
MAU * MAUTable
Definition Memory.hh:77
void packBE(const Memory::MAUTable data, int size, ULongWord &value)
Definition Memory.cc:737
virtual ~Memory()
Definition Memory.cc:80
Memory(ULongWord start, ULongWord end, ULongWord MAUSize, bool littleEndian_)
Definition Memory.cc:56
virtual void reset()
Definition Memory.cc:716
virtual void readBE(ULongWord address, int size, ULongWord &data)
Definition Memory.cc:640
void unpackLE(const ULongWord &value, int size, Memory::MAUTable data)
Definition Memory.cc:800
bool littleEndian_
Definition Memory.hh:128
void checkRange(ULongWord startAddress, int numberOfMAUs)
Definition Memory.cc:844
ULongWord start_
Starting point of the address space.
Definition Memory.hh:138
ULongWord end_
End point of the address space.
Definition Memory.hh:140
virtual void advanceClock()
Definition Memory.cc:819
virtual void write(ULongWord address, MAU data)=0
Definition Memory.cc:95
RequestQueue * writeRequests_
The uncommited write requests.
Definition Memory.hh:145
virtual void writeDirectlyBE(ULongWord address, int size, ULongWord data)
Definition Memory.cc:112
ULongWord MAUSize_
Size of the minimum adressable unit.
Definition Memory.hh:142
virtual void writeLE(ULongWord address, int size, ULongWord data)
Definition Memory.cc:221
virtual Memory::MAU read(ULongWord address)=0
Definition Memory.cc:160
virtual ULongWord MAUSize()
Definition Memory.hh:118
virtual void writeBE(ULongWord address, int size, ULongWord data)
Definition Memory.cc:194
virtual ULongWord start()
Definition Memory.hh:116
virtual void fillWithZeros()
Definition Memory.cc:704
void packLE(const Memory::MAUTable data, int size, ULongWord &value)
Definition Memory.cc:757
MinimumAddressableUnit MAU
Definition Memory.hh:76
virtual void writeDirectlyLE(ULongWord address, int size, ULongWord data)
Definition Memory.cc:137
int mask_
Mask bit pattern for unpacking IntULongWord to MAUs.
Definition Memory.hh:147
void unpackBE(const ULongWord &value, int size, Memory::MAUTable data)
Definition Memory.cc:778
Word address_
Address to be written to.
int size_
Size of the data to be read/written.
Memory::MAUTable data_
Data to be written.