OpenASIP  2.0
DataSection.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 DataSection.hh
26  *
27  * Declaration of DataSection class.
28  *
29  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
30  *
31  * @note rating: yellow
32  */
33 
34 #ifndef TTA_DATA_SECTION_HH
35 #define TTA_DATA_SECTION_HH
36 
37 #include <vector>
38 
39 #include "UDataSection.hh"
40 #include "Section.hh"
41 #include "TPEFBaseType.hh"
42 #include "Exception.hh"
43 
44 namespace TPEF {
45 
46 /**
47  * Data section for initialized data.
48  *
49  * Derives from uninitialized data section so, this is extension
50  * of UDataSection.
51  */
52 class DataSection : public UDataSection {
53 public:
54  virtual ~DataSection();
55 
56  virtual SectionType type() const;
57 
58  virtual Byte byte(const Chunk* chunk) const;
59  virtual Byte byte(Word offset) const;
60  virtual void addByte(Byte aByte);
61 
62  virtual MinimumAddressableUnit MAU(Word index) const;
63  virtual void addMAU(MinimumAddressableUnit aMAU);
64 
65  virtual void writeValue(Word index, Word numOfMAUs, unsigned long value);
66  virtual void writeValue(Word index, Word numOfMAUs, signed long value);
67 
68  virtual Word length() const;
69  virtual void setDataLength(Word length);
70 
71  virtual bool isDataSection() const override { return true; }
72 protected:
73  DataSection(bool init);
74  virtual Section* clone() const;
75 
76  virtual void setByte(Word offset, Byte aByte);
77 
78 private:
79  /// Prototype instance of section.
81 
82  /// Contains the data of data section.
83  std::vector<Byte> data_;
84 };
85 }
86 
87 #endif
TPEF::DataSection::proto_
static DataSection proto_
Prototype instance of section.
Definition: DataSection.hh:80
TPEF::DataSection::byte
virtual Byte byte(const Chunk *chunk) const
Definition: DataSection.cc:114
TPEF::DataSection::MAU
virtual MinimumAddressableUnit MAU(Word index) const
Definition: DataSection.cc:125
Exception.hh
TPEF::DataSection::addMAU
virtual void addMAU(MinimumAddressableUnit aMAU)
Definition: DataSection.cc:150
TPEF::DataSection::clone
virtual Section * clone() const
Definition: DataSection.cc:103
TPEF::DataSection::setByte
virtual void setByte(Word offset, Byte aByte)
Definition: DataSection.cc:86
TPEF::DataSection
Definition: DataSection.hh:52
Byte
unsigned char Byte
Definition: BaseType.hh:116
TPEF::DataSection::addByte
virtual void addByte(Byte aByte)
Definition: DataSection.cc:200
TPEF::Section
Definition: Section.hh:64
TPEF::DataSection::data_
std::vector< Byte > data_
Contains the data of data section.
Definition: DataSection.hh:83
MinimumAddressableUnit
Word MinimumAddressableUnit
Type for storing a MAU (must be unsigned type!). This limits the maximum size of the simulated minimu...
Definition: BaseType.hh:184
TPEF::UDataSection
Definition: UDataSection.hh:47
TPEF::DataSection::isDataSection
virtual bool isDataSection() const override
Definition: DataSection.hh:71
TPEF::DataSection::~DataSection
virtual ~DataSection()
Definition: DataSection.cc:64
TPEF::DataSection::type
virtual SectionType type() const
Definition: DataSection.cc:73
TPEF::DataSection::setDataLength
virtual void setDataLength(Word length)
Definition: DataSection.cc:225
UDataSection.hh
Section.hh
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::DataSection::DataSection
DataSection(bool init)
Definition: DataSection.cc:51
TPEF::DataSection::length
virtual Word length() const
Definition: DataSection.cc:210
TPEFBaseType.hh
TPEF::RawSection::chunk
virtual Chunk * chunk(SectionOffset offset) const
Definition: Section.cc:212
TPEF::Chunk
Definition: Chunk.hh:45
TPEF::DataSection::writeValue
virtual void writeValue(Word index, Word numOfMAUs, unsigned long value)
Definition: DataSection.cc:250
TPEF
Definition: Assembler.hh:43