News for hackers. Stuff that matters.
Re:How Does an FPGA Work? by user070223 on Wednesday May 03, 2023 @02:37PM (#35806034)
From my understanding

FPGA doesn't have the instruction pipeline as the command is encoded in the gates themselves. It means that on runtime the FPGA is not turing complete[0] as opposed to the CPU[1].

There is a phrase "data is code and code is data" in security context. The new saying if FPGA would ever replace cpus' as the main computation hardware(as you don't need turing complete when you keep using the same apps[microservices]) is something like "code is execution and execution is code" as you imprint the code in the gates. It would get rid of a whole class/subclass of memory safety vulernabilitie.

This paradigm change is like what webassembly did to the web. The slogan should be "make the bitstream go mainstream" Some made a demo running wasm on fpga[1], not sure if using a cpu or directly

of course you move complexity to compiling, and increase loading speed, all for order of magnitude faster execution

Companies devloped high level synthesis compilers but it's diffcult and challenging as you need to synchronize parallel excution piplines which you don't have to in cpu since it has steady clock rate for each step in the pipeline

A copmany named legup computing(acquired by microchip) compiled memcached/redis applications to fpga and improved perfromance & power efficency by an order of magnitude(10x)

There are a lot of intellectual properties in hardware design as opposed to software so tools and knowledge is scarce.

If anyone works / want to work on this problem hit me up in the comments

[0] Unless you implement a cpu on top of the fpga :)

[1] Assuming infinte memory, which is false, but good enough

[2] https://github.com/denisvasilik/wasm-fpga

Re:How Does an FPGA Work? by proto_lambda on Wednesday May 03, 2023 @03:13PM (#35806462)
> FPGA doesn't have the instruction pipeline as the command is encoded in the gates themselves. It means that on runtime the FPGA is not turing complete[0] as opposed to the CPU[1].

That obviously depends entirely on the circuit, many sufficiently advanced circuits probably end up being accidentally turing complete.

Re:How Does an FPGA Work? by JohnFen on Wednesday May 03, 2023 @03:35PM (#35806671)
You can implement turing-complete CPUs in FPGA fabric.
Re:How Does an FPGA Work? by proto_lambda on Wednesday May 03, 2023 @04:27PM (#35807327)
That's exactly what OP's footnotes say, yes.
Re:How Does an FPGA Work? by tuankiet65 on Wednesday May 03, 2023 @07:34PM (#35809293)
I've had this idea for a while: make an FPGA capable of executing WASM bytecode, then offloading WASM execution to the FPGA. Sounds like a fun project to learn FPGA and how to make a CPU.

Sorta off topic, but I wonder if a CPU with WASM bytecode as its native instruction set could be more performant / power-efficient than JIT-ing WASM code to ARM/x86 assembly. My understanding is that modern processors comes with a wide range of optimization tricks like register renaming, out-of-order, superscalar, ... such that it's probably just easier to JIT WASM bytecode to the native instruction set, so we'd get those optimizations for free, as opposed to design your own WASM CPU with those same optimizations.

Re:How Does an FPGA Work? by fargle on Wednesday May 03, 2023 @11:38PM (#35810935)
there's a hint that you are misunderstanding how things work a bit here. By the time you get to the footnote: "Unless you implement a CPU on top of the FPGA :)" you realize that of course FPGAs can be turing complete, but it's not really correct to say "on top of", more correct with be to say "implement a CPU with the FPGA. Secondly, you never say a CPU isn't really turing complete (footnote: unless you use JMP instructions). We would typically class machines class using the maximum possible because it's usually trivial, but uninteresting, to, for example, program or limit a Turing machine to not be Turing-complete.

FPGA's aren't CPUs that lack instruction pipelines. They are universal ASICs and digital circuits that are re-programmable. ANYTHING that can be accomplished with synchronous (clocked) digital logic circuit can be implemented with an FPGA, including CPUs, but also potentially many, many, other things.

Re:How Does an FPGA Work? by krisoft on Thursday May 04, 2023 @06:57AM (#35813587)
> [0] Unless you implement a cpu on top of the fpga :)

You should revisit what "Turing complete" means. The whole idea is based on one architecture being able to perform the computations an other architecture can by implementing a sort of emulator of the other architecture.

So the fact that the FPGA can implement a CPU shows that the FPGA is Turing complete, there is no "unless" about it.