OpenASIP 2.2
Loading...
Searching...
No Matches
ProgramImageGenerator.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 ProgramImageGenerator.hh
26 *
27 * Declaration of ProgramImageGenerator class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @author Otto Esko 2008 (otto.esko-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_PROGRAM_IMAGE_GENERATOR_HH
35#define TTA_PROGRAM_IMAGE_GENERATOR_HH
36
37#include <iostream>
38#include <set>
39#include <string>
40
42#include "BaseType.hh"
43#include "PluginTools.hh"
44#include "Exception.hh"
45#include "TCEString.hh"
46
47namespace TPEF {
48 class Binary;
49 class InstructionElement;
50 class DataSection;
51 class Section;
52}
53
54namespace TTAMachine {
55 class Machine;
56}
57
58class BinaryEncoding;
61
62/**
63 * The main class of program image generator module.
64 *
65 * This class provides the interface that is available to different user
66 * interfaces.
67 */
69public:
70
71 /// Different output formats of images.
73 BINARY, ///< Real binary format.
74 ASCII, ///< ASCII 1's and 0's.
75 ARRAY, ///< ASCII 1's and 0's in array form.
76 MIF, ///< MIF Memory Initialization File
77 VHDL, ///< Array as a Vhdl package
78 COE, ///< COE memory initialization format
79 HEX, ///< HEX memory initialization format
80 BIN2N /// Binary format padded to 2**n
81 };
82 typedef std::map<std::string, TPEF::Binary*> TPEFMap;
83
85 virtual ~ProgramImageGenerator();
86
87
88 void loadCompressorPlugin(const std::string& fileName);
91 void loadPrograms(TPEFMap programs);
93 void loadBEM(const BinaryEncoding& bem);
94
96 const std::string& programName,
97 std::ostream& stream,
98 OutputFormat format,
99 int mausPerLine = 0);
101 const std::string& programName, TPEF::Binary& program,
102 const std::string& addressSpace, std::ostream& stream,
103 OutputFormat format, int mausPerLine, bool usePregeneratedImage);
104 void generateDecompressor(std::ostream& stream, TCEString entityStr);
105
106 int imemMauWidth() const;
108
109 void setEntityName(const std::string& entity);
111 bool isDataStartSet(std::string aSpace) const;
112 uint64_t dataStartAddress(std::string aSpace) const;
113
114 static std::vector<std::string> availableCompressors();
115 static void printCompressorDescription(
116 const std::string& fileName, std::ostream& stream);
117
119 BitVector& bitVector,
120 const std::string& addressSpace,
121 TPEF::Section& section);
122
123private:
124 /// Typedef for program set.
125 typedef std::set<TPEF::Binary*> ProgramSet;
126
128 const std::string& fileName, PluginTools& pluginTool);
130 const TPEF::Binary& program,
131 const TPEF::DataSection& dataSection,
132 Word dataSectionOffset) const;
133
134 /// The code compressor.
136 /// Toplevel entity name
137 std::string entityName_;
138
139 static const std::string DATA_START_DESC;
141 /// The plugin tool.
143
144};
145
146#endif
TTAMachine::Machine * machine
the architecture definition of the estimated processor
find Finds info of the inner loops in the program
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
std::vector< Parameter > ParameterTable
Table for passing plugin parameters.
TPEF::InstructionElement * relocTarget(const TPEF::Binary &program, const TPEF::DataSection &dataSection, Word dataSectionOffset) const
static CodeCompressorPlugin * createCompressor(const std::string &fileName, PluginTools &pluginTool)
bool isDataStartSet(std::string aSpace) const
std::string entityName_
Toplevel entity name.
void loadPrograms(TPEFMap programs)
void setDataStartOptions(CmdLineOptionParser *options)
std::set< TPEF::Binary * > ProgramSet
Typedef for program set.
static std::vector< std::string > availableCompressors()
CodeCompressorPlugin * compressor_
The code compressor.
void writeDataSection(TPEF::Binary &program, BitVector &bitVector, const std::string &addressSpace, TPEF::Section &section)
CmdLineOptionParser * dataStartOptions_
uint64_t dataStartAddress(std::string aSpace) const
std::map< std::string, TPEF::Binary * > TPEFMap
void generateDataImage(const std::string &programName, TPEF::Binary &program, const std::string &addressSpace, std::ostream &stream, OutputFormat format, int mausPerLine, bool usePregeneratedImage)
void setEntityName(const std::string &entity)
void loadCompressorPlugin(const std::string &fileName)
void loadCompressorParameters(CodeCompressorPlugin::ParameterTable parameters)
static const std::string DATA_START_DESC
OutputFormat
Different output formats of images.
@ BINARY
Real binary format.
@ VHDL
Array as a Vhdl package.
@ BIN2N
Binary format padded to 2**n.
@ MIF
MIF Memory Initialization File.
@ ARRAY
ASCII 1's and 0's in array form.
@ COE
COE memory initialization format.
@ HEX
HEX memory initialization format.
static void printCompressorDescription(const std::string &fileName, std::ostream &stream)
void generateProgramImage(const std::string &programName, std::ostream &stream, OutputFormat format, int mausPerLine=0)
void generateDecompressor(std::ostream &stream, TCEString entityStr)
void loadMachine(const TTAMachine::Machine &machine)
PluginTools pluginTool_
The plugin tool.
CodeCompressorPlugin & compressor()
void loadBEM(const BinaryEncoding &bem)