News for hackers. Stuff that matters.
Re:Parallel Programming for FPGAs by moring on Tuesday August 02, 2022 @01:07AM (#32315316)
Slightly off-topic: I see lots of learning resources for FPGAs appearing that explain how to "think parallel", but are there good resources that explain how to deal with practical problems such as badly-documented primitives (looking at you, ECP5) or how to debug a non-working design (1), or how to find what causes the synthesis tool to segfault?

1 involving multiple primitives and you can't attach a signal logger to the signal between them because the FPGA doesn't have a path there to use.

The situation somewhat reminds me of the earlier LaTeX days when every tutorial started with "I'm assuming you have already installed LaTeX" as if that wasn't the biggest problem for most users, and then continues explaining the easy stuff that you can easily learn by trial and error.

Re:Parallel Programming for FPGAs by krapht on Tuesday August 02, 2022 @08:44AM (#32317779)
You're not gonna like this answer but every time I've had some issue like that at work the answer is: file a ticket with your local Xilinx field applications engineer.

Are you a hobbyist? Ha, have fun. Digging through the Xilinx forums is also productive.

Edit: I see you're strictly working with only free/open source tooling. I commend your patience. I also don't see the point. It's not the right choice for either learning or getting things done at the current moment.

Re:Parallel Programming for FPGAs by moring on Wednesday August 03, 2022 @02:56AM (#32328481)
> Edit: I see you're strictly working with only free/open source tooling. I commend your patience. I also don't see the point. It's not the right choice for either learning or getting things done at the current moment.

A bit late, but my original point was that so many of the tutorials appearing these days that claim to explain FPGA development, especially to people with a software background, don't deal with the practical problems that a SW dev has with FPGA development.

BTW this doesn't only apply to the open toolchain. The segfault problem specifically appeared with closed tools from the FPGA vendor. From a SW dev experience this is definitely new territory because things like javac, tsc, React, Hibernate, and log4j don't segfault if you look at them the wrong way, and even if they did, you can look at the source code and find what is causing the problem. None of this is possible with a closed, vendor-specific synthesis tool nor with a blackbox FPGA primitive with close to no documentation, and while it is often suggested that "FPGA development is hard because you have to think parallel", none of this is even remotely related to that.

Re:Parallel Programming for FPGAs by misnome on Tuesday August 02, 2022 @09:05AM (#32317981)
> You're not gonna like this answer but every time I've had some issue like that at work the answer is: file a ticket with your local Xilinx field applications engineer.

Basically this. I've been using the Intel OneAPI tools to write for their FPGA's in SYCL, and seem to have run into a large number of fundamental bugs (including plain routing errors) that makes me wonder how many other people are actually using the tools.

Re:Parallel Programming for FPGAs by AlteraThrowaway on Tuesday August 02, 2022 @12:07PM (#32320513)
It's not so much that no one is using it. It's more that the only people who are using it have dedicated engineers in the compiler team developing the tool who will dig through the compiler and figure out/fix bugs. Literally even within Intel, internal customers would have to fund head count in the compiler team in order to have a dedicated engineer who could support them in figuring out how to tailor their code for the compiler or fix the compiler to work with their code. And since that process involves hand-hacking the compiler it introduces far more bugs than it fixes.
Re:Parallel Programming for FPGAs by krapht on Tuesday August 02, 2022 @10:01AM (#32318569)
Well, now you know the answer is almost nobody :).

Xilinx and Altera have been promising efficient high level C++/openCL/CUDA -> FPGA compilation for decades now and almost everybody I know has been burnt by it at work, so thanks for confirming my bias, I'll avoid OneAPI too for the present. Guess VHDL and Verilog and the old standard tooling will live for another 10 years.

Everything is always amazing for the first 80% but the last 20% is impossible to fix and you end up not saving any dev time at all.

Re:Parallel Programming for FPGAs by misnome on Tuesday August 02, 2022 @01:09PM (#32321434)
> I'll avoid OneAPI too for the present.

I wouldn't write it off _completely_, for everyone. Compiler bugs notwithstanding, it seems to work reasonably well if you don't mind extremely long compiler cycles for running on the hardware. It gives you pretty reasonable emulation tooling to work out how well it runs, whether things are pipelined and, efficient if you know what you are looking at - but it doesn't seem to save you actually having to learn how the FPGAs work and model data flow.

Of course, you are also beholden on drivers/adaptors being written to actually be able to use them.... which at this point is two chipsets, the newer of which has just been deprecated. Evaluating Xilinx HLS is next on my list, at least it seems to have the benefit of being around for much longer, and we have collaborators who have had success with the tooling.

Re:Parallel Programming for FPGAs by dayjaby on Tuesday August 02, 2022 @01:54AM (#32315563)
> how to debug a non-working design

In LiteX, an open source toolset for making FPGA designs, you can embed an oscilloscope into your FPGA: https://github.com/enjoy-digital/litex/wiki/Use-LiteScope-To...

Re:Parallel Programming for FPGAs by moring on Tuesday August 02, 2022 @02:04AM (#32315614)
How does it solve the problem that the FPGA doesn't have a path from the signal-to-observe to the logic blocks?
Re:Parallel Programming for FPGAs by dayjaby on Tuesday August 02, 2022 @02:48AM (#32315834)
You can specify the list of signals to observe, which is built into the gateware.

As memory is also limited, you specify a condition like if signal A becomes 0x1234, then log the aforementioned signals for N cycles.

Re:Parallel Programming for FPGAs by moring on Tuesday August 02, 2022 @03:08AM (#32315929)
I have to admit I still don't get it. When I try to log the signal using my own signal logger (which I guess is somewhat like that "virtual oscilloscope"), the synthesis tool rejects the design and tells me that I cannot use that signal as an input because the FPGA doesn't have a path from there into the logic blocks. What does LiteX do differently to observe a signal that my own gateware cannot access?
Re:Parallel Programming for FPGAs by proto_lambda on Tuesday August 02, 2022 @03:22AM (#32315999)
What kind of primitives are you talking about here? In my experience you don't really have to manually instantiate anything other than a PLL or maybe a multiplier unless you're doing something very specialized.
Re:Parallel Programming for FPGAs by moring on Tuesday August 02, 2022 @05:39AM (#32316732)
I was specifically thinking about DDR3 related primitives.
Re:Parallel Programming for FPGAs by simne on Tuesday August 02, 2022 @07:10PM (#32325476)
Only simulator could check signal to which could not connect physically.

But, you could split project into small parts, connected by some interface (could use triggers or 2-way ram cells), and debug them separate.

Sure, you will loss some capacity, but this is life.

This is not equal to test real solution, because physical arrangement matter, but most probably, you will find most obvious mistakes.

Re:Parallel Programming for FPGAs by CorrectHorseBat on Tuesday August 02, 2022 @02:39AM (#32315788)
>1 involving multiple primitives and you can't attach a signal logger to the signal between them because the FPGA doesn't have a path there to use.

Does the problem not arise in simulation?

Re:Parallel Programming for FPGAs by moring on Tuesday August 02, 2022 @02:48AM (#32315830)
I don't have simulation models for the primitives, and I can't write them due to the lack of documentation. One of the downsides of working purely with the free / open-source toolchain, I guess.

edit for clarification: The lack of simulation models is due to the free toolchain. The documentation is fully available, it's just so bad that you don't even know what some of the primitives are meant to do.