9 ms·
Introduction to FPGAs
- hyperman1 4y agoWhile these things seem fun to play with, what are fun projects to actually do with them? I'd buy one, but I know a few people who have one, garhering dust.
- hulitu 4y agoI think a fun project would be to emulate old computers (i.e. i486, Sgis, SUNs)
- dholm 4y agoYou can find links to a lot of old computers and game consoles implemented in FPGA here: - https://github.com/MiSTer-devel/Wiki_MiSTer/wiki/Cores https://github.com/MiSTer-devel/Wiki_MiSTer/wiki/Cores
- LeftHandPath 4y agoAnything that would make a fun ASIC could be turned into an FPGA project. Something like Ben Eater's GPU project, which he did on a breadboard, could be implemented on them, or you could make a toy CPU with RISC-V, or create a softcore (faster than a software-simulated, slower than actual hardware) version of any number of older processors. Edit: Link to Ben's GPU project: https://eater.net/vga https://eater.net/vga
- drivers99 4y agoI have an FPGA and I've loaded up a sample that outputs a VGA signal[0] but the output is only based on hardwired patterns, not driving by a frame buffer or CPU. I'm not sure where to go next in order to use the memory chip on the dev board (I have the Digilent Arty [1] as well as a MiSTer FPGA setup) or have some sort of frame buffer which I can use with a CPU that is also running in the FPGA. I'm 90% through building Ben Eater's 8 bit cpu on breadboards (just have to add the control logic) and I did the 65C02 project of his just before that, so I'm definitely in the market for learning where to go next with it. My dream is to have a computer that I have completely design control over :) [0] https://digilent.com/reference/learn/programmable-logic/tutorials/arty-pmod-vga-demo/start https://digilent.com/reference/learn/programmable-logic/tuto... specifically [1] https://digilent.com/reference/programmable-logic/arty/reference-manual https://digilent.com/reference/programmable-logic/arty/refer...
- ponkpanda 4y agoI habe a few lying about. My fun project is to implement a usb CCID (smartcard) device to create a pkcs11comiant HSM from scratch (FYI the ESA dis this on MAX10s for one of their satellites or probes). Assuming you dev environment is not compromised. USB 1.1 and USB 2.0 have free/OSS IP cores. Personally, I do not see point in implementing a softcore Cpu unless design absolutely requires it. Separately, FPGA makers has shifted focus a bit from facilitating hardware design to providing coprocessors/accel cards.
- auggierose 4y agoAre there ANY tasks for which I could get a significant speed advantage on a cheap FPGA (including I/O with computer to communicate result) compared to just using a CPU? Are there any compared to using CPU+GPU? Edit: By cheap I mean something like in the article or a bit more expensive, for sure < $1000. By CPU I mean something like an M1. By GPU I mean something like an Nvidia 2080Ti.
- rowanG077 4y agoThis will really change with your definition of cheap, which CPU/GPU you compare it to and most importantly the algorithm. A recent example is bitcoin mining. Which AFAIK used to be done on FPGAs before they moved to ASIC.
- EarlKing 4y agoInsofar as an FPGA can have a customized pipeline to deal with an operation without the overhead of your CPU's instruction pipeline? Yes. Most any task can be sped up, but ultimately whether or not an FPGA is right will depend on how much that FPGA costs out the door vs a CPU, and how much you optimized the algorithm for your chosen task. With proper engineering an FPGA can handily beat a CPU in many cases... but it's going to depend on the task, the FPGA in question, and what CPU it's going up against. As with all things, it depends on the particular task and how much you have to spend.
- deleted 4y ago[deleted]
- bogantech 4y agoAn FPGA is useful for high-speed hard-realtime designs with input to output reaction times measured in nanoseconds. In retrocomputing for example they're useful for building accelerators that bolt much faster CPU's of a different model (like 68060 accelerators for an Amiga) or implementing a new graphics card with HD resolution, HDMI, and SDRAM controllers like the ZZ9000 https://shop.mntre.com/products/zz9000-for-amiga-preorder https://shop.mntre.com/products/zz9000-for-amiga-preorder
- d_tr 4y ago
- buildbot 4y agoFor anyone interested in FPGAs, I’d recommend one that can use the excellent open source F4PGA toolchain: https://f4pga.org/ https://f4pga.org/ I have an orangecrab board with a lattice FPGA, it’s super cool to be able to run a single makefile and build a riscv cpu and buildroot based linux for it.
- omniscient_oce 4y agoThat's awesome. I ordered an Orangecrab to start learning FPGAs with and it just arrived :)
- buildbot 4y agoExciting!! This was the project I used: https://github.com/litex-hub/linux-on-litex-vexriscv https://github.com/litex-hub/linux-on-litex-vexriscv
- ginko 4y ago>The Xilinix development environment is Vivado which supports writing and compiling your HDL along with creating testbenches and running simulations. I tried getting into FPGA development, played around a bit with simple Verilog implementations then got a cheap FPGA board an pretty much failed at Vivado. That tool is completely unusable. It makes me think of 90s Visual studio where you have to jump through 5 forms and wizards to generate a broken project that wouldn't compile or run on your board. Are there shell tools for FPGA programming you can just set up with a Makefile or something? Having to use a GUI for stuff like this seems silly to me.
- rowanG077 4y agoYes, yosys + nextpnr for example. But you have to pick an FPGA that is supported.
- mwbajor 4y agoYosys is nice, but you aren't going to get around using vendors tools for configuring IP unfortunately. Vendors stopped supporting 3rd party tools a few years ago primarly because it was so hard to integrate the IP configuration. For instance, the last time I used Synopsys' tool (Synplyfy) I had to always have ISE or Vivado open in another window to configure IP. Of course, for many things, you might not need to configure vendor IP. Examples where you most definitely need to are 1) Filters, 2) FFTs, 3) DDR controllers 4) High speed transceivers. In some cases you can configure vendor IP with language templates. If you don't need these components, then Yosys will be good for you.
- deleted 4y ago[deleted]
- Gracana 4y agoThe proprietary tools are painful! I never really used FPGAs outside of school until there were other options. Look at the open source yosys/nextpnr toolchain. Your best bet is to use lattice ice40 or ecp5 FPGAs with it, they’re very well supported.
- brakmic 4y agoFree Range VHDL book: https://github.com/fabriziotappero/Free-Range-VHDL-book https://github.com/fabriziotappero/Free-Range-VHDL-book
- hnthrowaway0315 4y agoMy Big Plan is to replicate what the UTokyo CPU project asks: Write a custom CPU and synthesize in a FPGA board -> port uv6 -> write a compiler for a subset of C -> write and run some programs
- lnsru 4y agoThat’s one of the fun university projects people can do. Small groups use whole term to replicate some historical CPU on FPGA. Your project sounds like one year part time if also writing report is included.
- hnthrowaway0315 4y agoYeah since I'm taking some couses for the next few years I can work on the project slowly.
- latchkey 4y agoReminds me of this post: https://hackaday.com/2022/11/22/home-built-cpu-runs-with-home-built-toolchain/ https://hackaday.com/2022/11/22/home-built-cpu-runs-with-hom...
- hnthrowaway0315 4y agoYeah! I can see how fun it is to anyone who has a bit of interest in the inner working of a computer. Now that said, I need to pick up the RISC-V softcore introductory course on edx and finishes it.
- hikingsimulator 4y agoQuestion to the community: At some point, I may want to work towards implementing a small tensor-core (or a vertex/pixel shader as in "GPU implementation of neural networks," Oh&Jung, 2004) for a toy ml project. Do you have some materials to recommend that would teach me how I should/could proceed? Thanks a lot.
- emacs28 4y agoOne good approach could be to base the architecture on the TPU v1 from [1]. There are also open-source accelerators you could get inspiration from, for example [2][3]. If you want to do less work/not hand code the RTL yourself then you could look into methods for automatically mapping OpenCL to an FPGA accelerator architecture (or a service like [3] provides pre-designed architectures for multiple FPGAs). [1] https://arxiv.org/abs/1704.04760 https://arxiv.org/abs/1704.04760 [2] https://github.com/jofrfu/tinyTPU https://github.com/jofrfu/tinyTPU [3] https://github.com/tensil-ai/tensil https://github.com/tensil-ai/tensil
- hikingsimulator 4y agoThanks!
- Const-me 4y agoTensor cores are simply multiplying matrices. Relatively easy to do with a compute shader. Here's an example of such shader in D3D11: https://github.com/Const-me/Whisper/blob/master/ComputeShaders/mulMatTiled.hlsl https://github.com/Const-me/Whisper/blob/master/ComputeShade...
- brakmic 4y agoCheck out https://nandland.com https://nandland.com
- fithisux 4y agoIs there any algorithmic problems for FPGAs or algorithms that need implementations?
- skedaddle 4y agoIt's been a while since I worked in this space but ~10 years ago I would have said TCP termination. It is a pretty big ask though. :) One issue in this area is that the underlying hard logic is limited, and differs from vendor to vendor and product to product. So a nice free IP core might exist for something, say for FFT, but the complete design cannot fit on your chip's LUTs, or it may not have enough buffer blocks or clock multipliers or buses or something to run a given core, or everything "fits" but it has to be run slower to meet timing constraints. That's not to say it's always like that. There is probably a need though for various implementations of some algorithms, with different topologies, or for niche environments etc. Just as in embedded development we need various implementations of FFT in floating point, fixed point, using static memory, etc. And it's not algorithmic really, but peripheral drivers contribute a ton to the community. Being able to e.g. plug a certain e-ink display into a widget without having to write the driver yourself. opencores.org might be of interest to you (github.com/klyone/opencores-ip).
- fithisux 4y agoThank you
- squarefoot 4y agoTwo historic related sites of interest: https://opencores.org/ https://opencores.org/ https://www.fpga4fun.com/ https://www.fpga4fun.com/
- FullyFunctional 4y agoNote, the included schematics of a DTL (diode-transistor-logic) gate is wrong on many levels and isn't even something we have used in the last four decades. The CMOS implementation _is_ what we actually use and for drive strength 1 it's literally just this (which isn't hard to understand): https://commons.wikimedia.org/wiki/File:CMOS_NAND.svg https://commons.wikimedia.org/wiki/File:CMOS_NAND.svg
- hmry 4y agoIt's not supposed to be DTL though, it's RTL...
- FullyFunctional 4y agoThanks, my slip up. The rest stands, RTL hasn't been used since before most people here were born.
- CamperBob2 4y agoRTL means something different in FPGA/ASIC-land (Register-Transfer Level.) It simply refers to the practice of low-level 'coding' in an HDL, as opposed to even lower-level schematic or gate-level entry, or higher-level synthesis based on IP core generators or traditional programming languages. See also https://electronics.stackexchange.com/questions/69022/rtl-vs-hdl-whats-the-difference https://electronics.stackexchange.com/questions/69022/rtl-vs... .
- FullyFunctional 4y agoWith only 17,576 different possibilities, TLAs are bound to alias. RTL in electronics can mean both register transfer level and Resistor-Transistor-Logic. If you are old enough, you will have used both.
- CamperBob2 4y agoExactly. I not only missed out on the original RTL, but I never even had to use a 74xx TTL part number that didn't have at least an 'LS' or an 'F' in the middle.
- joemi 4y agoI tried getting yosys (and related) working on my M1 macbook so I could play around with an icestick fpga I have, but could never get it working. There we software installation issues that I couldn't get past and don't remember the details of. Has anyone gotten a yosys (and related) setup going on an M1 mac?
- carry_bit 4y agoThere's a darwin-arm64 asset for https://github.com/YosysHQ/oss-cad-suite-build/releases https://github.com/YosysHQ/oss-cad-suite-build/releases at least. Installation is just 4 steps (see the readme). It just worked for me on Windows and Linux at least.
- joemi 4y agoI'll check out those release downloads. IIRC, I think I had been installing via homebrew, and that wasn't working out.
- Symmetry 4y agoPretty good but one correction >To build a CPU, you need a few more elements than basic logic gates, namely memory and a way to synchronize everything to a clock, but this is a good starting point. You can actually make all that with logic gates! Two NANDs with each's input connected to one of the other's output makes the most basic sort of static memory element. 4 NANDs and an inverter give you a D-latch that lets you synchronize your circuits to the clock signal. You can use fancier techniques that don't correspond to these so well but these are actually all you need.
- amelius 4y agoYeah, but you can't make DRAM cells (although you can emulate them with a lot more hardware).
- dreamcompiler 4y agoYep. You can even build the clock oscillator itself with chained NOT (or NAND) gates in a feedback configuration. It's not a great idea for a production machine but it's much more practical than the software analogy of using a Turing machine for everything.
- tspiteri 4y ago> 4 NANDs and an inverter give you a D-latch that lets you synchronize your circuits to the clock signal. A D latch would be enabled all the time the clock signal is high, so it is not suitable for synchronizing your circuits to the clock signal. What you need is for the device to store the input at the instant when the clock signal goes from low to high. (Using the tech terminology: the 4-NAND D-latch has level triggering, while for the clock you want edge triggering.)
- carry_bit 4y agoI've been learning a lot from the https://zipcpu.com/ https://zipcpu.com/ blog lately, and I'm just starting to play around with formal verification after reading all of the recommendations for that from the blog. SpinalHDL has been very nice to use so far instead of Verilog: https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html It even has simulation and formal verification workflows built in. In the simulation you can wiggle the bits on your ports using Scala, so you can code an emulation of any peripheral or the like that you want and have your design use it. (You can also do the same thing using C++ if you use Verilator directly instead.) You can code a bridge between a serial port in your simulated design and a TCP port, and then write a second program to bridge a real serial port to a TCP port the same way. You can then write tools that connect to the TCP port and then use those same tools against both your simulated design and your design in hardware.
- ge96 4y agoNice I bought a crab recently wanting to use it