OpenASIP  2.0
DirectAccessMemory.hh
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 DirectAccessMemory.hh
26  *
27  * Declaration of DirectAccessMemory class.
28  *
29  * @author Pekka Jääskeläinen 2007 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @note This file is used in compiled simulation. Keep dependencies *clean*
31  * @note rating: red
32  */
33 
34 #ifndef TTA_DIRECT_ACCESS_MEMORY_HH
35 #define TTA_DIRECT_ACCESS_MEMORY_HH
36 
37 #include "Memory.hh"
38 #include "BaseType.hh"
39 
40 class MemoryContents;
41 
42 /**
43  * Class that models an "ideal" memory to which updates are visible
44  * immediately.
45  *
46  * This model is used in compiled simulation. It does not require an
47  * advance clock call: all writes to it are visible immediately. Thus,
48  * one has to make sure that all reads in the same cycle are executed
49  * before writes in order for the reads to read the old values.
50  *
51  * Note that all range checking is disabled for fastest possible simulation
52  * model. In case you are unsure of your simulated input correctness, use
53  * the old simulation engine for verification.
54  */
55 class DirectAccessMemory : public Memory {
56 public:
59  ULongWord end,
60  Word MAUSize, bool littleEndian);
61 
62  virtual ~DirectAccessMemory();
63 
64  void write(ULongWord address, Memory::MAU data) override;
65 
66  void fastWriteMAU(
67  ULongWord address,
68  ULongWord data);
69 
70  void fastWrite2MAUsBE(
71  ULongWord address,
72  ULongWord data);
73 
74  void fastWrite4MAUsBE(
75  ULongWord address,
76  ULongWord data);
77 
78  void fastWrite2MAUsLE(
79  ULongWord address,
80  ULongWord data);
81 
82  void fastWrite4MAUsLE(
83  ULongWord address,
84  ULongWord data);
85 
86  Memory::MAU read(ULongWord address) override;
87 
88  void fastReadMAU(
89  ULongWord address,
90  ULongWord& data);
91 
92  void fastRead2MAUsBE(
93  ULongWord address,
94  ULongWord& data);
95 
96  void fastRead4MAUsBE(
97  ULongWord address,
98  ULongWord& data);
99 
100  void fastRead2MAUsLE(
101  ULongWord address,
102  ULongWord& data);
103 
104  void fastRead4MAUsLE(
105  ULongWord address,
106  ULongWord& data);
107 
108  virtual void advanceClock() {}
109  virtual void reset() {}
110  virtual void fillWithZeros();
111 
112  void writeBE(ULongWord address, int count, ULongWord data) override;
113 
114 
115  using Memory::write;
116  using Memory::read;
117 
118 private:
119  /// Copying not allowed.
121  /// Assignment not allowed.
123 
124  /// Starting point of the address space.
125  Word start_;
126  /// End point of the address space.
127  Word end_;
128  /// Size of the minimum adressable unit.
129  Word MAUSize_;
130  /// precalculated MAUSize_ * 3
131  Word MAUSize3_;
132  /// precalculated MAUSize_ * 2
133  Word MAUSize2_;
134  /// Size of the natural word as MAUs.
135  Word wordSize_;
136  /// Mask bit pattern for unpacking IntWord to MAUs.
137  Word mask_;
138  /// Contains MAUs of the memory model, that is, the actual data of the
139  /// memory.
141 };
142 
143 #endif
DirectAccessMemory::fastWrite2MAUsBE
void fastWrite2MAUsBE(ULongWord address, ULongWord data)
Definition: DirectAccessMemory.cc:159
DirectAccessMemory::MAUSize_
Word MAUSize_
Size of the minimum adressable unit.
Definition: DirectAccessMemory.hh:129
DirectAccessMemory::fastRead4MAUsBE
void fastRead4MAUsBE(ULongWord address, ULongWord &data)
Definition: DirectAccessMemory.cc:266
DirectAccessMemory::fillWithZeros
virtual void fillWithZeros()
Definition: DirectAccessMemory.cc:90
BaseType.hh
DirectAccessMemory::fastWrite4MAUsLE
void fastWrite4MAUsLE(ULongWord address, ULongWord data)
Definition: DirectAccessMemory.cc:206
DirectAccessMemory::reset
virtual void reset()
Definition: DirectAccessMemory.hh:109
DirectAccessMemory::fastReadMAU
void fastReadMAU(ULongWord address, ULongWord &data)
Definition: DirectAccessMemory.cc:223
Memory.hh
DirectAccessMemory::write
void write(ULongWord address, Memory::MAU data) override
Definition: DirectAccessMemory.cc:101
DirectAccessMemory::wordSize_
Word wordSize_
Size of the natural word as MAUs.
Definition: DirectAccessMemory.hh:135
DirectAccessMemory::fastWrite4MAUsBE
void fastWrite4MAUsBE(ULongWord address, ULongWord data)
Definition: DirectAccessMemory.cc:189
Memory::MAUSize
virtual ULongWord MAUSize()
Definition: Memory.hh:118
DirectAccessMemory
Definition: DirectAccessMemory.hh:55
DirectAccessMemory::start_
Word start_
Starting point of the address space.
Definition: DirectAccessMemory.hh:125
MemoryContents
Definition: MemoryContents.hh:48
DirectAccessMemory::fastWrite2MAUsLE
void fastWrite2MAUsLE(ULongWord address, ULongWord data)
Definition: DirectAccessMemory.cc:174
DirectAccessMemory::fastRead4MAUsLE
void fastRead4MAUsLE(ULongWord address, ULongWord &data)
Definition: DirectAccessMemory.cc:283
DirectAccessMemory::read
Memory::MAU read(ULongWord address) override
Definition: DirectAccessMemory.cc:131
DirectAccessMemory::operator=
DirectAccessMemory & operator=(const DirectAccessMemory &)
Assignment not allowed.
Memory::read
virtual Memory::MAU read(ULongWord address)=0
Definition: Memory.cc:160
Memory::MAU
MinimumAddressableUnit MAU
Definition: Memory.hh:76
DirectAccessMemory::fastWriteMAU
void fastWriteMAU(ULongWord address, ULongWord data)
Definition: DirectAccessMemory.cc:146
DirectAccessMemory::end_
Word end_
End point of the address space.
Definition: DirectAccessMemory.hh:127
DirectAccessMemory::writeBE
void writeBE(ULongWord address, int count, ULongWord data) override
Definition: DirectAccessMemory.cc:116
Memory::write
virtual void write(ULongWord address, MAU data)=0
Definition: Memory.cc:95
DirectAccessMemory::data_
MemoryContents * data_
Contains MAUs of the memory model, that is, the actual data of the memory.
Definition: DirectAccessMemory.hh:140
Memory::end
virtual ULongWord end()
Definition: Memory.hh:117
DirectAccessMemory::advanceClock
virtual void advanceClock()
Definition: DirectAccessMemory.hh:108
DirectAccessMemory::mask_
Word mask_
Mask bit pattern for unpacking IntWord to MAUs.
Definition: DirectAccessMemory.hh:137
DirectAccessMemory::MAUSize3_
Word MAUSize3_
precalculated MAUSize_ * 3
Definition: DirectAccessMemory.hh:131
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
DirectAccessMemory::fastRead2MAUsBE
void fastRead2MAUsBE(ULongWord address, ULongWord &data)
Definition: DirectAccessMemory.cc:236
DirectAccessMemory::~DirectAccessMemory
virtual ~DirectAccessMemory()
Definition: DirectAccessMemory.cc:78
DirectAccessMemory::DirectAccessMemory
DirectAccessMemory(ULongWord start, ULongWord end, Word MAUSize, bool littleEndian)
Definition: DirectAccessMemory.cc:55
DirectAccessMemory::fastRead2MAUsLE
void fastRead2MAUsLE(ULongWord address, ULongWord &data)
Definition: DirectAccessMemory.cc:251
DirectAccessMemory::MAUSize2_
Word MAUSize2_
precalculated MAUSize_ * 2
Definition: DirectAccessMemory.hh:133
Memory
Definition: Memory.hh:74
Memory::start
virtual ULongWord start()
Definition: Memory.hh:116