X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/4cf57e6db08da791233d75237f62e74bc88dd427..c85843afb9bd492b46d6fe87a8287157097483f5:/FunctionalBlock.cpp?ds=inline diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index 91f4e03..8ecd6a3 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -29,6 +29,7 @@ FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference lengthPP = -1; delta = -1; evaluator = NULL; + } FunctionalBlock::~FunctionalBlock() { @@ -77,6 +78,8 @@ void FunctionalBlock::populate() { addParameter(p); } + ConnectedInterface* toClk = NULL; + ConnectedInterface* toRst = NULL; // create interfaces from reference block QList lstRef = reference->getInterfaces(); // store relation between functional and reference @@ -90,8 +93,19 @@ void FunctionalBlock::populate() { exit(1); } hashIface.insert(lstRef.at(i),inter); - addInterface(inter); + /* WARNING FOR THE FUTURE : + in case of there are several clock interfaces ofr that block + it would be a godd idea to make the user choose which one + must be connected to defautl clk. + Presently, the first encountered is chosen + */ + if ((toClk == NULL) && (inter->getPurpose() == AbstractInterface::Clock)) { + toClk = AI_TO_CON(inter); + } + if ((toRst == NULL) && (inter->getPurpose() == AbstractInterface::Reset)) { + toRst = AI_TO_CON(inter); + } } AbstractInterface* funCtlIface = NULL; @@ -108,8 +122,19 @@ void FunctionalBlock::populate() { } } } -} + // connect clk and rst to group clk/rst or to clkrstgen + if ((name != "clkrstgen") && (parent != NULL)) { + try { + connectClkReset(); + } + catch(Exception e) { + AbstractBlock* source = (AbstractBlock *)(e.getSource()); + cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl; + throw(e); + } + } +} QString FunctionalBlock::getReferenceXmlFile() { return ((ReferenceBlock *)reference)->getXmlFile(); @@ -649,9 +674,7 @@ void FunctionalBlock::createInputPattern() throw(Exception) { } // get the precursor output pattern QList* out = connIface->getConnectedFrom()->getOutputPattern(); - - ConnectedInterface* assoIface = AI_TO_CON(connIface->getAssociatedIface()); - AbstractInputModifier* modifier = assoIface->getInputModifier(); + AbstractInputModifier* modifier = connIface->getInputModifier(); // check if the input is modified if (modifier != NULL) { @@ -815,12 +838,13 @@ void FunctionalBlock::computeOutputPattern(int nbExec) throw(Exception) { #ifdef DEBUG_FCTNAME cout << "call to " << qPrintable(fctName) << endl; #endif - + + clearOutputPattern(); + /* case 1: the block is a generator for which output pattern must be computed for a nbExec following executions */ - - + if (nbExec > 0) { cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl; foreach(AbstractInterface* iface, getControlOutputs()) { @@ -1243,6 +1267,20 @@ void FunctionalBlock::clearInputPattern() { lengthIP = -1; } +void FunctionalBlock::clearOutputPattern() { + + QMapIterator* > iterO(outputPattern); + while (iterO.hasNext()) { + iterO.next(); + ConnectedInterface* connIface = AI_TO_CON(iterO.key()); + connIface->resetOutputPattern(); + QList* pattern = iterO.value(); + if (pattern != NULL) delete pattern; + } + outputPattern.clear(); + lengthOP = -1; +} + void FunctionalBlock::clearAdmittanceDelays() { QMapIterator* > iterA(admittanceDelays); while (iterA.hasNext()) {