Electronic – When developing an algorithm for FPGA, should I be aware of amount of logic blocks (and other FPGA-specific properties)

fpgaverilogvhdl

I want to see how certain algorithm would fit FPGA architecture and plan to implement it with HLS tool like CλaSH which produces VHDL/Verilog. All I know about FPGAs so far is it's an array of interconnected logic blocks. So I wonder how can I ensure it's gonna be possible at all since every code construct consumes a certain amount of logic blocks of FPGA and it simply might not have enough of it?

For example when developing an algorithm for CPU prior to even trying to run it you need to ensure that it will have enough memory to load the code. It's never the problem with modern PCs anymore but it's very tight with FPGAs, right?

Is there a way to determine how much logic blocks an implementation requires prior to running it (… purchasing a dev board)? Are there any other considerations needed to be accounted for like logic blocks array width/length (which determine the flow parallelism?), etc?

Best Answer

Your question is rather broad.

To start with: the good new is that you don't need to buy an FPGA board to find out how big your design is. The development tool will tell you. It will also tell you if you exceed the number of resources (Memories, LUTs, Registers, DSPs or I/O pins.) If it does not fit, you select a bigger FPGA in the tool setting, until you get to the really BIG ones you probably can't afford because they are e.g. $15000 each.

The second good new is that most FPGA development tools are free, at least for the smaller FPGAs. And 'small' is still rather big.

The not-so-good new is that HLS is still in development. We ran some tests and they still markedly under-perform compared to Verilog or VHDL. But for just comparing algorithms they are probably good enough.

Now as to "flow, parallelism" you get into difficult areas. The more logic in parallel or more pipeline stages the faster the algorithm will run. But also the resources utilization (area) will go up. It is one of the many tasks of an HDL designer to try to find a balance between speed and area.

Getting to "array width/length". That is the fastest way I found to fill an FPGA. I recently designed code for convolution matrices. It was a module which had the matrix width/height as parameters. With little trouble I managed to fill 60% of the FPGA with that module alone (It was supposed to use 15%).

Related Topic