0
\$\begingroup\$

I have a piece of code that mainly consists of matrix-matrix and matrix-vector multiplications, but has other operations too. I have written my code in both Python and C and would like to map it to an Intel FPGA.

What I currently do is that I write a Verilog code that implements the same Python/C code and instantiates as many multipliers and adders as it is required to perform all operations in parallel. Obviously, this is not a scalable solution because when the size of matrices becomes large, all device resources will be exhausted quickly. As a result, there should be something like high-level synthesis that schedules these operations in different cycles.

Since I have not worked on such large designs before, I'm not sure what the best way is to go from a Python/C code to a code that includes the required datapath and controller for FPGA implementation.

Should I use a high-level synthesis tool that converts my C code to a Verilog code or there are better/easier solutions?

\$\endgroup\$
  • 1
    \$\begingroup\$ Use the FPGA for the parallelizable algorithms, and the CPU for the rest. \$\endgroup\$ – Ignacio Vazquez-Abrams May 6 '18 at 3:19
  • \$\begingroup\$ @IgnacioVazquez-Abrams the parallelizable algorithms need more resources than I have on my board, so I should somehow schedule them in different cycles. \$\endgroup\$ – Mahdi May 6 '18 at 3:44
  • 5
    \$\begingroup\$ Well, you can't just throw a pile of C at an HLS tool and expect it to do something sensible. You'll almost certainly have to rewrite your code from scratch with HLS in mind. And HLS tools aren't magic, they might not do a very good job with scheduling. If you have to do some complex scheduling to share resources across clock cycles, you might have to go back to the drawing board with the high-level architecture and perhaps build something similar to a special-purpose processor. Or perhaps write some code to generate HDL with the pipelining you need. \$\endgroup\$ – alex.forencich May 6 '18 at 3:49
  • \$\begingroup\$ I would use myhdl \$\endgroup\$ – JonRB May 6 '18 at 8:08
  • \$\begingroup\$ This is like saying how you would build a factory that would build an iPhone given someone's review of the phone--you can't do that. \$\endgroup\$ – hatsunearu May 6 '18 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.