OpenASIP 2.2
Loading...
Searching...
No Matches
Parameter.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2015 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 Parameter.hh
26 *
27 * Declaration of Parameter class.
28 *
29 * Created on: 20.4.2015
30 * @author: Henry Linjamäki (henry.linjamaki-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef PARAMETER_HH
35#define PARAMETER_HH
36
37#include <map>
38#include <string>
39
40#include "TCEString.hh"
41#include "Exception.hh"
42
43namespace ProGe {
44
45class BaseNetlistBlock;
46
47/**
48 * Class that represents a parameter for netlist objects such as netlist port
49 * and netlist block and is used to define port widths and enable/disable
50 * properties of blocks. Parameters are may have two different values: assigned
51 * and default where assigned value is real value assigned for the parameter
52 * and default value is fallback value in case the assigned have is not
53 * defined..
54 *
55 * From HDL point of view (VHDL, verilog) the assigned value corresponds to
56 * the value set for module/entity instantiation's parameter/generic and
57 * the default value corresponds to default value for a module's/entity's
58 * parameter/generic.
59 *
60 * Empty value means that the value is not defined.
61 */
62class Parameter {
63public:
64
65 Parameter();
67 const TCEString& name,
68 const TCEString& type,
69 const TCEString& assignedAndDefaultValue);
71 const TCEString& name,
72 const TCEString& type,
73 const TCEString& assignedValue,
74 const TCEString& defaultValue);
76 const TCEString& name,
77 const TCEString& type,
78 int assignedValue,
79 const TCEString& defaultValue);
81 const TCEString& name,
82 const TCEString& type,
83 const TCEString& nameOfConstant,
85 const TCEString& nameOfPackage);
86 virtual ~Parameter();
87
88 void set(
89 const TCEString& name,
90 const TCEString& type,
91 const TCEString& value);
92 void setName(const TCEString& name);
93 void setType(const TCEString& type);
94 void setValue(const TCEString& value);
95
96 const TCEString& name() const;
97 const TCEString& type() const;
98 const TCEString& value() const;
99 const TCEString& defaultValue() const;
100
101 bool valueIsSymbol() const;
102 bool valueIsConstant() const;
103 const std::string& packageNameOfConstant() const;
104
105private:
106
107 /// Name/identifier of the parameter.
109 /// Type of the parameter.
111 /// Assigned value to the parameter as actual value or as reference to
112 /// another parameter or name of a constant.
114 /// Default value of the parameter if value_ is not set (empty).
116 /// Package reference by name. If non-empty the value_ is treated as
117 /// name of a constant.
119};
120
121} /* namespace ProGe */
122
123#endif /* PARAMETER_HH */
TCEString value_
Assigned value to the parameter as actual value or as reference to another parameter or name of a con...
Definition Parameter.hh:113
TCEString name_
Name/identifier of the parameter.
Definition Parameter.hh:108
const std::string & packageNameOfConstant() const
Definition Parameter.cc:171
bool valueIsConstant() const
Definition Parameter.cc:166
virtual ~Parameter()
Definition Parameter.cc:107
const TCEString & value() const
Definition Parameter.cc:143
void setName(const TCEString &name)
Definition Parameter.cc:118
TCEString package_
Package reference by name. If non-empty the value_ is treated as name of a constant.
Definition Parameter.hh:118
void setValue(const TCEString &value)
Definition Parameter.cc:128
const TCEString & defaultValue() const
Definition Parameter.cc:148
const TCEString & type() const
Definition Parameter.cc:138
bool valueIsSymbol() const
Definition Parameter.cc:157
TCEString default_
Default value of the parameter if value_ is not set (empty).
Definition Parameter.hh:115
void setType(const TCEString &type)
Definition Parameter.cc:123
const TCEString & name() const
Definition Parameter.cc:133
TCEString type_
Type of the parameter.
Definition Parameter.hh:110
void set(const TCEString &name, const TCEString &type, const TCEString &value)
Definition Parameter.cc:110
Definition FUGen.hh:54