Difference between revisions of "VHDL"

From UCT EE Wiki
Jump to navigation Jump to search
Line 26: Line 26:
 
As we have mentioned an entity is a "box" with inputs and outputs called ports. We need to give the ports names and associate them with an entity. Here is an example of this:
 
As we have mentioned an entity is a "box" with inputs and outputs called ports. We need to give the ports names and associate them with an entity. Here is an example of this:
  
<pre>
+
<syntaxhighlight lang="vhdl" line='line'>
 
entity hadder is
 
entity hadder is
 
     port
 
     port
         ( inA, inB: in std_logic;
+
         (inA, inB : in std_logic;
        sum,carry: out std_logic); --note the semicolon
+
        sum,carry : out std_logic); --note the semicolon
 
end hadder;
 
end hadder;
</pre>
+
</syntaxhighlight>
  
 
This entity declaration states that we are creating an entity called hadder. This entity has two inputs called inA and inB and two outputs called sum and carry. Further we have declared that the ports are all 'std_logic' values. A std_logic value is basically a binary bit, which can take on the value 0 and 1. Std_logic bits can also take on a few other states, such as high impedance and undefined, in order to closely model the behaviour of real logic bits. The entity is shown graphically here:
 
This entity declaration states that we are creating an entity called hadder. This entity has two inputs called inA and inB and two outputs called sum and carry. Further we have declared that the ports are all 'std_logic' values. A std_logic value is basically a binary bit, which can take on the value 0 and 1. Std_logic bits can also take on a few other states, such as high impedance and undefined, in order to closely model the behaviour of real logic bits. The entity is shown graphically here:
Line 49: Line 49:
  
 
Here is an example of structural description:
 
Here is an example of structural description:
<pre>
+
<syntaxhighlight lang="vhdl" line='line'>
 
architecture structure of hadder is
 
architecture structure of hadder is
 
--We now need to describe the interface to the components that we are
 
--We now need to describe the interface to the components that we are
Line 72: Line 72:
 
  myXOR: a_7486 port map (a_2=>inputA,a_3=>inputB,a_1=>sum);
 
  myXOR: a_7486 port map (a_2=>inputA,a_3=>inputB,a_1=>sum);
 
end structure;
 
end structure;
</pre>
+
</syntaxhighlight>
  
 
The first thing that we do is state which components are contained in our box. These are an AND gate and an XOR gate. We also define the ports of these components. Note that the components were created previously and we are only using them here. We then define two signals. These signals are the internal "wires" which connect components together. The signals are inputA and inputB.
 
The first thing that we do is state which components are contained in our box. These are an AND gate and an XOR gate. We also define the ports of these components. Note that the components were created previously and we are only using them here. We then define two signals. These signals are the internal "wires" which connect components together. The signals are inputA and inputB.

Revision as of 10:14, 16 July 2020

VHDL stands for VHSIC-HDL, which in turn stands for Very High Speed Integrated Circuit Hardware Description Language. It is one way in which hardware can be described. The guide below was adapted by notes originally written by Samuel Ginsberg, which can be downloaded as a PDF here.

Structure and Behaviour

There are two fundamentally different ways of specifying logic. The first method is to specify the structure of the logic and the other method is to specify the behaviour of the system.

Structure

[Show/hide]

Behaviour

[Show/hide]

Entities

[Show/hide]

Architectures

[Show/hide]

Processes

Variables

VHDL Syntax

VHDL Operators

Attributes of Objects

More on Processes

Changing Execution Flow in VHDL

Dividing Big Jobs into Little Jobs

Packages

Conversion Functions

Megafunctions