OpenASIP  2.0
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 
43 namespace ProGe {
44 
45 class 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  */
62 class Parameter {
63 public:
64 
65  Parameter();
66  Parameter(
67  const TCEString& name,
68  const TCEString& type,
69  const TCEString& assignedAndDefaultValue);
70  Parameter(
71  const TCEString& name,
72  const TCEString& type,
73  const TCEString& assignedValue,
74  const TCEString& defaultValue);
75  Parameter(
76  const TCEString& name,
77  const TCEString& type,
78  int assignedValue,
79  const TCEString& defaultValue);
80  Parameter(
81  const TCEString& name,
82  const TCEString& type,
83  const TCEString& nameOfConstant,
84  const TCEString& defaultValue,
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 
105 private:
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 */
ProGe::Parameter::setValue
void setValue(const TCEString &value)
Definition: Parameter.cc:128
Exception.hh
ProGe::Parameter::type
const TCEString & type() const
Definition: Parameter.cc:138
ProGe::Parameter::package_
TCEString package_
Package reference by name. If non-empty the value_ is treated as name of a constant.
Definition: Parameter.hh:118
ProGe::Parameter::name_
TCEString name_
Name/identifier of the parameter.
Definition: Parameter.hh:108
TCEString.hh
ProGe::Parameter::packageNameOfConstant
const std::string & packageNameOfConstant() const
Definition: Parameter.cc:171
ProGe::Parameter::default_
TCEString default_
Default value of the parameter if value_ is not set (empty).
Definition: Parameter.hh:115
ProGe::Parameter::type_
TCEString type_
Type of the parameter.
Definition: Parameter.hh:110
ProGe::Parameter::valueIsSymbol
bool valueIsSymbol() const
Definition: Parameter.cc:157
ProGe::Parameter::setName
void setName(const TCEString &name)
Definition: Parameter.cc:118
ProGe::Parameter
Definition: Parameter.hh:62
ProGe::Parameter::valueIsConstant
bool valueIsConstant() const
Definition: Parameter.cc:166
ProGe::Parameter::name
const TCEString & name() const
Definition: Parameter.cc:133
ProGe::Parameter::value
const TCEString & value() const
Definition: Parameter.cc:143
ProGe::Parameter::set
void set(const TCEString &name, const TCEString &type, const TCEString &value)
Definition: Parameter.cc:110
ProGe
Definition: FUGen.hh:54
ProGe::Parameter::setType
void setType(const TCEString &type)
Definition: Parameter.cc:123
TCEString
Definition: TCEString.hh:53
ProGe::Parameter::Parameter
Parameter()
Definition: Parameter.cc:45
ProGe::Parameter::~Parameter
virtual ~Parameter()
Definition: Parameter.cc:107
ProGe::Parameter::defaultValue
const TCEString & defaultValue() const
Definition: Parameter.cc:148
ProGe::Parameter::value_
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