- //cout << "freq clk_in = " << clkIn-\r
-\r
- // in case of inputPattern not created, do it\r
- if (lengthIP <= 0) {\r
-\r
- cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl;\r
- // collect the input patterns for each input\r
- try {\r
- createInputPattern();\r
+ cout << "freq clk_in = " << clkIn->getClockFrequency() << endl;\r
+ cout << "freq clk_out = " << clkOut->getClockFrequency() << endl; \r
+ double periodIn = 1000.0/clkIn->getClockFrequency();\r
+ double periodOut = 1000.0/clkOut->getClockFrequency();\r
+ cout << "period clk_in = " << periodIn << endl;\r
+ cout << "period clk_out = " << periodOut << endl;\r
+ // starts with 1 data in FIFO\r
+ int latency = 1+(int)((periodIn+5.0*periodOut)/periodOut);\r
+ QList<char> pattern;\r
+ for(int i=0;i<latency;i++) {\r
+ pattern.append(0);\r
+ }\r
+ int inFifo = 1;\r
+ int idIn = 1;\r
+ int idOut = 1;\r
+ while (idIn < lengthIP) {\r
+ double tIn = (double)idIn * periodIn;\r
+ double tOut = (double)idOut * periodOut;\r
+ if (fabs(tIn-tOut) < 0.001) {\r
+ if (inFifo > 0) {\r
+ pattern.append(1);\r
+ }\r
+ else {\r
+ pattern.append(0);\r
+ inFifo ++;\r
+ }\r
+ idIn ++;\r
+ idOut ++;\r
+ }\r
+ else if (tIn < tOut) {\r
+ inFifo++;\r
+ idIn ++;\r