OpenASIP  2.0
Binary.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 Binary.hh
26  *
27  * Declaration of Binary class.
28  *
29  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
30  *
31  * @note rating: yellow
32  */
33 
34 #ifndef TTA_BINARY_HH
35 #define TTA_BINARY_HH
36 
37 #include <list>
38 #include <map>
39 #include "SafePointer.hh"
40 #include "Section.hh"
41 #include "StringSection.hh"
42 #include "TPEFHeaders.hh"
43 
44 namespace TPEF {
45 
46 /**
47  * Root class of tpef binary representation.
48  */
49 class Binary {
50 public:
51  /**
52  * Storing types of TTA code.
53  */
54  enum FileType {
55  FT_NULL = 0x00, ///< Illegal/undefined type.
56  FT_OBJSEQ = 0x04, ///< Sequential TTA object code.
57  FT_PURESEQ = 0x05, ///< Sequential TTA code, no unresolved symbols.
58  FT_LIBSEQ = 0x06, ///< Collection of sequential object code files
59  ///< for linkage.
60  FT_MIXED = 0x09, ///< Partly scheduled code.
61  FT_PARALLEL = 0x0D ///< Fully scheduled or mixed code.
62  };
63 
64  /**
65  * Encodings of program sections.
66  */
68  FA_NOARCH = 0x00, ///< Illegal/undefined architecture.
69  FA_TTA_MOVE = 0x01, ///< Move design framework.
70  FA_TTA_TUT = 0x02, ///< New TTA template.
71  FA_TDS_TI = 0x03 ///< TTA Design Studio architecture.
72  };
73 
74  Binary();
75  virtual ~Binary();
76 
77  void addSection(Section* section);
78 
79  Section* section(Word index) const;
80  Section* section(Section::SectionType type, Word number) const;
81 
82  Word sectionCount() const;
84 
85  StringSection* strings() const;
86  void setStrings(StringSection* strTable);
87  void setStrings(const ReferenceManager::SafePointer* strTable);
88 
89  FileArchitecture arch() const;
91 
92  FileType type() const;
93  void setType(FileType type);
94 
97 
98 private:
99  Binary(const Binary&);
100  Binary operator=(const Binary&);
101 
102  /// Reference to string table of binary.
104 
105  /// Stores sections of binary.
106  std::vector<Section*> sections_;
107 
108  /// Binary's file type. See enumerations for more info.
110  /// Binary's file architecture. See enumerations for more info.
112 
113  /// Indicates TPEF format version used.
115 };
116 }
117 
118 #include "Binary.icc"
119 
120 #endif
TPEF::Binary::FT_PARALLEL
@ FT_PARALLEL
Fully scheduled or mixed code.
Definition: Binary.hh:61
TPEF::Binary::FileArchitecture
FileArchitecture
Definition: Binary.hh:67
TPEF::Binary::setTPEFVersion
void setTPEFVersion(TPEFHeaders::TPEFVersion version)
TPEF::Binary::FA_TTA_TUT
@ FA_TTA_TUT
New TTA template.
Definition: Binary.hh:70
TPEF::Binary
Definition: Binary.hh:49
TPEF::Binary::addSection
void addSection(Section *section)
SafePointer.hh
TPEFHeaders.hh
TPEF::Binary::setType
void setType(FileType type)
TPEF::Binary::section
Section * section(Word index) const
TPEF::Binary::sectionCount
Word sectionCount() const
StringSection.hh
TPEF::Binary::sections_
std::vector< Section * > sections_
Stores sections of binary.
Definition: Binary.hh:106
TPEF::Section
Definition: Section.hh:64
TPEF::StringSection
Definition: StringSection.hh:48
TPEF::TPEFHeaders::TPEFVersion
TPEFVersion
Definition: TPEFHeaders.hh:56
TPEF::Binary::strings
StringSection * strings() const
TPEF::ReferenceManager::SafePointer
Definition: SafePointer.hh:188
TPEF::Binary::operator=
Binary operator=(const Binary &)
TPEF::Binary::tpefVersion_
TPEFHeaders::TPEFVersion tpefVersion_
Indicates TPEF format version used.
Definition: Binary.hh:114
TPEF::Binary::type
FileType type() const
TPEF::Binary::~Binary
virtual ~Binary()
Definition: Binary.cc:60
TPEF::Binary::FileType
FileType
Definition: Binary.hh:54
TPEF::Binary::Binary
Binary()
Definition: Binary.cc:53
TPEF::Binary::FA_NOARCH
@ FA_NOARCH
Illegal/undefined architecture.
Definition: Binary.hh:68
TPEF::Binary::fileType_
FileType fileType_
Binary's file type. See enumerations for more info.
Definition: Binary.hh:109
Binary.icc
TPEF::Binary::FA_TTA_MOVE
@ FA_TTA_MOVE
Move design framework.
Definition: Binary.hh:69
TPEF::Binary::FT_LIBSEQ
@ FT_LIBSEQ
Collection of sequential object code files for linkage.
Definition: Binary.hh:58
TPEF::Binary::arch
FileArchitecture arch() const
TPEF::Binary::FT_PURESEQ
@ FT_PURESEQ
Sequential TTA code, no unresolved symbols.
Definition: Binary.hh:57
TPEF::Binary::fileArch_
FileArchitecture fileArch_
Binary's file architecture. See enumerations for more info.
Definition: Binary.hh:111
Section.hh
TPEF::Binary::FT_NULL
@ FT_NULL
Illegal/undefined type.
Definition: Binary.hh:55
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::Binary::FT_MIXED
@ FT_MIXED
Partly scheduled code.
Definition: Binary.hh:60
TPEF::Binary::strings_
const ReferenceManager::SafePointer * strings_
Reference to string table of binary.
Definition: Binary.hh:103
TPEF::Binary::TPEFVersion
TPEFHeaders::TPEFVersion TPEFVersion() const
TPEF::Binary::FA_TDS_TI
@ FA_TDS_TI
TTA Design Studio architecture.
Definition: Binary.hh:71
TPEF::Binary::setStrings
void setStrings(StringSection *strTable)
TPEF::Binary::FT_OBJSEQ
@ FT_OBJSEQ
Sequential TTA object code.
Definition: Binary.hh:56
TPEF
Definition: Assembler.hh:43
TPEF::Binary::setArch
void setArch(FileArchitecture arch)