Hacker News new | past | comments | ask | show | jobs | submit login
FPGA Programming: Where to Begin? (2012) (741mhz.com)
85 points by nkurz on Nov 26, 2014 | hide | past | favorite | 25 comments



This is a really good "getting started" article. But I would add a couple more pointers for anyone out there who is interested in getting started with FPGA programming. First, it is not programming. It really is hardware description. I did a lot of the things they said in the article but the thing that helped me the most was first, getting a board (I started with the Terasic DE0 but there are a lot of good cheap ones out there, you don't need to spend a lot of money). I started out using the Altera Quartus II development software because it has a facility in it that allows you to draw a schematic diagram of standard gates and flip flops and it will then generate the equivalent HDL code. What that did for me is "learn by example" and helped me bridge the gap from real hardware to the Hardware Description Language.


I second this. it is not programming. Jettison all ideas you have about how a program normally runs.


I started with a Digilent Basys2[0], it could be a slightly cheaper alternative to the Terasic DE0. It uses a Xilinx chip, has a free design/development software called ISE Webpack, which also has schematic diagram support.

[0] http://www.digilentinc.com/Products/Detail.cfm?Prod=BASYS2&N...


One may also want to take a look at Logi-Pi: http://www.element14.com/LOGI


That is interesting, I haven't looked at it in detail yet but what does it use to create the .bit files or is the entire toolchain open source?


Unfortunately, it still relies on the same Xilinx ISE (webpack is sufficient), so, it's not possible to cook bitfiles on the Pi itself. But the board itself is nice, easily programmable via SPI, has a decent Spartan6 LX9.


How does it compare to Papilio, if I were to buy one which one should I get? http://papilio.cc/index.php?n=Papilio.Learning


There's a lecture series for Cornell's ECE5760 on youtube titled: "Microcontroller and system-on-chip construction using Verilog and Altera FPGA." There are 28 lectures

https://www.youtube.com/playlist?list=PL2BA78454E71FF0E5

http://people.ece.cornell.edu/land/courses/ece5760/


Me and a group of friends at NTNU spent the last three months implementing self-designed and working GPU from scratch in VHDL on a Xilinx Spartan 6 FPGA. At the same time as this, we also implemented fully working multi-cycle and pipelined MIPS CPUs for the same FPGA.

All of us came from software backgrounds, never having touched any hardware description language.

To get started I'd recommend reading Computer organization and design by Patterson and Hennessy (http://www.amazon.com/Computer-Organization-Design-Fifth-Edi...).

For the VHDL part, all we had available was this small basic VHDL compendium (not sure if I can redistribute it), open source github repositories from friends and classmates, as well as the always helpful vhdlguru.blogspot.com

So i'll reccomend following one of the open lecture series posted above :)


Would you mind making this effort open-source for a possibility to build completely open-source computer? The Novena laptop had all things except GPU because there is no open source GPU which would have all the schematics available. Some guy from Germany, I think, is also working on open-source design GPU on FPGA.


Verilator[0] can compile Verilog (which, in my opinion, is more friendly than VHDL) to C++ classes code. This is great tool for someone who don't want to spend money on hardware or use vendor specific tools. After compiling top-level module to C++ class, we can use it in code as a regular object.

[0] http://www.veripool.org/wiki/verilator


Verilator is an excellent tool, definitely recommended. I've been using it myself on a project and I have seen simulation times for tests drop from 22 seconds with Icarus down to 0.5 seconds with Verilator. Being able to easily call C code or DPI is a big win for testability.


There's at least 3 paths. Top down, like article recommends, your first project is lines of VHDL code. Bottom up where you learn gates and work your way up where your first project is feeding two switches on a dev board thru a single xor gate and light an LED with the gate output. Systems integrator is also a valid path where you go to opencores and pull a soft core CPU (ranging from totally proprietary all the way up to GPL) and start with a dumb peripheral and make it smarter.


The other thing to note about hardware, in comparison to software, is that it is inherently "parallel"; i.e. electrons will flow if they can, if a logic gate is set to switch it will, you can't make it "wait" to switch until you want it to. This is why clocking is important, it makes sure that things happen in a synchronised fashion; without it it's a bit like an orchestra playing with no conductor and/or beat, a mess.


How about a Dummies book :) http://design.altera.com/New2FPGAeBook


Also, Niklaus Wirth weighs in with Lola-2, his logic description language, with a compiler to translate it to Verilog. Also, source for a working RISC computer. All in service of Project Oberon, 2013 edition:

http://www.inf.ethz.ch/personal/wirth/ProjectOberon/index.ht...

http://www.inf.ethz.ch/personal/wirth/Lola/index.html


before getting to FPGA is helps to understand computer architecture and digital design 101, this book is a great intro with examples in verilog/hdl: http://www.amazon.com/Digital-Design-Computer-Architecture-E...

as a side benefit I learned MIPS assembly from this book which is very helpful in understanding assembly languages for other architectures, and assembly snippets in Knuth's TAOCP


I found fpga4fun.com to be a great resource when starting out. It has short and practical examples for learning how to program in an HDL. It's pretty cool when you see that you can write something like an Ethernet interface [0].

[0] http://www.fpga4fun.com/10BASE-T.html


I was about to mention this site too. I think that site is awesome. I found it a few years ago. The guy does a very nice job not only with FPGAs but also interfacing with current technologies like PCIx bus to create ethernet and acquisition boards for PCs. He also gets into windows device drivers to get the cards up in windows.


In practical terms, the answer would be "Introducing the Spartan 3E FPGA and VHDL" by Mike Field freely available.


It's available on the github repo of the author

https://github.com/hamsternz/IntroToSpartanFPGABook/blob/mas...


Someone has a link to an similar writeup for DSP programming?


I can't say about programming DSP processors but for learning DSP concepts, I wholeheartedly recommend this: http://www.dspguide.com/


Wholeheartedly seconding this. That book is a low-key gem.

I tried many introductory DSP books. That was the only one that stuck.


dspguide.com is good, also anything by Rick Lyons. Most of the other textbooks people tend to cite are excessively math-heavy and abstract in nature, or just plain not very good.

You wouldn't want to learn DSP on dedicated hardware at this point. Look into software-defined radio as a gateway to DSP development on native CPUs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: