Block Ram in Verilog with Vivado

Block Ram in Verilog with Vivado

You want to use Block Ram in Verilog with Vivado

There are two types of internal memory available on a typical FPGA:

  • Distributed Ram: made from the FPGA logic (LUTs)
  • Block Ram: dedicated memory blocks within the FPGA; also known as bram

However, persuading Vivado to make use of block ram isn't simple a case of changing a preference. You need to create a Verilog implementation that Vivado can infer as block ram. This recipe looks at inferring block ram on Xilinx 7 Series FPGAs (Spartan-7. Artix-7, Kintex-7, and Virtex-7), but this information should be relevant to other developers too. 

Read More

Initialize Memory in Verilog

Initialize Memory in Verilog

You want to initialize memory from a file using Verilog.

It's common for a simulation or firmware to need data loading into a memory array. Fortunately Verilog provides the $readmemh and $readmemb functions for this very purposes. Unfortunately there is a dearth of good Verilog documentation online, so using them can be harder than it should be. This article explains the syntax and provides plenty of examples, including how to do this in Xilinx Vivado.

Read More

Arty VGA Graphics in Verilog Part 1

Arty VGA Graphics in Verilog Part 1

 This tutorial series introduces video programming using FPGAs, starting with creating a VGA driver and moving onto more advanced features such as sprites and effects. FPGAs excel at high-speed I/O and custom logic: you'll be surprised how much you can achieve with a few hundred lines of Verilog.

The Digilent Arty is an inexpensive dev board based on a Xilinx Artix-7 FPGA. It doesn't have any built-in video output, but there is a $9 VGA Pmod board that adds VGA output. This article demonstrates how to directly produce simple VGA graphics using the Arty, VGA Pmod, and Verilog.  I assume you have a basic understanding of Verilog and are comfortable using Vivado. If you're new to Arty development try Getting Started with Verilog & Vivado first. You'll also need a VGA cable and monitor that supports VGA signals.

These tutorials should also work with the Digilent Basys3 board, which has built-in VGA output. However, you will need to adapt the constraints files used in this series; advice on how to do this is provided when you create your first constraints file, below.

Read More

Arty FPGA 02: Clocks, Counting, & Colour

Arty FPGA 02: Clocks, Counting, & Colour

Welcome back to my FPGA tutorial series with the Digilent Arty dev board and Verilog. In this second part we're going to use the 100 MHz clock on the Arty board to control the LEDs. We can obviously use the clock to flash the LEDs on and off, but the clock also allows us to control the brightness of the LEDs using a technique called pulse width modulation (PWM). PWN is commonly used in digital circuits to control the speed of motors as well as the brightness of lights (for example in the backlight of LCD screens). Finally we'll make use of PWM to control the colour of the RGB LEDs.

Read More

Arty FPGA 01: Hello World with Verilog & Vivado

Arty FPGA 01: Hello World with Verilog & Vivado

This Time to Explore tutorial series provides an introduction to development using FPGAs (Field Programmable Gate Arrays). On a microcontroller or PC you write software to run on an existing CPU. With an FPGA you develop the hardware itself at the logic level. This makes FPGAs uniquely flexible and powerful: especially when dealing with complex or parallel tasks and high-speed I/O such as networking and video. 

However, FPGAs are more than just a faster way to do what you already do; they're a fundamentally different tool that can solve many problems that would otherwise be impractical. Different materials have different properties: metal is not simply shiny plastic it has its own strengths and weaknesses. The same applies to FPGAs and microcontrollers: they can be used for some of the same purposes, but are fundamentally different. It's difficult to convey this in words: you really do need to experiment with FPGAs yourself to appreciate what they can do.

No prior experience of FPGA development is required to follow these tutorials, but basic knowledge of programming concepts is assumed. If you can write a simple program in Python, Ruby, or JavaScript then you shouldn't have any trouble with this course.

Finally, I find working with FPGAs gives me a sense of delight so often lacking in modern software development. There's something deeply satisfying about designing at the hardware level, be it drawing graphics on a screen, producing sound from a speaker, or even implementing your own arcade game from scratch. I hope you find these tutorials useful and have fun experimenting with FPGAs.
 

Read More