Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
6 views

A Tutorial Introduction to VHDL Programming Gazi download

The document is a tutorial introduction to VHDL programming by Orhan Gazi, covering fundamental concepts such as entities, architectures, data types, and VHDL operators. It includes sections on combinational and sequential circuit design, simulation of VHDL programs, and user-defined data types. The book is published by Springer Nature and is intended for those looking to learn VHDL programming in a structured manner.

Uploaded by

magzoblosika69
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
6 views

A Tutorial Introduction to VHDL Programming Gazi download

The document is a tutorial introduction to VHDL programming by Orhan Gazi, covering fundamental concepts such as entities, architectures, data types, and VHDL operators. It includes sections on combinational and sequential circuit design, simulation of VHDL programs, and user-defined data types. The book is published by Springer Nature and is intended for those looking to learn VHDL programming in a structured manner.

Uploaded by

magzoblosika69
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

A Tutorial Introduction to VHDL Programming Gazi

download

https://ebookmeta.com/product/a-tutorial-introduction-to-vhdl-
programming-gazi/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Modern C Programming Including Standards C99 C11 C17


C23 1st Edition Gazi

https://ebookmeta.com/product/modern-c-programming-including-
standards-c99-c11-c17-c23-1st-edition-gazi/

Eloquent JavaScript 3rd Edition A Modern Introduction


to Programming Marijn Haverbeke

https://ebookmeta.com/product/eloquent-javascript-3rd-edition-a-
modern-introduction-to-programming-marijn-haverbeke/

Introduction to Python Programming 1st Edition S

https://ebookmeta.com/product/introduction-to-python-
programming-1st-edition-s/

A Death in Live Oak A Jack Swyteck Novel 19th Edition


Grippando

https://ebookmeta.com/product/a-death-in-live-oak-a-jack-swyteck-
novel-19th-edition-grippando/
Media Practices Social Movements and Performativity
Transdisciplinary Approaches 1st Edition Susanne
Foellmer (Editor)

https://ebookmeta.com/product/media-practices-social-movements-
and-performativity-transdisciplinary-approaches-1st-edition-
susanne-foellmer-editor/

Human Anatomy & Physiology Laboratory Manual: Making


Connections, Cat Version 2nd Edition Catharine Whiting

https://ebookmeta.com/product/human-anatomy-physiology-
laboratory-manual-making-connections-cat-version-2nd-edition-
catharine-whiting/

Food Security in Africa s Secondary Cities No The


Oshakati Ongwediva Ondangwa Corridor Namibia 1st
Edition Ndeyapo Nickanor

https://ebookmeta.com/product/food-security-in-africa-s-
secondary-cities-no-the-oshakati-ongwediva-ondangwa-corridor-
namibia-1st-edition-ndeyapo-nickanor/

The Long Drop 1st Edition Denise Mina

https://ebookmeta.com/product/the-long-drop-1st-edition-denise-
mina/

Precalculus, 6e Robert F. Blitzer

https://ebookmeta.com/product/precalculus-6e-robert-f-blitzer/
Annotated criminal legislation New South Wales 2019
2020 edition Peter A. Johnson

https://ebookmeta.com/product/annotated-criminal-legislation-new-
south-wales-2019-2020-edition-peter-a-johnson/
Orhan Gazi

A Tutorial
Introduction
to VHDL
Programming
A Tutorial Introduction to VHDL Programming
Orhan Gazi

A Tutorial Introduction
to VHDL Programming

123
Orhan Gazi
Department of Electronics and
Communication Engineering
Çankaya University
Ankara, Turkey

ISBN 978-981-13-2308-9 ISBN 978-981-13-2309-6 (eBook)


https://doi.org/10.1007/978-981-13-2309-6
Library of Congress Control Number: 2018952599

© Springer Nature Singapore Pte Ltd. 2019


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission
or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publication does not imply, even in the absence of a specific statement, that such names are exempt from
the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the
authors or the editors give a warranty, express or implied, with respect to the material contained herein or
for any errors or omissions that may have been made. The publisher remains neutral with regard to
jurisdictional claims in published maps and institutional affiliations.

This Springer imprint is published by the registered company Springer Nature Singapore Pte Ltd.
The registered company address is: 152 Beach Road, #21-01/04 Gateway East, Singapore 189721,
Singapore
Contents

1 Entity, Architecture and VHDL Operators . . . . . . . . . . . . . . . . . . . . 1


1.1 Entity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The Data Types Used in Input/Output Ports . . . . . . . . . . . . . . . . . 6
1.3 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Data Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4.1 Constant Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4.2 Signal Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.4.3 Variable Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.5 VHDL Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.5.1 Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.5.2 Logical Operators and Shift Operators . . . . . . . . . . . . . . . 26
1.5.3 Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.5.4 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.5.5 Concatenation Operator “&” . . . . . . . . . . . . . . . . . . . . . . 32
1.5.6 Generic Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2 Combinational Logic Circuit Design and Concurrent
Coding in VHDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.1 “When” and “Select” Statements . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.2 Generate Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3 Examples for Combinational Circuits Implemented in VHDL . . . . 45
3 Simulation of VHDL Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.1 Test-Bench Writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4 User Defined Data Types, Arrays and Attributes . . . . . . . . . . . . . . . 99
4.1 User Defined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.1.1 Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.2 User Defined Array Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.2.1 Constrained Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.2.2 Unconstrained Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.2.3 Defining PORT Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 105

v
vi Contents

4.3 Defining 2D Arrays or Matrices . . . . . . . . . . . . . . . . . . . . . . . . . 107


4.3.1 Matrix as Column Wise Concatenated Row Vectors . . . . . 107
4.3.2 Matrix as Table of Numbers . . . . . . . . . . . . . . . . . . . . . . 110
4.3.3 3D Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.4 Subtypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.4.1 Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.5 Attributes of Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.5.1 Attributes for Scalar Data Types . . . . . . . . . . . . . . . . . . . 115
4.5.2 Attributes for Array Data Types . . . . . . . . . . . . . . . . . . . 117
4.5.3 Attributes for Signal Objects . . . . . . . . . . . . . . . . . . . . . . 119
5 Sequential Circuit Implementation in VHDL . . . . . . . . . . . . . . . . . . 123
5.1 Sequential Circuits in VHDL . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.1.1 Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
5.1.2 IF Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
5.2 Example Implementations for Sequential Logic Units . . . . . . . . . . 125
5.2.1 D-Type Flip Flop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.2.2 Multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.2.3 JK and T Flip-Flops . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.2.4 Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.2.5 Clock Divider (Frequency Divider) . . . . . . . . . . . . . . . . . 135
5.2.6 BCD to SS Converter with 1 s BCD Counter . . . . . . . . . 143
5.3 The Wait Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.3.1 Wait Until . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.3.2 Wait on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5.4 Case Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5.5 Loop Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.5.1 Next and Exit Statements . . . . . . . . . . . . . . . . . . . . . . . . 149
5.6 Example Sequential Logic Circuit Implementation in VHDL . . . . . 150
6 VHDL Implementation of Logic Circuits Involving
Registers and Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.1 Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.1.1 Shift Register with Parallel Load . . . . . . . . . . . . . . . . . . . 168
6.1.2 Logic Circuits Involving Shift Registers and Counter . . . . 170
6.1.3 Serial Transfer Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.1.4 Serial Adder Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7 Packages, Components, Functions and Procedures . . . . . . . . . . . . . . 189
7.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
7.2 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
7.3 Functions and Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
7.3.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
7.3.2 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Contents vii

7.4 Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212


7.4.1 Differences Between a Function and a Procedure . . . . . . . 214
8 Fixed and Floating Point Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.1 Fixed Point Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.1.1 Type Conversion Functions . . . . . . . . . . . . . . . . . . . . . . 221
8.1.2 Operators for Fixed Point Numbers . . . . . . . . . . . . . . . . . 222
8.1.3 Arithmetic Operations with Fixed Point Numbers
and Sizing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
8.1.4 Automatic Resizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.1.5 Resize Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.1.6 Add Cary Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.1.7 Divide Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.1.8 Reciprocal Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.1.9 Remainder Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.1.10 Scalb Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.1.11 Maximum and Minimum Function . . . . . . . . . . . . . . . . . 233
8.1.12 ‘Find Left Most’ and ‘Find Right Most’ Functions . . . . . . 234
8.1.13 ABS Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.2 Floating Point Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.2.1 Floating Point Type Conversion Functions . . . . . . . . . . . 238
8.2.2 Operators for Floating Point Numbers . . . . . . . . . . . . . . . 243
8.2.3 Copysign Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.2.4 Scalb Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.2.5 Logb Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Chapter 1
Entity, Architecture and VHDL
Operators

VHDL stands for “very high speed integrated circuits hardware description lan-
guage”, and first developed by the US department of defense in 1980s. It is used to
describe the behavior of an electronic circuit. VHDL programs consist of program
modules. A module is nothing but a program segment written for some specific
purposes. For instance, we have package modules, test modules, and main VHDL
modules, i.e., main programs.
In this chapter, entity and architecture parts of a VHDL program will be
explained in details. Entity part is used to describe the input and output ports of an
electronic circuit, i.e., used to describe I/O ports. On the other hand, architecture
part of a VHDL module is used to describe the operation of the electronic circuit.
During the circuit operation, the circuit process its input data obtained from input
ports, and produces its output data to be sent to the output ports. We will also
discuss the data types used for the ports available in entity part. In addition, VHDL
operators will be explained shortly.

1.1 Entity

As we mentioned in the previous paragraph, entity part of the VHDL program


describes the I/O ports of an electronic circuit. A port can be an input port, or an
output port, or both input and output port at the same time, or can be a buffer port.
In Fig. 1.1, the graphical illustration of the port types is given.

© Springer Nature Singapore Pte Ltd. 2019 1


O. Gazi, A Tutorial Introduction to VHDL Programming,
https://doi.org/10.1007/978-981-13-2309-6_1
2 1 Entity, Architecture and VHDL Operators

Fig. 1.1 Black box


representation of an electronic Output
circuit

Input/Output
Input Electronic
Circuit
Buffer

Internal
Circuit

The general structure of the entity part is shown in PR 1.1

PR 1.1 General structure of


entity unit entity entity_name is
port( port_ID1: I/O option signal_type;
port_ID2: I/O option signal_type;
);
end [entity] [entity_name];

where ‘[entity] [entity_name]’ means that you can omit or keep words inside
braces. Let’s illustrate the use of entity by an example.
Example 1.1 The black box representation of an electronic circuit is shown in
Fig. 1.2. Describe the electronic circuit ports by a VHDL program, i.e., by PR.

Fig. 1.2 Black box


representation of an electronic Electronic
circuit for Example 1.1 Circuit

Solution 1.1 We can write the entity part for the black box shown in Fig. 1.2 with
the following steps.
(S1) First, write the reserved word entity as in PR 1.2.

PR 1.2 Program 1.2


entity

(S2) In step 2, we give a name to entity as in PR 1.3.

PR 1.3 Program 1.3


entity my_circuit_name
1.1 Entity 3

(S3) In step 3, write the reserved word is to the end of the line of PR 1.3 as in PR 1.4.

PR 1.4 Program 1.4


entity my_circuit_name is

(S4) In step 4, write the closing tag of entity part as in PR 1.5.

PR 1.5 Program 1.6


entity my_circuit_name is

end my_circuit_name

(S5) In step 5, put a semicolon to the end of the closing tag as in PR 1.6.

PR 1.6 Program 1.6


entity my_circuit_name is

end my_circuit_name;

(S6) In step 6, write the reserved word port as in PR 1.7.

PR 1.7 Program 1.7


entity my_circuit_name is
port
end my_circuit_name;

(S7) In step 7, add parentheses to the port as in PR 1.8.

PR 1.8 Program 1.8


entity my_circuit_name is
port()
end my_circuit_name;

(S8) In step 8, put a semicolon to the end of port() as in PR 1.9.


PR 1.9 Program 1.9
entity my_circuit_name is
port();
end my_circuit_name;

(S9) If we look at the black box in Fig. 1.2, we see that we have two input ports and
three output ports. Let’s give names to these ports as in PR 1.10.

PR 1.10 Program 1.10


entity my_circuit_name is
port( inp1
inp2
outp1
outp2
outp3 );
end my circuit name;
4 1 Entity, Architecture and VHDL Operators

(S10) In step 10, we indicate the type of the ports using the reserved words in and
out as in PR 1.11.
PR 1.11 Program 1.11
entity my_circuit_name is
port( inp1: in
inp2: in
outp1: out
outp2: out
outp3: out );
end my_circuit_name;

(S11) In Step 11, we indicate the data type available at the input and output ports an
in PR 1.12 where we used std_logic for all port data types.

PR 1.12 Program 1.12


entity my_circuit_name is
port( inp1: in std_logic
inp2: in std_logic
outp1: out std_logic
outp2: out std_logic
outp3: out std_logic );
end my circuit name;

(S12) In step 12, we put semicolon to the end of every std_logic except for the last
one as in PR 1.13.

PR 1.13 Program 1.13


entity my_circuit_name is
port( inp1: in std_logic;
inp2: in std_logic;
outp1: out std_logic;
outp2: out std_logic;
outp3: out std_logic );
end my_circuit_name;

The enclosing tag or enclosing line of the program segment in PR 1.13 can also
be written as in PR 1.14. We can also write the enclosing line as “end entity
my_circuit_name”.

entity my_circuit_name is entity my_circuit_name is


port( inp1: in std_logic; port( inp1: in std_logic;
inp2: in std_logic; inp2: in std_logic;
outp1: out std_logic; outp1: out std_logic;
outp2: out std_logic; outp2: out std_logic;
outp3: out std_logic ); outp3: out std_logic );
end entity; end;

PR 1.14 Program 1.14


1.1 Entity 5

It is up to the programmer to select the enclosing line of the entity part.


(S12) In Step 12, add the header lines which are necessary for the data type
std_logic to be meaningful in our VHDL program as in PR 1.15.

PR 1.15 Program 1.15


library IEEE;
use IEEE.std_logic_1164.all;

entity my_circuit_name is
port( inp1: in std_logic;
inp2: in std_logic;
outp1: out std_logic;
outp2: out std_logic;
outp3: out std_logic );
end my circuit name;

(S12) Finally, we can add some comments to our VHDL code. For this purpose,
we can use
 Your comment here

format in our program. Then, our entity part becomes as in PR 1.16.

library IEEE; -- IEEE library


use IEEE.std_logic_1164.all; -- Necessary to use the std_logic

entity my_circuit_name is
port( inp1: in std_logic; --Input port
inp2: in std_logic; --Input port
outp1: out std_logic; --Output port
outp2: out std_logic; --Output port
outp3: out std_logic ); --Output port
end my_circuit_name; -- End of entity

PR 1.16 Program 1.16

The VHDL program in PR 1.16 completely describes the input/output ports of


the electronic circuit whose black box representation is given in Fig. 1.2.
The VHDL program in PR 1.16 can also be written as in PR 1.17 where the port
types are written in the same line.

library IEEE; -- IEEE library


use IEEE.std_logic_1164.all; -- Necessary to use the std_logic

entity my_circuit_name is
port( inp1, inp2: in std_logic; --Input ports
outp1, outp2, outp3: out std_logic ); --Output ports
end my_circuit_name; -- End of entity

PR 1.17 Program 1.17


6 1 Entity, Architecture and VHDL Operators

1.2 The Data Types Used in Input/Output Ports

In this section, we will give information about the data types used in VHDL
programming.
std_logic
In PR 1.17 the data type used for the ports is std_logic defined in the package IEEE.
std_logic_1164.all. For std_logic data type, there are 8 possible values available,
and these values are tabulated in Table 1.1.

Table 1.1 std_logic values ‘X’ Unknown


‘0’ Logic 0
‘1’ Logic 1
‘Z’ High Impedance
‘W’ Weak Unknown
‘L’ Weak Low
‘H’ Weak High
‘-’ Don’t Care

std_logic_vector
The std_logic_vector data type is defined in the library IEEE.std_logic_1164.all. If
an I/O port has data type of std_logic_vector, it means that the I/O port has a
number of std_logic values.
std_ulogic
The data type std_ulogic is defined in the package IEEE.std_logic_1164.all. For
std_ulogic data type, there are 9 possible values available, and these values are
tabulated in Table 1.2.

Table 1.2 std_ulogic values ‘U’ Uninitialized


‘X’ Unknown
‘0’ Logic 0
‘1’ Logic 1
‘Z’ High Impedance
‘W’ Weak Unknown
‘L’ Weak Low
‘H’ Weak High
‘-’ Don’t Care

std_ulogic_vector
The std_ulogic_vector data type is defined in the library IEEE.std_logic_1164.all.
If an I/O port has data type of std_ulogic_vector, it means that the I/O port has a
number of std_ulogic values.
1.2 The Data Types Used in Input/Output Ports 7

bit
The bit data type is defined in standard package, i.e., we don’t need to include an
extra package at the header of the VHDL program. For instance, if we use data type
bit for port I/Os, we can write PR 1.17 as in PR 1.18 where it is seen that no header
file is needed.

PR 1.18 Program 1.18

entity my_circuit_name is
port( inp1: in bit;
inp2: in bit;
outp1: out bit;
outp2: out bit;
outp3: out bit);
end my_circuit_name;

bit_vector
The bit_vector data type is defined in standard package, i.e., we don’t need to
include an extra package at the header of the VHDL program. If an I/O port has data
type of bit_vector, it means that the I/O port has a number of bit values.
integer, natural, positive
The data types integer, natural, positive are defined in standard package, i.e., we
don’t need to include an extra package at the header of the VHDL program. The
data type integer is used to represent integer numbers in the range 231 to 231  1.
The data type natural is used to represent the integers in the range 0 to 231  1. On
the other hand, the data type positive is used to represent the integers in the range 1
to 231  1.
unsigned, signed
The data types unsigned and signed are defined in the packages numeric_std and
std_logic_arith. One of these packages should be included in the header of the
VHDL program to be able to use these data types in entity declarations. The data
type unsigned is used to represent unsigned numbers, i.e., nonnegative integers,
and the data type signed is used to represent the signed numbers, i.e., integers.
An electronic circuit with a number of ports which consists of a number of bits
can be expressed with a number of equivalent ways. Let’s illustrate this concept
with an example.
Example 1.2 The black box representation of an electronic circuit is shown in
Fig. 1.3. Describe the electronic circuit ports by a VHDL program.
8 1 Entity, Architecture and VHDL Operators

Fig. 1.3 The black box 4-bit 5-bit


representation of an electronic
circuit for Example 1.2 Electronic
Circuit
4-bit 5-bit

(a) Use the data type std_logic_vector to describe the ports in entity part.
(b) Use the data type bit_vector to describe the ports in entity part.
(c) Use the data type integer to describe the ports in entity part.
(d) Use the data type natural to describe the ports in entity part.
(e) Use the data type positive to describe the ports in entity part.
(f) Use the data type unsigned to describe the ports in entity part.
(g) Use the data type signed to describe the ports in entity part.

Solution 1.2 Let’s solve the part-a in details, and follow the same approach for the
other parts in short.
In Fig. 1.3, the number of bits available at the ports is indicated, however, the
type of the data available at the ports is not clarified. For this reason, we can employ
all the data types mentioned in the question to represent the bits. Otherwise, con-
sidering the type of the data available at the ports, we would select the suitable
VHDL data type representation in our VHDL program. Now let’s proceed with the
solution of part-a.
(a) We can write the entity part for the black box as shown in Fig. 1.3 with the
following steps.
(S1) First, write the reserved word entity as in PR 1.19.

PR 1.19 Program 1.19


entity

(S2) In step 2, we give a name to entity as in PR 1.20.


PR 1.20 Program 1.20
entity FourBit_Circuit

(S3) In step 3, write the reserved word is to the end of the line of PR 1.20 as in PR
1.21.

PR 1.21 Program 1.21


entity FourBit_Circuit is

(S4) In step 4, write the closing tag of entity part as in PR 1.22.

PR 1.22 Program 1.22


entity FourBit_Circuit is

end FourBit_Circuit
Exploring the Variety of Random
Documents with Different Content
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like