FPGA Programming and Hardware Essentials (Extract)

Page 1


FPGA Programming and Hardware Essentials

Kick off with the MAX1000 and VHDPlus

}elsif(digits(3) = ‚1‘)

}elsif(digits(2) = ‚1‘)

{ Segment <= N(m/10 mod 10);

}elsif(digits(1) = ‚1‘)

{ Segment <= N(m/100 mod 10);

{ Segment <= N(m/1000 mod 10); } if(rising_edge(CLK))

{ i <= i + 1; if(i = 36000)

{ i <= 0;

i <= i if(i = idigits Digit digits <= digits(2 downto 0) & digits(3); Digit <= digits; } Segment <= N(m mod 10); if(rising_edge(CLK)) { { } } }

FPGA Programming and Hardware Essentials

Dogan Ibrahim

● This is an Elektor Publication. Elektor is the media brand of Elektor International Media B.V. PO Box 11, NL-6114-ZG Susteren, The Netherlands Phone: +31 46 4389444

● All rights reserved. No part of this book may be reproduced in any material form, including photocopying, or storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this publication, without the written permission of the copyright holder except in accordance with the provisions of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder's permission to reproduce any part of the publication should be addressed to the publishers.

● Declaration

The author and publisher have made every effort to ensure the accuracy of the information contained in this book. They do not assume, or hereby disclaim, any liability to any party for any loss or damage caused by errors or omissions in this book, whether such errors or omissions result from negligence, accident, or any other cause. The author expresses his sincere gratitude to Arrow Electronics and Trenz Electronic for granting permission to include various tables, figures, and program codes in this book.

● ISBN 978-3-89576-644-2 Print ISBN 978-3-89576-645-9 eBook

● © Copyright 2024 Elektor International Media www.elektor.com

Editor: Glaucileine Vieira

Prepress Production: D-Vision, Julian van den Berg Printers: Ipskamp, Enschede, The Netherlands

Elektor is the world's leading source of essential technical information and electronics products for pro engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops and delivers high-quality content - via a variety of media channels (including magazines, video, digital media, and social media) in several languages - relating to electronics design and DIY electronics. www.elektormagazine.com

Preface

Almost all complex digital systems are nowadays designed using hardware description languages (HDL). Designs involve using computationally intensive hardware such as ASICs, FPGAs, and PLDs. This is a significant change from earlier designs, which relied on using small and medium-scale integrated circuits.

An FPGA is a configurable integrated circuit that can be programmed after manufacturing. They consist of an array of programmable logic blocks with connecting grids that can be configured and programmed for the design of a complex digital circuit. FPGAs are nowadays used in the automotive industry, aerospace, telecommunications, digital signal processing, and in many industrial sectors. FPGAs can be configured to perform complex combinational logic functions as well as sequential digital logic operations. For example, it is possible to design a complete microcontroller system using FPGAs with a suitable HDL.

MAX1000 is a small, inexpensive, but rather powerful FPGA development board. It consists of memory, user LEDs, push-buttons, input-output ports, and several other on-board interface devices. MAX1000 is highly suitable for starters who want to learn about FPGAs, and also who want to learn to use HDLs. Users can design complex digital circuits and then implement them on the MAX1000 FPGA using its LEDs, I/O, interface features such as SPI, UART, I2C, I2S, etc. Perhaps the biggest advantage of MAX1000 is its simplicity and low cost compared to other FPGAs.

There are several HDLs in use today, such as VHDL, and Verilog. The design is either at an abstract behavioral level or at the structural level where more detailed gate-level designs are done. The MAX1000 can be programmed using the VHDL, VHDPlus, or Python programming languages.

In this book, you will learn to use the VHDPlus FPGA programming language to program the MAX1000. VHDPlus is a superset of the popular programming language VHDL. Users who are familiar with VHDL should find it easier to learn to use VHDPlus. VHDPlus runs on a PC and includes a large number of libraries and examples. Users can develop their FPGA projects on the PC using the VHDPlus IDE and then download the code to the MAX1000. In addition to a rich instruction set, VHDPlus also includes a simulator that helps users simulate their designs before downloading to the MAX1000. Another important feature of VHDPlus is that it supports NIOS II processor creation, where the Arduino Uno processor can be created and programmed inside the MAX1000 FPGA.

Many working and tested projects are given in the book using the VHDPlus programming language and implemented on the MAX1000 FPGA hardware. Readers can easily modify these programs for their own designs.

I hope you enjoy reading the book and that you use the MAX1000 FPGA together with VHDPlus in your next digital design.

Dr. Dogan Ibrahim London, 2024

Chapter 1 • Introduction

1.1 What is a Field Programmable Gate Array (FPGA)?

Field Programmable Gate Arrays (FPGAs) are semiconductor devices that are designed around a matrix of configurable logic blocks (CLBs) connected via user-programmable interconnections. Although CLB is the fundamental logic module of an FPGA, other modules such as interconnects, input-output blocks, and Digital-Signal-Processing (DSP) blocks are other modules within an FPGA.

The FPGA market has been growing steadily in the last decade and it is expected to grow to over USD 20 billion by the year 2030. The market is dominated by famous manufacturers such as Intel/Altera, Lattice, AMD/Xilinx, Microchip, Flex Logix, QuickLogic, Renesas, and some smaller companies that offer lower-cost products. Currently, Xilinx and Altera lead the FPGA market, with Microchip growing in the market.

FPGAs can be programmed by users to desired functionalities or applications after they are manufactured. Application Specific Integrated Circuits (ASICs) are similar to FPGAs, but ASICs are custom manufactured for specific applications or functionalities. Another difference between FPGAs and ASICs is that FPGAs are designed for lower speed and lower complexity. Complex Programmable Logic Devices (CPLDs) are also used in applications similar to FPGAs and ASICs, but they are less flexible and less customizable, although offer higher speeds than FPGAs at lower costs. CPLDs are usually used in less complex front-end logic applications, such as in interfacing, control, and state machines.

FPGAs find applications in various electronic fields, such as in digital signal processing, automotive industries, aerospace & defense electronics, consumer electronics, data centers, industrial applications, high-performance computing, medical applications, image and video processing, security, all fields of electronic communication, complex digital system design, and many more.

The logic blocks of an FPGA can be programmed to perform complex combinational or sequential logic functions. Input/output pads, reprogrammable interconnect, and programmable logic blocks make up a field-programmable gate array. Flip-flops or memory blocks may be utilized as memory components in the logic blocks of a field-programmable gate array. The logic blocks can carry out simple to complicated computational operations.

FPGAs are normally programmed using high-level description languages (HDL) such as VHDL, Verilog, VHDPlus, Python, C, C++, or several others.

The first FPGA was developed by Altera in 1984 (the EP300). This was in the form of an EPROM memory which had a quartz window so that the contents of the memory could be erased using an ultra-violet lamp. The first commercial FPGA was produced by Xilinx in 1985 (the XC2064). This chip had programmable gates and programmable interconnects between these gates.

The real FPGA manufacturing started growing in the 1990s. By the year 2013, Altera had 31% of the market share, Actel had 10%, and Xilinx had 36%. Together these three companies represented 77% of the FPGA market.

There are basically three types of FPGAs: static random-access memory (SRAM)-based, flash-based, and anti-fuse. SRAM-based FPGAs use volatile SRAM cells to store configuration data, which must be loaded every time an FPGA powers up. They are commonly used for prototyping, development, and applications where frequent design changes and tests are needed. Flash-based FPGAs use non-volatile flash memory cells to store configuration data, allowing the FPGA to retain its configuration at power-up. Flash-based FPGAs are most suitable for applications that need instant-on functionality without needing to reload the configuration data at each power cycle. Anti-fuse FPGAs are non-volatile and retain their data at power-up but are one-time programmable and cannot be undone or reconfigured by users. These limitations make anti-fuse FPGAs ideal for applications that require security and do not need additional reprogramming, such as in defense, aerospace, or other high-reliability applications.

The steps to program an FPGA are:

• Use a high-level description language (e.g., VHDL) to describe the required functionality of the task as a code

• Simulate (if possible) and verify the code

• Configure the FPGA device and load the code onto the device

• Run your code on the FPGA

• Test your code in real-time

1.2 Some popular FPGA development boards

There are many FPGA development boards available from companies such as Arrow Electronics, Trenz Electronic, AMD Xilinx, Lattice Semiconductor, QuickLogic, Altera Corporation, Microchip Technology, Terasic, Microsemi, Efinix, Digilent, GOWIN Semiconductor, Invent Logic, etc. The basic specifications of some popular FPGAs are given in this section.

Artix-7 FPGA AC701

This FPGA board (Figure 1.1) is manufactured by AMD. It is a high performance, high functionality FPGA, costing around $1,500. The Artix-7 is used by some other manufacturers as well. Some of its features are:

• 215,360 logic cells

• 740 DSP slices

• 13,140 memory cells

• 16 GTP transceivers

• 500 I/O pins

Some of its board features are:

• 5 x user push buttons

• 4 x user LEDs

• 4-position user DIP switches

• 2 x 16 LCD display

• HDMI video output

• SD card slot

• 10/100/1000 Mbps Ethernet

• UART to USB bridge

• JTAG header

• Pmod header

Further details on Artix-7 are available from the Xilinx website: https://www.xilinx.com/products/boards-and-kits/ek-a7-ac701-g.html

Spartan-7 SP701 FPGA

This board (Figure 1.2) is manufactured by AMD. It is a high-performance FPGA, costing around $800. Some of its features are:

• 102,400 logic cells

• 1,100 kB DRAM, 4,320 KB16 Block RAM

• 160 DSP slices

• 400 I/O pins

• 1 x analog-to-digital converter

• 8 x clock management tiles

• 1 x configuration AES

Some of its board features are:

• 6 x Pmod headers

• 6 x user push buttons

Figure 1.1 Artix-7 development board

• HDMI interface

• 2 x Ethernet ports

• MIPI camera interface

• MIPI display connector

• JTAG connector

Arty A7-100T

This FPGA development board (Figure 1.3) from Digilent costs around $299. Its basic features are:

• 101,440 logic cells

• 240 DSP slices

• 4,860 Kbits memory

• Analog-to-digital converter

Some of its board features are:

• 10/100 Mbps Ethernet port

• USB-UART bridge

• 4 x switches

• 4 x buttons

• 4 x LEDs

• 4 x RGB LEDs

Figure 1.2 Spartan-7 development board

Chapter 1 • Introduction

• 4 x Pmod connectors

• Arduino shield connectors

Further information on Arty A7-100T is available at the following link:

https://digilent.com/shop/arty-a7-100t-artix-7-fpga-development-board/

Figure 1.3 Arty A7-100T development board

USB104 A7

This FPGA (Figure 1.4) from Digilent is based on ADM Xilinx Artix-7, costing $349. Its basic features are:

• 101,440 logic cells

• 240 DSP slices

• 4,860 Kbits memory

Some of its board features are:

• 4 x LEDs

• 2 x push buttons

• USB-UART bridge

• 3 x Pmod ports

• USB-JTAG programming

• 1 x standard SYZYGY port

Further information on Arty A7-100T is available at the following link:

https://digilent.com/shop/usb104-a7-artix-7-fpga-development-board-withsyzygy-compatible-expansion/

BeMicro MAX10

This FPGA development board (Figure 1.5) from Arrow Electronics is designed to get you started using an FPGA. Its basic features are:

• 8,000 logic elements

• 414 Kbits of memory

• 2 x PLLs

• 24 x 18x18 multipliers

• Analog-to-digital converter, 17 analog inputs

• 250 I/O

Some of its board features are:

• ADXL362 three-axis accelerometer

• AD5681 12-bit DAC

• temperature sensor

• thermal resistor

• photo resistor

Further information on BeMicro MAX10 is available at the following link: https://www.arrow.com/en/products/bemicromax10/arrow-development-tools

Figure 1.4 USB104 A7 development board

MAX1000 FPGA

This is the FPGA used in this book (Figure 1.6). It is from Arrow Electronics and is designed to get you started using an FPGA, costing as low as $30. Although the board is described in later chapters in detail, its basic features are:

• Number of logic elements depends on the model and varies from 2,000 to 16,000

• User flash depends on the model and varies from 96Kb to 2,368Kb

• 8 MB SDRAM

• 12 MHz oscillator, PLL to 100 MHz

• Analog-to-digital converter

• USB-Bridge

Some of its board features are:

• 8 x user LEDs

• 2 x user buttons

• Motion sensor

• 3-axis Accelerometer

• Pmod header holes

• Arduino header

• JTAG header

• User I/O header

Further information on MAX1000 is available at the following link: https://www.arrow.com/en/products/max1000/arrow-development-tools

Figure 1.5 BeMicro MAX10 development board

1.6

Daventech iceWerx iCE40-HX8K FPGA

This is a low-cost FPGA board (Figure 1.7) from iceWerx, costing around £30. Its basic specifications are:

• 4 x 10-bit analog channels

• 12 MHz clock

• 7680 logic cells

• 128 kbits embedded RAM (32 × 4 kbit blocks)

• 2 PLL's

1.7 iCE40-HX8K development board

Sparkle FPGA PYNQ-Z2

This FPGA development board costs around £130 (Figure 1.8). Its basic features are:

• 1.3 M reconfigurable gates

• 650 MHz Cortex-A9 processor

• 512 MB DDR3/128 Mbit flash

• Multiple ports with USB, Ethernet, audio and video

• 2 Pmod ports

• Arduino shield connector

• Raspberry Pi connector

Figure
MAX1000 development board
Figure

Basys 3 Artix-7 FPGA Trainer Board

This FPGA board costs around £150 (Figure 1.9) and it is recommended for starters. The basic features of this board are:

• 16 MB memory

• 1,800 Kbits fast block RAM

• Internal clock speed over 450 MHz

• On-chip analog to digital converter

• USB-UART bridge

• VGA output

• 4-digit 7-segment display

• 16 user switches

• 16 user LEDs

• 5 user pushbuttons

• 4 Pmod ports

• USB-JTAG port for FPGA programming and communication

• Power switch

• External power connector

• Reset button

Figure 1.8 Sparkle PYNQ-Z2

CYC1000 FPGA

This is a small but powerful FPGA integrating an Intel Cyclone 10 LP FPGA (Figure 1.10), costing around £30. The basic features are:

• Intel Cyclone 10 LP FPGA: 25 kLE, 66 Memory blocks (9K), 594 Memory blocks (Kb), 18 x 18 multipliers -> 66

• 8 MByte SDRAM

• 8 MByte Flash (W25Q64JVSSIQ)

• ST Microelectronics LIS3DH 3-axis accelerometer

• 21 I/O Arduino MKR compatible headers

• JTAG and UART via Micro USB2 connector

• 2 x 14 pin headers (2.54 mm pitch) for 23 GPIOs

• 1 x 3 pin header for 2 GPIOs

• Pmod: 2x6 Pin support

• 8 x configurable LEDs

• 1 x user push button

• 5.0 V single power supply with on-board voltage regulators

• size: 6.15 x 2.5 cm

Figure 1.9 Basys 3 Artix-7 FPGA
Figure 1.10 CYC1000 FPGA

Chapter 2 • The MAX1000 FPGA Hardware

2.1 Overview

The MAX1000 (Figure 2.1) is a customizable development board, built around the MAX10 FPGA, which is the industry's first single-chip programmable and non-volatile logic device. MAX1000 is equipped with an Arrow USB Programmer 2, SDRAM, flash memory, accelerometer sensor, PMOd, and ARDUINO connectors, making it an ideal product for beginners as well as for project developers.

In this chapter, we will look at the hardware details of the MAX1000 development board.

2.2 The MAX1000 Hardware

Figure 2.2 shows the MAX1000 board layout where the locations of various components and connectors are shown. Next to the Pmod connector holes is the SDRAM with the accelerometer sensor located at its top right corner. The MAX10 chip is on the right of the SDRAM. The flash memory and the oscillator are located next to the MAX10 chip. On the right-hand side of the board, you can see the USB Bridge and the mini USB connector which is used to power the board. The user I/O pins are at the top of the board, the user buttons are at the top right, and the user LEDs are located at the bottom right part of the board. The recommended maximum logic level HIGH voltage is +3.3 V. Voltage level converters must be used if a +5 V source is to be interfaced to MAX1000 pins.

Figure 2.1 The MAX1000 FPGA

In summary, the following are available on the board:

• Intel MAX10 device

• Arrow USB Programmer 2

• 64Mbit SDRAM

• 64Mbit flash memory

• 1 x 12 MHz MEMS oscillator

• 1 x optional MEMS oscillator of preferred frequency

• 8 x red user LEDs

• 2 x board indicator LEDs

• 2 x user buttons

• 1 x 3-axis accelerometer

• 1 x 12-pin Pmod header (just the holes)

• 1 x user JTAG header (just the holes)

• 1 x user I/O header (just the holes)

• Mini USB type-B connector

2.2.1 Board Indicator LEDs

The upper board indicator LED (D1) is ON when +3.3 V power is applied to the board. The lower board indicator LED (D10) is ON when configuration data is loaded into MAX1000 without error (Figure 2.3).

Figure 2.2 MAX1000 board layout (Arrow MAX1000 User Guide)
Figure 2.3 Board indicator LEDs (Arrow MAX1000 User Guide)

2.2.2 Block Diagram

The block diagram of the board is shown in Figure 2.4. The design is centered around the MAX10 chip.

Figure 2.4 MAX1000 block diagram (Arrow MAX1000 User Guide)

Assuming you have a 10M08 type device, the chip resources are:

• 8,000 logic cells

• 378 Kb M9K memory

• 1,376 Kb flash memory

• 2.24 Mb configuration memory

• 1 x 12-bit 8-input 1 Msps Analog-to-digital converter (ADC)

• 2 x Phase-locked Loops (PLLs)

• 24x 18x18 multipliers

• 2 x configuration images

• 12 MHz oscillator

Figure 2.5 shows the MAX1000 pin layout.

Table 2.1 Arduino connector pins
Table 2.2 Pmod connector pins

FPGA Programming and Hardware Essentials

Kick off with the MAX1000 and VHDPlus

Ready to Master FPGA Programming? In this guide, we’re diving into the world of Field-Programmable Gate Arrays (FPGAs)—a configurable integrated circuit that can be programmed after manufacturing. Imagine bringing your ideas to life, from simple projects to complete microcontroller systems!

Meet the MAX1000: a compact and budget-friendly FPGA development board packed with features like memory, user LEDs, push-buttons, and flexible I/O ports. It’s the ideal starting point for anyone wanting to learn about FPGAs and Hardware Description Languages (HDLs).

In this book, you’ll get hands-on with the VHDPlus programming language—a simpler version of VHDL. We’ll work on practical projects using the MAX1000, helping you gain the skills and confidence to unleash your creativity.

Get ready for an exciting journey! You’ll explore a variety of projects that highlight the true power of FPGAs. Let’s turn your ideas into reality and embark on your FPGA adventure—your journey starts now!

Exciting Projects You’ll Find in This Book

> Arduino-Driven BCD to 7-Segment Display Decoder

> Use an Arduino Uno R4 to supply BCD data to the decoder, counting from 0 to 9 with a one-second delay.

> Multiplexed 4-Digit Event Counter

> Create an event counter that displays the total count on a 4-digit display, incrementing with each button press.

> PWM Waveform with Fixed Duty Cycle

> Generate a PWM waveform at 1 kHz with a fixed duty cycle of 50%.

> Ultrasonic Distance Measurement

> Measure distances using an ultrasonic sensor, displaying the results on a 4-digit 7-segment LED.

> Electronic Lock

> Build a simple electronic lock using combinational logic gates with push buttons and an LED output.

> Temperature Sensor

> Monitor ambient temperature with a TMP36 sensor and display the readings on a 7-segment LED.

Prof. Dr. Dogan Ibrahim holds a BSc in Electronic Engineering, an MSc in Automatic Control Engineering, and a PhD in Digital Signal Processing. He has worked in various industrial organizations before returning to academic life. Prof. Ibrahim is the author of over 70 technical books and has published more than 200 technical articles on microcontrollers, microprocessors, and related fields. He is a Chartered Electrical Engineer and a Fellow of the Institution of Engineering and Technology. Additionally, he is a certified Arduino professional.

Elektor International Media www.elektor.com

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.