OpenASIP 2.2
Loading...
Searching...
No Matches
EstimatorCmdLineOptions.cc
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 EstimatorCmdLineOptions.cc
26 *
27 * Declaration of EstimatorCmdLineOptions.
28 *
29 * @author Pekka J��skel�inen 2005 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <iostream>
34
35#include "CmdLineOptions.hh"
37#include "tce_config.h"
38
39
40/// Long switch string for setting the TPEF (program).
41const std::string SWL_TPEF = "program";
42/// Short switch string for setting the TPEF (program).
43const std::string SWS_TPEF = "p";
44/// Long switch string for setting the TraceDB.
45const std::string SWL_TRACE = "trace";
46/// Short switch string for setting the TraceDB.
47const std::string SWS_TRACE = "t";
48
49/// Long switch string for setting the total area estimation.
50const std::string SWL_TOTALAREA = "total-area";
51/// Short switch string for setting the total area estimation.
52const std::string SWS_TOTALAREA = "a";
53/// Long switch string for setting the longest path estimation.
54const std::string SWL_LONGESTPATH = "longest-path";
55/// Short switch string for setting the longest path estimation.
56const std::string SWS_LONGESTPATH = "l";
57/// Long switch string for setting the total energy consumed estimation.
58const std::string SWL_TOTALENERGY = "total-energy";
59/// Short switch string for setting the total energy consumed estimation.
60const std::string SWS_TOTALENERGY = "e";
61
62/**
63 * Constructor.
64 */
68 SWL_TPEF,
69 "sets the TTA program exchange format file (TPEF) from which to "
70 "load the estimated program (required for energy estimation only)",
71 SWS_TPEF));
74 SWL_TRACE,
75 "sets the simulation trace database (TraceDB) from which to "
76 "load the simulation data of the estimated program (required for "
77 "energy estimation only)",
78 SWS_TRACE));
82 "run total area estimation",
87 "run longest path estimation",
92 "run total energy consumption estimation",
94}
95
96/**
97 * Destructor.
98 */
101
102/**
103 * Prints the version of the program.
104 */
105void
107 std::cout << "estimate - TTA Processor Cost Estimator "
108 << Application::TCEVersionString() << std::endl;
109}
110
111/**
112 * Prints the help menu of the program.
113 */
114void
116 printVersion();
117 std::cout << std::endl
118 << "usage: estimate [options] ADF IDF "
119 << std::endl
120 << std::endl
121 << "ADF and IDF are required always, TPEF and TraceDB only for "
122 << "energy estimation, which is not performed in case they are "
123 << "not given."
124 << std::endl;
126}
127
128/**
129 * Returns the TPEF file name given by the user.
130 *
131 * If no value is given in the parsed command line, returns an empty string.
132 *
133 * @return The TPEF file name.
134 */
135std::string
139
140/**
141 * Returns the TraceDB file name given by the user.
142 *
143 * If no value is given in the parsed command line, returns an empty string.
144 *
145 * @return The TraceDB file name.
146 */
147std::string
151
152/**
153 * Test if estimation selection flags are given, returns true is so.
154 *
155 * @return True if estimation selection flags are given.
156 */
157bool
159 if (findOption(SWL_TOTALAREA)->isDefined() ||
160 findOption(SWL_LONGESTPATH)->isDefined() ||
161 findOption(SWL_LONGESTPATH)->isDefined()) {
162
163 return true;
164 }
165 return false;
166}
167
168/**
169 * Checks if run total area estimation option was given.
170 *
171 * @return True if option was given and was not "no" prefixed
172 */
173bool
175 if (findOption(SWL_TOTALAREA)->isDefined()) {
177 }
178 return false;
179}
180
181/**
182 * Checks if run longest path estimation option was given.
183 *
184 * @return True if option was given and was not "no" prefixed
185 */
186bool
188 if (findOption(SWL_LONGESTPATH)->isDefined()) {
190 }
191 return false;
192}
193
194/**
195 * Checks if run total energy consumption estimation option was given.
196 *
197 * @return True if option was given and was not "no" prefixed
198 */
199bool
201 if (findOption(SWL_TOTALENERGY)->isDefined()) {
203 }
204 return false;
205}
206
const std::string SWS_TOTALENERGY
Short switch string for setting the total energy consumed estimation.
const std::string SWS_TPEF
Short switch string for setting the TPEF (program).
const std::string SWS_TOTALAREA
Short switch string for setting the total area estimation.
const std::string SWL_TOTALAREA
Long switch string for setting the total area estimation.
const std::string SWL_TRACE
Long switch string for setting the TraceDB.
const std::string SWL_LONGESTPATH
Long switch string for setting the longest path estimation.
const std::string SWS_TRACE
Short switch string for setting the TraceDB.
const std::string SWL_TPEF
Long switch string for setting the TPEF (program).
const std::string SWL_TOTALENERGY
Long switch string for setting the total energy consumed estimation.
const std::string SWS_LONGESTPATH
Short switch string for setting the longest path estimation.
static std::string TCEVersionString()
virtual bool isFlagOn() const
virtual std::string String(int index=0) const
virtual void printHelp() const
CmdLineOptionParser * findOption(std::string name) const
void addOption(CmdLineOptionParser *opt)