Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Al Williams

Dr. Dobb's Bloggers

Starts with a V

June 18, 2013

A few weeks ago I spent a good deal of time talking about Verilog — a description language used to design FPGA circuits. However, several people took me to task for not making much mention of the other major language in use for this purpose: VHDL. VHDL (or VHSIC Hardware Description Language — VHSIC stands for Very High Speed Integrated Circuit) is a language that resembles Ada. That shouldn't be surprising, since both languages have a background with the United States Department of Defense.

Like any language, VHDL has its proponents and its detractors. My guess is if you like C, you might prefer Verilog and if you favor Ada or other similar languages, you might find VHDL to your liking. The languages are functionally similar. That is, you describe concurrent behavior and can only use certain language constructs if you expect to infer hardware designs. Both languages support things that are only for simulation and won't translate to an FPGA or other hardware implementation.

VHDL uses three different things to describe a circuit: an entity (think of this as a header file), an architecture (the implementation), and a configuration (bringing together different architectures into a complete system). Here's a simple 8 bit counter:

-- simple up counter
library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;

entity counter is
    port (
        cntout   :out std_logic_vector (7 downto 0);  
        enable :in  std_logic;                      -- Enable count
        clk    :in  std_logic;                      -- Clock
        reset  :in  std_logic                       -- Reset
end entity;

architecture behave of counter is
    signal count :std_logic_vector (7 downto 0);
    process (clk, reset) begin
        if (reset = '1') then
            count <= (others=>'0');
        elsif (rising_edge(clk)) then
            if (enable = '1') then
                count <= count + 1;
            end if;
        end if;
    end process;
    cntout <= count;
end architecture;

The tools from the major vendors will all take VHDL as well as Verilog. The simulator I used, Icarus, won't handle VHDL but a similar open source package, GHDL, will do the same job. As a side note, Icarus will translate Verilog into VHDL.

I'm not going to go into VHDL for now, but thought it would be worth mentioning it. If you want some interesting reading, as well as a nice front end for GHDL, visit freerangefactory.org. You can download their free book on VHDL (which is a pretty good read), a few other books of interest, and the software package Boot (for Linux), which is a front end that bridges your favorite editor, GHDL, and the OpenCores website. If you are using Windows or Mac OS, skip the Boot download and get GHDL from its home webpage.

You don't have to use an HDL to define an FPGA, by the way. There is a lot of interest in translating ordinary computer languages into FPGA code. While this is possible, it is a bit like running source code through a compiler. The result will work, but understanding the output may be a bit difficult. If you want to experiment, you can try a C to Verilog translator online. If you want to read more about that tool, I wrote about it way back in 2011.

I may revisit VHDL at some point in the future, especially if I get enough requests to do so. However, to be honest, I prefer using Verilog on my personal projects. Sometimes I have no choice, though, so I have done a good bit of VHDL and it certainly gets the job done.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.