OpenASIP 2.2
Loading...
Searching...
No Matches
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
40class 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 */
55class DirectAccessMemory : public Memory {
56public:
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
71 ULongWord address,
72 ULongWord data);
73
75 ULongWord address,
76 ULongWord data);
77
79 ULongWord address,
80 ULongWord data);
81
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
118private:
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.
130 /// precalculated MAUSize_ * 3
132 /// precalculated MAUSize_ * 2
134 /// Size of the natural word as MAUs.
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
unsigned long ULongWord
Definition BaseType.hh:51
Memory::MAU read(ULongWord address) override
DirectAccessMemory & operator=(const DirectAccessMemory &)
Assignment not allowed.
void fastRead4MAUsBE(ULongWord address, ULongWord &data)
void writeBE(ULongWord address, int count, ULongWord data) override
Word MAUSize_
Size of the minimum adressable unit.
void fastWrite2MAUsBE(ULongWord address, ULongWord data)
void fastWrite4MAUsBE(ULongWord address, ULongWord data)
void fastWriteMAU(ULongWord address, ULongWord data)
DirectAccessMemory(const DirectAccessMemory &)
Copying not allowed.
void fastRead2MAUsLE(ULongWord address, ULongWord &data)
Word start_
Starting point of the address space.
virtual void fillWithZeros()
Word end_
End point of the address space.
Word mask_
Mask bit pattern for unpacking IntWord to MAUs.
Word MAUSize2_
precalculated MAUSize_ * 2
void fastRead2MAUsBE(ULongWord address, ULongWord &data)
void fastWrite4MAUsLE(ULongWord address, ULongWord data)
void fastReadMAU(ULongWord address, ULongWord &data)
void fastRead4MAUsLE(ULongWord address, ULongWord &data)
void write(ULongWord address, Memory::MAU data) override
Word wordSize_
Size of the natural word as MAUs.
void fastWrite2MAUsLE(ULongWord address, ULongWord data)
MemoryContents * data_
Contains MAUs of the memory model, that is, the actual data of the memory.
Word MAUSize3_
precalculated MAUSize_ * 3
virtual void advanceClock()
virtual ULongWord end()
Definition Memory.hh:117
virtual void write(ULongWord address, MAU data)=0
Definition Memory.cc:95
virtual Memory::MAU read(ULongWord address)=0
Definition Memory.cc:160
virtual ULongWord MAUSize()
Definition Memory.hh:118
virtual ULongWord start()
Definition Memory.hh:116
MinimumAddressableUnit MAU
Definition Memory.hh:76