Lecture 5 HO

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Digital Electronics: EE 304

VHDL: Lecture 5
Introduction to Very High-Speed Integrated Circuit Hardware Description
Languages [VHDL]
.
Electrical and Electronic Department
Faculty of Engineering and the Built Environment

1 H.24.10.2022
M. Katongera Electrical and Electronic Department
OFFICE CD 37 mkatongera@eng.uz.ac.zw
Faculty of Engineering and the Built Environment
SUMMARY

Introduction

VHDL Modules

VHDL Descriptions of Combinational Logic

2 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
INTRODUCTION

3 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction

A hardware description language (HDL) is a


computer-based language that describes the
hardware of digital systems in a textual form.

It can be used to represent logic diagrams, truth


tables, Boolean expressions, and complex
abstractions of the behaviour of a digital system

4 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction

HDL describes a relationship between the input


signals to a circuit and the output signals of the
circuit

5 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Documentation

As a documentation language, an HDL is used to


represent and document digital systems in a form
that can be read by both humans and computers.

Design entry creates an HDL-based description of


the functionality that is to be implemented in
hardware

6 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Documentation

The description can be in a variety of forms:


Boolean logic equations, truth tables, a netlist of
interconnected gates, or an abstract behavioural
model

7 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Logic Simulation

Logic simulation displays the behaviour of a digital


system through the use of a computer.

Errors that are detected during a simulation can


be corrected by modifying the appropriate HDL
statements.

The stimulus that tests the functionality of the


design is called a test bench

8 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Logic Simulation

An alternative and more complex approach to


testing relies on formal mathematical methods to
prove that a circuit is functional correct

9 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Logic Synthesis

Logic synthesis is the process of deriving a list of


physical components and their interconnections
(called a netlist).

The netlist can be used to fabricate an integrated


circuit or to lay out a printed circuit board.

Logic synthesis is like compiling a program in a


conventional high level language

10 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Logic Synthesis

The designs of today's large, complex circuits are


made possible by logic synthesis software

11 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Timing verification

Timing verification confirms that the fabricated


integrated circuit will operate at a specified speed.

Timing verification checks each signal path to


verify that it is not compromised by propagation
delay

12 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: Timing verification

In VLSI circuit design fault simulation compares


the behaviour of an ideal circuit with the behaviour
of a circuit that contains a process-induced flaw

13 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Introduction: VHDL

In the public domain, there are two standard


HDLs that are supported by the IEEE: VHDL and
Verilog

14 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL MODULES

15 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules

To write a complete VHDL module like a logic


gate:
Declare all of the input and output signals using an
entity declaration, and

Specify the internal operation of the module using an


architecture declaration

16 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Example

VHDL module with two logic gates:

17 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Entity Declaration

VHDL Each entity declaration includes a list of


interface signals that can be used to connect to:
other modules

the outside world

18 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Entity Declaration

Port interface in square brackets is optional:

19 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Entity Declaration

Curly brackets indicate zero or more repetitions

Input signals are in mode in, and outputs are in


mode out.

Bidirectional signals are in mode inout

20 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Architecture Declaration

Associated with each entity is one or more


architecture declarations of the form

In declarations section, we find signals or


components used within the architecture

21 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Full Adder Example

Entity declaration of a full adder

Our input and output modes are of signal type


bit

22 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Full Adder Example

Operation of the full adder is specified by an


architecture declaration
Note architecture name is Equations.

Entity name FullAdder should match a declared entity

23 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Full Adder Example

Sum and Cout represent the logic equations


In the Cout equation, parentheses are required around
(X and Y) because VHDL does not specify an order of
precedence for the logic operators

24 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Full Adder Example

Now we show how module FullAdder is used as a


component in VHDL

25 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Full Adder Example

The VHDL code of four bit full adder

26 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Signals and Constants

Input and output signals for a module are


declared in the ports

Signals internal to the module, are declared at


beginning of Architecture.
signal list_of_signal_names: type_name [constraint] [:=
initial_value];

signal A, B, C: bit_vector(3 downto 0):= “1111”;

27 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Signals and Constants

Constants used within the module, are declared at


beginning of Architecture.
constant constant_name: type_name [constraint] [:=
constant_value];

constant limit : integer := 17;

28 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Modules: Arrays

To use arrays, we first declare an array type and


then declare the array object after the array type.
type SHORT_WORD is array (15 downto 0) of bit;

signal DATA_WORD: SHORT_WORD;

signal ALT_WORD: SHORT_WORD := “0101010101010101”;

constant ONE_WORD: SHORT_WORD := (others => ‘1’);

Others will set all bits to 1.

29 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Operators

There are seven classes of VHD operators

30 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Packages and Libraries

Packages are used to reference frequently used


functions and components

Package declaration has the form:

31 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Packages and Libraries

The package body usually contains component


descriptions and the function and procedure
bodies

Package declaration has the form:

32 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Packages and Libraries

To use a package components and functions, at


the beginning of VHDL file you call package using
USE statement.

Say a library BITLIB has bit_pack package


library BITLIB;

use BITLIB.bit_pack.all;

33 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
VHDL Packages and Libraries

To use a package components and functions, at


the beginning of VHDL file you call package using
USE statement.

Say a library ieee has std_logic_1164 package


library ieee;
use ieee.std_logic_1164.all;

34 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
Compilation and Simulation

After describing a digital system using VHDL one


can simulate the VHDL code by compiling.

If code has no error, compiler or analyser


generates intermediate code which can be used by
simulator.

Elaboration is done, ports are created, memory


reserved for variables and necessary settings.

35 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department


Faculty of Engineering and the Built Environment
36 24.10.2022 H. M. Katongera – mkatongera@eng.uz.ac.zw Electrical and Electronic Department
Faculty of Engineering and the Built Environment

You might also like