Download Data Manipulation - Cairo University Scholars

Document related concepts

UniPro protocol stack wikipedia , lookup

Computer wikipedia , lookup

Bus (computing) wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Transcript
Introduction To
Computer
Abd El-Aziz Ahmed Abd El-Aziz
Lecturer
Institute of Statistical Studies and Research,
Dept. of Computer and Information Sciences,
Cairo University
Outline











Introduction.
Lecture 1.
Lecture 2.
Lecture 3.
Lecture 4.
Lecture 5.
Lecture 6.
Lecture 7.
Lecture 8.
Lecture 9.
Lecture 10.
2
Outline











Introduction.
Lecture 1.
Lecture 2.
Lecture 3.
Lecture 4.
Lecture 5.
Lecture 6.
Lecture 7.
Lecture 8.
Lecture 9.
Lecture 10.
3
Introduction

The objective of this course is to learn the students what computer science
is about, especially data representations, algorithms, encodings, forms of
programming.

The references are:
1.
“Computer Science an Overview”, J. Glenn Brookshear.
2.
“ Introduction to Computer Sciences” , Hesham A. Hefny.
4
Introduction

The slides are available on scholar.cu.edu.eg/zizo.

The grades are distributed as follows:
1.
70 marks for final exam.
2.
10 marks for quiz 1.
3.
20 marks for assignments.
5
Outline











Introduction.
Lecture 1.
Lecture 2.
Lecture 3.
Lecture 4.
Lecture 5.
Lecture 6.
Lecture 7.
Lecture 8.
Lecture 9.
Lecture 10.
6
Lecture 1

Computer: is an algorithms machine which can be used for solving
algorithmic problem.

Algorithm:
is a finite set of ordered, unambiguous, and executable
instructions that directs a terminating activity. The algorithm is determined
by a flow chart or pseudo code. (Assignment 1: the difference bet. Flow
chart and pseudo code with example.)

Computer Science: is the science which deals with all issues related to
computing machines.

7
Lecture 1(Cont.)

Developments of Modern Digital Computers:

First Generation (1946-1959): Vacuum tubes in place of mechanical relays
and Controlling the operations of the computer using stored programs.

Second Generation (1959-1965): transistors in place of vacuum tubes,
magnetic cores for memory storage, and the operating system is appeared.

Third Generation (1965-1970): Integrated circuit technology allowed to
group thousands of transistors, Improved mass storage, visual display unit
appeared, and the multiprocessor concept is appeared.
8
Lecture 1(Cont.)

Developments of Modern Digital Computers:

Fourth Generation (1979-1980): multiprocessors appeared with capacity
of 4-8 bits, improved mass storage, and improved input / output devices.

Fifth Generation (1980- ): improved mass storage and input / output
devices, and computer network.

The features of obtained a new machine are:
1.
Smaller size.
2.
Lower power consumption.
3.
Higher computational power.
4.
Easier for handling.
5.
More user friendly.
9
Lecture 1(Cont.)

Architecture of Modern Computer Machine:

Central Processing Unit (CPU): is the main unit of the computer which is
responsible for executing programs stored in the internal memory. It
consists of Arithmetic and Logic Unit (ALU) and Control Unit (CU).

Arithmetic and Logic Unit (ALU): performs all the arithmetic and logical
operations.

Control Unit (CU): It controls all the operations of the CPU, such as
decoding the instruction of programs stored in the internal memory, and
controlling the flow of information through the ALU, I/O, and internal
memory.
10
Lecture 1(Cont.)

Architecture of Modern Computer Machine:

Internal Memory: It’s composed of chips of integrated circuits which are
capable of quickly storing and retrieving data. There are two types of
internal memory: Read Only Memory (ROM) and Random Access
Memory (RAM).

Read Only Memory (ROM): it is nonvolatile memory. It’s a chip contains
built in programs that are needed by the computer to start operation when
powered on. Theses programs are stored permanently during the
manufacturing and can’t be lost when power is turned off. The CPU can
only read the ROM.
11
Lecture 1(Cont.)

Architecture of Modern Computer Machine:

Random Access Memory (RAM): It’s the main memory. The CPU
executes programs stored in it. The CPU can read and write to RAM .
When the power is off, all the stored data in RAM are lost.

External Storage (auxiliary memory): It’s nonvolatile storage (secondary
memory). It’s a memory that holds the data permanently, such as magnetic
tapes, magnetic disks, compact disks (CDs), Digital versatile ( ‫ )تنوع‬disks
(DVDs), and flash memories.
12
Lecture 1(Cont.)

Architecture of Modern Computer Machine:

Input Devices: are devices that allow a user to enter data to a computer,
and convert it into digital signals to be suitable for processing, such as
keyboard, mouse, light pen, scanners, and digitizers.

Output Devices: are devices that convert the electric signals resulted from
the CPU into letters, numbers, or images on the screen, such as printers,
plotters (computer printers for printing vector graphics), and screens.
13
Outline











Introduction.
Lecture 1.
Lecture 2.
Lecture 3.
Lecture 4.
Lecture 5.
Lecture 6.
Lecture 7.
Lecture 8.
Lecture 9.
Lecture 10.
14
Lecture 2

Categories of Modern Computers: they are categorized by:

1.
Technology
Analog computers: which process and deliver data in a continuous timevarying forms. They are suitable for processing physical quantities, such
as temperature, voltages, and pressure.
2.
Digital computers: which can only process and express data using a
system of pre-set of values. Usually such a system works with two
possible stated for data; i.e., on-off or 0-1, such as the traditional on-off
light switch.
3.
Hybrid computers: which are a combination of digital and analog, such as
the hospital intensive care devices.
15
Lecture 2 (Cont.)

Categories of Modern Computers: they are categorized by:

1.
Usage
Special-purpose computers: which are manufactured to perform special
tasks, such as controlling factories production-lines or tracking military
missiles. A special purpose computer usually runs only one application
software.
2.
General-purpose computers: which are manufactured to perform several
tasks. A general-purpose computer is able to run wide-range of application
software.
16
Lecture 2 (Cont.)

Categories of Modern Computers: they are categorized by:

1.
Size and computational capabilities
Super computers: they are the highest in speed and the most expensive
type of computers. They are used in defense and military applications,
breaking codes , weather forecasting, and complex scientific applications.
They cost as much as twenty million dollars.
2.
Mainframes computers: they are large and stationary computers that
require space in an air conditioned room. Such machines are able to store
massive amounts of data, support hundreds or thousands of users
simultaneously, and run a wide variety of applications all at one time.
They cost from several hundred thousands dollars up to 10 million dollars.
They are usually used in banks, airlines, and insurance companies.
17
Lecture 2 (Cont.)

Categories of Modern Computers: they are categorized by:

3.
Size and computational capabilities
Minicomputers: they are similar to mainframes but on a smaller scale and
less power. They cost as much as ten thousand up to several hundred
thousand of dollars.
4.
Microcomputers: they are computers in which the CPU is manufactured as
a single chip called “microprocessor”. They are less in power and cost
compared with the above types. Today, almost all computers are
microprocessor-based machines. In other words, microcomputers become
the main player in computer manufacturing technology.
18
Lecture 2 (Cont.)

Types of Microcomputer Machines

There are different types of microcomputer machines available for
1.
2.
3.
4.
different applications:
Personal computers.
Handheld computers.
Workstations.
Videogames consoles.
19
Lecture 2 (Cont.)

Types of Microcomputer Machines

Personal computer: which are designed to meet computing needs of an
individuals with applications, such as word processing, spreadsheets,
internet access. They are available in different forms, such as Desktop and
Portable (or mobile).
20
Lecture 2 (Cont.)

Types of Microcomputer Machines

Desktop: which fits on a desk and runs on power from an electrical wall
outlet. Its system unit can be housed in horizontal or vertical cases.
Vertical cases are also called “tower” or “min-tower”.
21
Lecture 2 (Cont.)

Types of Microcomputer Machines

Portable (or mobile): which is a small, lightweight PC that can be carried
and used outdoors. It runs on power supplied by an electrical outlet or a
battery. Portable (or mobile) computers are available in different forms,
such as Notebooks (or laptops), Tablets, and Ultra-mobiles.
22
Lecture 2 (Cont.)

Types of Microcomputer Machines

Tablet: which has a touch-sensitive screen that can be used as a writing or
Drawing pad. Tablet computer is suitable for applications with
handwritten inputs.
23
Lecture 2 (Cont.)

Types of Microcomputer Machines

Ultra-mobile: Ultra-mobile PC (UMPC) is a small tablet designed to run
most of the software available for portable computers. It has a size of a
paperback book and weighting in at 2 pounds. UMPC usually has a
wireless internet access and may also be equipped with GPS. It can be
used to listen to music, watch videos and play games.
24
Lecture 2 (Cont.)

Types of Microcomputer Machines

Ultra-mobile: Ultra-mobile PC (UMPC) is a small tablet designed to run
most of the software available for portable computers. It has a size of a
paperback book and weighting in at 2 pounds. UMPC usually has a
wireless internet access and may also be equipped with GPS. It can be
used to listen to music, watch videos and play games.
25
Lecture 2 (Cont.)

Types of Microcomputer Machines

Handheld computer : It is also called “Personal digital assistant” (PDA).
It is designed to fit into pocket. As for examples: Apple iPhone,
BlackBerry .

It has either small keyboard or touch-sensitive screen. Such a type of
computers is usually used as an electronic appointment book, address
book, calculator, internet access, or make calls as a cellular phone.

Since it is not powerful as personal computers, it is usually needed to
update information stored in it using the feature of “synchronize
information” with a personal computer.
26
Lecture 2 (Cont.)

Types of Microcomputer Machines

Workstations: They are usually powerful desktop computers with one or
more microprocessors. They are suitable for tasks which require high
processing speed, such as medical imaging and computer-aided design.

A Workstation may be used as a standalone computer or as a network
computer when connected with other computers through a network.

Videogames
consoles:
today’s
videogames
consoles
contain
microprocessors, keyboards, DVD-players and internet access. They are
considered microcomputers but can not replace personal computers.
Examples include: Sony’s playstation, and Microsoft’s Xbox.
27
Lecture 2 (Cont.)

Data Representation In Modern Computers

Today’s algorithmic machines can generally be termed “Digital
Computers”.

The main characteristics of digital computers is its manipulation of
discrete elements of information. Such discrete elements are represented
physically by “electrical signals” such as voltages and currents.

The main memory of digital computers consists of millions of electrical
devices called transistors, each of which can only have two possible
states: on or off, quite similar to a mechanical switch.

The transistor circuit in main memory acts as an electronic switch with
two states according to its output voltage.
28
Lecture 2 (Cont.)

Data Representation In Modern Computers

Since main memory can only store data in the form of 0 and 1, therefore,
digital computers can only deal with information represented as binary
values.

All information entered to the digital computers , (regardless of being
numbers, characters or symbols), should be represented as a sequence of
binary digits.

Binary digit is usually abbreviated as bit.
29
Lecture 2 (Cont.)

Data Representation In Modern Computers

Bit is quite little piece of information to be handled in digital computer’s
main memory during the execution of an algorithm. Therefore, for
practical reasons, main memory is usually divided into large number of
cells (called words), with typical cell sizes being: 8, 16, or 32 bits. Each
collection of 8 bits is usually termed as byte.
30
Lecture 2 (Cont.)

Numbering System

In general, the decimal equivalent value for any real number of a
positional numbering system with base R can be calculated using the
following “expanded notation” formula:

31
Lecture 2 (Cont.)

Numbering System

32
Lecture 2 (Cont.)

Numbering System

33
Lecture 2 (Cont.)

Numbering System

34
Lecture 3

Conversions In Numbering Systems:

Conversion From Decimal To Binary System (0,1):
Example 1: convert 174.390625 to binary system:
35
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Therefore, the number (10101110.011001)2 is the exact binary equivalent to the
decimal number (174.390625)10.
Example 2: get the equivalent binary number of the decimal number 47.763 with a
precision of 7-binary digits.
36
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Therefore, the number (10111.1100001)2 is the approximate binary equivalent to
the decimal number (47.763)10.
37
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Decimal To Ternary System (0-2):
Example 3: Convert the decimal number 124.33 to its equivalent ternary number with
precision of 5 ternary digits.
38
Lecture 3 (Cont.)

Conversions In Numbering Systems:
Example 4: .
39
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Decimal To Octal System (0-7):
Example 5: Convert the decimal number 167.390625 to its equivalent octal number.
40
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Decimal To Octal System (0-7):
Example 6: Convert the decimal number 95.236 to its equivalent octal number with a
precision up to 4 octal digits.
41
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Decimal To Hexadecimal System (0-F):
Example 7: Convert the decimal 247.390625 to its equivalent hexadecimal number.
42
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Binary To Octal System and vice versa:

There are two ways:

Indirect conversion:
43
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Direct conversion: each 3-binary digits are replaced by one octal digit , and
vice versa , using the following table:
Octal
Binary
0
1
2
000 001 010
3
4
5
6
7
011
100
101
110
111
Example 8: using the indirect way, convert the binary number 1001101.1011 to octal
44
Lecture 3 (Cont.)

Conversions In Numbering Systems:
45
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Direct conversion:
Octal
Binary
0
1
2
000 001 010
3
4
5
6
7
011
100
101
110
111
Example 9: Using the direct way, convert the binary number 1001101.1011 to octal
46
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Conversion From Binary To Hexadecimal System and vice versa:

There are two ways:

Indirect conversion:
47
Lecture 3 (Cont.)

Conversions In Numbering Systems:

Direct conversion: each 4-binary digits are replaced by one hexadecimal digit ,
and vice versa , using the following table:
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
a
Bina 0 1
ry 0 0
0 0
0 0
0
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
0
1
0
1
0
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
Example 10: convert the hexadecimal 3BC. 2E directly to its equivalent binary
number.
48
Lecture 3 (Cont.)

Conversions In Numbering Systems:
49
Lecture 3 (Cont.)

Conversions In Numbering Systems:
Example11: Convert the binary number 111010.11011 directly to its equivalent
hexadecimal number.
Solution: start from the binary point and move to the right (for fraction part) and to the
left (for the integral part) grouping each 4- binary digits as one hexadecimal digit.
Adding 0’s to the extreme right (or left) is allowed. Thus, we have:

You should download (scholar.cu.edu.eg/zizo), answer, and submit Assignment 1.
50
Lecture 4

Addition & Subtraction In Binary System:

Binary Addition: Rules for binary addition are:
Example 1: Find the sum of the binary numbers 1101 & 110 and verify the result using
decimal numbers.
51
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:
Example 1: Find the sum of the binary numbers 1101 & 110 and verify the result using
decimal numbers.
52
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:
Example 2: Find the sum of the binary numbers 110101.101 + 10110.111 and verify
the result using decimal numbers.
53
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction: Rules for binary addition are:
as 10 – 1 = 1.
Note that: (10) will be 1 after borrowing 1 from it.
Example
3:
use
the
direct
binary
subtraction
to
get
the
result
of
1100101 – 100111 . Verify the result in decimal system. decimal numbers.
54
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Step 1: 1-1=0.

Step 2: 0-1= 10-1=1 after borrowing 1 from 1 in the 3rd column which will be 0.

Step 3: 0-1=10-1=1 after borrowing 1 from 10 in the 4th column which will be 1.

Step 4: 1-0=1.

Step 5: 1-0=1.

Step 6: 0-1=10-1=1 after borrowing 1 from 1 in then last column which will be 0.

Step 7: 0-0=0.

Note: the 6th column borrows 1 to the 5th column to be 10 and the 5th column
borrows 1 to the 4th column to be 10. Hence, after borrowing, the 6th col will be 0,
the 5th col will be 1, and the 4th col will be 1.
55
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:
56
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction Using the Complement Method:

The complement method allows to perform the binary (decimal) subtraction in
the form of binary (decimal) addition which is much easier.
This greatly
simplifies the design of the electronic circuits of the digital computers.
57
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Decimal Subtraction using 9’s Complement Method:
Example 4:
58
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Decimal Subtraction using 10’s Complement Method:
Example 5:
Similar to the 9’s and 10’s complements for decimal subtraction, there are 1’s and 2’s
complements for binary subtraction.
59
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 1’s Complement Method:
In 1’ complement, replace every 1 by 0 and every 0 by 1.
Example 6: calculate 110101 – 100101, using 1’s complement
Solution:
+
carry 1
110101
0 1 1 0 1 0 ( 1’s complement of subtrahend )
00 1111
Then
001111
+
1 (carry)
01 0 0 0 0
Then the result is 10000
60
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 1’s Complement Method:
Example 7: calculate 1011.001 – 110.10, using 1’s complement
Solution:
+
carry 1
1011.001
1 0 0 1 . 0 1 1( 1’s complement of subtrahend )
0 100.100
Then
0 100.100
+
1 (carry)
0100.101
Then the result is 0100.101
61
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 1’ s Complement Method:
Example 8: calculate 10110.01 – 11010.10 using 1’s complement
Solution:
10110.01
+
00101.01
11011.10
Since, there’s no carry, therefore, the result is a negative and it’s the negative of the 1’s
complement of ( 1 1 0 1 1 . 1 0 ) .
Hence the required difference is (-00100.01); i.e., (-100.01).
62
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:

The 2’s complement of a binary number can be obtained in two ways: -

A) By adding 1 to the 1’s complement.

B) Start the binary number from right. Leave the binary digits unchanged until the
first 1 appear, after it replace every 1 by 0 , and every 0 by 1.
63
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 9: Obtain the 2’s complement of the binary number 1011010.110.
64
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 9: Obtain the 2’s complement of the binary number 1011010.110.
65
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 10:calculate the following binary Subtraction: 11101.101 – 1011.11 , then
verify the result in decimal System.
66
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 10:calculate the following binary Subtraction: 11101.101 – 1011.11 , then
verify the result in decimal System.
67
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 11:calculate the following binary Subtraction: 1101.101 – 11011.11 , then
verify the result in decimal System.
Note: In direct subtraction, subtract 11011.110-01101.101 and add (–) to the result.
68
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 11:calculate the following binary Subtraction: 1101.101 – 11011.11 , then
verify the result in decimal System.
69
Lecture 4 (Cont.)

Addition & Subtraction In Binary System:

Binary Subtraction using 2’ s Complement Method:
Example 11:calculate the following binary Subtraction: 1101.101 – 11011.11 , then
verify the result in decimal System.
70
Lecture 5

Signed Binary Numbers:

The signed binary numbers are represented with a bit placed in the leftmost
position of the binary number to represent the sign.

The way of representing the signed binary numbers depends on the adopted
notational system. The most common notations are:
1. Signed-magnitude system.
2. Signed-complement system.
3.
Excess system .

For both of the signed-magnitude and the signed-complement systems, the
convention is to make the sign bit 0 for positive and 1 for negative numbers.
However, the reverse condition is used in the excess system.
71
Lecture 5 (Cont.)

Signed Binary Numbers

Signed-magnitude notation:

The number consists of two parts: a magnitudes and a symbol (+ or -). - Changing
the sign of the binary number in this system is simply obtained by altering the
leftmost bit from 0 to 1 , or vice versa.
Example 1: the string of bits 01001 can be considered as 9 (unsigned binary), or + 9
(signed-magnitude binary) since the leftmost bit is 0. The string of bits 11001 can be
considered as 25 (unsigned binary), or – 9 (signed-magnitude binary) since the leftmost
bit is 1.
72
Lecture 5 (Cont.)

Signed Binary Numbers

Signed-magnitude notation:

The signed-magnitude conversion table of a 3-bit binary pattern is as follows:
73
Lecture 5 (Cont.)

Signed Binary Numbers

Signed-magnitude notation:

While the unsigned decimal range of the 3-bit binary pattern is [ 0 , 7], the
corresponding signed-magnitude range is [– 3 , + 3 ]. For a n-bit binary pattern,
the allowed unsigned decimal range is [ 0 , (2n-1)10], and the allowed signedmagnitude range is [– (2n-1 –1)10 , + (2n-1 –1)10]. Despite of the simplicity of the
signed-magnitude system , it is not convenient to implement arithmetic operations
in a computer since there are two different representations of 0 in the table,
which are 000 (+0) and 100 (-0).
74
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:

In this system, a negative number is indicated by its complement.

Since positive numbers always start with 0;(i.e. +), in the leftmost position, the
complement will always start with 1 (i.e. –).

The signed-complement system can use either the 1’s complement or the 2’s
complement notations.

Changing from + to – and vise versa of the binary number in the 1’s complement
system is obtained by taking the 1’s complement of the binary number.

Changing from + to – and vise versa of the binary number in the 2’s complement
system is obtained by taking the 2’s complement of the binary number.
75
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:
Example 2: assuming the representation of the number 9 in binary with eight bits, we
have the following cases:
a) unsigned 9 or + 9 has the same representation in both signed-magnitude and
signed-complement systems which is: 00001001
b) – 9 has different representations in each system as follows:
In signed-magnitude representation: 10001001.
In signed-1’s complement representation: 11110110.
In signed-2’s complement representation: 11110111.
76
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:

The signed-complement conversion table of a 3-bit binary pattern is as follows
77
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:

100 is a negative number (the left most bit is 1), to know its positive, take the 1’s
complement which will be (011) (3). Hence 100 is -3 in 1’s complement.

100 is a negative number, to know its positive, take the 2’s complement which will
be (100) (4). Hence 100 is -4 in 2’s complement.

101 is a negative number (the left most bit is 1), to know its positive, take the 1’s
complement which will be (010) (2). Hence 101 is -2 in 1’s complement.

101 is a negative number, to know its positive, take the 2’s complement which will
be (011) (3). Hence 101 is -3 in 2’s complement.
78
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:
79
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:

While the unsigned decimal range of the 3-bit binary pattern is [ 0 , 7], the
corresponding signed -1’s complement range is [– 3 , + 3 ], and the corresponding
signed-2’s complement is [– 4 , + 3 ]. For a n-bit binary pattern,
the allowed unsigned decimal range is [ 0 , (2n-1)10], the allowed signed1’s complement range is [– (2n-1 –1)10 , + (2n-1 –1)10], and the allowed signed2’s complement range [– (2n-1 )10 , + (2n-1 –1)10].

The signed-1’s complement notation suffers the same problem as the signed-magnitude one,
namely the existence of two different representations of 0 in the table, which are 000 (+0)
and 111(-0).

The signed-2’s complement notation is the most commonly used notation to
implement arithmetic operations in a computer, since it provides a unique representation of
the signed decimal numbers in range, because 0 has a unique representation.
80
Lecture 5 (Cont.)

Signed Binary Numbers
 Signed -complement notation:
Example 3: obtain the decimal value of the binary number 11111001. 101 in case of:
a) unsigned binary notation.
b) signed-magnitude notation.
c) signed-1’s complement notation.
d) signed-2’s complement notation.
81
Lecture 5 (Cont.)

Signed Binary Numbers

Signed -complement notation:
Example 4: Show the upper and lower bound of decimal values that are allowed for
binary bit patterns of lengths: 4, 5, 6, 7and 8 in the cases of unsigned,
signed-magnitude and signed-complement notations.
82
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:

In this system, any binary number having 1 in the leftmost bit is considered as a
positive number. On the other hand, all negative numbers have 0 in their leftmost
bit.

The bit pattern with 1 in the leftmost bit and 0 elsewhere represents 0 decimal.

The excess n notation signed values are obtained by subtracting n from the
corresponding unsigned value.

excess decimal value (excess n notation signed values)=unsigned decimal valuen.

The excess four notation signed range for a 3-bit pattern (because 4 is 100) is [– 4
, + 3 ]. For a n-bit binary pattern, the allowed unsigned decimal range is [0 , 2n-1],
and the allowed excess notation signed decimal range is [– (2n-1)10 , + (2n-1 –1)10].83
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:

The following table is the excess four notation signed values, in which the
excess decimal values are obtained by subtracting the corresponding unsigned
decimal values from 4. 0 has a unique representation.
84
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:

From the previous table, 000 is called the excess four notation unsigned value
and -4 is called the equivalent excess decimal value (excess n notation signed
values), which is equal to the equivalent unsigned decimal value of the excess
notation - 4.

The excess four notation signed range for a 3-bit pattern is [– 4 , + 3 ]. For a n-bit
binary pattern, the allowed unsigned decimal range is [0 , 2n-1], and the allowed
excess notation signed decimal range is [– (2n-1)10 , + (2n-1 –1)10].
85
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:
Example 5: convert each of the following excess eight notations in 4-bit to its
equivalent excess decimal value:
a)
1 1 0 1.
b)
0 1 0 0.
c)
0 0 0 0.
Solution: excess decimal value = unsigned decimal value of the excess notation - 8
a) (1 1 0 1)  13 – 8 = + 5.
b) (0 1 0 0)  4 – 8 = – 4.
c) (0 0 0 0)  0 – 8 = – 8.
86
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:
Example 6: find the excess eight notations in 4 bits of the following excess decimal
value:
a)
+6.
b)
-6.
c)
0.
Solution: excess decimal value = unsigned decimal value of the excess notation - 8
a) (+6)  6+ 8 = 14=1110.
b) (-6)  -6+ 8 = 2=0010.
c) (0)  0+ 8 = 8=1000.
87
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:
Example 7: show the upper and lower bound of the signed decimal numbers in the
following cases:
a)
excess 4 .
b)
excess 8 .
c)
excess 16.
Solution:
a) excess 4(100)  4=23-1=22 , then only 3-bit pattern is needed  the range is [– 4 , +
3 ].
b) excess 8 (1000) 8=24-1=23 , only 4-bit pattern is needed  the range is [– 8 , + 7 ].
c) excess 16 (10000)  16=25-1=24 , only 5-bit pattern is needed  the range is [– 16 ,
+ 15 ].
88
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:
Example 8: Show all the 4-bit signed binary numbers together with its corresponding
decimal values for the signed-magnitude, signed-complement , and excess system.
89
Lecture 5 (Cont.)

Signed Binary Numbers

Excess notation:
90
Lecture 6

Signed-2’s Complement Addition & Subtraction

The signed-2’s complement notation is the most commonly used notation to
implement arithmetic operations in a computer since it provides a unique
representation of the signed decimal numbers in range. 0 has a unique
representation.

Signed-2’s complement addition:

When adding two signed numbers represented in signed-2’s complement system,
perform a normal addition including their sign bits. A carry out of the sign bit
position is discarded.
91
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Signed-2’s complement subtraction:

Take the 2’s complement of the subtrahend (including the sign bit) and add it to
the minuend (including the sign bit). A carry out of the sign bit is discarded.
92
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction
Example 1: using the signed 2’s complement notation, calculate the following
arithmetic operations in 4 bits:
93
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction
Solution:
-2 in 2’s complement is 1110 and -4 in 2’s complement is 1100.
94
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction
Solution:
+2.875=(0010.111) and -2.875 in 2’s complement is 1101.001.
95
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction
Example 2: assuming 8-bit signed 2’s complement binary numbers, calculate the
following operation: (– 6 ) – (– 13).
Solution: in 8-bit signed 2’s complement binary numbers, we have:
(+ 6 ) = 00000110 , (– 6 ) = 11111010.
(+ 13 ) = 00001101 , (– 13 ) = 11110011.
According to the signed 2’s complement subtraction rule, we have:
(– 6) – (– 13) = (– 6) + (+ 13)=
96
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Overflow problem:

Assuming using 2’s complement notation with 4-bit binary pattern, then the proper
range for allowed signed binary numbers is [– 8 , + 7 ]. This means that the value
+ 9 is out of range and consequently has no pattern associated with it. However,
when we calculate 5 + 4 the result will be as follows:
97
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Overflow problem:

This error is called overflow and it occurs when the result of an arithmetic
operation lies outside the allowed range of the signed numeric data.

Overflow in signed-2’s complement notation occurs in the following two cases:
1. when adding two positive numbers, the result is negative.
2. when adding two negative numbers , the result is positive.
To avoid the problem of overflow, the number of binary bits must be increased, to
allow a quite wide range for representing signed numbers before the occurrence of
overflow.
98
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Floating point representation:

Numbers used in scientific calculations are designed by a sign, by the magnitude
of the number, and by the position of the radix point.

The position of the radix point is required to represent fractions, integers, or mixed
integer-fraction numbers.

There are two ways of specifying the position of the radix point which are:
1. Fixed-point representation (which we have studied up till now) .
2. Floating-point representation.
99
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Floating point representation:

In Floating-point representation, there are two ways for positioning the radix
point. They are:

1- Putting the radix point at the extreme left of the number.

2- Putting the radix point at the extreme right of the number.

According to the first way, any number can be expressed as a fraction (mantissa)
and a positive exponent. On the other hand, the second way, makes the number be
expressed as an integer and a negative exponent.

In decimal system, the floating-point notation; which is also called “scientific
notation”; of any real number can be represented as :
100
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Floating point representation:
 (N)10 = .F × 10E
Where,
(N)10: is the real number in decimal.
F: is a fraction(mantissa) .
E: is an exponent.

Example 3: the real number + 6132.789 can be expressed using floating point
notation as:
101
Lecture 6 (Cont.)

Signed-2’s Complement Addition & Subtraction

Floating point representation:

Example 4: using the signed-magnitude method, the binary number + 1001.11 can
be represented with a 8-bit fraction
and 6-bit exponent as:
102
Lecture 7

Floating point representation:

There are 4 different formats for representing floating-point binary numbers:

A) signed-magnitude method B) 2’s complement method C) Excess method D)
IEEE standard method.
103
Lecture 7 (Cont.)

Floating point representation:

Signed-magnitude method:
104
Lecture 7 (Cont.)

Floating point representation:

Example 5: using the signed-magnitude method, the binary number + 1001.11 can
be represented with a 8-bit fraction and 6-bit exponent as:

Therefore, the floating-point representation is: 0 000100 0 00100111
105
Lecture 7 (Cont.)

Floating point representation:

Example 6: using the signed-magnitude method, the binary number -0.001101101
can be represented with a 8-bit fraction and 6-bit exponent as:
1101101 x 2-2
Therefore, the floating-point representation is: 1 000010 1 01101101
106
Lecture 7 (Cont.)

Floating point representation:

2’s complement method:

In this method, only the exponent part is expressed using 2’s complement
notation. There is only one sign bit exists for the mantissa part (with 0 for + and 1
for -), i.e., if the exponent is –ve, it is converted using the two’s complement.

Example 7: using the 2’s complement method, the binary number -0.001101101
can be represented with a 8-bit fraction and 6-bit exponent as: 1101101 x 2-2

Therefore, the floating-point representation is: 1 111110 01101101, where

111110 is the 2’s complement of 000010
Sign for
mantissa
107
Lecture 7 (Cont.)

Floating point representation:

Excess method:

In this method, only the exponent part is expressed using excess notation. There is
only one sign bit exists for the mantissa part (with 0 for + and 1 for -), i.e., if the
exponent is –ve, it is converted using the excess notation.

Example 8: using the excess method, the binary number 1001.11 be represented
as:


+ 4 is allowed in excess 8 notation. Thus, 4 + 8 = 12

Therefore, the floating-point representation is: 0 001100 00100111
→ 1100.
108
Lecture 7 (Cont.)

Floating point representation:

Excess method:

Example 9: using the excess method, the binary number -. 0001011 be
represented as:


- 3 is allowed in excess 4 notation. Thus, 4 -3 = 1

Therefore, the floating-point representation is: 1 000001 00001011
→ 001.
109
Lecture 7 (Cont.)

Floating point representation:

IEEE standard method:

In this method, the single precision floating-point number is expressed using 32
bits as follows:

The exponent part is expressed using excess 127 notation . The fraction part is
considered to be 1. f , with 1 hidden and appear only during calculation. For
example, if f is 01101, the mantissa would be 1.01101. If the exponent is 4, the e
field will be 4 + 127 = 131 (10000011).
110
Lecture 7 (Cont.)

Floating point representation:

IEEE standard method:

The following formula is used to calculate the floating-point number as a single
precision value:
111
Lecture 8

Data Representation In Modern Digital Computers:

Representation of Alphanumeric characters:

Data stored in the main memory of a digital computer can also be in the form of
letters, not only numbers.

An alphanumeric character set , is a set of elements that include the 10 decimal
digits (0-9), 26 letters of uppercase alphabet, 26 letters of the lowercase alphabet
and 32 special characters (%. $, #,…).

ASCII Character Code:

The standard and the most popular binary code for alphanumeric characters is
ASCII (American Standard Code For Information Interchange).

Originally, ASCII code uses 7-bits to code 128 (i.e. 27 ) characters as follows:
94 Graphic characters and 34 non-printing characters (i.e. control
characters).
112
Lecture 8 (Cont.)

Data Representation In Modern Digital Computers:

Representation of Alphanumeric characters:

The extended ASCII code uses 8-bits to code 256 (i.e. 28 ) characters for handling
additional symbols and special characters.
113
Lecture 8 (Cont.)

Data Representation In Modern Digital Computers:

Representation of Alphanumeric characters:

Another code is the UNICODE (Universal Code), which uses 16-bits for symbol
representation. This means that UNICODE can represent up to 65536 (i.e. 216 )
different symbols.

Other types of data that digital computers can deal with include: pictures, audio,
and videos. The techniques used to represent data for such forms are different
from those used for representing characters and numbers.

For example, storing a picture starts by considering it as a collection of dots (i.e.
pixels). Such pixels are arranged in rows and columns over the picture. Each
pixel may take 1 byte of storage in memory to keep data about its color and
brightness (called: Bitmap representation).
114
Lecture 8 (Cont.)

Data Representation In Modern Digital Computers:

Representation of Alphanumeric characters:

There are different coding techniques for such types of data, such as: TIFF (Tag
Image Format File), GIF
(Graphic Interchange Format), and JPEG(Joint
Photographic Experts Groups) for images
using bitmap formats, and MIDI
(Musical Instrument Digital Interface), AVI (Audio Visual Interleave), and MPEG
(Motion Picture Experts Group) for video and audio.
115
Lecture 8 (Cont.)

Computer Hardware:

The internal memory of digital computers consists of a large number of “memory
cells”. Each memory cell is called a “word”.

A “word” in memory is an entity of bits (cells) that can be moved in and out of the
memory as a unit.

A memory word is a group of 1’s and 0’s. It may represent a number, an
instruction, one or more alphanumeric character, or any other binary coded
information.

The size of a memory word is multiples of 8-bits in length: 8-bits (i.e.,1 byte),
16-bits (i.e., 2 bytes) , or 32-bits (i.e., 4 bytes), and so on .
116
Lecture 8 (Cont.)

Computer Hardware:

The capacity of memory is simply the total number of bytes that it can store.
117
Lecture 8 (Cont.)

Computer Hardware:

the units that are usually used for measuring memory capacities.
118
Lecture 8 (Cont.)

Computer Hardware:
119
Lecture 8 (Cont.)

Computer Hardware:

Memory Addressing:

The CPU can access each memory cell by a unique address. A CPU with n-address
line (the width of the address bus of a CPU is n bits) can access memory cells up
to 2n cells. In this case , the address range from 0 to 2n-1. The first address is
n….000000000 and the last address is n….11111111.
120
Lecture 8 (Cont.)

Computer Hardware:

Memory Addressing:

Example 2: what is the total memory capacity that can be addressed using a CPU
with 16-address line?

Solution: the total memory capacity = 216 = 26 × 210 = 64 K word. If each word
= 1 byte, then the total memory capacity = 64 KB. The address of the first memory
cell = 0000 0000 0000 0000.The address of the last memory cell = 1111 1111 1111
1111. In other words , using hexadecimal notation, the address range is: 0000 to
FFFF.

121
Lecture 8 (Cont.)

Computer Hardware:

Memory Addressing:

Example 3: what is the total number of address lines needed by a CPU to address
memory of capacity of 64 MB?

Solution: the total memory capacity = 26 × 220 = 226 B. If each word = 1 byte,
then the total memory capacity = 226 , Thus, the number of address lines is 26.
122
Lecture 8 (Cont.)

Computer Hardware:

Memory Addressing:

Example 3: what is the total number of address lines needed by a CPU to address
memory of capacity of 64 MB?

Solution: the total memory capacity = 26 × 220 = 226 B. If each word = 1 byte,
then the total memory capacity = 226 , Thus, the number of address lines is 26.

The CPU can access all memory cells equivalently without any differences in
accessibility between “low address” and “high address” cells. Therefore, main
memory is usually termed RAM (i.e., Random Access Memory) , which means
that all memory cells are accessible just by address.
123
Lecture 8 (Cont.)

Computer Hardware:

Memory Types:

There are 7-typs of internal memories inside a digital computer, they are: - CPU
internal registers, RAM, VRAM, ROM, CACHE, CMOS ,and Virtual Memory.
124
Lecture 8 (Cont.)

Computer Hardware:

Memory Types:

Random Access Memory :

RAM can be categorized according to the following different criteria:

Clock Synchronization:

Synchronous RAM: it matches the clock speed of the CPU ; i.e., the speed (Hz) of
read or write operation is matched to the clock speed of the CPU (the no of
executed operations in one second. It’s measured by Hz). Rambus DRAM
(RDRAM) is on type of SDRAM. It is a high speed memory chip developed by
Rambus. It can function up to six times faster than SDRAM. It is more expensive
than SDRAM and usually found in high performance workstations with
microprocessors that run at speed faster than 1 GHz.

Asynchronous RAM: it does not match the clock speed of the CPU.
125
Lecture 8 (Cont.)

Data Representation In Modern Digital Computers:

Memory Types:

Random Access Memory :

Memory cell technology:

Dynamic RAM (DRAM): memory cell is a transistor-capacitor pair. DRAMs
need to be refreshed thousands of time per second. They are usually synchronous.

Static RAM (SRAM): memory cell is a simple flip-flop. SRAMs need not to be
refreshed. So, it is much faster than DRAMs. They have much parts and need
more spaces than DRAMs. They are more expensive than DRAMs. SRAMS are
usually asynchronous.
126
Lecture 8 (Cont.)

Data Representation In Modern Digital Computers:

Memory Types:

Random Access Memory :

Chips Packaging:

Dual in-line package (DIP): a DIP has two rows of pins that connect the IC
circuitry to a circuit board.

Memory Modules: a memory module is a small circuit board containing several
chips.
127
Lecture 13

Computer Hardware

The lectures from 9 to 12 are self study.

The processor is an integrated circuit that contains a computer’s central processing
unit (CPU).

A microprocessor has two main components: control unit (CU) and arithmetic &
logic unit (ALU).

The ALU uses internal registers to hold data that is being processed.

Registers : are high speed storage spaces within a CPU. The size and number of
registers in the central processing unit are critical in determining the speed and
power of a computer.
128
Lecture 13 (Cont.)

Computer Hardware

The microprocessor has a finite set of instructions that can be performed, such
instructions are hard-wired into the processor’s circuitry. These instructions
include :
1. Basic arithmetic and logic operations.
2. Data transfer operations.
3. Control instructions.

The microprocessor executes programs stored only in the main memory through
the following steps:
1. Fetching each instruction of the program into internal registers,
2. Decoding it to its basic hard-wired instruction operations,
3. Executing it by activating the corresponding circuitry.
129
Lecture 13 (Cont.)

Computer Hardware

The fetch, decode , and execute steps are usually called “fetch-decode-execute
cycle ”, as the microprocessor continues cycling in these steps until finding
“END”, or “HALT” instruction.

Microprocessor can be classified according to the following criteria:

The technology of instruction set:
•Complex instruction set computer (CISC), such as Pentium series of processors
developed by Intel.
•Reduced instruction set computer (RISC), such as PowerPC series of processors
developed by Apple, IBM and Motorola.
130
Lecture 13 (Cont.)

Computer Hardware

The technology of executing instructions:
•
Serial: the processor must complete all steps in the instruction cycle before it
begins to execute the next instruction.
•
Pipelining: the processor can begin executing an instruction before it
completes the previous one.
•
Parallel: the processor can execute multiple instructions at the same time.
Such a processing ability can be achieved using either of the following
technologies:
a. Hyper-Threading : which is a circuitry that enables the processor to simulate
two processors.
b. Dual Core: which allows a single chip containing the circuitry of
two processors with a shared cache memory.
131
Lecture 13 (Cont.)

Computer Hardware

The performance of microprocessors are evaluated according to:

Clock speed (or clock rate): It is the speed at which a computer’s microprocessor
is able to process data. It is usually measured in hertz, generally in MHz (i.e.
million cycle per second), or GHz, (i.e. billion cycles per second). For example, a
CPU with a clock rate of 1.8 GHz can perform 1,800,000,000 clock cycles (fetchdecode-execute) per second.

The speed of the front side bus: Front side bus (FSB) refers to the circuitry that
transports data to and from the microprocessor. A fast FSB allows the processor to
work at full capacity. FSB speed ranges from 200 MHz up to 1250 MHz. Some
manufacturer use a technology called “Hyper-Transport ” to increase the speed of
data moving to the processor.
132
Lecture 13 (Cont.)

Computer Hardware

Word Size: It is the number of bits that a microprocessor can manipulate at one
time. It is based on the size of the registers of the ALU as well as the width of the
data bus. For example, 16-bit microprocessor can process 2 bytes at a time, while
32-bit microprocessor can process 4 bytes at a time.

Cache Size: which refers to level 1 cache (L1) (inside the microprocessor chip),
as well as level 2 cache (L2) (on a separate chip connected to the microprocessor
through a special bus called “cache bus ” or “backside bus”). Cache size is usually
measured in KB.

Instruction set: which is the technology used for designing the microprocessor
instructions set. Instructions set is usually: CISC or RISC technology.
133
Lecture 13 (Cont.)

Computer Hardware

Processing Technique: which is the technology used for executing instructions. It is usually serial, pipelining, or parallel processing.
134
Lecture 13 (Cont.)

Data Manipulation

Data manipulation in an algorithmic machine means: the ability to perform
operations on the data stored on memory , and Coordinating the sequence of these
operations.

The CPU of the computer is responsible for doing data manipulation as follows:
the ALU is responsible for performing arithmetic & logic operations, and the CU
is responsible for coordinating the machine’s activities.

The CPU contains internal temporary storage cells , called registers, that are
similar to main memory locations.
135
Lecture 13 (Cont.)

Data Manipulation

There are two types of registers inside the CPU:
1- General-purpose registers: which serves as temporary holding place of the
processed data .
2- Special-purpose registers: which are responsible for proper execution of the
programs, e.g. “Program counter register”, and “instruction register”.

To perform an operation on data stored in main memory:

1- The control unit transfers the data from memory into the general-purpose
registers.

2- The control unit informs the ALU which registers hold the data. Then, the
control unit activates the appropriate circuitry within the ALU. (based on the
content of the instruction register).

3- The control unit tells the ALU which register should receive the result.
136
Lecture 13 (Cont.)

Data Manipulation
137
Lecture 13 (Cont.)

Data Manipulation

To write (or store) data in a memory cell:
1. The CPU sends the address of the memory cell through the address bus.
2. The CPU sends the data to be stored through the data bus.
3. The CPU sends a write control signal through the control bus.

To read data from a memory cell:
1- The CPU sends the address of the memory cell through the address
bus.
2- The CPU sends a read control signal through the control bus.
3- The CPU receives the contents of the required memory cell through the
data bus and holds it in a register.
138
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

The processor has its own internal instructions that are used to perform various
forms of data manipulation.

The instruction sets differ according to the type of processor, e.g. Intel 8080.

The instructions set of a processor can be grouped into 3 categories as:
139
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

140
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

141
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

142
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

143
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

144
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

145
Lecture 13 (Cont.)

Data Manipulation

Machine Instructions.

146
Lecture 14

Data Manipulation

Machine Instructions.

147
Lecture 14 (Cont.)

Data Manipulation

Machine Instructions.

148
Lecture 14 (Cont.)

Data Manipulation

Machine Instructions.

149
Lecture 14 (Cont.)

Data Manipulation

Machine Instructions.

150
Lecture 14 (Cont.)

Data Manipulation

Machine Instructions.

The instruction register of the CPU is 2 bytes.

151
Lecture 14 (Cont.)

Data Manipulation

Program Execution

To execute a program stored in main memory, the control unit of the CPU uses the
special-purpose registers to do the job.

The first step is that the start address of the program, such as 156C in the main
memory should be placed in the “program counter” register. By the operating
system.

Once the address of the first instruction to be executed is put in the “program
counter” register, the control unit starts a “repeating algorithm” called
“machine cycle”.
152
Lecture 14 (Cont.)

Data Manipulation

Program Execution

The machine cycle consists of 3 steps:
1- Fetch: which is fetching the instruction from the memory cell whose address is in
the program counter, and putting it in the instruction register. At the end of fetch step,
the program counter is incremented to the next program instruction.
2- Decode: which is decoding the instruction contained in the instruction register and
analyzing its op-code field , and operand field.
3- Execute: after decoding the instruction, the control unit activates the required
circuitry to perform the needed operation.
153
Lecture 14 (Cont.)

Data Manipulation

Program Execution

The fetch-decode-execute cycle continues until the “HALT” instruction is decoded
in the instruction register, then before completing its execution the machine is
informed that the program is completed and the machine cycle stops.
154
Lecture 14 (Cont.)

Data Manipulation

Program Execution

The fetch-decode-execute cycle continues until the “HALT” instruction is decoded
in the instruction register, then before completing its execution the machine is
informed that the program is completed and the machine cycle stops.
155
Lecture 14 (Cont.)

Data Manipulation

Program Execution

Since the instruction in the hypothetical CPU is 16 bits, and the size of each
memory cell is 8 bits, then each instruction of the program occupies two
consecutive memory locations .
156
Lecture 14 (Cont.)

Data Manipulation

Program Execution
157
Lecture 14 (Cont.)

Data Manipulation

Program Execution
158
Lecture 14 (Cont.)

Data Manipulation

Program Execution
159
Lecture 14 (Cont.)

Data Manipulation

Program Execution
160
Lecture 14 (Cont.)

Data Manipulation

Program Execution
161
Lecture 14 (Cont.)

Data Manipulation

Program Execution
162
Lecture 14 (Cont.)

Data Manipulation

Program Execution
163
Lecture 14 (Cont.)

Data Manipulation

Program Execution
164
Lecture 14 (Cont.)

Data Manipulation

Program Execution
165
Lecture 14 (Cont.)

Data Manipulation

Program Execution
166
Lecture 14 (Cont.)

Data Manipulation

Program Execution
167
Lecture 14 (Cont.)

Data Manipulation

Program Execution
168
Lecture 14 (Cont.)

Data Manipulation

Program Execution
169
Lecture 14 (Cont.)

Data Manipulation

Program Execution
170
Lecture 14 (Cont.)

Data Manipulation

Program Execution
171
Lecture 14 (Cont.)

Data Manipulation

Program Execution
172
Lecture 14 (Cont.)

Data Manipulation

Program Execution
173
Lecture 15

Data Manipulation
174
Lecture 15 (Cont.)

Data Manipulation

175
Lecture 15 (Cont.)

Data Manipulation
176
Lecture 15 (Cont.)

Data Manipulation

177
Lecture 15 (Cont.)

Data Manipulation

178
Lecture 15 (Cont.)

Data Manipulation

179
Lecture 15 (Cont.)

Data Manipulation

180
Lecture 15 (Cont.)

Data Manipulation

181
Lecture 15 (Cont.)

Data Manipulation

182
Lecture 15 (Cont.)

Data Manipulation

183
Lecture 15 (Cont.)

Data Manipulation

184
Lecture 15 (Cont.)

Data Manipulation

185
Lecture 15 (Cont.)

Data Manipulation

186
Lecture 16

Data Manipulation

187
Lecture 16 (Cont.)

Data Manipulation

188
Lecture 16 (Cont.)

Data Manipulation

189
Lecture 16 (Cont.)

Data Manipulation

190
Lecture 16 (Cont.)

Data Manipulation

191
Lecture 16 (Cont.)

Data Manipulation

192
Lecture 16 (Cont.)

Data Manipulation

193
Lecture 16 (Cont.)

Data Manipulation

194
Lecture 16 (Cont.)

Data Manipulation

195
Lecture 16 (Cont.)

Data Manipulation

196
Lecture 16 (Cont.)

Data Manipulation

197
Lecture 16 (Cont.)

Data Manipulation

198
Lecture 16 (Cont.)

Data Manipulation

199
Lecture 16 (Cont.)

Data Manipulation

200
Lecture 16 (Cont.)

Data Manipulation

201
Lecture 16 (Cont.)

Data Manipulation

202
Lecture 16 (Cont.)

Data Manipulation

203
Lecture 16 (Cont.)

Data Manipulation

204