Author Topic: Good intros to FPGAs?  (Read 9798 times)

0 Members and 1 Guest are viewing this topic.

Offline InfravioletTopic starter

  • Super Contributor
  • ***
  • Posts: 1012
  • Country: gb
Good intros to FPGAs?
« on: July 01, 2022, 11:09:15 pm »
I've never done anything with FPGAs before but feel I ought to learn about them at some point.

Can anyone recommend good online resources for learning about their principles, and recommend a brand of FPGAs which are compatible with linux-compatible open source software toolchains (none of the software I'd need for programming them would be anything which can't run on a linux PC or which needs some connection to a remote server, even just for an initial activation, which might go down) and which offers fairly decent availability on a wide variety of different chips/boards. Effectively like arduino, but for FPGAs.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8515
  • Country: us
    • SiliconValleyGarage
Re: Good intros to FPGAs?
« Reply #1 on: July 01, 2022, 11:15:03 pm »
There are no open source toolchains except for a limited one or two device from latticce. and those toolchains are made by external people (not latticce) whoe reverse engineered the bitstream.
The guts of an FPGA are the secret sauce owned by the device maker.

Learn verilog or vhdl. the rest is just sending it through the synthesizer. The source verilog or vhdl is portable , the bitstream is not.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4509
  • Country: au
    • send complaints here
Re: Good intros to FPGAs?
« Reply #2 on: July 01, 2022, 11:35:38 pm »
Effectively like arduino, but for FPGAs.
There is nothing like this for FPGAs. There are some higher level abstractions such as Migen/LiteX which are trying to move into that space but they still end up using the vendor tools (not open source) to actually implement the design.

Do you like programming all your own libraries in assembler/C ? If no, FPGAs are probably not for you, its even lower level with fewer instructions/libraries/hard peripherals.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Good intros to FPGAs?
« Reply #3 on: July 01, 2022, 11:53:22 pm »
Yeah, forget about OSS software for FPGA. Lattice tools don't need an internet connection on their own, but they do require you to request a licence via a web site every 6 months. Others are very similar.
Alex
 

Offline InfravioletTopic starter

  • Super Contributor
  • ***
  • Posts: 1012
  • Country: gb
Re: Good intros to FPGAs?
« Reply #4 on: July 02, 2022, 12:03:12 am »
So unlike a lot of microcontrollers you're saying its not just the guts inside the chip's black resin body they keep secret, but also the protocol for "flashing" it and the compilation chain?
 

Offline Foxxz

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Good intros to FPGAs?
« Reply #5 on: July 02, 2022, 12:04:47 am »
Look at lattice if you want an open source toolchain (yosys). I recommend the ICE40 line of FPGAs. The lattice produced dev boards are well documented. But you are probably better off using the manufacturer tools like icecube2. I'm using the radiant toolchain right now and its kind of a pain in the butt because most documentation you find is for icecube2 and most of the primitives used in icecube2 have changed or don't work in radiant and they primitives are used in examples everywhere on the internet.

This guy's videos are a good primer
https://www.youtube.com/c/Nandland

Be aware every model of FPGA deb board is going to have differences on which pins attach to what. So examples for one model of board may not work on yours when it comes to things like UARTS, LEDS, etc.

Get comfortable with the idea that you will be spending alot of time simulating your designs as debugging in hardware is difficult.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Good intros to FPGAs?
« Reply #6 on: July 02, 2022, 12:05:08 am »
The actual programming algorithm is not secret. But you are not programming "registers". Tools generate a binary file that you program into the device memory. The structure of that file is not documented. The actual low level architecture of the block interconnects is also not documented.

You can try yosys, but if you are just starting, it may not be the best thing. It is missing a ton of features. Unlike for compilers, where free tools are orders of magnitude better than commercial stuff, for FPGA proprietary tools are the only real option for now.
Alex
 

Offline Foxxz

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Good intros to FPGAs?
« Reply #7 on: July 02, 2022, 12:11:15 am »
So unlike a lot of microcontrollers you're saying its not just the guts inside the chip's black resin body they keep secret, but also the protocol for "flashing" it and the compilation chain?

Loading the design itself into an FPGA is trivial and usually well understood. But how the bitstream is generated for any specific FPGA is proprietary and the format is not well understood. FPGAs have LUTs, routing fabric, memory, and hard IP blocks like DSPs, SPI, I2C, PWM, and whatever else the manufacturer has decided to include. Bitstreams aren't so much instructions but a bunch of bits that setup all the LUTs, load values into memory, connect all the parts to the routing fabric, and enable the IP blocks.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8515
  • Country: us
    • SiliconValleyGarage
Re: Good intros to FPGAs?
« Reply #8 on: July 02, 2022, 12:16:46 am »
easy start : get a terasic board for altera (now owned by intel) .
get an older version of quartus software . it exists on linux. license is free.
you can start as simple as drawing a schematic using 74xx ttl chip.
has built in verilog and vhdl synthesizer and simulator ( the later versions of quartus require mentor modelsim. there is a free version but that makes it even more complicated. )

you'll probably need specific versions of linux like redhat. may be a pain to get running on others. that stuff is target towards commercial users that frequently already have other tools like Cadence or Synopsys, specman and other stuff that is only supported on redhat.
This is not a 'let me compile it' , can i have the source ? world.

learning verilog : Verilog for synthesis by Bhasker is very good. no nonsense , no blabla that is not synthesizable, and simple to understand.
and use systemverilog 2005 or later that has always_ff and always_comb constructs and learn how to use scheduled logic instead of complicated if-then elseif trees. the logic becomes self explaining and you get it right first time in 99% of the cases without hidden pathways or even needing simulation
« Last Edit: July 02, 2022, 12:24:07 am by free_electron »
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14297
  • Country: fr
Re: Good intros to FPGAs?
« Reply #9 on: July 02, 2022, 12:18:04 am »
You can try yosys, but if you are just starting, it may not be the best thing. It is missing a ton of features. Unlike for compilers, where free tools are orders of magnitude better than commercial stuff, for FPGA proprietary tools are the only real option for now.

Yes. It would even be a very bad idea, actually. While yosys/nextpnr has become pretty good, you can still consider it experimental, and not particularly easy to use either for a beginner. If you're just starting with FPGAs, that would be like doubling the difficulty.

And if you're looking for some point-and-click environment a la Arduino, it's just the opposite of that.

So yeah, learn with vendor tools first. Once you're experienced enough with FPGAs and HDLs, you can always consider yosys if the FPGA you wanna use is supported, if you're comfortable with command-line tools and if open-source tools really matter that much to you. And still, be prepared for some head-scratching here and there and spending more time than you had expected on github opening tickets.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Good intros to FPGAs?
« Reply #10 on: July 02, 2022, 01:40:54 am »
easy start : get a terasic board for altera (now owned by intel) .
get an older version of quartus software . it exists on linux. license is free.
you can start as simple as drawing a schematic using 74xx ttl chip.
has built in verilog and vhdl synthesizer and simulator ( the later versions of quartus require mentor modelsim. there is a free version but that makes it even more complicated. )

you'll probably need specific versions of linux like redhat. may be a pain to get running on others. that stuff is target towards commercial users that frequently already have other tools like Cadence or Synopsys, specman and other stuff that is only supported on redhat.
This is not a 'let me compile it' , can i have the source ? world.

learning verilog : Verilog for synthesis by Bhasker is very good. no nonsense , no blabla that is not synthesizable, and simple to understand.
and use systemverilog 2005 or later that has always_ff and always_comb constructs and learn how to use scheduled logic instead of complicated if-then elseif trees. the logic becomes self explaining and you get it right first time in 99% of the cases without hidden pathways or even needing simulation

Wise advice. Also, don't cheap out and get a no-name development board from AliExpress or ebay, unless you have a helpful mentor who can assist you with getting started. Go Digilient board (for AMD/Xilinx) or Terasic board (for Intel/Altera).

Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 
The following users thanked this post: Someone

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7660
  • Country: ca
Re: Good intros to FPGAs?
« Reply #11 on: July 02, 2022, 02:18:51 am »
...has built in verilog and vhdl synthesizer and simulator ( the later versions of quartus require mentor modelsim. there is a free version but that makes it even more complicated. )

As Modelsim is available free with Altera/Intel Quartus and Lattice Diamond and Xilinx ISE, I do recommend learning how to program and work within Modelsim natively as it has it's own built in really fast Verilog and VHDL compilers.

I know this is an extra step prior to transferring your HDL code to your selected FPGA vendor, but you will begin with the ground difficult step of simulation your first design with a simulator tool separate of your chosen vendor's FPGA tool.  I went the other way around and began relying on Altera's Quartus to simulate my designs and looking back, suffered where recompiled could have been under a second each testing of my code and the ability to sniff hidden registers for debugging after-the-fact which wasn't a well flushed out capability in the full FPGA compiler tools.

I believe downloading Quartus 13.0 through 20.1 (latest Quartus has switched away from Modelsim) includes a download option for a free Modelsim as well as Lattice Diamond v3.12 and later.  I'm not sure which Xilinx packages include a free Modelsim.
« Last Edit: July 02, 2022, 02:21:27 am by BrianHG »
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Good intros to FPGAs?
« Reply #12 on: July 02, 2022, 04:52:18 am »
Buy the GO board, follow the examples in verilog or vhdl at the site
https://nandland.com/

https://freecomputerbooks.com/Free-Range-VHDL.html  The book is free in PDF format

There are more capable boards at https://digilent.com/shop/boards-and-components/system-boards/fpga-boards/

My favorite is the Nexys A7 board.  I choose it for the shiny features like buttons, switches, LEDs, Displays etc.  Having onboard IO is pretty useful.  It's pretty expensive compared to an Artix A7 or the GO board but, in my view, worth every penny.  But I don't have a bunch of them...  The BASYS boars are pretty handy as well.

https://vhdlwhiz.com/basic-vhdl-tutorials/
« Last Edit: July 02, 2022, 04:56:17 am by rstofer »
 
The following users thanked this post: zzattack

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6146
  • Country: ro
Re: Good intros to FPGAs?
« Reply #13 on: July 02, 2022, 06:27:11 am »
See if this place suits you:
https://www.fpga4fun.com/FPGAinfo1.html

Keep in mind that:
- FPGA is not software.  You do not write "programs" for FPGA, you write schematic, with flip-flops and logic gates and so on, except you'll use text to describe the schematic, instead of drawing lines like you do with other electronic schematics.

- you'll need to know/learn digital design, meaning logic gates, flip-flops, multiplexers, counters, state machines, Mealy Moore state machines, synchronous design techniques (e.g. clock domain crossing, metastability, etc.) and so on.  It's not software, it's hardware.  It's all digital schematics written in text, and called HDL (Hardware Design Language).  For example, Quartus still retains a graphic editor, where you draw flip-flops, and logic gates, and circuits from the 400 TTL family to design your schematic instead of describing your schematic wit VHDL or Verilog "code".

- the two main HDL languages are VHDL and Verilog.  Verilog is easier to beginners, but some companies are using VHDL only.

- again, these are not programming languages, and they are not "executed" in order, line by line, like the code is usually executed in other programming language.  In HDL, the language is for drawing digital schematics.

- there are some tools called High Level Syntheses that can convert, for example, a C program into a HDL schematic, but not every C program can be converted, and this way will usually waste too much FPGA area.  Anything serious will usually need to be written in VHDL or Verilog.

- FPGA's are much, much more complicated than any Arduino, both when learning about them, and when using them in practice.

- main two FPGA manufacturers are the former Xilinx and Altera.  Both of them have a free version of IDE+tools.  For Xilinx it's called Vivado, for Altera is called Quartus.  Both are running in Linux

- in FPGA, IDE+tools are proprietary, and very expensive.  There is something free for ICE40, but that's it.  Nothing that I know of for more recent FPGAs

- you can write HDL, synthesize it, then instead of downloading the bitstream (a bitstream is the equivalent of a binary in microcontrollers, but it's not a program, it's more like a map/table of on/off switches), you can simulate your design any hardware.  It's as easy as downloading Quartus for example ( https://www.intel.com/content/www/us/en/products/details/fpga/development-tools/quartus-prime.html ), then trying to use it.

To prepare against disappointments, keep in mind that learning FPGA will take many weeks or months, if not years.  It's not something that can be learned in a weekend.
« Last Edit: July 02, 2022, 06:30:17 am by RoGeorge »
 
The following users thanked this post: ebastler, 1001

Offline laugensalm

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ch
Re: Good intros to FPGAs?
« Reply #14 on: July 02, 2022, 07:31:29 am »
Seems there are many different perspectives.
The closest to an Arduino-simple approach I was getting is using Python HDL and Jupyter Notebooks with the basic OSS tools set up in a container to:
  • Write a hardware description in MyHDL
  • Synthesize via yosys and display inferred hardware elements
  • Run simulation, display waveform traces
  • Download to ECP5 FPGA

The setup is found at https://github.com/hackfin/hdlplayground, when you hit that blue binder button, it will start a virtual machine to play with. For the intro, you might want to look at the 'embedded world 2021' stuff, this shows some basic steps on how to create hardware using Python and how the corresponding VHDL/Verilog output looks like.

When running it locally, developing code and getting it verified is a matter of seconds. Actually, yosys isn't so much experimental if you do some diving into the internals, it's a very powerful and fast tool, for example, I'm getting a complex RISC-V SoC synthesized in under a minute whereas the Lattice tools take ~5 times longer.

However there are limitations in this Docker setup, and it's no longer maintained, although the Python code you'd write is reusable for the next generation. For professional development you'll likely be back at the vendor tools and still quite a bit of VHDL/Verilog coding for particular integration scenarios.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11228
  • Country: us
    • Personal site
Re: Good intros to FPGAs?
« Reply #15 on: July 02, 2022, 07:40:53 am »
Suggesting MyHDL to beginners is plain sadism. It might be close to Arduino, but realistically to get anywhere in FPGA world you need to get away from Arduino mindset.

Yosys/arachne-pnr workflow is missing very basic things that are necessary for majority of real project. Things like timing constraints are not implemented.

Vendor tools for FPGAs suck, but realistically they are the only option.
Alex
 
The following users thanked this post: daqq, langwadt, SiliconWizard

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Good intros to FPGAs?
« Reply #16 on: July 02, 2022, 08:19:51 am »
Suggesting MyHDL to beginners is plain sadism. It might be close to Arduino, but realistically to get anywhere in FPGA world you need to get away from Arduino mindset.

Yosys/arachne-pnr workflow is missing very basic things that are necessary for majority of real project. Things like timing constraints are not implemented.

Vendor tools for FPGAs suck, but realistically they are the only option.

^^^^

I hate to say it, but this is the correct answer.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline laugensalm

  • Regular Contributor
  • *
  • Posts: 104
  • Country: ch
Re: Good intros to FPGAs?
« Reply #17 on: July 02, 2022, 08:40:27 am »
Suggesting MyHDL to beginners is plain sadism. It might be close to Arduino, but realistically to get anywhere in FPGA world you need to get away from Arduino mindset.

Agree on the last one, but your first statement demonstrates you haven't tried, and my experience with students has shown otherwise. Or you mixed up with migen?

However, I agree that the legacy MyHDL code base isn't fit for the future and for complex projects, therefore the 'jupyosys' approach is currently revisited with a different kernel (myhdl compatible up to some point).
In general, let's forget about Arduino, as it obscures quite a bit on the innards. Here, we'd like to do the opposite, write a functional description, verify, see what it's inferred to. However, in some cases when dealing with pipelines, abstraction levels help, though one should be able to read Verilog or VHDL.

Let aside arachne-pnr, but nextpnr is significantly more powerful. PnR level optimization is in fact becoming less of an issue to me, but I agree that you have to stick with the vendor tools if you need to integrate classic V*-Code for proper timing closure.


 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3623
  • Country: nl
Re: Good intros to FPGAs?
« Reply #18 on: July 02, 2022, 09:12:30 am »
This site is also nice to learn about verilog: https://www.asic-world.com/verilog/veritut.html

Online chris_leyson

  • Super Contributor
  • ***
  • Posts: 1541
  • Country: wales
Re: Good intros to FPGAs?
« Reply #19 on: July 02, 2022, 09:20:37 am »
Xilinx Picoblaze 8 bit processor user guide UG129 for the KCPSM3 version of the processor is a good introduction. HDL is open source and available in VHDL and Verilog.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19280
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Good intros to FPGAs?
« Reply #20 on: July 02, 2022, 09:51:31 am »
I've never done anything with FPGAs before but feel I ought to learn about them at some point.

Good for you, but realise that it is a steep learning curve and that experience writing programs does not translate to creating hardware. To start with, hardware is inherently parallel, and software programmers have great difficulty creating parallel programs.

Well, that's not quite true. Enterprise level computing has finally evolved to look more like hardware: you interconnect (i.e. wire together) pre-defined blocks in parallel, and the enterprise framework implements the parallel processing.

Quote
Can anyone recommend good online resources for learning about their principles, and recommend a brand of FPGAs which are compatible with linux-compatible open source software toolchains (none of the software I'd need for programming them would be anything which can't run on a linux PC or which needs some connection to a remote server, even just for an initial activation, which might go down) and which offers fairly decent availability on a wide variety of different chips/boards. Effectively like arduino, but for FPGAs.

All decent toolchains will have to be proprietary. Many, if not all, will run well in Linux.

The key point is that while the LUTs will be well described and defined, they are only a tiny part of the problem.

One major issue is the interconnection fabric is complex and device specific, and is more important than the LUTs.

Another major issue is the layout/placement, which is critically dependent on the delays in the interconnect fabric. It takes longer for a signal to cross the chip than it does to go through a LUT. You have to specify timing constraints, and how those drive the layout is critical and a manufacturer's secret sauce. Often it is necessary for you to tell the toolchain where to place LUTs, so that it can place components sufficiently well to meet the timing constraints, and do that within a reasonable elapsed time.

So, pick a manufacturer's toolchain that will run on your hardware. That will dictate which families of devices you can use. Then buy a module with a suitable FPGA on it; don't attempt to make your own.
« Last Edit: July 02, 2022, 09:54:36 am by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: se
Re: Good intros to FPGAs?
« Reply #21 on: July 02, 2022, 02:16:50 pm »
I think it is worth emphasizing that FPGAs are programmable logic which is in many ways very different from how you learn to use something like an Arduino. I would say it is very useful to be well versed in traditional programming (C/C++) but one always have to remember that it is really logic gates you are creating which means you have to think a bit differently.

Get a decent board from Digilent or some other big manufacturer and start playing with it, following tutorials. FPGAs are fun but takes a lot of practice. They are not super difficult to get started with these days but there are also a lot less tutorials a la Arduino, so expect to do some more “advanced” reading to understand things.

Once you get past the basics, it becomes much more about knowing the tool chain and the specifics of your FPGA and the what the tool chain provides you with. All of them have their own special sauce that you can use to make things easier and better but it takes a lot to learn this for a hobbyist.

And, lastly, don’t forget to ask questions here. There are plenty of people here with tons of experience that share their knowledge. I think I owe quite a few people here a beer or two for the knowledge I’ve accumulated by just reading their posts here.
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1896
  • Country: ca
Re: Good intros to FPGAs?
« Reply #22 on: July 02, 2022, 06:16:06 pm »
After learning the basics, the best blog and gold mine on hole web is zipcpu.com blog, you would thank me later for the tip ^-^ >:D
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 
The following users thanked this post: agehall

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19280
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Good intros to FPGAs?
« Reply #23 on: July 02, 2022, 07:48:58 pm »
I think it is worth emphasizing that FPGAs are programmable logic which is in many ways very different from how you learn to use something like an Arduino. I would say it is very useful to be well versed in traditional programming (C/C++) but one always have to remember that it is really logic gates you are creating which means you have to think a bit differently.

C programming expertise is valuable, but not when it comes to programming FPGAs in an HDL. What, for example, is the FPGA equivalent of a C for loop?

(And if C++ is the answer, I want to examine the question in detail :) )
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: se
Re: Good intros to FPGAs?
« Reply #24 on: July 02, 2022, 07:59:03 pm »
Obviously there is no loop in the FPGA world like there is in C/C++. This is where one has to drop the high-level programming thinking.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf