Hello everyone, I'm among the selected challengers for the 7 ways to leave your Spartan-6 design challenge. Firstly I would like to thank the e14 community for providing me with the Arty S7 FPGA board. This will be my first FPGA board, having one of the modern FPGA architectures. I own a Spartan 3E board (Papilio One) which I bought during my early engineering days to learn about FPGAs.
The first blog will be an informatory blog to understand better FPGAs and how they differ from another most popular programmable hardware, i.e., the microcontroller. I will also talk about the differences between the HDLs and some syntax of VHDL. I will use VHDL for all my projects since I know the language and am comfortable with it.
With the Arty S7 board, I have planned to execute the following examples/projects-
Blog 1: Getting Started with FPGAs using VHDL
Blog 2: Getting Started with FPGAs - Digital Logic Design with FPGAs
Blog 3: Interfacing with FPGAs - LEDs, switches, 7 segment displays
Blog 4: Projects with FPGA - IR Object counter using FPGA
Blog 5: Using XADC demo and interfacing analog sensor with FPGA
Blog 6: Summary
Let's start by understanding FPGA and the difference between FPGA and MCU.
FPGA stands for Field Programmable Gate Array. It is essentially a collection of a massive number of digital logic blocks that are not connected. A user can 'wire' these logic blocks to implement pretty much any digital logic architecture inside the FPGA by writing a program using a hardware description language or HDL.
When I say programmable, the other immediate alternative that one thinks of is the microcontroller unit (MCU). MCUs are also programmable devices and are capable of performing digital logic operations. Then how do these two differ from each other?
The answer is very interesting - An FPGA performs concurrent operations, whereas an MCU performs sequential operations. This also means that the programmer must now pay attention to their coding methodology. Because in normal programming languages like C, C++, etc, the commands are executed sequentially, which means one statement execution is followed by the other. However, in an FPGA, all the statements are executed simultaneously or in parallel. This makes an FPGA much faster than an MCU.
Another difficulty one may face while writing programs for FPGAs is that while writing the program, one has to think of the digital implementation of the task that the user wants to perform. For example, if you are coding an FPGA for a finite state machine, then the programmer has to have a basic idea of what the digital circuit would comprise of (gates, flip flops, counters, etc). This is unlike the programs written for MCUs. Because in HDL, you'll be describing the logic gates and their connections within the FPGA, meaning you would implement the digital circuit onto the FPGA. This also means that one can implement an entire MCU architecture on an FPGA because MCUs contain nothing but separate digital logic circuits such as the CPU, timers, counters, digital I/O ports, etc.
Next, let's talk about HDLs. A hardware description language is used to describe the connections of several logic blocks or LUTs within an FPGA.
I will talk about one of the two HDLs - VHDL.
VHDL stands for Very High-Speed Integrated Circuit Hardware Description Language. VHDL is not case-sensitive, so it's easier to type and implement without any mistakes.
VHDL program contains two units - entity and architecture. An entity contains the architecture and not the other way around. An entity will basically describe the ports and other signals, whereas an architecture will do logical operations on these ports/signals.
An example of entity is shown below
entity name_of_entity is
port(
port_1 : in std_logic ;
port_2 : out std_logic; );
end name_of_entity;
-- This a comment in VHDL
Here, the entity is named as name_of_entity
the port defines the I/O port's names and the type of port direction (input or output)
double dash -- is the syntax for comments in VHDL.
Also, note that every statement in VHDL ends with a semicolon ';' just like C or C++.
Next, you'll have to define an architecture for the entity. The syntax for an entity is as follows -
architecture name_of_architecture of name_of_entity is
--write your statements/code here
end name_of_architecture;
This covers the basic VHDL framework. In the next blog, I will be covering the design of logic gates and hardware implementation using VHDL on the Arty S7 board using Vivado. Once we are able to design logic gates and implement digital architectures on FPGAs, we can move to advanced designs using FPGAs.