1 #ifndef __FUNCTIONALBLOCK_H__
\r
2 #define __FUNCTIONALBLOCK_H__
\r
8 #include "AbstractBlock.h"
\r
10 class ReferenceBlock;
\r
12 #include "Exception.h"
\r
14 class BlockImplementation;
\r
15 class ArithmeticEvaluator;
\r
19 using namespace std;
\r
23 - NEVER forget to call populate() after creating an instance of GraphBlock.
\r
26 class FunctionalBlock : public AbstractBlock {
\r
29 FunctionalBlock(GroupBlock* _parent, ReferenceBlock* _reference) throw(Exception);
\r
32 inline ReferenceBlock* getReference() { return reference; }
\r
33 inline QList<int> getProductionCounter() { return productionCounter; }
\r
34 inline int getDelta() { return delta; }
\r
37 inline void setImplementation(BlockImplementation* impl) { implementation = impl; }
\r
38 inline void setProductionCounter(QList<int> pattern) { productionCounter = pattern; }
\r
39 inline void setDelta(int _delta) { delta = _delta; }
\r
43 bool isFunctionalBlock();
\r
44 bool isSourceBlock(); //! a source block has no parent and has no data inputs
\r
48 void populate(); // create parameters and interface from reference block
\r
49 void parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock*>* blocksToConfigure);
\r
51 QString getReferenceXmlFile();
\r
52 QString getReferenceHashMd5();
\r
55 bool createPatterns();
\r
57 bool createConsumptionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation
\r
58 bool createProductionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation
\r
59 bool createProductionCounter(); // initialize a QList<int> from counter defined in implementation
\r
60 void initConsumptionPattern(); // initialize a char** from patterns defined for each interface
\r
61 void initProductionPattern(); // initialize a char** from patterns defined for each interface
\r
62 void clearConsumptionPattern();
\r
63 void clearProductionPattern();
\r
64 bool computeOutputPattern(int nbExec = -1);
\r
68 bool isValidDataGroup(char** pattern, int nbPorts, int clock);
\r
69 double evaluateExpression(const QString& expression, bool* ok);
\r
70 QList<char> expandPattern(const QString& pattern, bool* ok);
\r
71 QList<char> expandPatternRecur(const QString& pattern, int* offset, bool* ok);
\r
73 * \brief combinePatterns
\r
74 * \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc)
\r
75 * \param srcCol the column index within patternSrc
\r
76 * \param patternDest the pattern that is modified by the combination (patternDest = patternDest OR patternSrc)
\r
77 * \param destClock the column index within patternDest
\r
78 * \param nbCols the numer of columns to combine
\r
79 * \param nbPorts the number of rows in both patterns
\r
80 * BEWARE: no check is done if nbCols is consistent with the real length of both patterns, thus an access outside
\r
81 * the patterns is possible.
\r
83 void combinePatterns(char** patternSrc, int srcCol, char** patternDest, int destCol, int nbCols, int nbPorts );
\r
85 QList<int> productionCounter; //! only usefull for output interfaces
\r
88 char** consumptionPattern;
\r
89 int nbConsumingPorts;
\r
91 char** productionPattern;
\r
92 int nbProducingPorts;
\r
94 ArithmeticEvaluator* evaluator;
\r
96 ReferenceBlock* reference;
\r
97 BlockImplementation* implementation;
\r
101 #endif // __FUNCTIONALBLOCK_H__
\r