1 #ifndef __BLOCKPARAMETER_H__
\r
2 #define __BLOCKPARAMETER_H__
\r
9 #include "AbstractBlock.h"
\r
10 class AbstractBlock;
\r
12 using namespace std;
\r
16 class BlockParameter {
\r
20 enum ParamType { Expression = 1, Character, String, Bit, BitVector, Boolean, Integer, Natural, Positive, Real, Time};
\r
21 // a bit ugly to put that here but more practical for using them
\r
23 * \brief The ParamWBAccess enum
\r
24 * Read means that the block setup the value of this parameter and it is possible to
\r
25 * to read that value from outside the FPGA (via the wrapper of the wishbone). Thus,
\r
26 * from the block point of view, the parameter corresponds to an output port.
\r
27 * Write means that it is possible to setup the value of this paramter from outside the FPGA (via
\r
28 * the wrapper of the wishbone) so that the block can read that value. Thus,
\r
29 * from the block point of view, the parameter corresponds to an input port.
\r
31 enum ParamWBAccess { Read = 1, Write = 2};
\r
32 enum ParamWBDuration { Permanent = 1, Trigger = 2 };
\r
33 enum ParamVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface
\r
34 enum ParamVHDLFlags { NoComma = 1 };
\r
37 BlockParameter(AbstractBlock* _owner, const QString& _name , const QString& _type, const QString& _value);
\r
39 virtual ~BlockParameter();
\r
42 inline AbstractBlock* getOwner() { return owner; }
\r
43 inline QString getName() { return name; }
\r
44 inline int getType() { return type; }
\r
45 QString getTypeString();
\r
46 virtual QVariant getValue(); // may be overriden
\r
47 int getIntValue(bool* ok);
\r
48 double getDoubleValue(bool* ok);
\r
49 bool getBooleanValue(bool* ok);
\r
50 QString getStringValue();
\r
51 virtual QString getContext() = 0;
\r
54 inline void setOwner(AbstractBlock* _owner) { owner = _owner; }
\r
55 inline void setName(const QString& _name) { name = _name; }
\r
56 inline void setType(int _type) { type = _type; }
\r
57 virtual void setValue(const QString& _value);
\r
60 virtual bool isValueSet(); // may be overridden for User and Generic parameters
\r
61 virtual bool isUserParameter();
\r
62 virtual bool isGenericParameter();
\r
63 virtual bool isWishboneParameter();
\r
64 virtual bool isPortParameter();
\r
67 virtual BlockParameter* clone() = 0;
\r
68 virtual QString toVHDL(int context, int flags);
\r
69 int typeFromString(const QString& _type);
\r
73 AbstractBlock* owner;
\r
76 QVariant defaultValue; // the value set during construction
\r
80 #endif // __BLOCKPARAMETER_H__
\r