FPGA.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: FPGA.cpp
  4. * Description: FPGA
  5. *
  6. * IO implementation for constrained platforms where
  7. * inputs are contained in a header files and output is
  8. * only stdout.
  9. *
  10. * $Date: 20. June 2019
  11. * $Revision: V1.0.0
  12. *
  13. * Target Processor: Cortex-M cores
  14. * -------------------------------------------------------------------- */
  15. /*
  16. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  17. *
  18. * SPDX-License-Identifier: Apache-2.0
  19. *
  20. * Licensed under the Apache License, Version 2.0 (the License); you may
  21. * not use this file except in compliance with the License.
  22. * You may obtain a copy of the License at
  23. *
  24. * www.apache.org/licenses/LICENSE-2.0
  25. *
  26. * Unless required by applicable law or agreed to in writing, software
  27. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  28. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  29. * See the License for the specific language governing permissions and
  30. * limitations under the License.
  31. */
  32. #include "Test.h"
  33. #include <string>
  34. #include <cstddef>
  35. #include "FPGA.h"
  36. #include <stdio.h>
  37. #include <string.h>
  38. #include "Generators.h"
  39. namespace Client
  40. {
  41. struct offsetOrGen
  42. {
  43. int kind;
  44. unsigned long offset;
  45. Testing::param_t *data;
  46. Testing::nbSamples_t nbInputSamples;
  47. Testing::nbSamples_t nbOutputSamples;
  48. int dimensions;
  49. };
  50. FPGA::FPGA(const char *testDesc,const char *patterns)
  51. {
  52. this->m_testDesc=testDesc;
  53. this->m_patterns=patterns;
  54. this->currentDesc=testDesc;
  55. this->path=new std::vector<std::string>();
  56. this->patternOffsets=new std::vector<unsigned long>();
  57. this->patternSizes=new std::vector<unsigned long>();
  58. this->parameterOffsets=new std::vector<struct offsetOrGen>();
  59. this->parameterSizes=new std::vector<unsigned long>();
  60. this->outputNames=new std::vector<std::string>();
  61. }
  62. void FPGA::DeleteParams()
  63. {
  64. for (std::vector<struct offsetOrGen>::iterator it = this->parameterOffsets->begin() ; it != this->parameterOffsets->end(); ++it)
  65. {
  66. if (it->kind==1)
  67. {
  68. if (it->data)
  69. {
  70. free(it->data);
  71. it->data = NULL;
  72. }
  73. }
  74. }
  75. }
  76. FPGA::~FPGA()
  77. {
  78. delete(this->path);
  79. delete(this->patternOffsets);
  80. delete(this->patternSizes);
  81. this->DeleteParams();
  82. delete(this->parameterOffsets);
  83. delete(this->parameterSizes);
  84. delete(this->outputNames);
  85. }
  86. /** Read word 64 from C array
  87. */
  88. /** Read word 32 from C array
  89. */
  90. void FPGA::read32(unsigned long *r)
  91. {
  92. unsigned char a,b,c,d;
  93. unsigned long v;
  94. a = *this->currentDesc++;
  95. b = *this->currentDesc++;
  96. c = *this->currentDesc++;
  97. d = *this->currentDesc++;
  98. //printf("%d %d %d %d\n",a,b,c,d);
  99. v = a | (b << 8) | (c << 16) | (d << 24);
  100. *r = v;
  101. }
  102. /** Read null terminated C string C array
  103. */
  104. void FPGA::readStr(char *str)
  105. {
  106. char *p = str;
  107. while(*this->currentDesc != 0)
  108. {
  109. *p++ = *this->currentDesc++;
  110. }
  111. *p++ = 0;
  112. this->currentDesc++;
  113. }
  114. void FPGA::readChar(char *c)
  115. {
  116. *c = *this->currentDesc;
  117. this->currentDesc++;
  118. }
  119. /** Get output path from output ID
  120. */
  121. std::string FPGA::getOutputPath(Testing::outputID_t id)
  122. {
  123. char fmt[256];
  124. std::string tmp;
  125. tmp += this->testDir;
  126. sprintf(fmt,"/%s_%ld.txt",(*this->outputNames)[id].c_str(),this->currentId);
  127. tmp += std::string(fmt);
  128. //printf("%s\n",tmp.c_str());
  129. return(tmp);
  130. }
  131. /** Read the number of parameters for all the tests in a suite
  132. Used for benchmarking. Same functions executed with
  133. different initializations controlled by the parameters.
  134. */
  135. Testing::nbParameters_t FPGA::ReadNbParameters()
  136. {
  137. unsigned long nb;
  138. this->read32(&nb);
  139. return(nb);
  140. }
  141. void FPGA::ReadTestIdentification()
  142. {
  143. char tmp[255];
  144. unsigned long kind;
  145. unsigned long theId;
  146. char hasPath;
  147. char hasParamID;
  148. Testing::PatternID_t paramID;
  149. //printf("Read ident\n");
  150. this->read32(&kind);
  151. this->read32(&theId);
  152. this->readChar(&hasParamID);
  153. this->m_hasParam=false;
  154. if (hasParamID == 'y')
  155. {
  156. this->m_hasParam=true;
  157. this->read32(&paramID);
  158. this->currentParam=paramID;
  159. }
  160. this->readChar(&hasPath);
  161. if (hasPath == 'y')
  162. {
  163. this->readStr(tmp);
  164. //printf("-->%s\n",tmp);
  165. currentPath.assign(tmp);
  166. }
  167. this->currentKind=kind;
  168. this->currentId=theId;
  169. switch(kind)
  170. {
  171. case 1:
  172. printf("S: t \n");
  173. break;
  174. case 2:
  175. printf("S: s %ld\n",this->currentId);
  176. break;
  177. case 3:
  178. printf("S: g %ld\n",this->currentId);
  179. break;
  180. default:
  181. printf("S: u\n");
  182. }
  183. //printf("End read ident\n\n");
  184. }
  185. void FPGA::recomputeTestDir()
  186. {
  187. this->testDir = ".";
  188. int start = 1;
  189. std::vector<std::string>::const_iterator iter;
  190. for (iter = this->path->begin(); iter != this->path->end(); ++iter)
  191. {
  192. if (start)
  193. {
  194. this->testDir = *iter;
  195. start =0;
  196. }
  197. else
  198. {
  199. if (!(*iter).empty())
  200. {
  201. this->testDir += "/" + *iter;
  202. }
  203. }
  204. }
  205. }
  206. void FPGA::ReadIdentification()
  207. {
  208. this->ReadTestIdentification();
  209. this->path->push_back(currentPath);
  210. this->recomputeTestDir();
  211. }
  212. /** There is only stdout available for "FPGA".
  213. So status output and data output are interleaved.
  214. Status is starting with "S: "
  215. */
  216. void FPGA::DispStatus(Testing::TestStatus status
  217. ,Testing::errorID_t error
  218. ,unsigned long lineNb
  219. ,Testing::cycles_t cycles)
  220. {
  221. if (status == Testing::kTestFailed)
  222. {
  223. printf("S: %ld %ld %ld 0 N\n",this->currentId,error,lineNb);
  224. }
  225. else
  226. {
  227. #ifdef EXTBENCH
  228. printf("S: %ld 0 0 t Y\n",this->currentId);
  229. #else
  230. printf("S: %ld 0 0 %u Y\n",this->currentId, cycles);
  231. #endif
  232. }
  233. }
  234. void FPGA::EndGroup()
  235. {
  236. printf("S: p\n");
  237. this->path->pop_back();
  238. }
  239. /** Read pattern list
  240. Different from semihosting.
  241. We read offset and sizes for the patterns
  242. rather than file names.
  243. */
  244. void FPGA::ReadPatternList()
  245. {
  246. unsigned long offset,nb;
  247. unsigned long nbPatterns;
  248. this->read32(&nbPatterns);
  249. this->patternOffsets->clear();
  250. this->patternSizes->clear();
  251. std::string tmpstr;
  252. for(int i=0;i<nbPatterns;i++)
  253. {
  254. this->read32(&offset);
  255. this->read32(&nb);
  256. this->patternOffsets->push_back(offset);
  257. this->patternSizes->push_back(nb);
  258. }
  259. }
  260. /** Read parameters list
  261. Different from semihosting.
  262. We read offset and sizes for the parameters
  263. rather than file names.
  264. */
  265. void FPGA::ReadParameterList(Testing::nbParameters_t nbParams)
  266. {
  267. unsigned long offset,nb;
  268. unsigned long nbValues;
  269. char paramKind;
  270. this->read32(&nbValues);
  271. this->DeleteParams();
  272. this->parameterOffsets->clear();
  273. this->parameterSizes->clear();
  274. std::string tmpstr;
  275. for(int i=0;i<nbValues;i++)
  276. {
  277. this->readChar(&paramKind);
  278. struct offsetOrGen gen;
  279. if (paramKind == 'p')
  280. {
  281. gen.kind=0;
  282. this->read32(&offset);
  283. this->read32(&nb);
  284. gen.offset=offset;
  285. gen.kind=0;
  286. gen.nbInputSamples=nb;
  287. gen.dimensions = nbParams;
  288. }
  289. else
  290. {
  291. unsigned long kind,nbInputSamples,nbOutputSamples,dimensions,sample;
  292. Testing::param_t *p,*current;
  293. // Generator kind
  294. this->read32(&kind);
  295. this->read32(&nbInputSamples);
  296. this->read32(&nbOutputSamples);
  297. this->read32(&dimensions);
  298. p=(Testing::param_t*)malloc(sizeof(Testing::param_t)*(nbInputSamples));
  299. current=p;
  300. for(int i=0;i < nbInputSamples; i ++)
  301. {
  302. this->read32(&sample);
  303. *current++ = (Testing::param_t)sample;
  304. }
  305. gen.kind=1;
  306. gen.data=p;
  307. gen.nbInputSamples = nbInputSamples;
  308. gen.nbOutputSamples = nbOutputSamples;
  309. gen.dimensions = dimensions;
  310. }
  311. this->parameterOffsets->push_back(gen);
  312. this->parameterSizes->push_back(nb);
  313. }
  314. }
  315. void FPGA::ReadOutputList()
  316. {
  317. char tmp[256];
  318. unsigned long nbOutputs;
  319. this->read32(&nbOutputs);
  320. this->outputNames->clear();
  321. std::string tmpstr;
  322. for(int i=0;i<nbOutputs;i++)
  323. {
  324. this->readStr(tmp);
  325. tmpstr.assign(tmp);
  326. this->outputNames->push_back(tmpstr);
  327. }
  328. }
  329. unsigned long FPGA::getPatternOffset(Testing::PatternID_t id)
  330. {
  331. return((*this->patternOffsets)[id]);
  332. }
  333. Testing::nbSamples_t FPGA::GetPatternSize(Testing::PatternID_t id)
  334. {
  335. return((Testing::nbSamples_t)((*this->patternSizes)[id]));
  336. }
  337. unsigned long FPGA::getParameterOffset(Testing::PatternID_t id)
  338. {
  339. return((*this->parameterOffsets)[id].offset);
  340. }
  341. struct offsetOrGen FPGA::getParameterDesc(Testing::PatternID_t id)
  342. {
  343. return((*this->parameterOffsets)[id]);
  344. }
  345. void FPGA::DumpParams(std::vector<Testing::param_t>& params)
  346. {
  347. bool begin=true;
  348. printf("b ");
  349. for(std::vector<Testing::param_t>::iterator it = params.begin(); it != params.end(); ++it)
  350. {
  351. if (!begin)
  352. {
  353. printf(",");
  354. }
  355. printf("%d",*it);
  356. begin=false;
  357. }
  358. printf("\n");
  359. }
  360. Testing::param_t* FPGA::ImportParams(Testing::PatternID_t id,Testing::nbParameterEntries_t &nbEntries,Testing::ParameterKind &paramKind)
  361. {
  362. nbEntries=0;
  363. unsigned long offset;
  364. Testing::nbSamples_t len;
  365. struct offsetOrGen gen = this->getParameterDesc(id);
  366. if (gen.kind == 0)
  367. {
  368. offset=gen.offset;
  369. paramKind=Testing::kStaticBuffer;
  370. nbEntries = gen.nbInputSamples / gen.dimensions;
  371. const char *patternStart = this->m_patterns + offset;
  372. return((Testing::param_t*)patternStart);
  373. }
  374. else
  375. {
  376. Testing::param_t* result;
  377. // Output samples is number of parameter line
  378. len=gen.nbOutputSamples * gen.dimensions;
  379. paramKind=Testing::kDynamicBuffer;
  380. result=(Testing::param_t*)malloc(len*sizeof(Testing::param_t));
  381. switch(gen.dimensions)
  382. {
  383. case 1:
  384. generate1(result,gen.data,nbEntries);
  385. break;
  386. case 2:
  387. generate2(result,gen.data,nbEntries);
  388. break;
  389. case 3:
  390. generate3(result,gen.data,nbEntries);
  391. break;
  392. case 4:
  393. generate4(result,gen.data,nbEntries);
  394. break;
  395. default:
  396. generate1(result,gen.data,nbEntries);
  397. break;
  398. }
  399. return(result);
  400. }
  401. }
  402. bool FPGA::hasParam()
  403. {
  404. return(this->m_hasParam);
  405. }
  406. Testing::PatternID_t FPGA::getParamID()
  407. {
  408. return(this->currentParam);
  409. }
  410. void FPGA::ImportPattern_f64(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  411. {
  412. unsigned long offset,i;
  413. offset=this->getPatternOffset(id);
  414. const char *patternStart = this->m_patterns + offset;
  415. const float64_t *src = (const float64_t*)patternStart;
  416. float64_t *dst = (float64_t*)p;
  417. if (dst)
  418. {
  419. for(i=0; i < nb; i++)
  420. {
  421. *dst++ = *src++;
  422. }
  423. }
  424. }
  425. void FPGA::ImportPattern_f32(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  426. {
  427. unsigned long offset,i;
  428. offset=this->getPatternOffset(id);
  429. const char *patternStart = this->m_patterns + offset;
  430. const float32_t *src = (const float32_t*)patternStart;
  431. float32_t *dst = (float32_t*)p;
  432. if (dst)
  433. {
  434. for(i=0; i < nb; i++)
  435. {
  436. *dst++ = *src++;
  437. }
  438. }
  439. }
  440. void FPGA::ImportPattern_q63(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  441. {
  442. unsigned long offset,i;
  443. offset=this->getPatternOffset(id);
  444. const char *patternStart = this->m_patterns + offset;
  445. const q63_t *src = (const q63_t*)patternStart;
  446. q63_t *dst = (q63_t*)p;
  447. if (dst)
  448. {
  449. for(i=0; i < nb; i++)
  450. {
  451. *dst++ = *src++;
  452. }
  453. }
  454. }
  455. void FPGA::ImportPattern_q31(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  456. {
  457. unsigned long offset,i;
  458. offset=this->getPatternOffset(id);
  459. const char *patternStart = this->m_patterns + offset;
  460. const q31_t *src = (const q31_t*)patternStart;
  461. q31_t *dst = (q31_t*)p;
  462. if (dst)
  463. {
  464. for(i=0; i < nb; i++)
  465. {
  466. *dst++ = *src++;
  467. }
  468. }
  469. }
  470. void FPGA::ImportPattern_q15(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  471. {
  472. unsigned long offset,i;
  473. offset=this->getPatternOffset(id);
  474. const char *patternStart = this->m_patterns + offset;
  475. const q15_t *src = (const q15_t*)patternStart;
  476. q15_t *dst = (q15_t*)p;
  477. if (dst)
  478. {
  479. for(i=0; i < nb; i++)
  480. {
  481. *dst++ = *src++;
  482. }
  483. }
  484. }
  485. void FPGA::ImportPattern_q7(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  486. {
  487. unsigned long offset,i;
  488. offset=this->getPatternOffset(id);
  489. const char *patternStart = this->m_patterns + offset;
  490. const q7_t *src = (const q7_t*)patternStart;
  491. q7_t *dst = (q7_t*)p;
  492. if (dst)
  493. {
  494. for(i=0; i < nb; i++)
  495. {
  496. *dst++ = *src++;
  497. }
  498. }
  499. }
  500. void FPGA::ImportPattern_u32(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  501. {
  502. unsigned long offset,i;
  503. offset=this->getPatternOffset(id);
  504. const char *patternStart = this->m_patterns + offset;
  505. const uint32_t *src = (const uint32_t*)patternStart;
  506. uint32_t *dst = (uint32_t*)p;
  507. if (dst)
  508. {
  509. for(i=0; i < nb; i++)
  510. {
  511. *dst++ = *src++;
  512. }
  513. }
  514. }
  515. void FPGA::ImportPattern_u16(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  516. {
  517. unsigned long offset,i;
  518. offset=this->getPatternOffset(id);
  519. const char *patternStart = this->m_patterns + offset;
  520. const uint16_t *src = (const uint16_t*)patternStart;
  521. uint16_t *dst = (uint16_t*)p;
  522. if (dst)
  523. {
  524. for(i=0; i < nb; i++)
  525. {
  526. *dst++ = *src++;
  527. }
  528. }
  529. }
  530. void FPGA::ImportPattern_u8(Testing::PatternID_t id,char* p,Testing::nbSamples_t nb)
  531. {
  532. unsigned long offset,i;
  533. offset=this->getPatternOffset(id);
  534. const char *patternStart = this->m_patterns + offset;
  535. const uint8_t *src = (const uint8_t*)patternStart;
  536. uint8_t *dst = (uint8_t*)p;
  537. if (dst)
  538. {
  539. for(i=0; i < nb; i++)
  540. {
  541. *dst++ = *src++;
  542. }
  543. }
  544. }
  545. /** Dump patterns.
  546. There is only stdout available for "FPGA".
  547. So status output and data output are interleaved.
  548. Data is starting with "D: "
  549. */
  550. void FPGA::DumpPattern_f64(Testing::outputID_t id,Testing::nbSamples_t nb, float64_t* data)
  551. {
  552. std::string fileName = this->getOutputPath(id);
  553. if (data)
  554. {
  555. printf("D: %s\n",fileName.c_str());
  556. Testing::nbSamples_t i=0;
  557. uint64_t t;
  558. float64_t v;
  559. for(i=0; i < nb; i++)
  560. {
  561. v = data[i];
  562. t = TOINT64(v);
  563. printf("D: 0x%016llx\n",t);
  564. }
  565. printf("D: END\n");
  566. }
  567. }
  568. void FPGA::DumpPattern_f32(Testing::outputID_t id,Testing::nbSamples_t nb, float32_t* data)
  569. {
  570. std::string fileName = this->getOutputPath(id);
  571. if (data)
  572. {
  573. printf("D: %s\n",fileName.c_str());
  574. Testing::nbSamples_t i=0;
  575. uint32_t t;
  576. float32_t v;
  577. for(i=0; i < nb; i++)
  578. {
  579. v = data[i];
  580. t = TOINT32(v);
  581. printf("D: 0x%08x\n",t);
  582. }
  583. printf("D: END\n");
  584. }
  585. }
  586. void FPGA::DumpPattern_q63(Testing::outputID_t id,Testing::nbSamples_t nb, q63_t* data)
  587. {
  588. std::string fileName = this->getOutputPath(id);
  589. if (data)
  590. {
  591. printf("D: %s\n",fileName.c_str());
  592. Testing::nbSamples_t i=0;
  593. uint64_t t;
  594. q63_t v;
  595. for(i=0; i < nb; i++)
  596. {
  597. v = data[i];
  598. t = (uint64_t)v;
  599. printf("D: 0x%016llx\n",t);
  600. }
  601. printf("D: END\n");
  602. }
  603. }
  604. void FPGA::DumpPattern_q31(Testing::outputID_t id,Testing::nbSamples_t nb, q31_t* data)
  605. {
  606. std::string fileName = this->getOutputPath(id);
  607. if (data)
  608. {
  609. printf("D: %s\n",fileName.c_str());
  610. Testing::nbSamples_t i=0;
  611. uint32_t t;
  612. q31_t v;
  613. for(i=0; i < nb; i++)
  614. {
  615. v = data[i];
  616. t = (uint32_t)v;
  617. printf("D: 0x%08x\n",t);
  618. }
  619. printf("D: END\n");
  620. }
  621. }
  622. void FPGA::DumpPattern_q15(Testing::outputID_t id,Testing::nbSamples_t nb, q15_t* data)
  623. {
  624. std::string fileName = this->getOutputPath(id);
  625. if (data)
  626. {
  627. printf("D: %s\n",fileName.c_str());
  628. Testing::nbSamples_t i=0;
  629. uint32_t t;
  630. q15_t v;
  631. for(i=0; i < nb; i++)
  632. {
  633. v = data[i];
  634. t = (uint32_t)v;
  635. printf("D: 0x%08x\n",t);
  636. }
  637. printf("D: END\n");
  638. }
  639. }
  640. void FPGA::DumpPattern_q7(Testing::outputID_t id,Testing::nbSamples_t nb, q7_t* data)
  641. {
  642. std::string fileName = this->getOutputPath(id);
  643. if (data)
  644. {
  645. printf("D: %s\n",fileName.c_str());
  646. Testing::nbSamples_t i=0;
  647. uint32_t t;
  648. q7_t v;
  649. for(i=0; i < nb; i++)
  650. {
  651. v = data[i];
  652. t = (uint32_t)v;
  653. printf("D: 0x%08x\n",t);
  654. }
  655. printf("D: END\n");
  656. }
  657. }
  658. void FPGA::DumpPattern_u32(Testing::outputID_t id,Testing::nbSamples_t nb, uint32_t* data)
  659. {
  660. std::string fileName = this->getOutputPath(id);
  661. if (data)
  662. {
  663. printf("D: %s\n",fileName.c_str());
  664. Testing::nbSamples_t i=0;
  665. uint32_t t;
  666. uint32_t v;
  667. for(i=0; i < nb; i++)
  668. {
  669. v = data[i];
  670. t = (uint32_t)v;
  671. printf("D: 0x%08x\n",t);
  672. }
  673. printf("D: END\n");
  674. }
  675. }
  676. void FPGA::DumpPattern_u16(Testing::outputID_t id,Testing::nbSamples_t nb, uint16_t* data)
  677. {
  678. std::string fileName = this->getOutputPath(id);
  679. if (data)
  680. {
  681. printf("D: %s\n",fileName.c_str());
  682. Testing::nbSamples_t i=0;
  683. uint32_t t;
  684. uint16_t v;
  685. for(i=0; i < nb; i++)
  686. {
  687. v = data[i];
  688. t = (uint32_t)v;
  689. printf("D: 0x%08x\n",t);
  690. }
  691. printf("D: END\n");
  692. }
  693. }
  694. void FPGA::DumpPattern_u8(Testing::outputID_t id,Testing::nbSamples_t nb, uint8_t* data)
  695. {
  696. std::string fileName = this->getOutputPath(id);
  697. if (data)
  698. {
  699. printf("D: %s\n",fileName.c_str());
  700. Testing::nbSamples_t i=0;
  701. uint32_t t;
  702. uint8_t v;
  703. for(i=0; i < nb; i++)
  704. {
  705. v = data[i];
  706. t = (uint32_t)v;
  707. printf("D: 0x%08x\n",t);
  708. }
  709. printf("D: END\n");
  710. }
  711. }
  712. Testing::testID_t FPGA::CurrentTestID()
  713. {
  714. return(this->currentId);
  715. }
  716. }