Lecture-1-2-3 UEC859 PDF
Lecture-1-2-3 UEC859 PDF
Lecture-1-2-3 UEC859 PDF
= Equality operator
/= Inequality operator
:= The assignment operator for variables
< The “less than” operator
<= “less than or equal to” when used in an expression on scalar types & array
The assignment operator
> The “greater than” operator
>= The “greater than or equal to” operator
+ The addition operator
- The subtraction operator
* The multiplication operator
/ The division operator
** The exponentiation operator
& The concatenation operator
Operator Precedence
Some
The Interface keywords (reserved words)
type
(A, B : in BIT; type
Z : out BIT);
identifier
Statement Part
Z <= A or B ;
end DATA_FLOW ;
and
Other operators:
or *** “Anytime the input signal A and or B changes value the
xor signal assignment statement executes and computes a new
value for the output signal. ” This is called “ Signal
xnor Transformation.”
nand
nor
not
VHDL Program Skelton
library ieee; use ieee.std_logic_1164.all;
entity XOR_2 is
Port (A,B : in BIT; Z : out BIT);
end XOR_2;
-- Body
architecture DATA_FLOW of XOR_2 is
end DATA_FLOW;
Libraries (Predefined)
WORK
The working library into which design units are presently
being analyzed are stored. (ie. design entities).
Libraries (Predefined)
• Logic function
– and, nand, or, nor, xor, xnor, not
VHDL Format : Library
Arithmetic functions : +, -, *
Comparison functions : <, >, <=, >=, =, /= and etc.
↔ std_logic_signed
ENTITY nand_gate IS
PORT(
a : IN STD_LOGIC;
b : IN STD_LOGIC;
No Semicolon
z : OUT STD_LOGIC after last port
);
END nand_gate;
VHDL Design
Styles
BEHAVIORAL
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY xor3 IS
PORT(
A : IN STD_LOGIC;
B : IN STD_LOGIC;
C : IN STD_LOGIC;
Result : OUT STD_LOGIC
);
END xor3;
1. Data Flow Description
• Describes how data moves through the system and the various
processing steps.
– Dataflow uses series of concurrent statements to realize logic.
– Dataflow is most useful style when series of Boolean equations
can represent a logic used to implement simple
combinational logic
XOR3
Cont’d…
PROCESS (A,B,C)
BEGIN
IF ((A XOR B XOR C) = '1') THEN
Result <= '1';
ELSE
Result <= '0';
END IF;
END PROCESS;
END behavioral;
Test Bench your Model
• Initialization phase
– each signal is given its initial value
– for each process
• activate
• execute until a wait statement, then suspend
Simulation Model for Half Adder
VHDL Model of HA VHDL Test bench Model for HA
Lecture : 3
VHDL Data Types
Types
Composite
Access
Scalar
Array Record
• In the above example, the first two variable assignments are valid
since they assign integers to variables of type integer.
‘0’ : logic 0
‘1’ : logic 1
‘-’ : Don’t care
'U': uninitialized,
'X': unknown
'Z': High Impedance
'W': Weak signal, can't tell if it should be 0 or 1.
'L': Weak signal that should probably go to 0
‘H': Weak signal that should probably go to 1
VHDL Data Types: Enumerated data type
• The enumerated data type allows a user to specify the list of legal
values that a variable or signal of the defined type may be assigned.
VHDL Data Types: Physical data type
• Example of physical type declaration:
• The physical data type is used for values which have associated units.
• The designer first declares the name and range of the data type and then
specifies the units of the type.
• Notice there is no semicolon separating the end of the TYPE statement and the
UNITS statement.
• The line after the UNITS line states the base unit of the type. The units after the
base unit statement may be in terms of the base unit or another already
defined unit.
• The VHDL access type will not be discussed in detail in this module.
VHDL Data Types: Subtype
• Declaration example:
VHDL Objects: Signal
• Used for communication between components
• Declaration Syntax:
• Declaration example:
VHDL Objects: Variable vs. Signal
• A key difference between variables and signal is the
assignment delay
VHDL Objects: Variable vs. Signal
• In this example, variables are used to achieve the same functionality as
the example in the previous slide
• Files provide the way for a VHDL design to communicate with host
environment
• The package TEXTIO defines powerful routine handling I/O of test files