OpenASIP 2.2
Loading...
Searching...
No Matches
TPEFHeaders.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 TPEFHeaders.hh
26 *
27 * TPEF file and section header related offsets and
28 * some other TPEF binary file related values.
29 *
30 * @author Mikael Lepistö 2004 (tmlepist-no.spam-cs.tut.fi)
31 *
32 * @note rating: yellow
33 */
34
35#ifndef TTA_TPEF_HEADERS
36#define TTA_TPEF_HEADERS
37
38#include "TPEFBaseType.hh"
39
40namespace TPEF {
41namespace TPEFHeaders {
42
43 /// File format identification mark (TPEF version 1).
44 /// See TPEF documentation for more info.
45 const Byte FH_ID_BYTES[] = {
46 0x7f, 0x54, 0x54, 0x41, 0x2d, 0x50, 0x46, 0x00, 0x01, 0x0a
47 };
48
49 /// Size of file identification code.
50 const Byte FH_ID_SIZE = 10;
51 /// Size of file header.
52 const HalfWord FH_HEADER_SIZE = 26;
53 /// Suze of section header.
54 const HalfWord SH_HEADER_SIZE = 32;
55
57 TPEF_V1 = 0x01, ///< Initial TPEF version.
58 TPEF_V2 = 0x02 ///< Support for over 255 Buses, FUs, RFs.
59 };
60
61 /**
62 * Offsets of file header.
63 */
65 FH_ID = 0, ///< File identification code.
66 FH_ARCH = 10, ///< Architecture template.
67 FH_TYPE = 11, ///< Type of TTA program.
68 FH_SHOFF = 12, ///< Offset to first section header.
69 FH_SIZE = 16, ///< File header size.
70 FH_SHSIZE = 18, ///< Size of section header entry.
71 FH_SHNUM = 20, ///< Number of section headers.
72 FH_SHSTRTAB = 22 ///< Offset to header of string table.
73 };
74
75 /**
76 * Offsets of section header.
77 */
79 SH_NAME = 0, ///< Section offset to name.
80 SH_TYPE = 4, ///< Type of section.
81 SH_FLAGS = 5, ///< Flags of section.
82 SH_ADDR = 6, ///< Starting memory address of program section.
83 SH_OFFSET = 10, ///< Offset to section data.
84 SH_SIZE = 14, ///< Size of section data.
85 SH_ID = 18, ///< Section identification code.
86 SH_ASPACE = 20, ///< Section address space identifier.
87 SH_PADDING = 21, ///< Padding, must be zero.
88 SH_LINK = 22, ///< Section identifier link.
89 SH_INFO = 24, ///< Section specific information, usually zero.
90 SH_ENTSIZE = 28 ///< Size of section elements (if fixed size).
91 };
92
93 /**
94 * Values for SymbolElement other field.
95 */
97 STO_ABS = 0x80 ///< Section is absolute, not relocating.
98 };
99
100 /**
101 * Values for RelocationElement type field
102 */
104 STF_RELOCATION_TYPE_MASK = 0x0F, ///< Mask for getting reloc type.
105 STF_CHUNK = 0x80 ///< Relocation applied to chunk(1)
106 ///< or complete address(0).
107 };
108
109 /**
110 * InstructionAnnotation flags and masks.
111 */
113 IANNOTE_CONTINUATION = 0x80, ///< If there is more annotations.
114 IANNOTE_SIZE = 0x7f ///< Size of payload of annotation.
115 };
116
117 /**
118 * Instruction attribute flags and masks.
119 */
121 IA_TYPE = 0x01, ///< Instruction type: move (0), immediate (1).
122 IA_END = 0x02, ///< Is end of instruction.
123 IA_ANNOTE = 0x04, ///< Contains annotation.
124 IA_EMPTY = 0x08, ///< Empty instruction.
125 IA_IMMSIZE = 0xf0, ///< Immediade size mask.
126 IA_MGUARD = 0x10 ///< Is conditional move or unconditional move.
127 };
128
129 /**
130 * Masks for getting source and destination fields from instruction.
131 */
133 IE_SRC_TYPE_MASK = 0x0c, ///< Instruction source type mask.
134 IE_DST_TYPE_MASK = 0x30, ///< Instruction destination type mask.
135 IE_GUARD_TYPE_MASK = 0x80,///< If (1) guard points to GPR,(0) to FU.
136 MVS_NULL = 0x00, ///< Illegal source.
137 MVS_RF = 0x04, ///< Source is RF.
138 MVS_IMM = 0x08, ///< Source is immediate.
139 MVS_UNIT = 0x0c, ///< Source is FU.
140 MVD_NULL = 0x00, ///< Illegal destination.
141 MVD_RF = 0x10, ///< Destination is RF.
142 MVD_ILLEGAL = 0x20, ///< Illegal destination.
143 MVD_UNIT = 0x30, ///< Destination is FU.
144 MVG_UNIT = 0x00, ///< Guard is FU.
145 MVG_RF = 0x80, ///< Guard is RF.
146 IE_GUARD_INV_MASK = 0x40 ///< Guard inverted (1) means inverted.
147 };
148
149} // namespace TPEFHeaders;
150} // namespace TPEF;
151
152#endif
unsigned char Byte
Definition BaseType.hh:116
const Byte FH_ID_BYTES[]
File format identification mark (TPEF version 1). See TPEF documentation for more info.
@ IA_END
Is end of instruction.
@ IA_MGUARD
Is conditional move or unconditional move.
@ IA_TYPE
Instruction type: move (0), immediate (1).
@ IA_ANNOTE
Contains annotation.
@ IA_IMMSIZE
Immediade size mask.
@ IA_EMPTY
Empty instruction.
@ STF_RELOCATION_TYPE_MASK
Mask for getting reloc type.
@ STF_CHUNK
Relocation applied to chunk(1) or complete address(0).
@ FH_ARCH
Architecture template.
@ FH_SHSIZE
Size of section header entry.
@ FH_SHSTRTAB
Offset to header of string table.
@ FH_ID
File identification code.
@ FH_SHNUM
Number of section headers.
@ FH_SHOFF
Offset to first section header.
@ FH_TYPE
Type of TTA program.
@ FH_SIZE
File header size.
@ SH_LINK
Section identifier link.
@ SH_FLAGS
Flags of section.
@ SH_ASPACE
Section address space identifier.
@ SH_OFFSET
Offset to section data.
@ SH_ID
Section identification code.
@ SH_INFO
Section specific information, usually zero.
@ SH_ADDR
Starting memory address of program section.
@ SH_SIZE
Size of section data.
@ SH_NAME
Section offset to name.
@ SH_TYPE
Type of section.
@ SH_ENTSIZE
Size of section elements (if fixed size).
@ SH_PADDING
Padding, must be zero.
@ STO_ABS
Section is absolute, not relocating.
const Byte FH_ID_SIZE
Size of file identification code.
@ IE_GUARD_TYPE_MASK
If (1) guard points to GPR,(0) to FU.
@ IE_GUARD_INV_MASK
Guard inverted (1) means inverted.
@ MVG_RF
Guard is RF.
@ MVD_UNIT
Destination is FU.
@ MVD_NULL
Illegal destination.
@ MVS_IMM
Source is immediate.
@ MVD_RF
Destination is RF.
@ MVS_UNIT
Source is FU.
@ MVS_NULL
Illegal source.
@ MVG_UNIT
Guard is FU.
@ MVD_ILLEGAL
Illegal destination.
@ IE_DST_TYPE_MASK
Instruction destination type mask.
@ MVS_RF
Source is RF.
@ IE_SRC_TYPE_MASK
Instruction source type mask.
const HalfWord SH_HEADER_SIZE
Suze of section header.
@ TPEF_V1
Initial TPEF version.
@ TPEF_V2
Support for over 255 Buses, FUs, RFs.
const HalfWord FH_HEADER_SIZE
Size of file header.
@ IANNOTE_SIZE
Size of payload of annotation.
@ IANNOTE_CONTINUATION
If there is more annotations.