Uploaded by Carlos Josephine

COMPUTER LOGIC 2

advertisement
LECTURE ONE
INTRODUCTION TO PERSONAL COMPUTER
What is Computer?
Computer is any machine, which is capable of carrying out calculations and logical operations upon
command. It is a machine that is capable of accepting data in its raw form, processes the data through
some logical sequence and relay the result of the processed data to the user as information.
Examples of computers are
1. Pocket or desk calculator
2. Automatic washing machine
3. Digital traffic control.
4. Word processing machines
A computer is capable of carrying out the following functions.
a.
It must be able to accept data from the outside world
(input).
b.
It must be able to interpret the data so received.
c.
It must be able to supply information to the outside world as OUTPUT.
d.
It must be able to store information temporarily and permanently on magnetic disks or tapes.
e.
It must be able to retrieve the stored information when desired by the user.
f.
It should be able to send information on a data communication channel.
g.
It should be able to receive information from a data communication channel.
Of all these tasks, the three basic functions of a computer are:
i. It accepts the data
ii. It processes the data
iii. It supplies information as OUTPUT in special format.
These can be schematically shown as below.
INCOMING DATA
Input
COMPUTER
INFORMATION
Processing
Output
The main purpose of using computers is to process data quickly and efficiently so that the output or
information can be obtained timely, meaningfully and accurately.
A computer is a system and the word system has several commonly used definitions and meaning.
There are for example the digestive system, grading system, electronic system and telephone
system among others. In all these, one thing is clear and is the fact that in a system, there is more
1
than one part. A system is an integration of two or more devices that are connected together to form
a whole. Therefore, a computer system is a group of devices that under the control of stored
programs process data into information. In a more comprehensive form, a computer system can be
defined as an electronic machine which under the control of stored programs accepts data through
the input device, process it into information which can be stored in its memory for later use or
communicated to the user through any available output device. It can also be defined as an
electronic machine which by means of stored instructions performs rapid, often complex
calculations or compiles, correlates and selects data. Basically, a computer can be thought of as a
machine that manipulates information in the form of numbers and characters. It is a device that
works under the control of stored programs, automatically accepting, storing and processing data to
produce information. The devices that make up a computer system are the input, system unit and
output.
What makes computer remarkable and appreciated is the speed and precision with which it can
store, retrieve and manipulate data. Computer system is different from other systems because it
works under the control of stored program.
2
LECTURE TWO
SYSTEM OVERVIEW
This is a summary of the components of a personal computer, intended to give a picture of how the
parts fit together. A computer system consists of two sorts of components: Hardware and Software.
The Hardware is the physical equipment or physical machine that makes up the computer. The
Software, on the other hand, is programs (or sets of instructions) that defines what operation the
Hardware will perform.
Different programs may be “loaded” into the machine to make it perform different functions such
as word-processing, data manipulation or numerical calculations; the Hardware remains the same
and the Software makes it behave differently. When we are working with the computer, we need to
store information in the machine. This information is of two main kinds:
i)
The Data we are working on:
This may be a set of numbers on which we want to do calculations, the text of a
document we are preparing by using word-processing facilities, etc.
ii)
The Instructions telling the computer what to do with the Data entered:
When we are using a program like Excel, it may appear that we are doing this by
typing in instructions from the keyboard: we can press keys that tell the machine to
draw a graph, delete some material from the worksheet, and calculate the total of a
column of numbers or whatever. The instructions we enter from the keyboard have
to be broken down into a series of smaller steps so that the computer can carry them
out, and this is done by a program: a set of instructions and commands that tells the
computer to perform specific tasks.
HARDWARE OVERVIEW
The Monitor
The main way a computer communicates with the user is through the screen called the Monitor or
Visual Display Unit (VDU) and resembles a television set. It displays messages from the Software,
such as instructions on how to proceed, as well as what you have typed in at the keyboard. A
flashing square on the screen called the Cursor indicates where the next text will appear. (The
3
Cursor is a marker that appears on the monitor to indicate the position at which the next typed
character will appear).
The System Unit
The System Unit, also known as the Central Processing Unit (CPU) is the part of the Computer that
allows it to perform all of its functions. The way the CPU operates gives the Computer its
characteristics and general behaviour pattern that we come to recognize and adapt to as we use the
Computer. The way the CPU is constructed is referred to as its ARCHITECTURE and this
Architecture is made up of the Control Unit and the Arithmetic and Logic Unit (ALU).
The CPU contains three basic components, namely:
(i)
The Processor: - This performs all the work in the system and controls other
components.
(ii)
The Disk Drive: - Serves as the long-term memory of the system allowing
information to be stored and later recalled or retrieved. The drive rotates the disk at
high speed, something like a record player. It has a head, much like that of a tape
recorder, which reads (plays back information from the disk) and writes (records
information on the disk).
Disk may be fixed or exchangeable. Most personal Computers have one fixed drive
and one exchangeable drive. The exchangeable drive mostly located on the left side
of the System Unit is called drive A or drive B while the fixed drive located on the
right side of the System Unit is called drive C. The drive C (i.e., fixed drive) is also
called Hard Disk.
(iii)
The Memory:-This contains programs to be executed and the data to be operated on,
text of letters, sets of numbers, etc. Data must be copied from disk to memory before
it may be accessed, like Xeroxing; it also remains on the disk. It must be copied
back to the disk if it is to be changed permanently. Data in memory is lost if the
machine is switched off and may be changed or corrupted by programs.
When we are using a particular program (such as Lotus 1-2-3, Microsoft Word, Visual Basic, etc.)
then both the data on which we are working and the program itself are stored in the Computer’s
memory known as Random Access Memory (RAM).
The size of a Computer’s memory is measured in bytes (i.e., the working unit of memory is the
byte). A byte contain one character, such as a letter, a “plus” sign, a numerical digit or whatever (it
4
is worth remembering that numbers which are to be used in calculations, rather than treated simply
as a series of characters, are stored in a different way).
In measuring the size of a Computer’s memory it is common to often find or see the symbol K
being used. This represents roughly a thousand, so that a Computer with a 640K memory contains
about 640,000 bytes of RAM.
1024 Bytes = 1 Kilobyte or simply 1K or 1KB
1024 KB
= 1 Megabyte or 1M or 1MB
1024 MB = 1 Gigabyte or 1G or 1GB
1024 GB
= 1 Terabyte or 1T or 1TB
Typical memory capacity of present day Personal Computer is 512MB
One 5.25 inch disk = 360 KB
One A4 double spaced = 2KB
The size of a Computer’s main memory may limit speed of program execution or limit usage of
packages.
The Keyboard
This is the main device for communicating with a Computer. We type instructions to the Computer
in much the same way that we type letters, numbers and words on a regular typewriter. The
keyboard is the most common means of inputting information into the CPU. It contains keys
labeled with the letters of the Alphabet, the numbers 0 to 9, punctuation and grammar symbols and
a number of special keys like the cursor controls key and the function keys.
With a Computer, what you type is displayed on a screen before it is committed to paper and can be
changed at will.
The Printer
Like a typewriter without keys, the printer takes what you have entered in the Computer and makes
a printed copy of it. The hardcopy then becomes a permanent record.
SOFTWARE OVERVIEW
A Computer system needs two kinds of Software to make it work. These are:
5
The System Software/Operating System
This is a special program to manage and organize the Hardware, which must be loaded into the
system when it is started.
The Application Programs
These perform specific tasks such as Word-processor, Corel Draw, Page Maker, Visual Basic,
SPSS, Excel Spreadsheet, etc. Application programs use the operating system as an intermediary
between themselves and the Hardware.
6
LECTURE THREE
INTERNAL STRUCTURE OF A DIGITAL COMPUTER
The hardware is the physical components of the computer system and is not limited to the
system units’ components but includes the peripheral devices which are input and output
devices. The components of the internal structure of a digital computer are made up of the
main memory, Arithmetic / Logical Unit (ALU) and control unit These components are
referred to as Central Processing Unit (CPU). The internal structure of the digital computer
is as shown below
Secondary Memory
Main Memory
Program
Output
Input
A.L.U
CONTROL UNIT
Information
CENTRAL PROCESSING UNIT
Fig. 3.1 Internal Structure of Digital Computer
MICROCHIPS
The great advances in methods of storing, processing and communicating data and
information have been made possible by the availability of cheap, powerful microchips.
Microchips are small in size, contain no moving parts, and made largely from silicon.
Silicon is found in sand. Microchips contain large numbers of very small electric circuits.
They can be used for all types of operations that have to do with information; storing,
processing, sending and receiving and controlling equipment. Designing microchips is a
difficult process because they are so complex. Microchips are cheap, and are getting
cheaper. Their speed, processing power and the amount of information they can store are
increasing as well.
7
MICRO – PROCESSORS
A micro processor is an entire small computer processor (usually excluding main memory)
manufactured on a single chip. Computers built around such device are called MICRO
COMPUTERS. Processors are made from logic circuits and they have no moving parts.
They are constructed as one or more microchips which contain hundreds of thousands of
logic gates on a 5mm2 (square) of silicon. The processor in a micro computer is a single
chip called the micro processor chip. Although, it is the most important component in a
computer system, a micro processor is very cheap, uses hardly any electricity and can work
without breaking down for many years. The availability of cheap, reliable micro processor
chips has been one of the main reasons for the rapid spread of computers in recent years
The first micro processor was produced in 1972 by the Intel Corporation. It was known as
Model 4004 and its chip contained about 2300 transistors. It should be noted that transistors
operate as electric switches each having two binary states (ON or OFF).
Over the years, the technology of manufacturing micro processors has been improved upon.
Example of micro processor used in personal computer is the Intel 386. It has a chip some
half such square set in a protective case with connectors on its sides. The chip contains
275,000 transistors. Many early models of PC used the Intel 8086 micro processor which
contains about 29,000 transistors; this was followed by the Intel 286 which had about
130,000 transistors. This trend continues with the introduction of Intel 436 with about
1,200,000 transistors and the Intel Pentium with 3,300,000 transistors.
Another chip manufacturer is Motorola. It has brought a series of processors which had also
been improved upon in a manner comparable to the Intel chips. They produced M68,000,
M68,030 and M68, 040 processor chips which are also used in some personal computers
especially the Apple Macintosh range of computers.
MAIN MEMORY
Most micro processors do not contain main storage which is normally produced on separate
silicon chips. Semi conductor memory has replaced a former main storage medium called
“CORE STORE” during the mid-seventies. The most common types of semi conductor
memory are “Volatile” this means that all data is lost if the power supply is removed. The
most common type of volatile memory is called RAM (Random Access Memory). Most
computers do come with a small proportion of ROM (Read Only Memory) which is a NonVolatile Memory.
FEATURES OF SEMI CONDUCTOR MEMORY
The following are the main features of the semi conductor devices within the computer:
8
(a)
(b)
(c)
(d)
(e)
Their operation - is wholly electronics: This makes them to be very fast and
reliable;
They are less costly – Despite the complexity of these devices, modern
manufacturing methods have enabled them to be produced at costs that
represents only minor percentage of the total cost of a whole computer;
They are highly miniaturized – this feature has been exposed to produce computer
hardware that can be accommodated in the office, home, petrol
pumps,
cars,
washing machine etc;
Data is almost instantly accessible from main memory because of its electronic
operation and close proximity to the processor and
Data must be transferred to main storage before it can be processed by the
processor.
USES OF MAIN STORAGE
Main memory is used to store:
a.
Instructions waiting to be obeyed
b.
Instruction currently being obeyed
c.
Data awaiting processing
d.
Data currently being processed
e.
Data awaiting output.
An area of main storage being used for data currently being processed is called a working
storage area and the area being used for data awaiting processing or output is called a buffer
area.
BYTES AND WORDS:- The capacity of the memory is measured in bytes. A byte is eight
(8) bits, a bit is 0 or 1 i.e. binary digit. A register is a set of bits. A byte is normally used to
code a character and the character can be:
Alphabets
A, B, C, D, E, …… Z
a, b, c, d, e, ……….z
Numbers
0, 1, 2, 3, 4,……..9
Special characters P, =, +, ?
:. 1024 bytes is 1 kilobytes i.e. 1k and 1 megabytes = 1024k.
The main store is arranged like a set of boxes that are numbered from zero upward so that
each box can be identified and located. A location in main store corresponds to one of the
boxes and the location address is the number of the box.
Location 0
Location 1
Location 2
Location 3
Location 4
Location 5
etc.
Fig. 3.2 LOCATION IN MAIN STORAGE
9
Each location in main storage holds a unit of data called a word and words can be sub
divided into smaller units called bytes depending on the computer design.
Fixed word length computers – in a fixed length computer, one word is equal to one
location in main storage. This means data is transferred into main storage one location at a
time. The number of bits in each location is known as the word length and this depends on
the make and model of the computer.
Typical word lengths are 8, 16, 32 and 64 bits.
10
LECTURE FOUR
DATA REPRESENTATION IN DIGITAL COMPUTER
Number Systems
Any piece of information whether it is the name of an item, an operation to be performed,
or a numerical value can be represented by a code, which differentiates it from a different
piece of information. In its general form, a code is composed of an ordered set of symbols,
which, in turn can be coded into a string of numerical digits. Thus a number may be used to
represent a piece of non numerical as well as numerical information.
A number may be physically represented either in the analog form or in the digital form.
The first method is based on a direct presentation of mathematical quantities by some
physical quantities such as lengths, angles, voltage, current and the like. To perform certain
operations on these quantities it is necessary to construct a physical system in which the
corresponding physical quantities are transformed according to the value which describes
the transformation of the mathematical quantities in question. Computers based on this
principle are called analogue computing device. The slide rule is a simple example of an
analogue computing device. The second method is based on the use of a device which
makes it possible to represent the mathematical quantities under consideration in a digital
form. The transformation of these quantities is then reduced to arithmetic operations on
digits. The computing machines of this class are called digital computers. The abacus is an
example of a digital computer.
A number is assigned a value which depends on its numerical symbol and its position in the
whole number. The decimal number system which is studied at school and which we use in
everyday life uses ten symbols (0 to 9). Other numbers are constructed by assigning
different values (or weights) to the position of the symbol relative to the decimal point. For
example, the number 008 represents eight units while the number 080 represents a quantity
of eighty units and the number 800 represents a quantity of eight hundred units. This
number system is inconvenient for the work of electronic digital computer. This is because
naturally occurring ten state devices are very rare and when specially made tend to be
expensive in components. It would appear obvious to use a number system with fewer
symbols. But there are many examples of readily available two state devices such as
switches (on/off) relay contacts (make/unmake), transistors and valves (conducting/cut off)
etc. Thus, if we could use a method of counting which involved only two symbols (the
binary system), we could utilize these two state devices to device an economical hardware
number representation.
The base or radix of number system is the amount of symbols or numbers a system
possesses including zero. A base 8 system has eight digits 0-7. A base 2 system has two
11
digits; 0-1. A number system based on a positive integer radix may be defined
mathematically in terms of the polynomial:
N = a0r0 + a1r1 + a2r2 + ……..anrn
Where
A = 0,1,2,3,4,……
r = base or radix of the number system
n = number of digits having values between 0 and r-1
The above equation is valid for N>1. For 0<N<1 the following equation holds
N= a1r1 + a2r2+a3r3+…….+ a-nr-n
DECIMAL NUMBER SYSTEM
Numbers are generally written with the least significant digit on the right and the most
significant digit on the left. For example, 4073.123 in the decimal number system may be
written as :
(4073.123)10 = 4X103+ 0X102 + 7X101 + 3X100 + 1X10-1+ 2X10-2+3X10-3
= 4000 + 0 + 70 + 3 + 0.1 + 0.02 + 0.003
= 4073.123
The following diagram illustrates the integral part of the decimal system’s positional
notation
Thousands Hundreds Tens
4073 + 4
0
7
Units
3
3X100 = 3X1 =
7X 101 = 7X10 =
3
70
0 X102 = 0 X100 = 0
4X103 = 4X 1000 = 4000
4073
The value of the decimal number is equal to the sum of the products
12
Tenths
.123 = 1
Hundredths
2
Thousandths
3
1X10-1 = 1X1/10 = .1
2X10-2 = 2 X1/100 = .02
3X10-3 = 3X1/1000 = .003
.123
The value of the decimal number is equal to the sum of the products
Decimal numbers are numbers that are in base 10. In decimal, numbers are counted from 0
to 9. This is the base we are all familiar with. Addition, Subtraction, Multiplication,
Division and other logical operations can be carried out in this base. For example 5 2 4 8
+ 3 2 1 2 can be solved as follows:
TH H
T
U
5
2
4
8
3
2
1
2
8
4
6
0
Also 4 0 7 3 is got as follows:
4 x 103 + 0 x 102 + 7 x 101 + 3 x 100
4000 + 0 + 70 + 3
4073.
5 2 4 8 is got as follows:
5 x 103 + 2 x 102 + 4 x 101 + 8 x 100
5000 + 200 + 40 + 8 = 5248
Therefore, in the decimal number system the radix (base) is 10.
Binary Number System
It is apparent that with only two symbols it is easier to represent numbers more
economically in terms of hardware by using two-state devices such as switches. However,
the numbers so represented are much longer than their decimal counterparts. For example, 9
(decimal) would require four binary digits to specify it (1001)2. This makes the manual
transcription of large binary numbers a time consuming process which often leads to error.
13
The binary number system uses two symbols 0 and 1 and its position weights are powers of
2. This is the counting of numbers from 0 and terminating it at 1. It is 0 and 1. The higher
digit in binary is 1 while it is 9 in the decimal. A binary number must not be more than 1
therefore we cannot have any number that is more than 1.
The following diagram illustrates t he integral part of the binary system’s position notation
Eights
1011 = 1
Fours
0
Twos
1
Units
1
(Explanation in Decimal)
1X20 = 1X1 = 1
1X21 = 1X2 = 2
0X22 = 0X4 = 0
1X23 = 1X8 = 8
11
The decimal equivalent of binary 1011 is 11
The following diagram illustrates the fractional part of the binary system’s position notation
Halves
.101 = .1
Quarter
0
Eighths
1
(Explanation in Decimal)
1X2-1 = 1X1/2 = .5
0X2-2 = 0X1/4 = .00
1X2-3 = 1X1/8 = .125
.625
The decimal equivalent of the binary number .101 is .625
1 0 1 1 0 = 14 03 12 11 00 = 1 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 0 x 20
= 16 + 0 + 4 + 2 + 0 = 22
i.e. 1 0 1 1 02 = 2210
14
Just as it is possible to convert from binary to decimal so also we can convert decimal to
binary.
4010 to base 2 =
2
4 0
2
2 0 rem 0
2
1 0 rem 0
2
5 rem 0
2
2
rem 1
1
rem 0
= 101000
OCTAL – RADIX 8
This is counting of numbers from 0 and terminating it at 7
The digit is from 0-7. The weight is 82, 81,80, 8-1, 8-2 the normal mathematical operation
can be performed on numbers in this base e.g.
4+4
=
+4
4
10
17+ 11
17
11
30
We can convert Numbers in base 10 to base 8 and vice- versa for example convert 10910 to
octal and convert back to decimal as a check conversion to octal done by retreated division
by 8
8
8
8
109
13
1
0
=
rem 5
rem 5
rem 1
Therefore , 10910 = 1558
Conversion to decimal from octal
Place values
82
81
80
64
8
1
Octal number
1
5
5
Conversion
1 x 64 + 5 x 8 + 5 x 1 = 109.
Thus 1558 = 10910
Conversion between octal and Binary. A simple relationship exists between Octal and
binary because 8 is the cube of two. To do the conversion, it just requires remembering
15
binary equivalent for the eight octal symbols. Octal is often used as a shorthand for binary
because of this easy conversion.
Conversion Table
Octal
0
Binary
Equivalent 000
1
2
3
4
5
6
7
001
010
011
100
101
110
111
Convert 1 2 48 to binary
Octal
1
Binary
Equivalent 001
2
4
010
100
1248 =001010100
Convert 11101110000102 to octal.
In order to use the conversion table, we group the binary digits into threes working from
right to left adding extra zero (es) at the left if necessary
Group Binary Digits
001
Octal Equivalent from the 1
conversion table
110
6
111
7
000
0
010
2
:. 1 1 1 0 1 1 1 0 0 0 0102 = 167028
HEXADECIMAL NUMBERS: Hexadecimal numbers, usually abbreviated to Hex are
numbers to base 16. The sixteen symbols used in Hex system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E and F and place values increase in powers of sixteen. The highest digit in Hex
is 15. It should be noted that A, B, C, D, E and F are equivalent to 10, 11, 12, 13, 14 and 15.
Decimal conversion between Hexadecimal and decimal follow the same pattern used for
binary and octal.
a.
Conversion to Hex from Decimal
Convert 10910 to 16
Working
109 13 = D16
6 6 = 66
Detail
109 ÷ 16 = 6 rem. 13
6 ÷ 16 = 0 rem. 6
Thus 10910 = 6D16
Conversion to Decimal from Hex
Place value 162 161 160
16
Hex No
0
6
D
Conversion (0 x 256) + (6 x 16) + (13 x 1)
Thus 6D16 = 10910
Conversion between Hex and other bases: Conversion between Hex, Octal and Binary is
done in the same way as the octal/binary conversion earlier demonstrated.
The following conversion table will be a guide
Decimal 0
1
2
3
4
5
6
7
8
9
Binary
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Octal
0
1
2
3
4
5
6
7
10
11
Hexad
0
1
2
3
4
5
6
7
8
9
Decimal 10
11
12
Binary
1010 1011 1100
Octal
12
13
14
Hexad
A
B
C
Convert 6D16 to binary and octal.
through binary.
Hex Number
Binary Equivalent
13
14
15
1101 1110 1111
15
16
17
D
E
F
A conversion between Hex and octal is most early made
6
0110
D
1101
6
61
D
15
Convert 6D16 to octal
Hex Number
Octal
6D16 = 6 158
Convert 1 1 1 0 1 1 1 0 0 0 0 1 02 to Hex.
Grouped busy digit
Hex Equivalent
=
1DC216
0001
1
1101
D
1100
C
0010
2
Practice
Convert these decimal numbers to (a) Octal (b) Binary (c) Hex
1.
22
2.
44
3.
751 4.
1453
Express this binary numbers in Octal and Hex
11011101010110101011
17
LECTURE FIVE
CODES
Digital computers generally work with data rather than information. This is because data
has a precise meaning and it can almost be written in a concise way. Computers store and
process data but it is the people who use the data that interpret it and turn it into
information. Computers work with data which to it is no more than strings of symbols and
those symbols are letters, numbers, other characters and to an increasing extent, graphs and
pictures. Inside a computer and out of sight from the people using the computer, all the data
is represented in the computer own codes. Those codes are based on two symbols only, the
digits 0 and 1. The digits 0 and 1 are also those used in the binary (base two) number
system. They are given the names bits, short for binary digits. The reasons for using bits as
the basis of computer codes have to do with the way computers are constructed. The
electronic circuits which process the data and the magnetic disks and tapes which store it
can handle data much more easily as bits than in any other form of coding. The use of bits
simplifies the design of computers and therefore helps to keep their costs down. A single bit
can only have one of two values: 0 or 1. On its own, a bit can represent an answer ‘yes’ or
‘no’ or switch being opened or closed. Most bits has more than two possible values and so
more than one bit is used to encode e.g. a common code for characters is the seven bit
ASCII Code. Some letters in this code are:
a
1
0
0
0
0
0
1
b
1
0
0
0
0
1
0
c
1
1
0
0
0
1
1
.
.
.
y
z
1
1
1
1
1
1
1
1
0
0
0
1
1
0
ASCII is an acronym for American Standard code for information code for information
interchange. It is a binary code used for representing data in many computers and for
transmitting data over communication lines. A – Z is equivalent to 65 – 90.
This most convenient way of grouping bits inside a computer is in sets of eight. A set of
eight bits is called a byte. Most computer memories are partitioned into bytes and small
micro-computers process one byte of data in one operation. A byte can store an ASC11
character with one bit to spare. It should be noted that the coding of data using bits is done
18
inside a computer to suit its internal working. When data is entered into a computer, and
when it is printed or displayed by a computer it is a form which people can interpret. The
conversion to and from internal codes is done by the computer, without the person using the
computer knowing about it.
As earlier said, a code is an organized ordered set of symbols which only those in the
system can know the meaning. In a number system, there are many different types and ways
which data can be represented and among them are binary, octal, decimal and hexadecimal.
Codes generally are used to simplify communication with the machine. There are two types
and these are weighted and unweighted codes.
Weighted code: in this type of code, weight is assigned to each or the digit in the code. The
weights are usually integers and can be negative. Example or weighted code is Binary
Coded Decimal (BCB) where we have 8421, 2421, etc. four binary digits are used for the
weight because 9 which is the last figure in decimal contains four binary digits
Dec.
0
1
2
3
4
5.
6
7
8
9
8
0
0
0
0
0
0
0
0
1
1
4
0
0
0
0
1
1
1
1
0
0
2
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
2
0
0
0
0
0
1
1
1
1
1
4
0
0
0
0
1
0
1
1
1
1
2
0
0
1
1
0
1
0
0
1
1
1
0
1
0
1
0
1
0
1
0
1
6
0
0
0
1
0
1
1
1
1
1
4
0
1
0
0
1
0
0
1
0
1
2
0
0
1
0
0
1
0
0
1
1
-3
0
1
0
1
0
1
0
1
0
1
The general formula for finding the decimal number in weighted code is
N = W4x4 + W3 x3 + w2 x2 + w, x,
e.g.
9 = 8 x 1 + 4x 0 + 2x 0 + 1x 1 = 8+ 0 + 0 + 1 = 9
9 = 2x1 + 4 x 1 + 2 x 1 + 1x 1 = 2 + 4 + 2 + 1 = 9
9 = 6x 1 + 4x1 + 2x1 + - 3x 1 = 6+ 4+ 2- 3 = 9
Some of these are self complementary and unique while some are not. In self
complementary code, sum of the, weight is 9 e.g. 3321, 2421, 5211, 4311 etc. the addition
of any of this will give 9. A code is unique when its value can only be represented in one
way (one code) and is not unique when a code word can be represented by more than one
code e.g. 2421, 6423 where from 3 downward can be represented in more than one code.
One important code which is not unique and not self complementary is 7421.
Dec
7
4
2
1
0
0
0
0
0
1
0
0
0
1
2
0
0
1
0
3
0
0
1
1
19
4
5
6
7
8
9
0
0
0
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
0
0
1
0
or
0111
Properties
(i)
It is not unique
(ii) It is not self complimentary
(iii) It has minimum number of 1 in its representation
(iv) It minimizes power consumption if used in electrical devices
20
LECTURE SIX
DIGITAL LOGIC
Digital logic deals with the investigation of the basic elements from which digital
computers are constructed. Computers represent data in codes based on the binary digits 0
and 1 only. Data is processed in terms of operations on these digits. The electronic circuit
inside a computer which does the processing may be thought of as gates which the bits pass
through and are transformed on the way. The operations performed by the gates are logical
operations following simple rules. The two district classes of components that form the
building blocks of digital systems are the gates and the flip flops. The two common types of
digital logic systems are the combinational and sequential logic circuit. Three basic types of
system units exist and there are analog, digital and hybrid.
Analog System: The word analog is coined from the word analogy meaning a quantity that
is related to another quantity. Hence this system process data or parameters in continuous or
non-discrete form. That is, it can have any value between its maximum and minimum limits
e.g. if its value ranges from -10v to 5v then we have numbers as – 9.9v, - 9.8v, -9.7v ---4.7v, 4.8v, 4.9v, 5v
Digital system: This is coined from the word digit. It processes its data or information in
discrete or discontinuous form. Suppose x is a variable represented by the voltage range -5v
to 5v in a digit system, x has value from -4, -3, -2-----3, 4.
Hybrid system: This system concatenates or juxtaposes the properties of both the analog
and the digital systems. Digital systems are bi stable in nature; the language understood by
digital computers has two symbols 0 and 1 (sometimes called false and true or low and high
or off and on) which is a binary digit. A simple binary digit is known as a bit (binary digit)
and it is the smaller unit information possible. In current technology, two ranges of voltage
represent the binary values of information inside a computer. These binary digits are also
referred to as the logic value or state (0 or 1). This is shown in the figure below:
5v
2.8v
2.4v
Input range
for logic 0
output range
for logic 1
forbidden zero
21
Input range
for logic 0
output range for
logic 0
FEATURES OF LOGICAL VALUES
1.
There are two discrete states; every logic input or output must assume one of the two
states. There is no intermediate state; it is either 0 or 1.
2.
Each logic input or output exists in only one state at any one time.
3.
Each state has an inverse or complement, i.e. the negation at the current state e.g.
the inverse of 0 is 1 and the inverse of 1 is 0.
4.
A logical value can be a constant or a variable. A constant is a static value while a
dynamic variable may change or switch between the state 0 and 1. A boolean
constant is often frequently referred to as a literal.
5.
A variable is often named by the action it cause to take place such as START, STOP,
INCREMENT, COUNT which are self explanatory.
6.
If a logical one initiates an action, it is said to be active high otherwise the signal is
said to be active low.
7.
When a logical one represent the high level signal and a logical zero represent the
low level, the logic is called a positive logic otherwise it is called a negative logic.
22
LECTURE SEVEN
Logic Equations
Logic or propositional calculus is the study of the logical relationship between objects called
propositions and forms the basis of all mathematical reasoning. A proposition is a statement that is
either true or false, but not both (we usually denote a proposition by letters; p, q, r, s, . . .).
The value of a proposition is called its truth value; denoted by T or 1 if it is true and F or 0 if it is
false. Opinions, interrogative and imperative sentences are not propositions.
A logic block can be thought of as a black box that takes signals in and produces signals out. There
are two kinds of blocks and these are combinational and sequential.
Combinational or combinatorial has the following features:
a. Does NOT have memory elements
b. Is simpler than circuits with memory since it is a function from the inputs to the outputs
Sequential properties are:
a.
b.
c.
Contains memory
The current value in the memory is called the state of the block.
The output depends on the input AND the state
TRUTH TABLES
Since combinatorial logic has no memory, it is simply a function from its inputs to its outputs. A
Truth Table has as columns for all inputs that produce the outputs. It has one row for each
possible set of input values and the output columns have the output for that input. A really simple
case of a logic block with one input and one output is as follows:
There are two columns (1 + 1) and two rows (2**1).
Input
0
1
Output
?
?
23
From the above four different truth tables are there for one in and one out: the constant functions 1
and 0, the identity, and an inverter. There were two `?'s in the above table each can be a 0 or 1 so
2**2 possibilities.
Two inputs and 1 output.
Three columns (2+1) and 4 rows (2**2).
In1
0
0
1
1
In2
0
1
0
1
Out
?
?
?
?
How many are there? It is just how many ways can you fill in the output entries. There are 4 output
entries so answer is 2**4=16.
How about 2 in and 8 out?



10 cols
4 rows
2**(4*8)=4 billion possible
3 in and 8 out?



11 cols
8 rows
2**(8**8)=2**64 possible
n in and k out?



n+k cols
2**n rows
2**([2**n]*k) possible
Logical Connectives
Connectives are used to create a compound proposition from two or more other propositions. The
most fundamental connectives are:
Negation
denoted ⌐ ⌐ or !)
And
denoted ^ or Logical Conjunction
Or
denoted ᵥ or Logical Disjunction
Exclusive Or
XOR, denoted _)
Implication
denoted !
Biconditional; “if and only if” denoted $
24
LECTURE EIGHT
GATES
Gates (logic elements) are devices that control the passage of pulses, thus facilitating logical
operations. In logic diagrams gates are represented by symbols. The four common types of logic
gates are AND gate, OR gate NOT and exclusive OR gate.
AND GATE: An AND gate is a circuit that has two or more inputs and produces a single
output. The output of an AND gate is true (i.e.) if and only if each of its input is true i.e. 1.
The gate is used to perform logical multiplication.
Gates
implement
basic
logic
functions:
25
AND
OR
NOT
XOR
Equivalence
AND GATE
The logical connective And is true only if both of the propositions
are true. It is also referred to as a conjunction. The AND gate will only output a high signal if it
receives two i.e. exactly high signal at he same time.
X
AND
XY
Y
The Truth Table
P
0
Q
0
p^q
0
1
1
1
0
1
0
0
1
0
NOTE: 1 mean a high signal
0 mean a low signal
The diagram above shows a two input AND gate i.e. an AND gate (AND element) has two
input signals, A and B and gives one output signal corresponding to A.B.. There is no need
to write AND inside the AND symbol once it has been leant. Simplified symbols may be
used in which the name of the gate is written inside a circle as shown below.
A
AND
C
B
OR GATE:
The logical disjunction (or logical or) is true if one or both of the propositions are true.. An Or gate
takes two (or more) inputs and produces a single output. The output is 1 if one input OR the
other input or both are 1; otherwise it is 0. It is use to perform logical addition. It is OR
because it can only work if one or more of the input is true.
Example (Logical Connective: Or)
It is raining or it is the second day of lecture.
(2 + 2 = 5) _ (p2 < 2)
You may have rice or beans.
TRUTH TABLE
A
B
C
26
0
0
1
1
0
1
0
1
0
1
1
1
A
A+B =C
B
Truth Table for AND and OR
P
0
0
1
1
Q
0
1
0
1
p^q
p vq
0
0
0
1
0
1
1
1
NOT GATE: Not gate has only one input to produce an output as shown below
A-
A
TRUTH TABLE
A
B
=
0
1
1
0
A
If the input is 1, the output will be A. The NOT gate is also known as an INTEGER.
It is that any logic function can be constructed from AND OR NOT as it is shown hereafter. So this
triple is called universal.
Exclusive OR gate
The exclusive OR (XOR) gate also known as a non-equivalence (NEQ) gate has two inputs
and produces a single output. The output is 1 if one input OR the other input (but not both)
are 1.
A
OR
C
B
The operation taken is a fullness
27
Input
A
0
0
1
1
Output
C
0
1
1
0
B
0
1
0
1
C = A XOR B
From the operation table, it can be seen that the output is 1 if the inputs are different. This
gate is called a non equivalence gate.
NAND GATE (NOT AND): This gate is got by joining NOT and AND gates together. The
output of a NAND gate is false only when truth input are at the 1 state.
NOR GATE: NOR gate denotes NOT OR gate and is the combination of NOT and OR
gates. The output of a NOR gate assume a 1 state only when each input is false.
TRUTH
X
Y
0
0
0
1
1
0
1
1
X
TABLE
Z
1
0
0
0
X+Y
X+Y
Y
EXNOR GATE: This gate uses the determination that EXNOR assumes a true state i.e. 1 if
and only if the two inputs are smaller. It is an important gate because it can only have two
inputs at a time.
TRUTH TABLE
X
Y
Z
0
0
1
0
1
0
1
0
0
1
1
1
X
Z
Y
The truth able of the six basic gate is as follows:
INPUTS
A
B
0
0
0
1
1
0
1
1
OR
A+B
0
1
1
1
AND
A.B
0
0
0
1
NOR
A+B
1
0
0
0
NAND
A.B
1
1
1
0
28
EXOR
A (+) B
0
1
1
0
EXNOR
A- (+) B1
0
0
1
NEGATIVE LOGIC: In negative logic, positive AND gate is represented by an OR gate
and a poster logic OR gate is an AND gate. Negative logic reverse the value of the state of
the input i.e. 0 is true and 1 is false.
A
B
OR AND
A+B A-B
0
0
0
0
0
1
0
1
1
0
0
1
1
1
1
1
In summary, gates (logic elements) are devices that control the passage of pulses thereby
facilitating logical operation.
In logic diagram, gates are represented by symbols. A combination of AND, OR and NOT
gates may be replaced by just NAND or just NOR gates. Codes can be used for:
i.
Arithmetic and logic purposes
ii.
Control purpose such as selecting operations or devises e.g. by multiplying.
iii.
Encoding and decoding
Universal Pairs
Are there any pairs that are universal? Could it be that there is a single function that is universal?
YES!
NOR (NOT OR) is true when OR is false. Do TT.
NAND (NOT AND) is true when AND is false. Do TT.
Draw two logic diagrams for each, one from definition and equivalent one with bubbles.
Theorem A 2-input NOR is universal and A 2-input NAND is universal.
Proof
We must show that you can get A', A+B, and AB using just a two input NOR.



A' = A NOR A
A+B = (A NOR B)' (we can use ' by above)
AB = (A' OR B')'
29
LECTURE NINE
COMBINATIONAL AND SEQUENTIAL LOGIC
In a combination logic data, its output is completely defined by the combination of inputs.
A sequential logic gate differs from combinational logic in that the output depend not only
on the combination of inputs but on the sequence in which they occur AND, OR, and NOT
gates provide examples of combinations logic and a flip-flop provides an example of
sequential logic. Though the term sequential logic may not be familiar but its idea is
familiar for example, a TV set may have a single On/OFF button and the set may be in one
of two states “ON” or “OFF”. The output resulting from the single “input” of pressing the
ON/OFF button will depend on the state the set is in when the button is pressed. Thus the
output (set on or set off) resulting from the “input” press button depends on where we are in
the on/off sequence.
GATES AS TRANSMISSION ELEMENTS
A way of looking at gates is to regard them as transmission elements that control the flow
of information within a computer. Let us consider each of AND, OF and EXOR gates with
two inputs. One input is a control input (that may be set to a logical 1 or logical 0 state).
The other input represent a variable x. The effect the gate has on the transmission of x
through it can be determined by the figure below.
(a)
AND gate, control input C = 0
C=1
X
X
0
X
C=0
C=1
(b)
OR gate control input c = 0
X
X
X
(c)
1
C=0
C=1
EXOR gate
C=0
C=1
30
X
X
X
X
C=0
C=1
LECTURE TEN
APPLICATION OF GATES
Combination of the connection of two or more gates considered so far is used in building
simple circuit. The OR gates, AND gates and Inverter can be interconnected to form gating
or logic network .e.g.
A
P
B
F = AB + BC
Q
C
F = P + Q when P = AB, Q = BC
It can be shown on the truth take as follows:
The Truth Table
Inputs
INTERMEDIATE VALUES OUTPUT
A
B
C
B
Q = BC
P = AB
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
1
31
F=P+Q
0
1
0
0
0
1
1
1
LECTURE ELEVEN
BOOLEAN ALGEBRA
Certain logic functions (i.e. truth tables) are quite common and familiar. We use a notation that
looks like algebra to express logic functions and expressions involving them.
The notation is called Boolean algebra in honor of George Boole. Boolean Algebra is defined as
set of two elements, denoted by 0 and 1 together with three operations +, and NOT called addition,
multiplication and complementation for which the following postulates or rules hold:
Addition
0+0=0,0+1=1,
1+0=1. and
1+1=1
Multiplication
0+0=0, 0.1 =0,
1.0=0 and
1.1 = 1
Complementation
0= l and 1=0
A Boolean variable is a quantity such as A, B, C, etc which may take on the values 0 or 1 and
which satisfies the rules of equations above.
A Boolean function is a function of Boolean variables such that F(A,B)=A+B.
The only operations allowed in constructing Boolean functions are Boolean operations (i.e. +, . and
complementation).
The truth table displays all the combinations the variables of a function may assume with the
corresponding values. There are 2n possible inputs for the truth table of a Boolean function with n
variables.
Two Boolean functions f and g are said to be equal if they assume the same value for any set of
inputs.
A Boolean value is a 1 or a 0.
A Boolean variable takes on Boolean values.
A Boolean function takes in boolean variables and produces boolean values.
32
1. The (inclusive) OR Boolean function of two variables. Draw its truth table. This is written +
(e.g. X+Y where X and Y are Boolean variables) and often called the logical sum. (Three
out of four output values in the truth table look right!)
2. AND. Draw TT. Called log product and written as a centered dot (like product in regular
algebra). All four values look right.
3. NOT. Draw TT. This is a unary operator (One argument, not two like above; the two above
are called binary). Written A with a bar over it (I will use ' instead of a bar as it is easier for
my to type).
4. Exclusive OR (XOR). Written as + with circle around. True if exactly one input is true (i.e.
true XOR true = false). Draw TT.
The name Boolean comes from the name of logician called George Boolean who much
pioneering work in the algebra of logic. His work was developed upon Claude Shannon by
applying his Boolean algebra to switching circuits and such circuit were found in telephone
exchanges and later in digital computer. Today Boolean algebra is used to design digital
circuits and to analyze their behaviour. Also, Boolean algebra permits an idea to be exposed
in mathematical form; the resulting experience is simplified and then translated to the real
gates and other logic elements. Boolean algebra differs in a major way from ordinary
algebra in that Boolean contents and variables are allowed to have two possible values, 0
and 1. Boolean variable is a quantity that may at different times be equal to either 0 and 1
and are often used to represent the voltage level present on a wire at the input 1 output
terminals of a circuit. Boolean algebra cannot at a set of element say E, a set of function F
that operate on the numbers of E and a ser of basic laws called the axioms that defines the
properties of E and F. There are three operations allowed in Boolean algebra and they are
the logical OR, AND and NOT.
BASIC RULES OF BOOLEAN ALGEBRA
1
0.x=0
2
1.x=x
3
x.x=x
4
x.x=0
5
0+x=x
6
1+x=1
7
x+x=x
8
x+x=1
9
x=x
10
x+y=y+x
11
x–y=y-x
12
x(y+z) = x.y+z.z
13
x+yz = (x+z)(x+z)
14
x.(x+z) = (x.y)z
15
x+(y.z) = (x+y)+z
33
From the above the following theorems were deduced
1.
x+xz = z
x+xz = x (1+z) from 6
=xz
2.
x(x+y) = x
x(x+y) = xx +xy
= x+xy – from 3
= x(1+y) from 6
=x
3.
(x+y) (x+z) = x+yz
(x+y)(x+z) = xx+xz+xy+yx = x+xz+xy+yz from 3
= x+xy +yz
= x(1+y) +yz from 6
= x+yz
4.
x+xy = x+y
X+xy = x(y+1) +xy from 6
=xy+x+xy from 12
=x+y(x+x) from 8
=x+y
Start from example 5
Some manipulation laws. Remember this is Boolean ALGEBRA.
Identity:



A+0 = 0+A = A
A.1 = 1.A = A
(using . for and)
Inverse:



A+A' = A'+A = 1
A.A' = A'.A = 0
(using ' for not)
Both + and . are commutative
The name inverse law is somehow since you Add the inverse and get the identity for Product or
Multiply by the inverse and get the identity for Sum.
Associative:

A+(B+C) = (A+B)+C
34

A.(B.C)=(A.B).C
Due to associative law we can write A.B.C since either order of evaluation gives the same answer.
Often elide the . so the product associative law is A(BC)=(AB)C.
Distributive:



A(B+C)=AB+AC
A+(BC)=(A+B)(A+C)
Note that BOTH distributive laws hold UNLIKE ordinary arithmetic.
How does one prove these laws? It can be proved by following these steps:


Simple (but long) write the TTs for each and see that the outputs are the same.
Do the first dist laws on the board.
Consider a logic function with three inputs A, B, and C; and three outputs D, E, and F defined as
follows: D is true if at least one input is true, E if exactly two are true, and F if all three are true.
(Note that by if we mean if and only if.
Draw the truth table.
Show the logic equations


For E first use the obvious method of writing one condition for each 1-value in the E
column
i.e.
(A'BC) + (AB'C) + (ABC')
Observe that E is true if two (but not three) inputs are true, i.e.,
(AB+AC+BC) (ABC)' (using . higher precedence than +)
The first way we solved part E shows that any logic function can be written using just AND, OR,
and NOT. Indeed, it is in a nice form. Called two levels of logic, i.e. it is a sum of products of just
inputs and their compliments.
DeMorgan's Rules: These rules aid simplification of expression. To apply De Morgan’s Rules to
simple expression with a view to simplification;; the following should be followed:
i. change ANDs to Ors and ORs and Ors to ANDs
ii negate all variables
iii. negate the expression so formed
Examples Apply the rule to either side to obtain the other
A+B
35


(A+B)' = A'B'
(AB)' = A'+B'
With DM we can do quite a bit without resorting to TTs. For example one can show that the two
expressions for E on example above (page B-6) are equal. Indeed that is
LECTURE TWELVE
SOME USEFUL COMBINATIONAL CIRCUITS
In this section, we are going to consider some combinational logic circuits which are
frequently used in the design of digital systems..
Encoding and decoding : Encoding involves the conversion of one signal from one set into
a group of signals of another set. A device that can be used to perform this task is called an
encoder.
Example
10 inputs, only one of which
Is a “high signal” at anytime
Output signals
Eg corresponding BCD
36
Encoder
numeric code for the
particular input signal
0
1
2
3
4
5
6
7
8
9
INPUT
0 1 2
1 0 0
0 1 0
0 0 1
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
3
0
0
0
1
0
0
0
0
0
0
W
X
Y
Z
4
0
0
0
0
1
0
0
0
0
0
5
0
0
0
0
0
1
0
0
0
0
6
0
0
0
0
0
0
1
0
0
0
7
0
0
0
0
0
0
0
1
0
0
8
0
0
0
0
0
0
0
0
1
0
OUTPUT
W X Y
0 0 0
0 0 0
0 0 1
0 0 1
0 1 0
0 1 0
0 1 1
0 1 1
1 0 0
1 0 0
9
0
0
0
0
0
0
0
0
0
1
Y
0
1
0
1
0
1
0
1
0
1
1 = high signal
0 = low signal
Application : An example of an encoder is a keyboard device where 1 of 64 lines is raised
by pressing one key and the corresponding 6-bit character is produced on 6 wires coming
out of the encoder. Usually a further 2 bits are included in the output, one being the parity
37
bit, the other being a control key which is pressed in conjunction with one of the other 64
keys
Decoding
This is the opposite operation to encoding and the device that performs the task is called a
decoder. A decoder is a logic circuit that accepts K input variables (Xk-1, X1-X0) and
produces n=2k outputs(Yn-1-Y1-Y0). One and only one output has the value 1 for every given
input combination. In other words if ‘n’ wires are connected in there will normally be 2n
wires out, only one of which will be a logic “1” at any instant
3-bit code in
8 light display with
with one light on at a time
0
1
2
3
4
5
6
7
X
Decoder
Y
Z
INPUT
OUTPUT
X
Y
Z
0 1 2 3 4 5 6 7
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
38
1
1
1
USES : Encoders and decoders are used for :
a. translations of internal binary codes to or from external signals for peripheral input or output
actions such as printing characters, reading magnetic cards, moving pens in plotters or monitoring
device status
b. The control of hardware, eg selecting output channels from device codes, translating control
signals for disk-head movements or translating function codes
LECTURE THIRTEEN
The Multiplexer
Multiplexers are selection mechanism. A multiplexer receives two groups of input; m (where m
=2k) input Xm-1-X1-X0=X of data variables and k inputs Yk-1 – Y1 – Y0 = y of control variables and a
single output. The function of the circuit is to use the control inputs to select one of the data inputs
and make this selected data input the multiplexor output. That is , the output value of a multiplexor
is, at any time equal to the value of one of its inputs. To allow the selection of an input, each input
line is assigned a number (address) by which it can be selected for connection to the output. A
multiplexor logic for m =4 and k = 2 is shown below
39
X3
X2
X1
X0
Y1
Multiplexer
Y0
W
Diagram of a multiplexor for m =4 and k = 2
ASCII ‘H’
ASCII ‘S’
0 1 0 0 1 0 0 0
0 1 0 1 0 0 1 1
Input from device A
Input from device B
Selection
Signal
0 Device A
1 Device B
40
0 1 0 0 1 0 0 0
The Distributor/Multiplexer
In a demultiplexer the reverse process of multiplexer takes place, ie, a single input is switched to an
appropriate output path.. The Distributor logic circuit is very similar to the Decoder logic circuit
REFERENCES AND TITLES FOR FURTHER READING
[1]
[2]
[3]
[4]
[5]
Bassler, Richard A, &Joslin, Edward O (1975) An Introduction to Computer Systems (3 rd
Ed), Arlington, VA: College Readings
French, C S Computer Science BookPower
Okeyinka A.E. Introduction to Computer Technology LAUTECH PRESS Ogbomosho
M. Morris Mano and Charles Kime Logic and Computer Design Fundamentals (4th
Edition)
Michael Huth and Mark Ryan (2004) Logic in Computer Science modelling and reasoning
about systems Cambridge University Press
41
EXCERCISES
1
(a) Describe the following gates: NOT, NOR and NAND.
(b) Clearly explain the meaning of the following terms;
I
Non-equivalence gate
ii
Truth table
iii
Logic circuit
iv
Boolean algebra
42
v
2
(a)
Gate
i what are the uses of Boolean algebra?
ii Identify one major difference between Boolean algebra and ordinary
algebra.
(b) State the major features of logical values.
3
(a) The place values for decimal fractions are tenth, hundredth, thousandth, etc.
What
are the place values for binary fractions?
(b) An alternative method of representing whole numbers on a computer is to
encode each decimal separately in binary. In BCD, four bits are used for each
decimal digit. Therefore what are the corresponding binary value of the following
decimal numbers 29, 67,245, 140 and 524?
b. Convert the following BCD to represent numbers in a computer?
i 1001011
ii 011010000
4ai.
Briefly explain the term digital logic.
ii.
Enumerate and discuss the two common types of digital logic systems.
b.
Identify and explain the types of system Unit.
5ai.
With the aid of a diagram, clearly describe the internal structure of a digital
computer.
bii.
What is semi conductor memory? (ii) state four (4) features of semi conductor
memory.
6ai.
State the major difference between analog computers and digital computers
ii.
Itemize Using relevant example the difference between sequential Logic gates and
combinational Logic gates.
b.
Combination of two or more gates can be used to build a simple circuit. Using
appropriate diagram, clearly explain how, AND. OR, and NOT gates can be used to
build a simple circuit assuming A, B and C are the inputs.
7
Explain the following terms (i) EXOR (ii) OR Gate (iii) AND Gate (iv) inverter (v) EX
NOR Gate
43
REVISION QUESTIONS
1.
2.
3.
4.
5.
6.
Convert 5310 to binary number.
Answer is 110101
Convert 10100112 to decimal.
Answer is 83
Perform the following binary addition: 1110+1001 + 11011.
Answer is
110010
Perform the following binary subtraction: 1 1000-1 111.
Answer is
1001
find the value of the Boolean function F=A+AB when A=0 and B=l.
Answer is F=0
Show the truth table for the operation A OR B.
A
0
0
1
1
B
0
1
0
1
Answer
A OR B
0
1
1
1
7.
Evaluate the function F=AB+(B+C) when A=l, B=l and C=0.
Answer is F=l
8. How many minterms will a live-variable system have?
Answer is 32
9. Find the niinterms corresponding to inputs 01000, 01011 and 10001 if the variables are A, B,
C, D and E.
Answer is ABCDE, ABCDE, ABCDE
10. Obtain in SOP form the function F(A, B, C) defined by F=l when A, B, C are given by 001,01
1, 101 and 1--0 otherwise.
ABC+ABC+ABC = AC(1+B)=
SECTION 2
1. Define the two basic problems in digital circuit theory.
The two basic problems in digital circuit theory arc analysis and synthesis of circuits.
Analyse the circuit given below in its original form.
F=AB+(A+C)
A
B
C
Synthesise the function F=ABC+ABD+AE with a one (two) level network (not counting the
inverters) of AND. OK or NOT gates.
44
2. Find the minimal equivalent of the function F defined as follows: F=(A+B)(A+B+C)(A+C)
using a Karnaugh map.
A digital circuit is to have an output F and inputs A, B, C and D so that F=1 if and only if the
decimal equivalent of (ABCD)2 is divisible by either 3 or 4. Find the minimal expression for F.
Dec A
B
C
D F Minterms
0
0
0
0
0 0
1
0
0
0
1 0
2
0
0
1
0 0
3
0
0
1
1 1
ABCD
4
0
1
0
0 1
ABCD
5
0
1
0
1 0
6
0
1
1
0 1
ABCD
7
0
1
1
1 0
8
1
0
0
0 1
ABCD
9
1
0
0
1 1
ABCD
10
1
0
1
0 0
11
1
0
1
1 0
12
1
1
0
0 I
ABCD
13
1
1
0
1 0
14
I
i
I
0 0
15
1
1
1
1 1
ABCD
F=ABCD +'ABCD+ABCD+ABCD+ABCD+ABCD+ABCD =
3. Identify the two basic types of digital networks and state their characteristics and differences.
What type of digital circuit is a flip-flop? Give at least four types of flip-flops with their symbols
showing inputs and output signals.
Answer
45
The two basic types of digital networks are combinational and sequential. The combinational logic
produces output based on the input while sequential logic produce outputs based on the current
input and previous state (memory).
Flip flops are sequential type of digital networks.
The SR flip flop
S
R
s
Q
R
Q
q
Q
The JK flip flop
J
Q
CL
Q
K
The D flip Hop
D
Q
-
CL
Q
The T flip flop
Q
T
T
Q
Gated SR Hip Hop
s
Q
CL
R
Q
4. Define the term Boolean algebra and describe its components such as variables, functions, and
combination of input values. State the three Boolean operations and give example of each.
46
Answer
Boolean Algebra is defined as set of two elements, denoted by 0 and 1 together with three
operations +, and NOT called addition, multiplication and complementation for which the
following postulates or rules hold:
Addition
0+0=0,0+1=1,
1+0=1. and
1+1=1
Multiplication
0+0=0, 0.1 =0,
1.0=0 and
1.1 = 1
Complementation
0= l and 1=0
A Boolean variable is a quantity such as A, B, C, etc which may take on the values 0 or 1 and
which satisfies the rules of equations above.
A Boolean function is a function of Boolean variables such that F(A,B)=A+B.
The only operations allowed in constructing Boolean functions are Boolean operations (i.e. +, . and
complementation).
The truth table displays all the combinations the variables of a function may assume with the
corresponding values. There are 2n possible inputs for the truth table of a Boolean function with n
variables.
Two Boolean functions f and g are said to be equal if they assume the same value for any set of
inputs.
Examples as above
5. State De Morgan's Law. The minterms corresponding to function F is given as:
F=ABC t ABC"' ABC, draw a truth table showing these minterms and the maxterms. What is the
main difference between canonical and standard forms of representing sum of product and product
of sum? Pro\e the following statement by perfect induction: (A+C)(A+D)(B+C)(B+D)=AB+CD.
Answer
De Morgan's Law states that the complement of a product is the sum of complements and the
complements of a sum is the product of the complements.
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
1
1
0
1
F
Minterms
ABC
ABC
ABC
ABC
ABC
ABC
ABC
ABC
47
Maxterms
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
The main difference between canonical and standard forms of representation is that the canonical
form contains all the variables of the minterms or maxterms (complemented or uncomplemented)
while the standard form may not contain all the variables of the terms.
e.g. Fcanonical =ABC+ABC+ABC
Fstandard = C+BC+ABC
Perfect induction prove for (A+C)(A+D)(B+C)(B+D)=AB+CD
A
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
B
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
C
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
D
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
A+C
0
A+D
B+C
B+D
(A+C)(A+D)(B+C)(B+D)
AB
CD
AB+CD
EXCERCISES
1. (a) Briefly explain the following terms:
(i) Micro – Processor
(ii) Micro Computer
(iii) Semi conductor memory
(iv) Code
(b) Differentiate combinational logic gate from sequential logic gate
2. (a) i List the main features of semi conductor memory
(ii) What are the types of information and data that the main memory is capable
to store
(b) List and explain clearly the three fundamental types of gate
3. (a) Convert Decimal 0 – 16 to binary, Octal and hexadecimal
(b) Convert:
(i) 6D16 to Decimal
(ii) 111011100000102 to octal
(iii) 3910 to binary
4. (a i) What is digital logic?
48
(ii) State the features of logical values
(iii) Itemize the basic rules of Boolean Algebra
5 (a) Describe the following gates: NOT, NOR and NAND.
(b) Clearly explain the meaning of the following terms;
6 (a)
I
Non-equivalence gate
ii
Truth table
iii
Logic circuit
iv
Boolean algebra
v
Gate
i what are the uses of Boolean algebra?
ii Identify one major difference between Boolean algebra and ordinary algebra.
(b)
7(a)
(b)
State the major features of logical values.
The place values for decimal fractions are tenth, hundredth, thousandth, etc. What
are the place values for binary fractions?
An alternative method of representing whole numbers on a computer is to encode
each decimal separately in binary. In BCD, four bits are used for each decimal digit.
Therefore what are the corresponding binary value of the following decimal
numbers 29, 67,245, 140 and 524?
Convert the following BCD to represent numbers in a computer?
i 1001011
ii 011010000
49
Download