finn-plus 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. finn_plus-1.0.0/AUTHORS.rst +40 -0
  2. finn_plus-1.0.0/LICENSE.txt +33 -0
  3. finn_plus-1.0.0/PKG-INFO +144 -0
  4. finn_plus-1.0.0/README.md +74 -0
  5. finn_plus-1.0.0/custom_hls/__init__.py +0 -0
  6. finn_plus-1.0.0/custom_hls/checksum.cpp +36 -0
  7. finn_plus-1.0.0/custom_hls/checksum.hpp +134 -0
  8. finn_plus-1.0.0/custom_hls/checksum_tb.sv +136 -0
  9. finn_plus-1.0.0/custom_hls/lookup.hpp +107 -0
  10. finn_plus-1.0.0/finn-rtllib/__init__.py +0 -0
  11. finn_plus-1.0.0/finn-rtllib/axi_info/component.xml +717 -0
  12. finn_plus-1.0.0/finn-rtllib/axi_info/hdl/axi_info.sv +119 -0
  13. finn_plus-1.0.0/finn-rtllib/axi_info/hdl/axi_info_top.sv +98 -0
  14. finn_plus-1.0.0/finn-rtllib/axi_info/xgui/axi_info_top_v1_0.tcl +69 -0
  15. finn_plus-1.0.0/finn-rtllib/dwc/hdl/dwc.sv +158 -0
  16. finn_plus-1.0.0/finn-rtllib/dwc/hdl/dwc_axi.sv +65 -0
  17. finn_plus-1.0.0/finn-rtllib/dwc/hdl/dwc_template.v +71 -0
  18. finn_plus-1.0.0/finn-rtllib/dwc/sim/dwc_axi_tb.sv +195 -0
  19. finn_plus-1.0.0/finn-rtllib/fifo/hdl/Q_srl.v +318 -0
  20. finn_plus-1.0.0/finn-rtllib/fifo/hdl/fifo_template.v +72 -0
  21. finn_plus-1.0.0/finn-rtllib/fmpadding/hdl/axi2we.sv +122 -0
  22. finn_plus-1.0.0/finn-rtllib/fmpadding/hdl/fmpadding.sv +223 -0
  23. finn_plus-1.0.0/finn-rtllib/fmpadding/hdl/fmpadding_axi.sv +123 -0
  24. finn_plus-1.0.0/finn-rtllib/fmpadding/hdl/fmpadding_axi_tb.sv +154 -0
  25. finn_plus-1.0.0/finn-rtllib/fmpadding/hdl/fmpadding_template.v +119 -0
  26. finn_plus-1.0.0/finn-rtllib/memstream/doc/README +45 -0
  27. finn_plus-1.0.0/finn-rtllib/memstream/hdl/axilite_if.v +210 -0
  28. finn_plus-1.0.0/finn-rtllib/memstream/hdl/memstream.sv +221 -0
  29. finn_plus-1.0.0/finn-rtllib/memstream/hdl/memstream_axi.sv +265 -0
  30. finn_plus-1.0.0/finn-rtllib/memstream/hdl/memstream_wrapper_template.v +120 -0
  31. finn_plus-1.0.0/finn-rtllib/memstream/sim/memstream_axi_tb.sv +223 -0
  32. finn_plus-1.0.0/finn-rtllib/memstream/sim/memstream_tb.sv +212 -0
  33. finn_plus-1.0.0/finn-rtllib/mvu/mvu_4sx4u.sv +830 -0
  34. finn_plus-1.0.0/finn-rtllib/mvu/mvu_8sx8u_dsp48.sv +653 -0
  35. finn_plus-1.0.0/finn-rtllib/mvu/mvu_vvu_8sx9_dsp58.sv +449 -0
  36. finn_plus-1.0.0/finn-rtllib/mvu/mvu_vvu_axi.sv +424 -0
  37. finn_plus-1.0.0/finn-rtllib/mvu/mvu_vvu_axi_wrapper.v +98 -0
  38. finn_plus-1.0.0/finn-rtllib/mvu/replay_buffer.sv +181 -0
  39. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_3sx3u_tb.sv +165 -0
  40. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_8sx9_tb.sv +165 -0
  41. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_accu_tb.dat +192 -0
  42. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_accu_tb.sv +162 -0
  43. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_axi_tb.sv +255 -0
  44. finn_plus-1.0.0/finn-rtllib/mvu/tb/mvu_dsp58_tb.sv +142 -0
  45. finn_plus-1.0.0/finn-rtllib/mvu/tb/replay_buffer_tb.sv +130 -0
  46. finn_plus-1.0.0/finn-rtllib/mvu/tb/vvu_axi_tb.sv +227 -0
  47. finn_plus-1.0.0/finn-rtllib/passthru/rtl/passthru_axi.sv +57 -0
  48. finn_plus-1.0.0/finn-rtllib/passthru/rtl/passthru_template_wrapper.v +62 -0
  49. finn_plus-1.0.0/finn-rtllib/swg/swg_common.sv +248 -0
  50. finn_plus-1.0.0/finn-rtllib/swg/swg_pkg.sv +41 -0
  51. finn_plus-1.0.0/finn-rtllib/swg/swg_template_axilite.v +593 -0
  52. finn_plus-1.0.0/finn-rtllib/swg/swg_template_default.sv +237 -0
  53. finn_plus-1.0.0/finn-rtllib/swg/swg_template_default_dynamic.sv +417 -0
  54. finn_plus-1.0.0/finn-rtllib/swg/swg_template_parallel.sv +216 -0
  55. finn_plus-1.0.0/finn-rtllib/swg/swg_template_wrapper.v +78 -0
  56. finn_plus-1.0.0/finn-rtllib/swg/swg_template_wrapper_dynamic.v +187 -0
  57. finn_plus-1.0.0/finn-rtllib/thresholding/hdl/axilite_if.v +211 -0
  58. finn_plus-1.0.0/finn-rtllib/thresholding/hdl/thresholding.sv +372 -0
  59. finn_plus-1.0.0/finn-rtllib/thresholding/hdl/thresholding_axi.sv +199 -0
  60. finn_plus-1.0.0/finn-rtllib/thresholding/hdl/thresholding_template_wrapper.v +122 -0
  61. finn_plus-1.0.0/finn-rtllib/thresholding/sim/thresh_gen.sv +75 -0
  62. finn_plus-1.0.0/finn-rtllib/thresholding/sim/thresholding_axi_tb.sv +314 -0
  63. finn_plus-1.0.0/finn-rtllib/thresholding/sim/thresholding_tb.sv +274 -0
  64. finn_plus-1.0.0/notebooks/LFCW1A1.onnx +0 -0
  65. finn_plus-1.0.0/notebooks/advanced/0_custom_analysis_pass.ipynb +161 -0
  66. finn_plus-1.0.0/notebooks/advanced/1_custom_transformation_pass.ipynb +258 -0
  67. finn_plus-1.0.0/notebooks/advanced/2_custom_op.ipynb +680 -0
  68. finn_plus-1.0.0/notebooks/advanced/3_folding.ipynb +669 -0
  69. finn_plus-1.0.0/notebooks/advanced/4_advanced_builder_settings.ipynb +1844 -0
  70. finn_plus-1.0.0/notebooks/advanced/cnv-w2a2_folding_config.json +79 -0
  71. finn_plus-1.0.0/notebooks/advanced/cybsec_PE_SIMD.onnx +0 -0
  72. finn_plus-1.0.0/notebooks/advanced/finn-dataflow.png +0 -0
  73. finn_plus-1.0.0/notebooks/advanced/finn-folding-mvau.png +0 -0
  74. finn_plus-1.0.0/notebooks/advanced/finn-folding.png +0 -0
  75. finn_plus-1.0.0/notebooks/basics/0_how_to_work_with_onnx.ipynb +621 -0
  76. finn_plus-1.0.0/notebooks/basics/1_brevitas_network_import_via_QONNX.ipynb +326 -0
  77. finn_plus-1.0.0/notebooks/end2end_example/README.md +13 -0
  78. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/StreamingDataflowPartition_1.pdf +4211 -0
  79. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/cnv-mp-fc.png +0 -0
  80. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/cnv_end2end_example.ipynb +650 -0
  81. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/finn-design-flow-example.svg +1 -0
  82. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/finn-hw-arch.png +0 -0
  83. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/pynq_shell_project.png +0 -0
  84. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/stitched_ip.png +0 -0
  85. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/tfc_end2end_example.ipynb +1086 -0
  86. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/tfc_end2end_verification.ipynb +468 -0
  87. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/top.pdf +2755 -0
  88. finn_plus-1.0.0/notebooks/end2end_example/bnn-pynq/verification.svg +1 -0
  89. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/1-train-mlp-with-brevitas.ipynb +770 -0
  90. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/2-import-into-finn-and-verify.ipynb +509 -0
  91. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/3-build-accelerator-with-finn.ipynb +667 -0
  92. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/README.md +21 -0
  93. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/dataloader_quantized.py +398 -0
  94. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/finn-example.png +0 -0
  95. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/state_dict.pth +0 -0
  96. finn_plus-1.0.0/notebooks/end2end_example/cybersecurity/validate-unsw-nb15.py +101 -0
  97. finn_plus-1.0.0/pyproject.toml +140 -0
  98. finn_plus-1.0.0/src/finn/__init__.py +0 -0
  99. finn_plus-1.0.0/src/finn/analysis/__init__.py +0 -0
  100. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/__init__.py +0 -0
  101. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/dataflow_performance.py +78 -0
  102. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/exp_cycles_per_layer.py +49 -0
  103. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/floorplan_params.py +61 -0
  104. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py +81 -0
  105. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/op_and_param_counts.py +60 -0
  106. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/post_synth_res.py +133 -0
  107. finn_plus-1.0.0/src/finn/analysis/fpgadataflow/res_estimation.py +86 -0
  108. finn_plus-1.0.0/src/finn/analysis/verify_custom_nodes.py +49 -0
  109. finn_plus-1.0.0/src/finn/builder/__init__.py +0 -0
  110. finn_plus-1.0.0/src/finn/builder/build_dataflow.py +298 -0
  111. finn_plus-1.0.0/src/finn/builder/build_dataflow_config.py +457 -0
  112. finn_plus-1.0.0/src/finn/builder/build_dataflow_steps.py +866 -0
  113. finn_plus-1.0.0/src/finn/core/__init__.py +0 -0
  114. finn_plus-1.0.0/src/finn/core/onnx_exec.py +135 -0
  115. finn_plus-1.0.0/src/finn/core/rtlsim_exec.py +411 -0
  116. finn_plus-1.0.0/src/finn/core/throughput_test.py +85 -0
  117. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/__init__.py +118 -0
  118. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/addstreams.py +152 -0
  119. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/attention.py +775 -0
  120. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/attention_heads.py +645 -0
  121. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/channelwise_op.py +249 -0
  122. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/concat.py +157 -0
  123. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/convolutioninputgenerator.py +268 -0
  124. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/downsampler.py +219 -0
  125. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/duplicatestreams.py +156 -0
  126. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/elementwise_binary.py +809 -0
  127. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/fmpadding.py +162 -0
  128. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/fmpadding_pixel.py +164 -0
  129. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/globalaccpool.py +150 -0
  130. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/__init__.py +131 -0
  131. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/addstreams_hls.py +116 -0
  132. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/attention_heads_hls.py +490 -0
  133. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/attention_hls.py +809 -0
  134. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/channelwise_op_hls.py +354 -0
  135. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/checksum_hls.py +256 -0
  136. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/concat_hls.py +183 -0
  137. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/convolutioninputgenerator_hls.py +551 -0
  138. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/downsampler_hls.py +90 -0
  139. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/duplicatestreams_hls.py +156 -0
  140. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/elementwise_binary_hls.py +766 -0
  141. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/fmpadding_hls.py +138 -0
  142. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/fmpadding_pixel_hls.py +92 -0
  143. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/globalaccpool_hls.py +100 -0
  144. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/iodma_hls.py +399 -0
  145. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/labelselect_hls.py +138 -0
  146. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/lookup_hls.py +228 -0
  147. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/matrixvectoractivation_hls.py +582 -0
  148. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/pool_hls.py +133 -0
  149. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/replicate_stream_hls.py +253 -0
  150. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/split_hls.py +302 -0
  151. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/squeeze_hls.py +234 -0
  152. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/streamingdatawidthconverter_hls.py +124 -0
  153. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/streamingeltwise_hls.py +167 -0
  154. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/streamingmaxpool_hls.py +135 -0
  155. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/thresholding_hls.py +724 -0
  156. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/tlastmarker_hls.py +259 -0
  157. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/unsqueeze_hls.py +234 -0
  158. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/upsampler_hls.py +98 -0
  159. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hls/vectorvectoractivation_hls.py +533 -0
  160. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hlsbackend.py +567 -0
  161. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/hwcustomop.py +456 -0
  162. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/labelselect.py +168 -0
  163. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/lookup.py +223 -0
  164. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/matrixvectoractivation.py +1018 -0
  165. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/pool.py +217 -0
  166. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/replicate_stream.py +300 -0
  167. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/__init__.py +51 -0
  168. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/convolutioninputgenerator_rtl.py +980 -0
  169. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/fmpadding_rtl.py +188 -0
  170. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/matrixvectoractivation_rtl.py +356 -0
  171. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/streamingdatawidthconverter_rtl.py +147 -0
  172. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/streamingfifo_rtl.py +222 -0
  173. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/thresholding_rtl.py +509 -0
  174. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtl/vectorvectoractivation_rtl.py +312 -0
  175. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/rtlbackend.py +149 -0
  176. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/split.py +164 -0
  177. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/squeeze.py +329 -0
  178. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/streamingdataflowpartition.py +117 -0
  179. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/streamingdatawidthconverter.py +209 -0
  180. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/streamingeltwise.py +203 -0
  181. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/streamingfifo.py +200 -0
  182. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/streamingmaxpool.py +224 -0
  183. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/templates.py +265 -0
  184. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/thresholding.py +286 -0
  185. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/unsqueeze.py +330 -0
  186. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/upsampler.py +181 -0
  187. finn_plus-1.0.0/src/finn/custom_op/fpgadataflow/vectorvectoractivation.py +918 -0
  188. finn_plus-1.0.0/src/finn/interface/__init__.py +4 -0
  189. finn_plus-1.0.0/src/finn/interface/interface_globals.py +95 -0
  190. finn_plus-1.0.0/src/finn/interface/interface_utils.py +161 -0
  191. finn_plus-1.0.0/src/finn/interface/manage_deps.py +308 -0
  192. finn_plus-1.0.0/src/finn/interface/manage_tests.py +90 -0
  193. finn_plus-1.0.0/src/finn/interface/run_finn.py +394 -0
  194. finn_plus-1.0.0/src/finn/qnn-data/__init__.py +0 -0
  195. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/build.py +70 -0
  196. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/dataflow_build_config.json +28 -0
  197. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/expected_output.npy +0 -0
  198. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/folding_config.json +29 -0
  199. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/input.npy +0 -0
  200. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/model.onnx +0 -0
  201. finn_plus-1.0.0/src/finn/qnn-data/build_dataflow/specialize_layers_config.json +21 -0
  202. finn_plus-1.0.0/src/finn/qnn-data/cifar10/cifar10-test-data-class3.npz +0 -0
  203. finn_plus-1.0.0/src/finn/qnn-data/cpp/npy2apintstream.hpp +80 -0
  204. finn_plus-1.0.0/src/finn/qnn-data/cpp/npy2vectorstream.hpp +72 -0
  205. finn_plus-1.0.0/src/finn/qnn-data/cpp/xsi_simdriver.cpp +444 -0
  206. finn_plus-1.0.0/src/finn/qnn-data/cybsec-mlp/state_dict.pth +0 -0
  207. finn_plus-1.0.0/src/finn/qnn-data/cybsec-mlp/validate-unsw-nb15.py +105 -0
  208. finn_plus-1.0.0/src/finn/qnn-data/mdd-data/finn_design.mdd +36 -0
  209. finn_plus-1.0.0/src/finn/qnn-data/mdd-data/finn_design.tcl +60 -0
  210. finn_plus-1.0.0/src/finn/qnn-data/templates/driver/driver_base.py +488 -0
  211. finn_plus-1.0.0/src/finn/qnn-data/templates/driver/validate.py +107 -0
  212. finn_plus-1.0.0/src/finn/qnn-data/test_ext_weights/specialize_layers_config.json +30 -0
  213. finn_plus-1.0.0/src/finn/qnn-data/test_ext_weights/tfc-w2a2-extw.json +38 -0
  214. finn_plus-1.0.0/src/finn/qnn-data/testcase/residual_testcase.onnx +0 -0
  215. finn_plus-1.0.0/src/finn/qnn-data/verilog/custom_axis_infrastructure.vh +346 -0
  216. finn_plus-1.0.0/src/finn/qnn-data/verilog/myadd/myadd_myadd.v +118 -0
  217. finn_plus-1.0.0/src/finn/qnn-data/verilog/myadd/myadd_myadd_control_s_axi.v +357 -0
  218. finn_plus-1.0.0/src/finn/transformation/__init__.py +0 -0
  219. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/__init__.py +0 -0
  220. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/annotate_cycles.py +61 -0
  221. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/annotate_resources.py +109 -0
  222. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/attention.py +658 -0
  223. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/attention_heads.py +824 -0
  224. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/cleanup.py +84 -0
  225. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/compile_cppsim.py +75 -0
  226. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/convert_to_hw_layers.py +2090 -0
  227. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/create_dataflow_partition.py +118 -0
  228. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/create_stitched_ip.py +658 -0
  229. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/derive_characteristic.py +186 -0
  230. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/externalize_params.py +71 -0
  231. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/floorplan.py +181 -0
  232. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/get_driver_shapes.py +143 -0
  233. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/hlssynth_ip.py +84 -0
  234. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/infer_pixel_padding_deconv.py +205 -0
  235. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/insert_dwc.py +133 -0
  236. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/insert_fifo.py +307 -0
  237. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/insert_hook.py +131 -0
  238. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/insert_iodma.py +255 -0
  239. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/insert_tlastmarker.py +159 -0
  240. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/make_driver.py +461 -0
  241. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/make_zynq_proj.py +361 -0
  242. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/minimize_accumulator_width.py +57 -0
  243. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/minimize_weight_bit_width.py +49 -0
  244. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/prepare_cppsim.py +106 -0
  245. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/prepare_ip.py +95 -0
  246. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/prepare_rtlsim.py +72 -0
  247. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/replace_verilog_relpaths.py +68 -0
  248. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/replicate_stream.py +110 -0
  249. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/set_exec_mode.py +64 -0
  250. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/set_fifo_depths.py +629 -0
  251. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/set_folding.py +287 -0
  252. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/specialize_layers.py +323 -0
  253. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/synth_ooc.py +65 -0
  254. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/template_driver.py +143 -0
  255. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/templates.py +207 -0
  256. finn_plus-1.0.0/src/finn/transformation/fpgadataflow/vitis_build.py +457 -0
  257. finn_plus-1.0.0/src/finn/transformation/move_reshape.py +68 -0
  258. finn_plus-1.0.0/src/finn/transformation/qonnx/__init__.py +0 -0
  259. finn_plus-1.0.0/src/finn/transformation/qonnx/convert_qonnx_to_finn.py +95 -0
  260. finn_plus-1.0.0/src/finn/transformation/qonnx/fold_quant_weights.py +238 -0
  261. finn_plus-1.0.0/src/finn/transformation/qonnx/infer_quant_avg_pool_2d.py +284 -0
  262. finn_plus-1.0.0/src/finn/transformation/qonnx/qonnx_activation_handlers.py +652 -0
  263. finn_plus-1.0.0/src/finn/transformation/qonnx/quant_act_to_multithreshold.py +153 -0
  264. finn_plus-1.0.0/src/finn/transformation/squeeze.py +428 -0
  265. finn_plus-1.0.0/src/finn/transformation/streamline/__init__.py +103 -0
  266. finn_plus-1.0.0/src/finn/transformation/streamline/absorb.py +721 -0
  267. finn_plus-1.0.0/src/finn/transformation/streamline/collapse_repeated.py +212 -0
  268. finn_plus-1.0.0/src/finn/transformation/streamline/remove.py +101 -0
  269. finn_plus-1.0.0/src/finn/transformation/streamline/reorder.py +2474 -0
  270. finn_plus-1.0.0/src/finn/transformation/streamline/round_thresholds.py +94 -0
  271. finn_plus-1.0.0/src/finn/transformation/streamline/sign_to_thres.py +73 -0
  272. finn_plus-1.0.0/src/finn/transformation/streamline/streamline_plus.py +110 -0
  273. finn_plus-1.0.0/src/finn/transformation/util.py +142 -0
  274. finn_plus-1.0.0/src/finn/util/__init__.py +0 -0
  275. finn_plus-1.0.0/src/finn/util/basic.py +311 -0
  276. finn_plus-1.0.0/src/finn/util/create.py +173 -0
  277. finn_plus-1.0.0/src/finn/util/data_packing.py +451 -0
  278. finn_plus-1.0.0/src/finn/util/deps.py +10 -0
  279. finn_plus-1.0.0/src/finn/util/fpgadataflow.py +71 -0
  280. finn_plus-1.0.0/src/finn/util/hls.py +74 -0
  281. finn_plus-1.0.0/src/finn/util/imagenet.py +1146 -0
  282. finn_plus-1.0.0/src/finn/util/logging.py +3 -0
  283. finn_plus-1.0.0/src/finn/util/platforms.py +505 -0
  284. finn_plus-1.0.0/src/finn/util/pytorch.py +65 -0
  285. finn_plus-1.0.0/src/finn/util/test.py +186 -0
  286. finn_plus-1.0.0/src/finn/util/visualization.py +62 -0
  287. finn_plus-1.0.0/src/finn/util/vivado.py +87 -0
  288. finn_plus-1.0.0/tests/brevitas/king_charles.jpg +0 -0
  289. finn_plus-1.0.0/tests/brevitas/test_brevitas_avg_pool_export.py +114 -0
  290. finn_plus-1.0.0/tests/brevitas/test_brevitas_cnv.py +81 -0
  291. finn_plus-1.0.0/tests/brevitas/test_brevitas_debug.py +98 -0
  292. finn_plus-1.0.0/tests/brevitas/test_brevitas_deconv.py +82 -0
  293. finn_plus-1.0.0/tests/brevitas/test_brevitas_fc.py +87 -0
  294. finn_plus-1.0.0/tests/brevitas/test_brevitas_mobilenet.py +130 -0
  295. finn_plus-1.0.0/tests/brevitas/test_brevitas_non_scaled_quanthardtanh_export.py +87 -0
  296. finn_plus-1.0.0/tests/brevitas/test_brevitas_qconv2d.py +108 -0
  297. finn_plus-1.0.0/tests/brevitas/test_brevitas_qlinear.py +83 -0
  298. finn_plus-1.0.0/tests/brevitas/test_brevitas_relu_act_export.py +105 -0
  299. finn_plus-1.0.0/tests/brevitas/test_brevitas_scaled_qhardtanh_export.py +123 -0
  300. finn_plus-1.0.0/tests/brevitas/test_brevitas_selu_act_export.py +73 -0
  301. finn_plus-1.0.0/tests/brevitas/test_brevitas_validate_mobilenet.py +214 -0
  302. finn_plus-1.0.0/tests/conftest.py +91 -0
  303. finn_plus-1.0.0/tests/end2end/test_end2end_bnn_pynq.py +824 -0
  304. finn_plus-1.0.0/tests/end2end/test_end2end_cybsec_mlp.py +191 -0
  305. finn_plus-1.0.0/tests/end2end/test_end2end_mobilenet_v1.py +523 -0
  306. finn_plus-1.0.0/tests/end2end/test_ext_weights.py +103 -0
  307. finn_plus-1.0.0/tests/fpgadataflow/test_code_gen_trafo.py +98 -0
  308. finn_plus-1.0.0/tests/fpgadataflow/test_compilation_trafo.py +95 -0
  309. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_1d_conv_layer.py +196 -0
  310. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_channelwise_layer.py +143 -0
  311. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_conv_fc_transition.py +226 -0
  312. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_conv_layer.py +198 -0
  313. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_layers_cnv.py +156 -0
  314. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_layers_fc.py +208 -0
  315. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_layers_synthetic.py +238 -0
  316. finn_plus-1.0.0/tests/fpgadataflow/test_convert_to_hw_pool_batch.py +244 -0
  317. finn_plus-1.0.0/tests/fpgadataflow/test_depthwise_convolution.py +242 -0
  318. finn_plus-1.0.0/tests/fpgadataflow/test_elementwise_binary.py +834 -0
  319. finn_plus-1.0.0/tests/fpgadataflow/test_fifosizing.py +180 -0
  320. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_addstreams.py +147 -0
  321. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_attention.py +537 -0
  322. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_attention_heads.py +411 -0
  323. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_channelwise_ops.py +174 -0
  324. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_checksum.py +228 -0
  325. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_concat.py +176 -0
  326. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_convinputgenerator.py +239 -0
  327. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_convinputgenerator_rtl_dynamic.py +611 -0
  328. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_deconv.py +206 -0
  329. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_downsampler.py +162 -0
  330. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_duplicatestreams.py +159 -0
  331. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_dwc.py +174 -0
  332. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_eltwise.py +143 -0
  333. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_fifo.py +111 -0
  334. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_fmpadding.py +163 -0
  335. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_globalaccpool.py +146 -0
  336. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_ipstitch.py +329 -0
  337. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_labelselect.py +138 -0
  338. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_lookup.py +192 -0
  339. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_mvau.py +817 -0
  340. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_replicate_stream.py +222 -0
  341. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_res_estimate.py +145 -0
  342. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_split.py +151 -0
  343. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_streamingmaxpool.py +182 -0
  344. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_thresholding.py +367 -0
  345. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_thresholding_runtime.py +347 -0
  346. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_upsampler.py +214 -0
  347. finn_plus-1.0.0/tests/fpgadataflow/test_fpgadataflow_vvau.py +474 -0
  348. finn_plus-1.0.0/tests/fpgadataflow/test_minimize_bit_width.py +304 -0
  349. finn_plus-1.0.0/tests/fpgadataflow/test_runtime_weights.py +138 -0
  350. finn_plus-1.0.0/tests/fpgadataflow/test_set_folding.py +136 -0
  351. finn_plus-1.0.0/tests/fpgadataflow/test_split_large_fifos.py +123 -0
  352. finn_plus-1.0.0/tests/fpgadataflow/test_squeeze.py +392 -0
  353. finn_plus-1.0.0/tests/fpgadataflow/test_unsqueeze.py +397 -0
  354. finn_plus-1.0.0/tests/infrastructure/custom_steps.py +2 -0
  355. finn_plus-1.0.0/tests/infrastructure/test_custom_step_resolution.py +32 -0
  356. finn_plus-1.0.0/tests/notebooks/test_jupyter_notebooks.py +110 -0
  357. finn_plus-1.0.0/tests/test_enforce_import_order.py +43 -0
  358. finn_plus-1.0.0/tests/transformation/streamline/test_absorb_mul_into_topk.py +108 -0
  359. finn_plus-1.0.0/tests/transformation/streamline/test_absorb_opposite_transposes.py +81 -0
  360. finn_plus-1.0.0/tests/transformation/streamline/test_absorb_transp_into_flatten.py +100 -0
  361. finn_plus-1.0.0/tests/transformation/streamline/test_collapse_repeated_op.py +132 -0
  362. finn_plus-1.0.0/tests/transformation/streamline/test_factor_out_mul_sign_magnitude.py +61 -0
  363. finn_plus-1.0.0/tests/transformation/streamline/test_maxpool_nhwc.py +97 -0
  364. finn_plus-1.0.0/tests/transformation/streamline/test_move_add_past_mul.py +150 -0
  365. finn_plus-1.0.0/tests/transformation/streamline/test_move_chw_add_past_conv.py +107 -0
  366. finn_plus-1.0.0/tests/transformation/streamline/test_move_flatten_past_affine.py +108 -0
  367. finn_plus-1.0.0/tests/transformation/streamline/test_move_flatten_past_topk.py +94 -0
  368. finn_plus-1.0.0/tests/transformation/streamline/test_move_identical_op_past_join_add.py +150 -0
  369. finn_plus-1.0.0/tests/transformation/streamline/test_move_identical_op_past_join_concat.py +183 -0
  370. finn_plus-1.0.0/tests/transformation/streamline/test_move_identical_op_past_split.py +142 -0
  371. finn_plus-1.0.0/tests/transformation/streamline/test_move_maxpool_past_multithreshold.py +125 -0
  372. finn_plus-1.0.0/tests/transformation/streamline/test_move_mul_past_dw_conv.py +118 -0
  373. finn_plus-1.0.0/tests/transformation/streamline/test_move_mul_past_maxpool.py +116 -0
  374. finn_plus-1.0.0/tests/transformation/streamline/test_move_past_fork.py +133 -0
  375. finn_plus-1.0.0/tests/transformation/streamline/test_move_scalar_past_conv.py +196 -0
  376. finn_plus-1.0.0/tests/transformation/streamline/test_move_scalar_past_convtranspose.py +106 -0
  377. finn_plus-1.0.0/tests/transformation/streamline/test_move_scalar_past_matmul.py +190 -0
  378. finn_plus-1.0.0/tests/transformation/streamline/test_move_transpose_past_scalar_mul.py +113 -0
  379. finn_plus-1.0.0/tests/transformation/streamline/test_round_thresholds.py +270 -0
  380. finn_plus-1.0.0/tests/transformation/streamline/test_scale_resize_nhwc.py +376 -0
  381. finn_plus-1.0.0/tests/transformation/streamline/test_sign_to_thres.py +66 -0
  382. finn_plus-1.0.0/tests/transformation/streamline/test_streamline_cnv.py +99 -0
  383. finn_plus-1.0.0/tests/transformation/streamline/test_streamline_fc.py +96 -0
  384. finn_plus-1.0.0/tests/transformation/test_batchnorm_to_affine_bnn_pynq.py +95 -0
  385. finn_plus-1.0.0/tests/transformation/test_infer_data_layouts_cnv.py +124 -0
  386. finn_plus-1.0.0/tests/transformation/test_infer_datatypes_lfc.py +68 -0
  387. finn_plus-1.0.0/tests/transformation/test_qonnx_to_finn.py +141 -0
  388. finn_plus-1.0.0/tests/util/test_build_dataflow.py +79 -0
  389. finn_plus-1.0.0/tests/util/test_create.py +67 -0
  390. finn_plus-1.0.0/tests/util/test_data_packing.py +183 -0
  391. finn_plus-1.0.0/tests/util/test_hls_vector.py +118 -0
@@ -0,0 +1,40 @@
1
+ ============
2
+ Contributors
3
+ ============
4
+
5
+ * Felix Jentzsch (@fpjentzsch) (FINN+ maintainer)
6
+ * Christoph Berganski (@iksnagreb) (FINN+ maintainer)
7
+ * Linus Jungemann (@LinusJungemann) (FINN+ maintainer)
8
+ * Bjarne Wintermann (@bwintermann) (FINN+ maintainer)
9
+ * Jakoba Petri-Koenig (@auphelia) (FINN maintainer)
10
+ * Thomas Preusser (@preusser)
11
+ * Yaman Umuroglu (@maltanar)
12
+ * Andrea Rigoni (@AndreaRigoni)
13
+ * Hendrik Borras (@HenniOVP)
14
+ * Lucian Petrica (@quetric)
15
+ * Tobias Alonso (@Tobi-Alonso)
16
+ * Mirza Mrahorovic (@mmrahorovic)
17
+ * Suranga Mahesh (@surangamh)
18
+ * Peter Lehnhardt (@pete-lennart)
19
+ * Neil Kim Nielsen (@neilkimn)
20
+ * Jon Ander Lezeta (@jalezeta)
21
+ * John Terry (@jterry-x)
22
+ * Alina Vasilciuc (@alinavalinav)
23
+ * Alessandro Pappalardo (@volcacius)
24
+ * Giuseppe Franco (@Giuseppe5)
25
+ * Syed Asad Alam (@asadalam)
26
+ * Javier Duarte (@jmduarte)
27
+ * Uma Maheshwari (@umav1511)
28
+ * José Rosa (@pinxau1000)
29
+ * Aziz Bahri (@azizb-xlnx)
30
+ * Fionn O'Donohoe (@fionnodonohoe-xlnx)
31
+ * Matthias Gehre (@mgehre-amd)
32
+ * Hugo Le Blevec (@hleblevec)
33
+ * Patrick Geel (@patrickgeel)
34
+ * John Monks (@jmonks-amd)
35
+ * Tim Paine (@timkpaine)
36
+ * Shashwat Khandelwal (@shashwat1198)
37
+ * Ian Colbert (@i-colbert)
38
+ * Rachit Garg (@rstar900)
39
+ * Jonas Kuehle (@vopade)
40
+ * Aditya S (@Adityasrinivas24)
@@ -0,0 +1,33 @@
1
+ Copyright for portions of project FINN+ is held by AMD as part of project FINN
2
+ and is provided under the BSD license. All other copyright for project FINN+
3
+ is held by Paderborn University and is provided under the same license.
4
+
5
+ Copyright (C) 2020-2022, Xilinx, Inc.
6
+ Copyright (C) 2022-2025, Advanced Micro Devices, Inc.
7
+ Copyright (C) 2025, Paderborn University
8
+ All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ * Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ * Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ * Neither the name of FINN/FINN+ nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.3
2
+ Name: finn-plus
3
+ Version: 1.0.0
4
+ Summary: Fork of FINN, a QNN dataflow compiler for AMD/Xilinx FPGAs
5
+ Maintainer: Felix Jentzsch
6
+ Maintainer-email: felix.jentzsch@upb.de
7
+ Requires-Python: >=3.10,<3.12
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Requires-Dist: bitstring (==3.1.7)
12
+ Requires-Dist: click (>=8.1.8,<9.0.0)
13
+ Requires-Dist: clize (==5.0.1)
14
+ Requires-Dist: deap (==1.3.1)
15
+ Requires-Dist: dependencies (==2.0.1)
16
+ Requires-Dist: dvc[webdav] (==3.59.1)
17
+ Requires-Dist: dvclive[image] (==3.48.2)
18
+ Requires-Dist: future-annotations (==1.0.0)
19
+ Requires-Dist: gspread (==3.6.0)
20
+ Requires-Dist: importlib-resources (==6.1.0)
21
+ Requires-Dist: ipykernel (==6.21.2)
22
+ Requires-Dist: ipython (==8.12.2)
23
+ Requires-Dist: jupyter (==1.0.0)
24
+ Requires-Dist: markupsafe (==2.0.1)
25
+ Requires-Dist: mashumaro[yaml] (>=3.15,<4.0)
26
+ Requires-Dist: matplotlib (==3.7.0)
27
+ Requires-Dist: mip (==1.13.0)
28
+ Requires-Dist: netron (>5.0.0)
29
+ Requires-Dist: networkx (==2.8)
30
+ Requires-Dist: numpy (==1.24.1)
31
+ Requires-Dist: onnx (==1.17.0)
32
+ Requires-Dist: onnxoptimizer (>=0.3.13,<0.4.0)
33
+ Requires-Dist: onnxruntime (==1.18.1)
34
+ Requires-Dist: pandas (==1.5.3)
35
+ Requires-Dist: pre-commit (==3.3.2)
36
+ Requires-Dist: protobuf (==3.20.3)
37
+ Requires-Dist: psutil (==5.9.4)
38
+ Requires-Dist: pygments (==2.14.0)
39
+ Requires-Dist: pyscaffold (==4.6)
40
+ Requires-Dist: pytest (==8.3.4)
41
+ Requires-Dist: pytest-cov (==6.0.0)
42
+ Requires-Dist: pytest-dependency (==0.6.0)
43
+ Requires-Dist: pytest-forked (==1.6.0)
44
+ Requires-Dist: pytest-html (==4.1.1)
45
+ Requires-Dist: pytest-html-merger (==0.1.0)
46
+ Requires-Dist: pytest-metadata (==3.1.1)
47
+ Requires-Dist: pytest-parallel (==0.1.1)
48
+ Requires-Dist: pytest-rerunfailures (==15.0)
49
+ Requires-Dist: pytest-xdist[setproctitle] (==3.6.1)
50
+ Requires-Dist: pyyaml (==6.0.1)
51
+ Requires-Dist: rich (>=13.9.4,<14.0.0)
52
+ Requires-Dist: scikit-learn (==1.2.1)
53
+ Requires-Dist: scipy (==1.10.1)
54
+ Requires-Dist: setupext-janitor (>=1.1.2,<2.0.0)
55
+ Requires-Dist: setuptools (>40.8.0)
56
+ Requires-Dist: sigtools (==4.0.1)
57
+ Requires-Dist: tclwrapper (==0.0.1)
58
+ Requires-Dist: termcolor (>=2.5.0,<3.0.0)
59
+ Requires-Dist: tokenize-rt (==4.2.1)
60
+ Requires-Dist: toposort (==1.7.0)
61
+ Requires-Dist: torch (==2.6.0)
62
+ Requires-Dist: torchvision (==0.21.0)
63
+ Requires-Dist: tqdm (==4.64.1)
64
+ Requires-Dist: vcdvcd (==1.0.5)
65
+ Requires-Dist: wget (==3.2)
66
+ Project-URL: EKI Project, https://www.eki-project.tech/
67
+ Project-URL: GitHub, https://github.com/eki-project/finn-plus
68
+ Description-Content-Type: text/markdown
69
+
70
+ <img src=https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/finn-plus_logo.png width=196/>
71
+
72
+ # Dataflow Compiler for Fast, Scalable Quantized Neural Network Inference on FPGAs
73
+
74
+ **FINN+** is a fork of **FINN**, an experimental framework from the Integrated Communications and AI Lab of AMD Research & Advanced Development to explore deep neural network inference on FPGAs.
75
+ It specifically targets quantized neural networks, with emphasis on generating dataflow-style architectures customized for each network.
76
+ The resulting FPGA accelerators are highly efficient and can yield high throughput and low latency.
77
+ The framework is fully open-source in order to give a higher degree of flexibility, and is intended to enable neural network research spanning several layers of the software/hardware abstraction stack.
78
+
79
+ **To get an overview of how FINN+ is used, take a look at the Getting Started section below!**
80
+
81
+ **While our [Wiki](https://github.com/eki-project/finn-plus/wiki) is under construction, we refer to the original [FINN homepage](https://xilinx.github.io/finn/) for further information.**
82
+
83
+ ## FINN+ Extensions
84
+ **FINN+** aims to incorporate all development from the upstream repository (dev branch) while extending **FINN** in all directions, including the following list of features that are either in progress or already completed:
85
+ - Transformer/Attention support
86
+ - Improved streamlining
87
+ - Improved automatic folding and FIFO-sizing
88
+ - Empirical quality-of-result (QoR) estimation
89
+ - Back-end extensions
90
+ - Instrumentation for accurate performance profiling in simulation and on hardware
91
+ - Improved Alveo build flow
92
+ - Multi-FPGA support
93
+ - Optimized C++ driver
94
+ - Quality-of-live improvements
95
+ - Better logging and error handling
96
+ - Type hinting/checking
97
+ - Alternative YAML-based build configuration
98
+ - Containerless setup
99
+
100
+ Please refer to our [**Feature Tracker**](https://github.com/orgs/eki-project/projects/1) for the current status of individual features.
101
+ While some items are already on-track to be merged into the upstream repository, we try to merge them into the **FINN+** dev branch as early as possible to increase development pace and drive our research forward.
102
+
103
+ ## Getting Started
104
+ This is a quick overview of how to get started, for additional information please refer to our [**Wiki**](https://github.com/eki-project/finn-plus/wiki)!
105
+
106
+ ### Requirements
107
+ The primary dependencies currently are:
108
+ - Python >= 3.10 (< 3.12)
109
+ - Vivado, Vitis, Vitis HLS (2022.2 or 2024.2)
110
+ - Some basic system-level packages, refer to the [**dependency installation script**](https://github.com/eki-project/finn-plus/blob/main/installDependencies.sh)
111
+
112
+ ### Installing via pip
113
+ After preparing the dependencies mentioned above, simply run the following to start a build flow:
114
+ ```
115
+ # Make sure to create a fresh virtual environment for FINN+
116
+ pip install finn-plus # Install FINN+ and its Python dependencies via pip
117
+ finn deps update # Ensure FINN+ pulled all further dependencies (this might update packages in your venv!)
118
+ finn build build_config.yaml # Run a FINN+ build defined in a YAML file
119
+ ```
120
+
121
+ ### Installing from the repository
122
+ To install directly from the repository, you'll need Poetry (>= 2.0) for dependency management. After cloning the repo and setting up the system-level dependencies, run the following to start a build flow:
123
+ ```
124
+ cd finn-plus
125
+ poetry install # Install Python packages into a Poetry-managed virtual environment
126
+ source <your-poetry-venv> # Use "poetry env info" to find the path to your Poetry venv. For further information visit the Poetry documentation
127
+ finn config create # Create a default configuration in ~/.finn/settings.yaml. Optional but recommended
128
+ finn deps update # Ensure FINN+ pulled all further dependencies (this might update packages in your venv!)
129
+ finn build build_config.yaml # Run a FINN+ build defined in a YAML file
130
+ ```
131
+
132
+ ## About Us
133
+ FINN+ is maintained by researchers from the [Computer Engineering Group](https://en.cs.uni-paderborn.de/ceg) (CEG) and [Paderborn Center for Parallel Computing](https://pc2.uni-paderborn.de/) (PC²) at Paderborn University, Germany as part of the [eki research project](https://www.eki-project.tech/).
134
+
135
+ <p align="left">
136
+ <a href="https://en.cs.uni-paderborn.de/ceg"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/UPB_Logo_ENG_coloured_RGB.jpg" alt="logo" style="margin-right: 20px" width="250"/></a>
137
+ <a href="https://pc2.uni-paderborn.de/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/PC2_logo.png" alt="logo" style="margin-right: 20px" width="250"/></a>
138
+ </p>
139
+
140
+ <p align="left">
141
+ <a href="https://www.eki-project.tech/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/eki-RGB-EN-s.png" alt="logo" style="margin-right: 20px" width="250"/></a>
142
+ <a href="https://www.bmuv.de/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/BMUV_Fz_2021_Office_Farbe_en.png" alt="logo" style="margin-right: 20px" width="250"/></a>
143
+ </p>
144
+
@@ -0,0 +1,74 @@
1
+ <img src=https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/finn-plus_logo.png width=196/>
2
+
3
+ # Dataflow Compiler for Fast, Scalable Quantized Neural Network Inference on FPGAs
4
+
5
+ **FINN+** is a fork of **FINN**, an experimental framework from the Integrated Communications and AI Lab of AMD Research & Advanced Development to explore deep neural network inference on FPGAs.
6
+ It specifically targets quantized neural networks, with emphasis on generating dataflow-style architectures customized for each network.
7
+ The resulting FPGA accelerators are highly efficient and can yield high throughput and low latency.
8
+ The framework is fully open-source in order to give a higher degree of flexibility, and is intended to enable neural network research spanning several layers of the software/hardware abstraction stack.
9
+
10
+ **To get an overview of how FINN+ is used, take a look at the Getting Started section below!**
11
+
12
+ **While our [Wiki](https://github.com/eki-project/finn-plus/wiki) is under construction, we refer to the original [FINN homepage](https://xilinx.github.io/finn/) for further information.**
13
+
14
+ ## FINN+ Extensions
15
+ **FINN+** aims to incorporate all development from the upstream repository (dev branch) while extending **FINN** in all directions, including the following list of features that are either in progress or already completed:
16
+ - Transformer/Attention support
17
+ - Improved streamlining
18
+ - Improved automatic folding and FIFO-sizing
19
+ - Empirical quality-of-result (QoR) estimation
20
+ - Back-end extensions
21
+ - Instrumentation for accurate performance profiling in simulation and on hardware
22
+ - Improved Alveo build flow
23
+ - Multi-FPGA support
24
+ - Optimized C++ driver
25
+ - Quality-of-live improvements
26
+ - Better logging and error handling
27
+ - Type hinting/checking
28
+ - Alternative YAML-based build configuration
29
+ - Containerless setup
30
+
31
+ Please refer to our [**Feature Tracker**](https://github.com/orgs/eki-project/projects/1) for the current status of individual features.
32
+ While some items are already on-track to be merged into the upstream repository, we try to merge them into the **FINN+** dev branch as early as possible to increase development pace and drive our research forward.
33
+
34
+ ## Getting Started
35
+ This is a quick overview of how to get started, for additional information please refer to our [**Wiki**](https://github.com/eki-project/finn-plus/wiki)!
36
+
37
+ ### Requirements
38
+ The primary dependencies currently are:
39
+ - Python >= 3.10 (< 3.12)
40
+ - Vivado, Vitis, Vitis HLS (2022.2 or 2024.2)
41
+ - Some basic system-level packages, refer to the [**dependency installation script**](https://github.com/eki-project/finn-plus/blob/main/installDependencies.sh)
42
+
43
+ ### Installing via pip
44
+ After preparing the dependencies mentioned above, simply run the following to start a build flow:
45
+ ```
46
+ # Make sure to create a fresh virtual environment for FINN+
47
+ pip install finn-plus # Install FINN+ and its Python dependencies via pip
48
+ finn deps update # Ensure FINN+ pulled all further dependencies (this might update packages in your venv!)
49
+ finn build build_config.yaml # Run a FINN+ build defined in a YAML file
50
+ ```
51
+
52
+ ### Installing from the repository
53
+ To install directly from the repository, you'll need Poetry (>= 2.0) for dependency management. After cloning the repo and setting up the system-level dependencies, run the following to start a build flow:
54
+ ```
55
+ cd finn-plus
56
+ poetry install # Install Python packages into a Poetry-managed virtual environment
57
+ source <your-poetry-venv> # Use "poetry env info" to find the path to your Poetry venv. For further information visit the Poetry documentation
58
+ finn config create # Create a default configuration in ~/.finn/settings.yaml. Optional but recommended
59
+ finn deps update # Ensure FINN+ pulled all further dependencies (this might update packages in your venv!)
60
+ finn build build_config.yaml # Run a FINN+ build defined in a YAML file
61
+ ```
62
+
63
+ ## About Us
64
+ FINN+ is maintained by researchers from the [Computer Engineering Group](https://en.cs.uni-paderborn.de/ceg) (CEG) and [Paderborn Center for Parallel Computing](https://pc2.uni-paderborn.de/) (PC²) at Paderborn University, Germany as part of the [eki research project](https://www.eki-project.tech/).
65
+
66
+ <p align="left">
67
+ <a href="https://en.cs.uni-paderborn.de/ceg"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/UPB_Logo_ENG_coloured_RGB.jpg" alt="logo" style="margin-right: 20px" width="250"/></a>
68
+ <a href="https://pc2.uni-paderborn.de/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/PC2_logo.png" alt="logo" style="margin-right: 20px" width="250"/></a>
69
+ </p>
70
+
71
+ <p align="left">
72
+ <a href="https://www.eki-project.tech/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/eki-RGB-EN-s.png" alt="logo" style="margin-right: 20px" width="250"/></a>
73
+ <a href="https://www.bmuv.de/"><img align="top" src="https://cs.uni-paderborn.de/fileadmin-eim/informatik/fg/ce/MiscImages/BMUV_Fz_2021_Office_Farbe_en.png" alt="logo" style="margin-right: 20px" width="250"/></a>
74
+ </p>
File without changes
@@ -0,0 +1,36 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2022, Xilinx, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice,
9
+ * this list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26
+ * OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @brief Validation top-level module for checksum component.
32
+ * @author Thomas B. Preußer <tpreusse@amd.com>
33
+ *
34
+ *******************************************************************************/
35
+ #include "checksum.hpp"
36
+ CHECKSUM_TOP(WORDS_PER_FRAME, WORD_SIZE, ITEMS_PER_WORD)
@@ -0,0 +1,134 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2022, Xilinx, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice,
9
+ * this list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26
+ * OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @brief Checksum over stream-carried data frames.
32
+ * @author Thomas B. Preußer <tpreusse@amd.com>
33
+ *
34
+ *******************************************************************************/
35
+ #include <hls_stream.h>
36
+ #include <ap_int.h>
37
+
38
+
39
+ /**
40
+ * Computes a checksum over a forwarded stream assumed to carry frames of
41
+ * N words further subdivided into K subwords.
42
+ * - Subword slicing can be customized typically by using a lambda.
43
+ * The provided DefaultSubwordSlicer assumes an `ap_(u)int`-like word
44
+ * type with a member `width` and a range-based slicing operator. It
45
+ * further assumes a little-endian arrangement of subwords within words
46
+ * for the canonical subword stream order.
47
+ * - Subwords wider than 23 bits are folded using bitwise XOR across
48
+ * slices of 23 bits starting from the LSB.
49
+ * - The folded subword values are weighted according to their position
50
+ * in the stream relative to the start of frame by a periodic weight
51
+ * sequence 1, 2, 3, ...
52
+ * - The weighted folded subword values are reduced to a checksum by an
53
+ * accumulation module 2^24.
54
+ * - A checksum is emitted for each completed frame. It is the concatenation
55
+ * of an 8-bit (modulo 256) frame counter and the 24-bit frame checksum.
56
+ */
57
+ template<typename T, unsigned K> class DefaultSubwordSlicer {
58
+ static_assert(T::width%K == 0, "Word size must be subword multiple.");
59
+ static constexpr unsigned W = T::width/K;
60
+ public:
61
+ ap_uint<W> operator()(T const &x, unsigned const j) const {
62
+ #pragma HLS inline
63
+ return x((j+1)*W-1, j*W);
64
+ }
65
+ };
66
+
67
+ template<
68
+ unsigned N, // number of data words in a frame
69
+ unsigned K, // subword count per data word
70
+ typename T, // type of stream-carried data words
71
+ typename F = DefaultSubwordSlicer<T, K> // f(T(), j) to extract subwords
72
+ >
73
+ void checksum(
74
+ hls::stream<T> &src,
75
+ hls::stream<T> &dst,
76
+ ap_uint<32> &chk,
77
+ ap_uint<1> drain, // drain data after checksuming without forward to `dst`
78
+ F&& f = F()
79
+ ) {
80
+ ap_uint<2> coeff[3] = { 1, 2, 3 };
81
+ ap_uint<24> s = 0;
82
+
83
+ for(unsigned i = 0; i < N; i++) {
84
+ #pragma HLS pipeline II=1 style=flp
85
+ T const x = src.read();
86
+
87
+ // Pass-thru copy
88
+ if(!drain) dst.write(x);
89
+
90
+ // Actual checksum update
91
+ for(unsigned j = 0; j < K; j++) {
92
+ #pragma HLS unroll
93
+ auto const v0 = f(x, j);
94
+ constexpr unsigned W = 1 + (decltype(v0)::width-1)/23;
95
+ ap_uint<K*23> v = v0;
96
+ ap_uint< 23> w = 0;
97
+ for(unsigned k = 0; k < W; k++) {
98
+ w ^= v(23*k+22, 23*k);
99
+ }
100
+ s += (coeff[j%3][1]? (w, ap_uint<1>(0)) : ap_uint<24>(0)) + (coeff[j%3][0]? w : ap_uint<23>(0));
101
+ }
102
+
103
+ // Re-align coefficients
104
+ for(unsigned j = 0; j < 3; j++) {
105
+ #pragma HLS unroll
106
+ ap_uint<3> const cc = coeff[j] + ap_uint<3>(K%3);
107
+ coeff[j] = cc(1, 0) + cc[2];
108
+ }
109
+ }
110
+
111
+ // Frame counter & output
112
+ static ap_uint<8> cnt = 0;
113
+ #pragma HLS reset variable=cnt
114
+ chk = (cnt++, s);
115
+ }
116
+
117
+ #define CHECKSUM_TOP_(WORDS_PER_FRAME, WORD_SIZE, ITEMS_PER_WORD) \
118
+ using T = ap_uint<WORD_SIZE>; \
119
+ void checksum_ ## WORDS_PER_FRAME ## _ ## WORD_SIZE ## _ ## ITEMS_PER_WORD ( \
120
+ hls::stream<T> &src, \
121
+ hls::stream<T> &dst, \
122
+ ap_uint<32> &chk, \
123
+ ap_uint< 1> drain \
124
+ ) { \
125
+ _Pragma("HLS interface port=src axis") \
126
+ _Pragma("HLS interface port=dst axis") \
127
+ _Pragma("HLS interface port=chk s_axilite") \
128
+ _Pragma("HLS interface port=drain s_axilite") \
129
+ _Pragma("HLS interface port=return ap_ctrl_none") \
130
+ _Pragma("HLS dataflow disable_start_propagation") \
131
+ checksum<WORDS_PER_FRAME, ITEMS_PER_WORD>(src, dst, chk, drain); \
132
+ }
133
+ #define CHECKSUM_TOP(WORDS_PER_FRAME, WORD_SIZE, ITEMS_PER_WORD) \
134
+ CHECKSUM_TOP_(WORDS_PER_FRAME, WORD_SIZE, ITEMS_PER_WORD)
@@ -0,0 +1,136 @@
1
+ /******************************************************************************
2
+ * Copyright (c) 2022, Xilinx, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice,
9
+ * this list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26
+ * OR BUSINESS INTERRUPTION). HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ *
31
+ * @brief Testbench for checksum component.
32
+ * @author Thomas B. Preußer <tpreusse@amd.com>
33
+ *
34
+ *******************************************************************************/
35
+ module checksum_tb;
36
+
37
+ //-----------------------------------------------------------------------
38
+ // Global Control
39
+ logic clk = 0;
40
+ always #5ns clk = !clk;
41
+ logic rst;
42
+
43
+ //-----------------------------------------------------------------------
44
+ // DUT
45
+ localparam int unsigned N = 60; // words per frame
46
+ localparam int unsigned K = 4; // subwords per word
47
+ localparam int unsigned W = 8; // subword size
48
+
49
+ logic [K-1:0][W-1:0] src_TDATA;
50
+ logic src_TVALID;
51
+ uwire src_TREADY;
52
+
53
+ uwire [K-1:0][W-1:0] dst_TDATA;
54
+ uwire dst_TVALID;
55
+ logic dst_TREADY;
56
+
57
+ uwire [31:0] chk;
58
+ uwire chk_vld;
59
+
60
+ checksum_top dut (
61
+ .ap_clk(clk), .ap_rst_n(!rst),
62
+ .src_TDATA, .src_TVALID, .src_TREADY,
63
+ .dst_TDATA, .dst_TVALID, .dst_TREADY,
64
+ .chk, .chk_ap_vld(chk_vld),
65
+ .ap_local_block(), .ap_local_deadlock()
66
+ );
67
+
68
+ //-----------------------------------------------------------------------
69
+ // Stimulus
70
+ logic [K-1:0][W-1:0] Bypass [$] = {};
71
+ logic [31:0] Checksum[$] = {};
72
+ initial begin
73
+ src_TDATA = 'x;
74
+ src_TVALID = 0;
75
+
76
+ rst = 1;
77
+ repeat(9) @(posedge clk);
78
+ rst <= 0;
79
+
80
+ for(int unsigned r = 0; r < 311; r++) begin
81
+ automatic logic [23:0] sum = 0;
82
+ src_TVALID <= 1;
83
+ for(int unsigned i = 0; i < N; i++) begin
84
+ for(int unsigned k = 0; k < K; k++) begin
85
+ automatic logic [W-1:0] v = $urandom()>>17;
86
+ src_TDATA[k] <= v;
87
+ sum += ((K*i+k)%3 + 1) * v;
88
+ end
89
+ @(posedge clk iff src_TREADY);
90
+ Bypass.push_back(src_TDATA);
91
+ end
92
+ src_TVALID <= 0;
93
+ $display("Expect: %02x:%06x", r[7:0], sum);
94
+ Checksum.push_back({r, sum});
95
+ end
96
+
97
+ repeat(8) @(posedge clk);
98
+ $finish;
99
+ end
100
+
101
+ //-----------------------------------------------------------------------
102
+ // Output Validation
103
+
104
+ // Drain and check pass-thru stream
105
+ assign dst_TREADY = 1;
106
+ always_ff @(posedge clk iff dst_TVALID) begin
107
+ assert(Bypass.size()) begin
108
+ automatic logic [K-1:0][W-1:0] exp = Bypass.pop_front();
109
+ assert(dst_TDATA === exp) else begin
110
+ $error("Unexpected output %0x instead of %0x.", dst_TDATA, exp);
111
+ $stop;
112
+ end
113
+ end
114
+ else begin
115
+ $error("Spurious data output.");
116
+ $stop;
117
+ end
118
+ end
119
+
120
+ // Validate checksum reports
121
+ always_ff @(posedge clk iff chk_vld) begin
122
+ $display("Check: %02x:%06x", chk[31:24], chk[23:0]);
123
+ assert(Checksum.size()) begin
124
+ automatic logic [31:0] exp = Checksum.pop_front();
125
+ assert(chk === exp) else begin
126
+ $error("Unexpected checksum %0x instead of %0x.", chk, exp);
127
+ $stop;
128
+ end
129
+ end
130
+ else begin
131
+ $error("Spurious checksum output.");
132
+ $stop;
133
+ end
134
+ end
135
+
136
+ endmodule : checksum_tb