Simulating Hardware in VHDL Using GHDL

Follow the steps below to create a simple “Hello, World” program in VHDL using GHDL.

VHDL, or “VHSIC Hardware Description Language”, is a programming language used to simulate the operation of computer hardware in software.  It provides a standardized method of designing and testing electronic hardware, which reduces the difficulty of the design’s eventual translation into real, physical components.

GHDL is an open-source simulator that can compile and run VHDL code.

1. Download and extract GHDL.  As of this writing, the latest Windows version is available at the URL “https://github.com/tgingold/ghdl/releases/tag/v0.33”.

2. Locate “GHDL.exe” within the “bin” directory of the newly extracted GHDL archive.  Make a note of the path of GHDL.exe. If desired, this path can be added to the system’s PATH environment variable.

3. In any convenient location, create a new directory named “VHDLTest”.

4. In the newly created VHDLTest directory, create a new text file named “hello.vhdl”, containing the following text. This code is taken from the file “ghdl.htm” within the GHDL archive.


     --  Hello world program.
     use std.textio.all; --  Imports the standard textio package.

     --  Defines a design entity, without any ports.
     entity hello_world is
     end hello_world;

     architecture behaviour of hello_world is
     begin
        process
           variable l : line;
        begin
           write (l, String'("Hello world!"));
           writeline (output, l);
           wait;
        end process;
     end behaviour;

5. Open a command prompt window and run the following commands, substituting the full path of the file ghdl.exe where necessary:


ghdl.exe -a hello.vhdl
ghdl.exe -e hello_world
ghdl.exe -r hello_world

6. Verify that the message “Hello world!” appears in the command prompt window.

Advertisements
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s