X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/a13795fc34cd1e74f94695d35253c3d00abec9bc..4327c2b8817b627249d98d889835726217c81a4e:/SpecialBlock.cpp?ds=sidebyside diff --git a/SpecialBlock.cpp b/SpecialBlock.cpp index 9576dc9..be9452e 100644 --- a/SpecialBlock.cpp +++ b/SpecialBlock.cpp @@ -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); } @@ -105,36 +105,61 @@ void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) AbstractInterface* clkIn = getIfaceFromName("clk_in"); AbstractInterface* clkOut = getIfaceFromName("clk_out"); cout << "freq clk_in = " << clkIn->getClockFrequency() << endl; - cout << "freq clk_out = " << clkOut->getClockFrequency() << endl; - - // 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_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; }