What Is a Hardware Description Language (HDL)?
This FEQ (or Frequent Engineering Question) covers the basics of a crucial topic: hardware description languages.
Digital circuits consist primarily of interconnected transistors. We design and analyze these circuits with the aid of a hierarchical structure: we could, in theory, interpret a central processing unit (CPU) as a vast sea of transistors, but it is much easier to organize transistors into logic gates, logic gates into adders or registers or timing modules, registers into memory banks, and so forth.
This hierarchical structure allows us to effectively represent a digital circuit by means of interconnected diagrams. We call this a schematic. This visual approach to describing a digital circuit is intuitive, but it becomes impractical as complexity increases. Another way to describe digital circuits is to use a textual language that is specifically intended to clearly and concisely capture the defining features of digital design.
Such languages exist, and they are called hardware description languages (HDLs).
What Do HDLs Do?
The most popular hardware description languages are Verilog and VHDL. They are widely used in conjunction with FPGAs, which are digital devices that are specifically designed to facilitate the creation of customized digital circuits.
Hardware description languages allow you to describe a circuit using words and symbols, and then development software can convert that textual description into configuration data that is loaded into the FPGA in order to implement the desired functionality.
An Example of HDL Code
Here is an example of HDL code:
1 entity Circuit_1 is
2 Port ( a : in STD_LOGIC;
3 b : in STD_LOGIC;
4 out1 : out STD_LOGIC);
5 end Circuit_1;
-----------------------------------------------------
6 architecture Behavioral of Circuit_1 is
8 begin
9 out1 <= ( a and b );
10 end Behavioral;
The electrical behavior described by this code can be visually represented as follows:
Programming Languages vs. Hardware Description Languages
Many people are already familiar with programming languages when they begin to learn about hardware description languages. HDLs resemble high-level programming languages such as C or Python, but it’s important to understand that there is a fundamental difference: statements in HDL code involve parallel operation, whereas programming languages represent sequential operation.
When we write a computer program or firmware module, we understand that the processor will execute lines of code one at a time, following the top-to-bottom organization that we use when reading text on a page.
In HDL code, we are describing digital hardware, and separate portions of this hardware can operate simultaneously, despite the fact that the corresponding lines of code are written using a top-to-bottom organization.
Further Reading
- Programming Languages for Embedded Systems 101: Background and Resources
- A Microcontroller Enthusiast’s First Look at Programmable Logic
- Getting Started with FPGAs: The Development Environment and “Hello World”
What do you want to learn about hardware description languages? Share your questions in the comments below.