FPGA from Blinker to Game of Life,
through RISC-V also

Prof. Ricardo Menotti, Thiago Martins, Gustavo M. Barreto and Lucas Arruk Mendes

Let's get to know each other first

menti.com   kahoot.it

Practical Approach

This course will follow a very practical approach, so let's get to the code... 👉

But take it easy

We need at least a bit of context...👇

The two ways of computing [1]

Playing music with hardware/software

The third way... [1]

Field-Programmable Gate Array (FPGA) [1]

What an incredible circuit! [1]

Intel® Stratix® 10 FPGA and SoC ALM Block Diagram [2]

Intel® Hyperflex™ Core Architecture [2]

Intel® Stratix® 10 FPGA and SoC Architecture Block Diagram [2]

Economic and performance tradeoffs [3]

Flexibility vs performance [4]

Recover or Crack? [5]

Mandelbrot set [6]

Clock Speed Render Time Cycles Used
VHDL-based generator 25MHz 0.2 seconds 5,000,000
Nios II (hardware floats) 100MHz 23.8 seconds 2,380,000,000
Visual C++ test program 2GHz 3.3 seconds 6,600,000,000
Nios II (software floats) 100MHz 54 minutes, 30 seconds 327,000,000,000

And how do I use it? [1]

That's enough context

Let's go!

Before the labs, let's clarify some concepts

click here to open a hardware simulator (a.k.a. Github)

  • Press . to edit with VS Code 🥚
  • Install the following extensions:
    • Verilog Highlight
    • DigitalJS

Our first Blinker

Let's do it!

Pratice time (Lab. #1a)

Our first Blinker

Our first Counter

Our first Counter

Let's do it!

Pratice time (Lab. #1b)

A sequential problem

\[\small F_0 = 0, F_1 = 1, F_n = F_{n-1} + F_{n-2}\]
Simulate it here!

Seven segments decoder

Let's do it!

Pratice time (Lab. #2)

A parallelizable problem

\[\small gray = (R \times 0.299) + (G \times 0.587) + (B \times 0.114)\]

VGA signal generation

ROM memory (with contents)

Linear-Feedback Shift Register (LFSR)

Putting all together

Let's do it!

Pratice time (Lab. #3)

Duc in altum!

Gospers glider gun.gif

Gosper glider gun

Conway's Game of Life

  1. Any live cell with fewer than two live neighbours dies, as if by underpopulation;
  2. Any live cell with two or three live neighbours lives on to the next generation;
  3. Any live cell with more than three live neighbours dies, as if by overpopulation;
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Hardware design [7]

Conway's Game of Life

Let's do it!

Pratice time (Lab. #4)

RISC-V is an open standard Instruction Set Architecture (ISA) enabling a new era of processor innovation through open collaboration

RISC-V enables the community to share technical investment, contribute to the strategic future, create more rapidly, enjoy unprecedented design freedom, and substantially reduce the cost of innovation

From Blinker to RISC-V [8]

  1. Brief explanation of RISC-V philosophy
  2. Didactic and very well documented tutorial
  3. Targeting small FPGAs with open source tools

FemtoRV (step20.v)

System-On-Chip

Using Memory-Mapped I/O

Incrementing LEDs (counter)

Let's do it!

Pratice time (Lab. #5ab)

Conway's Game of Life

https://godbolt.org/z/Yc54z1s6b

Conway's Game of Life

Troubles:

  1. Takes up twice the memory
  2. Generates mul instruction to address memory
  3. Generates rem instruction to wrap around screen

Conway's Game of Life

Workarounds:

  1. Replicate only part of the frame buffer
  2. Linearize memory access using macros
  3. Software pipeline techniques to handle edges

Conway's Game of Life

https://godbolt.org/z/PqerTYx8d

Let's do it!

Pratice time (Lab. #5c)

AI & approximate computing

FPGA roles in quantum computing

  1. Hardware-accelerated simulation and emulation
  2. Post-quantum cryptography (PQC)
  3. Quantum error correction (QEC)
  4. Quantum control systems
    1. High-speed pulse generation
    2. Real-time measurement and feedback
    3. Radio Frequency System-on-Chip (RFSoC)

Thank you!

FPGA from Blinker to Game of Life,
through RISC-V also

Prof. Ricardo Menotti, Thiago Martins, Gustavo M. Barreto and Lucas Arruk Mendes

Additional readings

Our book
  1. QuestI0
  2. WONG, H., HDLBits, 2017.
  3. MENOTTI, R. Digital Logic Course., 2023.
  4. ANDREW, M.; RON, W. FPGA for Dummies. 2017.