FPGA.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: FPGA.h
  4. * Description: FPGA Header
  5. *
  6. * $Date: 20. June 2019
  7. * $Revision: V1.0.0
  8. *
  9. * Target Processor: Cortex-M cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #ifndef _FPGA_H_
  29. #define _FPGA_H_
  30. #include <string>
  31. #include "stdlib.h"
  32. namespace Client
  33. {
  34. /*
  35. FPGA driver. Used to read a C array describing how to drive the test.
  36. */
  37. struct offsetOrGen;
  38. class FPGA:public IO
  39. {
  40. public:
  41. FPGA(const char *testDesc,const char *patterns);
  42. ~FPGA();
  43. virtual void ReadIdentification();
  44. virtual void ReadTestIdentification();
  45. virtual Testing::nbParameters_t ReadNbParameters();
  46. virtual void DispStatus(Testing::TestStatus,Testing::errorID_t,unsigned long,Testing::cycles_t);
  47. virtual void DispErrorDetails(const char* );
  48. virtual void EndGroup();
  49. virtual void ReadPatternList();
  50. virtual void ReadOutputList();
  51. virtual void ReadParameterList(Testing::nbParameters_t);
  52. virtual Testing::nbSamples_t GetPatternSize(Testing::PatternID_t);
  53. virtual void ImportPattern_f64(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  54. virtual void ImportPattern_f32(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  55. virtual void ImportPattern_q63(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  56. virtual void ImportPattern_q31(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  57. virtual void ImportPattern_q15(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  58. virtual void ImportPattern_q7(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  59. virtual void ImportPattern_u32(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  60. virtual void ImportPattern_u16(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  61. virtual void ImportPattern_u8(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
  62. virtual void DumpParams(std::vector<Testing::param_t>&);
  63. virtual Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &,Testing::ParameterKind &);
  64. virtual bool hasParam();
  65. virtual Testing::PatternID_t getParamID();
  66. virtual void DumpPattern_f64(Testing::outputID_t,Testing::nbSamples_t nb, float64_t* data);
  67. virtual void DumpPattern_f32(Testing::outputID_t,Testing::nbSamples_t nb, float32_t* data);
  68. virtual void DumpPattern_q63(Testing::outputID_t,Testing::nbSamples_t nb, q63_t* data);
  69. virtual void DumpPattern_q31(Testing::outputID_t,Testing::nbSamples_t nb, q31_t* data);
  70. virtual void DumpPattern_q15(Testing::outputID_t,Testing::nbSamples_t nb, q15_t* data);
  71. virtual void DumpPattern_q7(Testing::outputID_t,Testing::nbSamples_t nb, q7_t* data);
  72. virtual void DumpPattern_u32(Testing::outputID_t,Testing::nbSamples_t nb, uint32_t* data);
  73. virtual void DumpPattern_u16(Testing::outputID_t,Testing::nbSamples_t nb, uint16_t* data);
  74. virtual void DumpPattern_u8(Testing::outputID_t,Testing::nbSamples_t nb, uint8_t* data);
  75. virtual Testing::testID_t CurrentTestID();
  76. private:
  77. void recomputeTestDir();
  78. void DeleteParams();
  79. struct offsetOrGen getParameterDesc(Testing::PatternID_t id);
  80. // Get offset in C array of a pattern.
  81. unsigned long getPatternOffset(Testing::PatternID_t);
  82. // Get output path
  83. std::string getOutputPath(Testing::outputID_t id);
  84. // Get offset in C array of a parameter.
  85. unsigned long getParameterOffset(Testing::PatternID_t);
  86. // Read data from the driver C array.
  87. void read32(unsigned long *);
  88. void readStr(char *str);
  89. void readChar(char *);
  90. // Driver array
  91. const char *m_testDesc;
  92. // Pattern array
  93. const char *m_patterns;
  94. // Parameter array
  95. char *m_parameters;
  96. // Current position in the driver array
  97. const char *currentDesc;
  98. int currentKind;
  99. Testing::testID_t currentId;
  100. // Current param ID for the node
  101. Testing::PatternID_t currentParam;
  102. bool m_hasParam;
  103. // Association pattern ID to pattern offset in C array m_patterns
  104. std::vector<unsigned long> *patternOffsets;
  105. // Association pattern ID to pattern size.
  106. std::vector<Testing::nbSamples_t> *patternSizes;
  107. // Association parameter ID to parameter offset in C array m_parameters
  108. std::vector<struct offsetOrGen> *parameterOffsets;
  109. // Association parameter ID to parameter size.
  110. std::vector<Testing::nbSamples_t> *parameterSizes;
  111. // testDir is only used for output.
  112. // In a future version it will be removed.
  113. // Output will just use ID and post processing
  114. // script will recover the path
  115. std::string testDir;
  116. std::vector<std::string> *path;
  117. std::string currentPath;
  118. std::vector<std::string> *outputNames;
  119. };
  120. }
  121. #endif