]> AND Private Git Repository - blast.git/blob - FunctionalBlock.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
started adding delta comput
[blast.git] / FunctionalBlock.h
1 #ifndef __FUNCTIONALBLOCK_H__\r
2 #define __FUNCTIONALBLOCK_H__\r
3 \r
4 #include <iostream>\r
5 \r
6 #include <QtCore>\r
7 \r
8 #include "AbstractBlock.h"\r
9 class AbstractBlock;\r
10 class ReferenceBlock;\r
11 class GroupBlock;\r
12 #include "Exception.h"\r
13 class Exception;\r
14 class BlockImplementation;\r
15 class ArithmeticEvaluator;\r
16     \r
17 \r
18 \r
19 using namespace std;\r
20 using namespace Qt;\r
21 \r
22 /* NOTES :\r
23    - NEVER forget to call populate() after creating an instance of GraphBlock.\r
24  */\r
25 \r
26 class FunctionalBlock : public AbstractBlock {\r
27 public:\r
28 \r
29   FunctionalBlock(GroupBlock* _parent, ReferenceBlock* _reference) throw(Exception);\r
30 \r
31   // getters\r
32   inline ReferenceBlock* getReference() { return reference; }\r
33 \r
34   // setters\r
35   inline void setImplementation(BlockImplementation* impl) { implementation = impl; }\r
36 \r
37   // testers\r
38   bool isFunctionalBlock();\r
39   bool isSourceBlock(); //! a source block has no parent and has no data inputs\r
40 \r
41   // others\r
42 \r
43   void populate(); // create parameters and interface from reference block\r
44   void parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock*>* blocksToConfigure);\r
45 \r
46   QString getReferenceXmlFile();\r
47   QString getReferenceHashMd5();\r
48   \r
49   // patterns\r
50   bool createPatterns();\r
51   bool createDelta();\r
52   bool createConsumptionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation\r
53   bool createProductionPattern(); // initialize a QList<char> for each interface from patterns defined in implementation\r
54   bool createProductionCounter(); // initialize a QList<int> from counter defined in implementation\r
55   void initConsumptionPattern(); // initialize a char** from patterns defined for each interface\r
56   void initProductionPattern(); // initialize a char** from patterns defined for each interface\r
57   void clearConsumptionPattern();\r
58   void clearProductionPattern();\r
59   \r
60 private:  \r
61   // patterns\r
62   bool computeOutputPattern(int nbExec = -1);\r
63   bool isValidDataGroup(char** pattern, int nbPorts, int clock);\r
64   /*!\r
65    * \brief combinePatterns\r
66    * \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc)  \r
67    * \param srcCol the column index within patternSrc\r
68    * \param patternDest the pattern that is modified by the combination (patternDest = patternDest OR patternSrc)\r
69    * \param destClock the column index within patternDest\r
70    * \param nbCols the numer of columns to combine\r
71    * \param nbPorts the number of rows in both patterns\r
72    * BEWARE: no check is done if nbCols is consistent with the real length of both patterns, thus an access outside\r
73    * the patterns is possible.\r
74    */\r
75   void combinePatterns(char** patternSrc, int srcCol, char** patternDest, int destCol, int nbCols, int nbPorts );\r
76 \r
77   char** consumptionPattern;\r
78   int nbConsumingPorts;\r
79   int lengthCP;\r
80   char** productionPattern;\r
81   int nbProducingPorts;\r
82   int lengthPP;\r
83   ArithmeticEvaluator* evaluator;\r
84   \r
85   ReferenceBlock* reference;\r
86   BlockImplementation* implementation;\r
87 \r
88 };\r
89 \r
90 #endif // __FUNCTIONALBLOCK_H__\r