X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/2019e5afdaf7fd0ad21607848710348bbc3be256..cf93fd850a8b6e9a6f40faed9f796a0e2fb0cedb:/FunctionalBlock.h diff --git a/FunctionalBlock.h b/FunctionalBlock.h index 6f47a00..440c154 100644 --- a/FunctionalBlock.h +++ b/FunctionalBlock.h @@ -27,7 +27,7 @@ class FunctionalBlock : public AbstractBlock { public: FunctionalBlock(GroupBlock* _parent, ReferenceBlock* _reference) throw(Exception); - + ~FunctionalBlock(); // getters inline ReferenceBlock* getReference() { return reference; } inline QList getProductionCounter() { return productionCounter; } @@ -56,25 +56,36 @@ public: QString getReferenceHashMd5(); // patterns - bool createPatterns(); - bool createDelta(); - bool createConsumptionPattern(); // initialize a QList for each interface from patterns defined in implementation - bool createProductionPattern(); // initialize a QList for each interface from patterns defined in implementation - bool createProductionCounter(); // initialize a QList from counter defined in implementation - bool createAdmittance(int nbExec); // initialize a QList from consumption pattern and delta + void createPatterns() throw(Exception); // called in Graph, before checking compatibility and computing output pattern + void checkInputPatternCompatibility() throw(Exception); + void computeOutputPattern(int nbExec = -1) throw(Exception); + +private: + // patterns + void createDelta() throw(Exception); + void createConsumptionPattern() throw(Exception); // initialize a QList for each interface from patterns defined in implementation + void createProductionPattern() throw(Exception); // initialize a QList for each interface from patterns defined in implementation + void createProductionCounter() throw(Exception); // initialize a QList from counter defined in implementation + void createAdmittance(int nbExec) throw(Exception); // initialize a QList from consumption pattern and delta void clearConsumptionPattern(); void clearProductionPattern(); - void createInputPattern(); + void createInputPattern() throw(Exception); void clearInputPattern(); - int getNumberOfExecution(); // compute number of block execution from inputPattern and delta - bool checkInputPatternCompatibility(); - bool computeOutputPattern(int nbExec = -1); + int createTriggers(); // compute the clock cycle at which the block is triggered -private: - // patterns - double evaluateExpression(const QString& expression, bool* ok); - QList* expandPattern(const QString& patternIn, bool* ok); - void expandPatternRecur(const QString& patternIn, int* offset, bool* ok, QList *patternOut); + double evaluateExpression(const QString& expression) throw(Exception); + QList* expandPattern(const QString& patternIn) throw(Exception); + void expandPatternRecur(const QString& patternIn, int* offset, QList *patternOut) throw(Exception); + /*! + * \brief samePatterns + * \param patternSrc the pattern that must be tested with patternDest (is patternDest == patternDest) + * \param srcCol the column index within patternSrc + * \param patternDest the pattern that must be tested with patternSrc + * \param destCol the column index within patternDest + * BEWARE: this method returns as soons as there is an acces problem (i.e. out of list range, impossible combine, ...) + leaving the dest pattern in an inconsistent state. Thus, it is a good idea to call canCombine before. + */ + bool samePatterns(const QMap* >& patternSrc, int srcCol, const QMap* >& patternDest, int destCol); /*! * \brief canCombinePatterns * \param patternSrc the pattern that must be combined with patternDest (patternDest = patternDest OR patternSrc) @@ -140,7 +151,8 @@ private: QMap* > productionPattern; QMap* > inputPattern; QMap* > outputPattern; // CAUTION: the QList* must also be stored in the outputPattern attributes of AbstractInterface - QList productionCounter; //! only usefull for control output interfaces + QList productionCounter; // only usefull for control output interfaces + QList triggers; // the clock cycles at which the block is triggered, taking into account IP int lengthIP; // for convenience, set in createInputPattern() int lengthCP; // for convenience, set in createConsumptionPattern() int lengthAP; // for convenience, set in createAdmittance()