Seyed Masoud Hosseini · Overview · Study log · Ideas · Transcript · RSS feed

FPGA & Verilog Design · Lecture 1 of 12 · 15:20

Part 1: What is an FPGA?

Introduction to FPGA Part 1 - What is an FPGA? | Digi-Key Electronics on YouTube

Study guide

What this lecture covers

This opening lecture in the FPGA and Verilog series answers a basic question: what is a field-programmable gate array, and why would you reach for one instead of a microcontroller, microprocessor, or GPU? It sets up the rest of the series by explaining that an FPGA is made of reconfigurable logic cells you wire together like building blocks, rather than a fixed processor running instructions.

By the end, you should understand the kinds of problems FPGAs are good for, know the difference between Verilog and VHDL, and recognize the stages a design passes through - from writing HDL code to uploading a configuration bitstream to the chip. The lecture is conceptual; no code is written yet.

Key ideas

  • FPGA fabric: an FPGA is a grid of programmable logic cells, plus resources like clock networks and block RAM, that can be wired into custom digital circuits.
  • Soft core processor: you can implement your own processor inside the FPGA fabric using open designs such as RISC-V, and modify its behavior since the source is open.
  • When to use an FPGA: cases include needing peripherals a microcontroller lacks, high-throughput signal processing (filtering, FFT), custom parallel hardware, and prototyping before committing to an ASIC.
  • Hardware description language (HDL): languages like Verilog and VHDL describe circuit behavior, not sequential instructions; most of a design executes concurrently rather than line by line.
  • Verilog vs VHDL: both date to the early 1980s and operate at the register transfer level; Verilog is weakly typed with C-like syntax, VHDL is strongly typed and more verbose.
  • IP blocks: closed-source, pre-built hardware modules (like software libraries) that save you from designing complex functions like DSP filters from scratch.
  • Design flow: HDL code moves through simulation, synthesis, place-and-route, and bitstream packaging before it configures the physical FPGA.

Walkthrough

Intro and what an FPGA is (0:00)

The lecture opens by contrasting common but incomplete answers ("FPGAs are fast", "FPGAs are parallel") with a clearer picture: an FPGA is a collection of logic cells you configure and connect, similar to combining Lego bricks. It walks through example applications - LED cube drivers, communications DSP, the FPGA inside a Mercedes-Benz infotainment system, data acquisition in an oscilloscope, and cryptocurrency mining - to show where custom digital logic outperforms a general-purpose processor.

Digital Signal Processing (DSP) (3:57)

This section summarizes the reasons to pick an FPGA over a microcontroller: building peripherals that don't exist off the shelf, implementing an open soft core processor you can customize down to the instruction set, and creating specialized circuits that compute things like the Fast Fourier Transform in far fewer clock cycles than a general-purpose chip would need. FPGAs are also framed as a practical way to prototype logic before committing to a fixed-function ASIC.

Hardware Description Language (HDL) (7:35)

The lecture introduces HDLs as closer to a markup language than a programming language, since a design is not executed sequentially. It compares Verilog and VHDL, notes that both are register-transfer-level languages, and briefly mentions SystemVerilog (used for test benches) and high-level synthesis tools that convert C, C++, or MATLAB into RTL code. It also explains IP blocks as closed-source, reusable hardware components.

Design Flow (11:13)

The lecture walks through the open-source toolchain used for the rest of the series: writing Verilog, simulating with GTKWave, synthesizing with Yosys into a gate-level netlist, running place-and-route with nextpnr to map the netlist onto the target FPGA, packing the result into a binary with icepack, and uploading it with iceprog. It notes that apio wraps all of these tools together, and that the series targets the low-cost Lattice iCE40 FPGA family, specifically the iCEstick board.

Before you watch

  • Some familiarity with binary numbers and basic logic gates (AND, OR, NOT) will help, since the lecture assumes you know what a digital circuit is.
  • No FPGA hardware or software is required for this episode; it's conceptual.

Check your understanding

  1. Why does the lecture argue that "fast" and "parallel" are incomplete descriptions of what an FPGA offers?
  2. What distinguishes an HDL like Verilog from a traditional sequential programming language?
  3. Name two example applications where the lecture says an FPGA can outperform a microcontroller or GPU.
  4. What are the main stages a Verilog design passes through before it runs on the iCEstick?
  5. What is a soft core processor, and why might you want to implement one in FPGA fabric?

Chapters

From the YouTube description

A field-programmable gate array (FPGA) is an integrated circuit (IC) that lets you implement custom digital circuits. You can use an FPGA to create optimized digital logic for things like digital signal processing (DSP), machine learning, and cryptocurrency mining. Because of the FPGA’s flexibility, you can often implement entire processors using its digital logic. You can find FPGAs in consumer electronics, satellites, and in servers used to perform specialized calculations.

In this series, we will see how an FPGA works and demonstrate how to create custom digital logic using the Verilog hardware description language (HDL).

In this first episode, we examine why you might use an FPGA over other solutions, such as a microcontroller. Additionally, we present several example FPGA applications and cover the basic design flow for creating a digital design in an FPGA.

A written version of this video can be found here: https://www.digikey.com/en/maker/projects/introduction-to-fpga-part-1-what-is-an-fpga/3ee5f6c8fa594161a655a9f960060893

All code examples and solutions for this series can be found here: https://github.com/ShawnHymel/introduction-to-fpga

You will need an iCE40 development board for this series. Any of the boards supported by apio https://github.com/FPGAwars/apio#supported-boards should work. That being said, I recommend the iCEstick https://www.digikey.com/en/products/detail/lattice-semiconductor-corporation/ICE40HX1K-STICK-EVN/4289604 , which is what I will use in the videos. You will also need a breadboard, jumper wires, and some pushbuttons.

An FPGA is made up of many programmable logic blocks (PLBs) that can be configured and connected together to create a large number of digital circuits. You create your desired digital circuit using an HDL (we will use Verilog). The synthesis tool converts your HDL into a gate-level representation of the circuit. The place-and-route tool converts that representation into actual configuration information for your particular FPGA.

Throughout the series, we will use the apio tool https://github.com/FPGAwars/apio to manage the build and upload process. Apio relies on underlying tools to complete these steps:

- Synthesis: http://yosyshq.net/yosys/
- Simulation: http://gtkwave.sourceforge.net/
- Place and route: https://github.com/YosysHQ/nextpnr
- Package: icepack as part of Project IceStorm: https://github.com/YosysHQ/icestorm
- Upload: iceprog as part of Project IceStorm: https://github.com/YosysHQ/icestorm

Many times, a microcontroller, microprocessor, or graphics processing unit (GPU) is capable of accomplishing the job. However, you sometimes need custom digital logic for your particular application, which is where an FPGA can be helpful. Here are some potential applications:

- Parallel I/O operations
- Data acquisition (DAQ)
- Specialized computations
- Custom processor

Note: while yosys officially supports Verilog-2005, you can find other open source tools capable of synthesizing other HDLs. For example the GHDL project https://github.com/ghdl/ghdl supports VHDL.

In the next episode, we will install the apio toolset and upload our first FPGA design.

Product Links:
https://www.digikey.com/en/products/detail/lattice-semiconductor-corporation/ICE40HX1K-STICK-EVN/4289604

Related Videos:
https://www.youtube.com/watch?v=z8Oldd-nrfs
https://www.youtube.com/watch?v=5kNXX67mchE
https://www.youtube.com/watch?v=iwcxLQ6AB88

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-fpga-part-1-what-is-an-fpga/3ee5f6c8fa594161a655a9f960060893

Related Articles:
https://www.digikey.com/en/pdf/r/renesas-electronics-america/powering-fpga-applications
https://www.digikey.com/en/videos/d/dsp/edge-machine-deep-learning-on-fpga
https://www.digikey.com/en/product-highlight/l/lattice/ice40-fpga-family-developmental-solutions

Learn more:
Maker.io - https://www.digikey.com/en/maker
Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/
And follow us on Twitter https://twitter.com/digikey

Part 2: Getting Started with Yosys, IceStorm, and Apio →