OpenASIP  2.0
IdealSRAM.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 IdealSRAM.hh
26  *
27  * Declaration of IdealSRAM class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_IDEAL_SRAM_HH
34 #define TTA_IDEAL_SRAM_HH
35 
36 #include <vector>
37 #include <map>
38 
39 #include "Memory.hh"
40 
41 class MemoryContents;
42 
43 /**
44  * Class that models an "ideal" memory.
45  *
46  * An ideal memory is defined as a memory with read latency zero.
47  * The data is available at the same cycle in which the load is initiated.
48  * Also, after a store is initiated, data is written into memory as soon as
49  * the clock advances.
50  *
51  * This implementation uses a "paged array" as the storage structure which
52  * avoids unnecessary allocation while providing O(1) access time. See
53  * PagedArray for more details.
54  */
55 class IdealSRAM : public Memory {
56 public:
57  IdealSRAM(ULongWord start, ULongWord end, Word MAUSize, bool littleEndian);
58  virtual ~IdealSRAM();
59 
60  virtual void write(ULongWord address, MAU data) override;
61  virtual Memory::MAU read(ULongWord address) override;
62 
63  using Memory::write;
64  using Memory::read;
65 
66  virtual void fillWithZeros();
67 
68 private:
69  /// Copying not allowed.
70  IdealSRAM(const IdealSRAM&);
71  /// Assignment not allowed.
72  IdealSRAM& operator=(const IdealSRAM&);
73 
74  /// Starting point of the address space.
76  /// End point of the address space.
78  /// Size of the minimum adressable unit.
79  Word MAUSize_;
80  /// Container for holding read/write requests.
82 };
83 
84 #endif
UIntWord
Word UIntWord
Definition: BaseType.hh:144
IdealSRAM::~IdealSRAM
virtual ~IdealSRAM()
Definition: IdealSRAM.cc:69
IdealSRAM::start_
UIntWord start_
Starting point of the address space.
Definition: IdealSRAM.hh:75
Memory.hh
IdealSRAM::fillWithZeros
virtual void fillWithZeros()
Definition: IdealSRAM.cc:107
IdealSRAM::read
virtual Memory::MAU read(ULongWord address) override
Definition: IdealSRAM.cc:96
Memory::MAUSize
virtual ULongWord MAUSize()
Definition: Memory.hh:118
MemoryContents
Definition: MemoryContents.hh:48
IdealSRAM::end_
UIntWord end_
End point of the address space.
Definition: IdealSRAM.hh:77
IdealSRAM::write
virtual void write(ULongWord address, MAU data) override
Definition: IdealSRAM.cc:83
IdealSRAM::MAUSize_
Word MAUSize_
Size of the minimum adressable unit.
Definition: IdealSRAM.hh:79
IdealSRAM::IdealSRAM
IdealSRAM(ULongWord start, ULongWord end, Word MAUSize, bool littleEndian)
Definition: IdealSRAM.cc:56
Memory::read
virtual Memory::MAU read(ULongWord address)=0
Definition: Memory.cc:160
Memory::MAU
MinimumAddressableUnit MAU
Definition: Memory.hh:76
IdealSRAM::operator=
IdealSRAM & operator=(const IdealSRAM &)
Assignment not allowed.
Memory::write
virtual void write(ULongWord address, MAU data)=0
Definition: Memory.cc:95
Memory::end
virtual ULongWord end()
Definition: Memory.hh:117
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
IdealSRAM
Definition: IdealSRAM.hh:55
IdealSRAM::data_
MemoryContents * data_
Container for holding read/write requests.
Definition: IdealSRAM.hh:81
Memory
Definition: Memory.hh:74
Memory::start
virtual ULongWord start()
Definition: Memory.hh:116