Author Topic: Getting started with FPGA  (Read 18716 times)

0 Members and 1 Guest are viewing this topic.

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Getting started with FPGA
« on: December 21, 2017, 11:53:30 am »
IMHO I've been very good this year so I'm i'm thinking of asking Santa for a Terasic DE0-Nano or perhaps DE10-Nano..

(I am quite interested in https://github.com/MiSTer-devel/Main_MiSTer/wiki project but that is a long way off and due to time constraints may never happen.)

Can anyone recommend some reading to provide a background for either of these devices/technologies to get started?

(Never done any HDL before)
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Getting started with FPGA
« Reply #1 on: December 21, 2017, 04:15:43 pm »
I prefer a board with 'gadgets' like 7 segment displays, switches and buttons.  There is nothing wrong with the DE-10 Nano as long as you have a way to implement the gadgets.

My favorite board at the moment is the Nexys 4 DDR but it is really pricey and probably a bit of overkill:
http://store.digilentinc.com/nexys-4-ddr-artix-7-fpga-trainer-board-recommended-for-ece-curriculum/

As a fallback, I would consider the Basys 3 Artix 7 board which is a little more reasonable:
http://store.digilentinc.com/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users/

These are personal choices, but they are based on the 'gadgets'.

You will need to pick a language to start your travels.  You have a choice of 3:  VHDL, Verilog (about which I know little) or System Verilog (about which I know nothing).  I started with and continue to use VHDL.  And, yes, you can start a language war by trying to discuss 'which is better'.  Pick one - just make sure it is VHDL.

You need to install the appropriate toolchain: Xilinx Vivado for either of the Digilent boards and Altera <whatever> for the Nano.  These will be huge installs and CPU speed WILL matter as soon as you try to synthesize a project.

Books:

"Real World FPGA Design with Verilog" - I really need to read this book.  I have it but I haven't had time.

"Digital Design and Computer Architecture" Harris and Harris - Uses System Verilog and VHDL in parallel.  You can compare the languages as you go.  This book builds a MIPS type CPU from scratch and presents all of the design considerations and their implementation.

"Digital Design and Computer Architecture ARM Edition" Harris and Harris - same authors building an ARM processor.

"Computer Architecture and Design" Patterson and Hennessy - has nothing to do with FPGAs but is considered the gold standard for design.  The authors designed the MIPS processors and started the MIPS company.

"RTL Hardware Design Using VHDL" Pong Chu - dedicated to using VHDL properly.

"Introduction to Computing Systems: From Bits and Gates to C and Beyond" Patt and Patel - this book starts at the very beginning of logic design and works up through a RISC CPU and on to an assembler and C compiler.  This is a great starter project and is used in many universities.  Google for 'LC-3'  The book does not present the VHDL but it is a pretty easy project to build as they give you the hardware layout and a description of the state machine.  I really like this project!  You should definitely have this book!

https://www.amazon.com/Introduction-Computing-Systems-Gates-Beyond/dp/0072467509

There are only a very few constructs you need to learn.  Gates, registers, multiplexers and finite state machines (unless I forgot a couple).  Once you know how to implement these constructs, the rest is just details.

Hint:  As you build LC-3, you will see why I want my boards to have 'gadgets'.  It sometimes comes to pass that my code isn't perfect right out of the gate.  Debugging is easier with 'gadgets'.

 
« Last Edit: December 21, 2017, 04:23:02 pm by rstofer »
 
The following users thanked this post: NivagSwerdna

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #2 on: December 21, 2017, 07:26:19 pm »
Pick one - just make sure it is VHDL.
It sucks. SystemVerilog rocks! No other language is even close when it comes to verification. Just take a look at AXI Verification IP from Xilinx, and show me something that is even remotely as powerful written on something other that SV.
I'd pick a board based on Xilinx part over Antel as the former provides a lot of IP cores for free, while the latter will charge you through the nose for the same thing.

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26896
  • Country: nl
    • NCT Developments
Re: Getting started with FPGA
« Reply #3 on: December 22, 2017, 12:23:16 am »
Pick one - just make sure it is VHDL.
It sucks. SystemVerilog rocks! No other language is even close when it comes to verification.
Perhaps but for FPGA code itself VHDL is much more powerful and compact (as long as you don't start to describe hardware). SystemVerilog is just Verilog with some extra features bolted on but it still doesn't cut it when compared with VHDL.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #4 on: December 22, 2017, 12:42:31 am »
Perhaps but for FPGA code itself VHDL is much more powerful and compact (as long as you don't start to describe hardware). SystemVerilog is just Verilog with some extra features bolted on but it still doesn't cut it when compared with VHDL.
Name VHDL features which don't have SV counterparts. I can easily name quite a few features of SV which not only don't exist VHDL but can not be even emulated in it. We're going to have a good laugh :D
Not to mention very poor syntax noise-to-signal ratio of VHDL. I know all three languages, so I can compare them.
Also you seem to disregard verification while in fact it's VERY important as it allows to use TDD-like approach which not only speeds up design, but makes it more robust because of automated tests. Full suite of AXI peripheral tests would take a ton of VHDL code that is extremely hard to maintain, while in SV it's literally a few dozen lines of code.
Sorry man, but the holy war is over - SV wins on ALL fronts - from hardware to verification. VHDL is the thing of the past, and holds it own only until old generation of engineers who can't learn new things will be replaced by a new generation.

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: Getting started with FPGA
« Reply #5 on: December 22, 2017, 02:44:01 am »
I have a de0 nano, which I bought a while ago, and I don't think it makes any sense to buy it today. I might be a special case, since I'm interested in the combination fpga+internet, so GBit ethernet is a must if you ask me.
A CPU with some RAM makes initialization of additional hardware a looot easier (just working on a CPU core just to initialize a phy).
Some 7 segment digits provide some helpful status info.
VGA out is good, if you want to develop gaming hardware.
So if you want to buy altera, buy a de10 or one of those 15$ cyclone 2 boards, if you just want to play with a HDL language.

Or just download the free dev tools and just run simulations.
 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1668
  • Country: us
Re: Getting started with FPGA
« Reply #6 on: December 22, 2017, 03:19:25 am »
I have a Digilent Arty-A7, which is only $99. It's got a Xilinx Artix-7 FPGA, which is compatible with Vivado. Not as fancy as some of the other popular boards, but not too pricey either.

And for heaven's sake, use SystemVerilog, not that ancient and mouldy VHDL...
Complexity is the number-one enemy of high-quality code.
 
The following users thanked this post: asmi

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #7 on: December 22, 2017, 03:54:41 am »
I have a de0 nano, which I bought a while ago, and I don't think it makes any sense to buy it today. I might be a special case, since I'm interested in the combination fpga+internet, so GBit ethernet is a must if you ask me.
A CPU with some RAM makes initialization of additional hardware a looot easier (just working on a CPU core just to initialize a phy).
Some 7 segment digits provide some helpful status info.
I would recommend you take a look at one of Zynq boards if SoC is something you're interested in.
VGA out is good, if you want to develop gaming hardware.
I would suggest you take a look at HDMI instead - it's almost as simple as VGA, and even relatively slow speed grade "1" Artix can easily pump out 720p@60Hz or 1080p@24Hz (as odd as it sounds, the latter actually requires slightly less of "on the wire" bandwidth than the former). It took me just a couple of hours to implement a very simple HDMI core so that I can test HDMI TX connector on my own board. The advantage is obvious though - you will be able to output video in full honest-to-God 24 bit color, and you won't have to search for device that actually have VGA port.

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #8 on: December 22, 2017, 04:13:09 am »
I have a Digilent Arty-A7, which is only $99. It's got a Xilinx Artix-7 FPGA, which is compatible with Vivado. Not as fancy as some of the other popular boards, but not too pricey either.
I have it too, but the problem is I've "outgrown" it quite quickly as it doesn't have any hi-speed expansion options. Which is why now I design and build my own devboards :)

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Getting started with FPGA
« Reply #9 on: December 22, 2017, 12:33:04 pm »
What about a second hand DE2? It has quite an old Cyclone??
 

Offline Mr. Scram

  • Super Contributor
  • ***
  • Posts: 9810
  • Country: 00
  • Display aficionado
Re: Getting started with FPGA
« Reply #10 on: December 22, 2017, 12:40:51 pm »
You may want to have a look at this shop on Aliexpress. It has reasonably priced boards and documentation is present, at least with the board I bought. Another forum member had similar experiences. I'm not affiliated in any way.

https://nl.aliexpress.com/store/620372
 
The following users thanked this post: hendorog

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6187
  • Country: ro
Re: Getting started with FPGA
« Reply #11 on: December 22, 2017, 12:51:05 pm »
This is a good place for getting started with FPGA:
http://www.fpga4fun.com/
 
The following users thanked this post: nugglix

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: Getting started with FPGA
« Reply #12 on: December 22, 2017, 08:15:17 pm »
I'm a big fan of Digilent's boards.  They're designed well, reliable, lots of interfaces and I/O, and they have tons of example and demo projects for each board that demonstrate various features.  Finally, they provide their schematics (minus the FTDI/programming page), so if you want to move to designing your own board you can see exactly how everything was hooked up in the dev board.  Many dev boards are like this, but not all.  I personally have experience with the Nexys 2, Nexys 3, Nexys Video, Arty A7, Arty S7, Cmod C2, and Cmod A7.  I don't have any complaints about any of them.  The Artys are good entry level boards, and if you want to experiment with more I/O, high speed interfaces, etc. the Nexys line works well for that.
« Last Edit: December 22, 2017, 08:20:04 pm by suicidaleggroll »
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #13 on: December 22, 2017, 08:41:12 pm »
I'm a big fan of Digilent's boards.  They're designed well, reliable, lots of interfaces and I/O, and they have tons of example and demo projects for each board that demonstrate various features.  Finally, they provide their schematics (minus the FTDI/programming page), so if you want to move to designing your own board you can see exactly how everything was hooked up in the dev board.  Many dev boards are like this, but not all.  I personally have experience with the Nexys 2, Nexys 3, Nexys Video, Arty A7, Arty S7, Cmod C2, and Cmod A7.  I don't have any complaints about any of them.  The Artys are good entry level boards, and if you want to experiment with more I/O, high speed interfaces, etc. the Nexys line works well for that.
Yea, I used their schematics quite a bit during design of my own boards. However you'd better stay vigilant - I've found a mistake in design of their Arty-Z7 board, and they said they are going to fix it, but as of now (over half year later) it still not fixed (at least in schematics).

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Getting started with FPGA
« Reply #14 on: December 22, 2017, 08:54:25 pm »
As I said earlier, I want gadgets.  I absolutely need at least 8 digits of 7 segment displays and prefer 16.  I also need at least 16 toggle switches and some number of buttons, say 8 or 9, the 9th being 'reset'.  16 individual LEDs would also be helpful.

Microchip IO Expanders will take care of all the discrete IO and a Maxim display driver can handle 16 digits of 7 segment displays.  These devices can be had with SPI interfaces so you need 3 IO lines (SCK, MISO, MOSI) plus some number of CS' lines (probably 4).  Build this PCB first and test it with a 3.3V Arduino.  I would feed it with a 5V wall wart and use a 3.3V LDO regulator for all the devices.  Once working, you would have a universal debugging gadget for any FPGA project.

Obviously, the first FPGA project is to create components to drive the board.

I can't convince myself that these eBay specials will work on 3.3V logic but that's what the supplier says.  They are cheap enough that it is worth experimenting:

https://www.ebay.com/itm/MAX7219-8-Digital-Segment-Digital-LED-Display-Tube-For-Arduino-51-AVR-STM32/201536584320

If the 7 segment displays work out, more than half of the work is finished.  Then it's just a simple PCB for switches, buttons and LEDs.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Getting started with FPGA
« Reply #15 on: December 22, 2017, 10:18:28 pm »
I absolutely need at least 8 digits of 7 segment displays and prefer 16

If you have USB or Ethernet, you can send data to the PC, which has lots more than 8 digits, and also letters, special symbols, and graphics too. IMHO, this beats the on-board LCD in and out.
 

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: Getting started with FPGA
« Reply #16 on: December 22, 2017, 10:56:46 pm »
Hmmh...I know that there are some fpga boards with ethernet hardware.

But do they actually come with some software/core to use this hardware? I'm interested in ethernet for fpga, but the easiest way so far would be a 10 MBit SPI PHY, implement a simple CPU and then use something like lwip.

Are there free HDL TCP stacks, that could be used with reasonable effort?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Getting started with FPGA
« Reply #17 on: December 22, 2017, 11:01:43 pm »
I absolutely need at least 8 digits of 7 segment displays and prefer 16

If you have USB or Ethernet, you can send data to the PC, which has lots more than 8 digits, and also letters, special symbols, and graphics too. IMHO, this beats the on-board LCD in and out.

If I had USB working or Ethernet, my project would be essentially complete.  These gadgets would be more useful earlier in the process.

Some boards have the USB programmer interface provide a serial port.  This is pretty nice and certainly a useful addition.  I would expect using serial to be considerably more complex than shoving bytes out over an SPI interface.  Maybe not...  I haven't tried it.  We would need to convert 32 bit binary, for example, to 8 ASCII chars. 

No, I think I would prefer gadgets when I first start implementing the project.  If it is a CPU, let the CPU deal with text messages.  Once I get that far...
« Last Edit: December 22, 2017, 11:09:56 pm by rstofer »
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13742
  • Country: gb
    • Mike's Electric Stuff
Re: Getting started with FPGA
« Reply #18 on: December 22, 2017, 11:32:04 pm »
Hmmh...I know that there are some fpga boards with ethernet hardware.

But do they actually come with some software/core to use this hardware? I'm interested in ethernet for fpga, but the easiest way so far would be a 10 MBit SPI PHY, implement a simple CPU and then use something like lwip.

Are there free HDL TCP stacks, that could be used with reasonable effort?
A Wiznet W5500 is a quick and easy way to get ethernet - certainly easier than doing it on the FPGA
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: daybyter

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26896
  • Country: nl
    • NCT Developments
Re: Getting started with FPGA
« Reply #19 on: December 22, 2017, 11:36:29 pm »
Hmmh...I know that there are some fpga boards with ethernet hardware.

But do they actually come with some software/core to use this hardware? I'm interested in ethernet for fpga, but the easiest way so far would be a 10 MBit SPI PHY, implement a simple CPU and then use something like lwip.

Are there free HDL TCP stacks, that could be used with reasonable effort?
A Wiznet W5500 is a quick and easy way to get ethernet - certainly easier than doing it on the FPGA
But you'd still need some kind of softcore to setup the W5500 and communicate with it. If you need TCP/IP then the W5500 is a good way to go. Using UDP is much easier and certainly doable directly from the FPGA. A softcore is handy to deal with things like ARP, DHCP and so on.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3481
  • Country: us
Re: Getting started with FPGA
« Reply #20 on: December 23, 2017, 12:21:23 am »

"Computer Architecture and Design" Patterson and Hennessy - has nothing to do with FPGAs but is considered the gold standard for design.  The authors designed the MIPS processors and started the MIPS company.


Thanks for the nice list of FPGA books.  However, Patterson developed the SPARC and Hennessy the MIPS.  But I salute your including it.  I've got  the first 4 editions and have read 3.  If I had  HPC work I'd read whatever the most recent edition was.  Each edition was a complete change in how you had to write HPC code.

BTW Patterson is also the culprit behind RAID ;-)
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: Getting started with FPGA
« Reply #21 on: December 23, 2017, 12:36:05 am »
Hmmh...I know that there are some fpga boards with ethernet hardware.

But do they actually come with some software/core to use this hardware? I'm interested in ethernet for fpga, but the easiest way so far would be a 10 MBit SPI PHY, implement a simple CPU and then use something like lwip.

Are there free HDL TCP stacks, that could be used with reasonable effort?
Xilinx provides 10/100 Ethernet core, as well as lightweight IP stack for Microblaze softcore for free.
 
The following users thanked this post: daybyter

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Getting started with FPGA
« Reply #22 on: December 23, 2017, 05:32:11 pm »
If I had USB working or Ethernet, my project would be essentially complete.  These gadgets would be more useful earlier in the process.

If you get a board, it usually will have some connectivity provisions and often will have sample projects that use them. You can start from these and then add to it using it as a test-bed. Since you're not using all the fabric, the connectivity part may coexist with your project. It is easy with FPGA (unlike MCU where overbloated connectivity modules might be screwing your timing). Then, when you move to your own board, you just shoot off the parts which you do not need. But, by that time you would have your own connectivity.
 

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Getting started with FPGA
« Reply #23 on: January 10, 2018, 10:00:38 pm »
I know it's probably totally obsolete but I bought an old DE2 Terasic Board on EBAY and plan to follow Bruce Land's Cornell https://people.ece.cornell.edu/land/courses/ece5760/ labs and videos... Bruce et al have moved on to the DE1-SoC but that is beyond my current budget.
The DE2 should be a good starting point (although it's too old to be worth using in any YouTube videos).

If any Terasic rep reads this board and wants to lend me a DE1-Soc make sure you get in touch,  :)

The board I bought smells slightly of magic smoke but seems to power up into some wild flashing mode OK so I am hopeful. it also comes with a display, camera module and some other I/O gadget and all for £75+P&P.... I thought it was worth it.

TRDB-DC2,TRDB-LCM,THDB-ADA & DE2 Serial 1.....

(The THDB-ADA has a bit of physical damage... one ADT1-1WT RF Transformer hanging off... but probably repairable)

[Incidentally, I'm interested in old arcade games, I have a Konami machine... so generating VGA, sprites etc... right up my alley... maybe some AY-3-8910 emulation... ]
« Last Edit: January 10, 2018, 10:17:34 pm by NivagSwerdna »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Getting started with FPGA
« Reply #24 on: January 10, 2018, 11:02:46 pm »
For just starting out I like the EP2C5T144C8 "mini boards" you can get for under $15 from ebay and various other Chinese sellers. Yes it's an old part, but it's also plenty capable of doing some really cool stuff. There's Grant Searle's "Multicomp" 8 bit microcomputer, even a variant that runs fullblown CP/M from a SD card. I have recreated a number of 70s Atari arcade games on one, the biggest consumes about 50% of that FPGA. For a beginner there is no need to spend a lot, a fancier FPGA costs more, compiling is much slower, and it will blow up just as easily when you accidentally short one of the IO pins to an excessive voltage.

Everyone has an opinion on languages, personally I like VHDL and find that it has the best hobbyist support. Verilog is the other big one, which you choose is largely a matter of personal preference. Anything that can be done with one can be done with the other.

The most important thing to remember no matter what is when you are writing HDL you are NOT WRITING A PROGRAM!! You are describing digital hardware in a language that superficially resembles a program. Think about that every time you sit down to work with it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf