X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/60c13e8b4c7ea3d595969c1e7c0a28b068a17ca6..4327c2b8817b627249d98d889835726217c81a4e:/SpecialBlock.cpp?ds=sidebyside diff --git a/SpecialBlock.cpp b/SpecialBlock.cpp index 8f2271d..be9452e 100644 --- a/SpecialBlock.cpp +++ b/SpecialBlock.cpp @@ -1,7 +1,7 @@ #include "SpecialBlock.h" #include "FunctionalInterface.h" -SpecialBlock::SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) { +SpecialBlock::SpecialBlock(Graph *_graph, int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_graph, _parent, _reference, createIfaces) { specialType = _type; } @@ -58,7 +58,7 @@ void SpecialBlock::checkInputPatternCompatibilitySource() throw(Exception) { } void SpecialBlock::computeOutputPatternSource(int nbExec) throw(Exception) { - cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl; + cout << "computing output pattern of special block " << qPrintable(name) << " for " << nbExec << " executions" << endl; foreach(AbstractInterface* iface, getControlOutputs()) { FunctionalInterface* connIface = AI_TO_FUN(iface); // create output pattern @@ -68,7 +68,7 @@ void SpecialBlock::computeOutputPatternSource(int nbExec) throw(Exception) { // assign pattern to interface connIface->setOutputPattern(pattern); // store it in QMap - outputPattern.insert(connIface,pattern); + outputPattern.insert(connIface,pattern); } setOutputPatternComputed(true); } @@ -97,43 +97,69 @@ void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) #ifdef DEBUG_FCTNAME cout << "call to " << qPrintable(fctName) << endl; #endif - cout << "computing output pattern of " << qPrintable(name) << endl; + cout << "computing output pattern of special block " << qPrintable(name) << endl; /* CAUTION: it is assumed that all clock domain converters are using * a clk_in and clk_out signals for input and output clocks. */ AbstractInterface* clkIn = getIfaceFromName("clk_in"); AbstractInterface* clkOut = getIfaceFromName("clk_out"); - cout << "freq clk_in = " << clkIn- - - // in case of inputPattern not created, do it - if (lengthIP <= 0) { - - cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl; - // collect the input patterns for each input - try { - createInputPattern(); + cout << "freq clk_in = " << clkIn->getClockFrequency() << endl; + cout << "freq clk_out = " << clkOut->getClockFrequency() << endl; + double periodIn = 1000.0/clkIn->getClockFrequency(); + double periodOut = 1000.0/clkOut->getClockFrequency(); + cout << "period clk_in = " << periodIn << endl; + cout << "period clk_out = " << periodOut << endl; + // starts with 1 data in FIFO + int latency = 1+(int)((periodIn+5.0*periodOut)/periodOut); + QList pattern; + for(int i=0;i 0) { + pattern.append(1); + } + else { + pattern.append(0); + inFifo ++; + } + idIn ++; + idOut ++; + } + else if (tIn < tOut) { + inFifo++; + idIn ++; } - catch(Exception e) { - throw(e); + else { + if (inFifo > 0) { + pattern.append(1); + inFifo--; + } + else { + pattern.append(0); + } + idOut++; } - cout << "input pattern array initialized with min. len " << lengthIP << endl; } + foreach(char c, pattern) cout << (int)c; + cout << endl; // initialize the output pattern - lengthOP = 0; + lengthOP = pattern.size(); foreach(AbstractInterface* iface, getControlOutputs()) { - FunctionalInterface* connIface = AI_TO_FUN(iface); - lengthOP = lengthIP+productionPattern.value(connIface)->size(); - QList* pattern = new QList(); - for(int i=0;iappend(0); - connIface->setOutputPattern(pattern); - outputPattern.insert(connIface,pattern); + FunctionalInterface* connIface = AI_TO_FUN(iface); + QList* pat = new QList(pattern); + connIface->setOutputPattern(pat); + outputPattern.insert(connIface,pat); } - cout << "output pattern array initialized" << endl; - - int clock = 0; - + cout << "output pattern computed" << endl; }