You are on page 1of 284

INTRODUCTION OF COA

 Er. Ajit Saxena


 HOD of Computer Science Deptt

 Eshan College of Engineering, Mathura


WHAT IS COA?

 COA means Computer Organisation and


Architecture.
 It is a combination of Computer Organisation
and Computer Architecture.
 In COA, we discuss about the organisation of a
computer and architecture of computer.
COMPUTER ORGANISATION

 Computer organisation deals with functions


and design of various units of a digital system.
 CO is concerned with the way the h/w
components operate and the way they are
connected together to form a computer system.
COMPUTER ARCHITECTURE

 Computer Architecture deals with the


specification of the instruction set and the h/w
units that implement the instructions.
 It is concerned with the structure and behaviour
of the computer as seen by the user.
 It includes the information formats, the
instructions set and techniques for addressing
the memory.
COMPUTER ARCHITECTURE COMPUTER ORGANISATION

 Computer Architecture is  Computer Organization is


concerned with the way concerned with the structure
hardware components are and behavior of a computer
connected together to form a system as seen by the user.
computer system.
 It acts as the interface  It deals with the components
between hardware and of a connection in a system.
software.  Computer Organization tells
 Computer Architecture helps us how exactly all the units in
us to understand the the system are arranged and
functionalities of a system. interconnected.

COMPARISON BETWEEN CO AND CA


COMPUTER ARCHITECTURE COMPUTER ORGANISATION

 While designing a computer  An organization is done on


system architecture is the basis of architecture.
considered first.  Computer Organization deals
 Computer Architecture deals with low-level design issues.
with high-level design issues.  Organization involves
 Architecture involves Logic Physical Components (Circuit
(Instruction sets, Addressing design, Adders, Signals,
modes, Data types) Peripherals)

COMPARISON BETWEEN CO AND CA


WHAT IS SYSTEM?

 A system is a collection of elements or


components that are organized for a common
purpose.
 A system is a machine which have input, output
and processing unit.
 Some systems also have memory unit as
computer system.
WHAT IS DIGITAL SYSTEM?
 Digital systems are designed to store, process,
and communicate information in digital form.
 They are found in a wide range of applications,
including process control, communication
systems, digital instruments, and consumer
products.
 The digital computer, more commonly called the
computer, is an example of a typical digital
system.
FUNCTIONAL UNITS OF DIGITAL SYSTEM

 Functional units of a computer system are


parts of the CPU (Central Processing Unit) that
performs the operations and calculations
called for by the computer program.
 A computer consists of three main components
namely, Input unit, Central Processing Unit and
Output unit.
BLOCK DIAGRAM OF A COMPUTER
INPUT UNIT
 Input units are used by the computer to read the
data. The most commonly used input devices are
keyboards, mouse, joysticks, trackballs,
microphones, etc.
 However, the most well-known input device is a
keyboard. Whenever a key is pressed, the
corresponding letter or digit is automatically
translated into its corresponding binary code and
transmitted over a cable to either the memory or
the processor.
CENTRAL PROCESSING UNIT

 Central processing unit commonly known as


CPU can be referred as an electronic circuitry
within a computer that carries out the
instructions given by a computer program by
performing the basic arithmetic, logical, control
and input/output (I/O) operations specified by
the instructions.
MEMORY UNIT

 The Memory unit can be referred to as the


storage area in which programs are kept which
are running and that contains data needed by
the running programs.
 It enables a processor to access running
execution applications and services that are
temporarily stored in a specific memory
location.
ARITHMETIC AND LOGICAL UNIT

 Most of all the arithmetic and logical


operations of a computer are executed in the
ALU (Arithmetic and Logical Unit) of the
processor.
 It performs arithmetic operations like addition,
subtraction, multiplication, division and also
the logical operations like AND, OR, NOT
operations.
CONTROL UNIT

 The control unit is a component of a computer's


central processing unit that coordinates the
operation of the processor.
 It tells the computer's memory, arithmetic/logic
unit and input /output devices how to respond
to a program's instructions.
 The control unit is also known as the nerve
center of a computer system.
OUTPUT UNIT
 The primary function of the output unit is to send
the processed results to the user.
 Output devices display information in a way that
the user can understand.
 Output devices are pieces of equipment that are
used to generate information or any other
response processed by the computer.
 These devices display information that has been
held or generated within a computer.
WHAT IS NUMBER SYSTEM

 Number systems are the technique to


represent numbers in the computer system
architecture.
 Every value that you are saving or getting
into/from computer memory has a defined
number system.
TYPES OF NUMBER SYSTEM

 Computer architecture supports following


number systems:-
 Binary number system

 Octal number system

 Decimal number system

 Hexadecimal (hex) number system


1. BINARY NUMBER SYSTEM

A Binary number system has only two digits


that are 0 and 1.
 Every number (value) represents with 0
and 1 in this number system.
 The base of binary number system is 2,
because it has only two digits.
2. OCTAL NUMBER SYSTEM

 Octal number system has only eight (8)


digits from 0 to 7.
 Every number (value) represents with
0,1,2,3,4,5,6 and 7 in this number system.
 The base of octal number system is 8,
because it has only 8 digits.
3. DECIMAL NUMBER SYSTEM

 Decimal number system has only ten (10)


digits from 0 to 9.
 Every number (value) represents with
0,1,2,3,4,5,6, 7,8 and 9 in this number
system.
 The base of decimal number system is 10,
because it has only 10 digits.
4. HEXADECIMAL NUMBER SYSTEM

 A Hexadecimal number system has sixteen


(16) alphanumeric values from 0 to 9 and A
to F.
 Every number (value) represents with
0,1,2,3,4,5,6, 7,8,9,A,B,C,D,E and F in this
number system.
 The base of hexadecimal number system is
16, because it has 16 alphanumeric values.
 Here A is 10, B is 11, C is 12, D is 13, E is
14 and F is 15.
NUMBER SYSTEM CONVERSION
 There are three types of conversion:
 Decimal Number System to Other Base

 [for example: Decimal Number System to


Binary Number System]
 Other Base to Decimal Number System

 [for example: Binary Number System to


Decimal Number System]
 Other Base to Other Base

 [for example: Binary Number System to


Hexadecimal Number System]
DECIMAL NUMBER SYSTEM TO OTHER BASE
 To convert from Decimal Number
System to Any Other Base, you have to
follow just two steps:
 A) Divide the Number by the base of
target base system (in which you want
to convert the number: Binary (2), octal
(8) and Hexadecimal (16)).
 B) Write the remainder from bottom to
top.
1. DECIMAL TO BINARY
One more example
2. DECIMAL TO OCTAL
One more example
3. DECIMAL TO HEXADECIMAL
One more example
OTHER BASE SYSTEM TO DECIMAL
NUMBER BASE
 To convert from Any Other Base System to
Decimal Number System, you have to follow
just three steps:
 A) Determine the base value of source
Number System that you want to convert and
also determine the position of digits from first
digit’s position – 0, second digit’s position –
1 and so on.
 B) Multiply each digit with its corresponding
multiplication of position value and Base of
Source Number System’s Base.
1. BINARY TO DECIMAL
One more example
2. OCTAL TO DECIMAL
One more example
3. HEXADECIMAL TO DECIMAL
One more example
FORMULA TO LEARN

Binary Binary

Octal Decimal Octal

Hexadecimal Hexadecimal

Multiply Divide
OTHER BASE TO OTHER BASE

 1. Binary Number into Octal Number


System
 To convert any binary value into its
equivalent octal value, we have to follow
these two steps:-
 (a) First convert the given binary Number
into decimal Number.
 (b) Now, convert this decimal Number into
its equivalent octal Number.
BINARY TO OCTAL EXAMPLE
 Example − Convert binary number 10010110
into octal number.
 First convert this into decimal number

 = (10010110)2

 =1x27+0x26+0x25+1x24+0x23+1x22+1x21

 +0x20

 = 128+0+0+16+0+4+2+0

 = (150)10

 Then, convert it into octal number


 = (150)10
= 8 150 Remainder
 8 18 6
 8 2 2
 0 2
 = (226)8 which is answer.
ANOTHER METHOD (GROUPING METHOD)
 Since, there are only 8 digits (from 0 to 7) in
octal number system, so we can represent
any digit of octal number system using only
3 bits.
 So, if you make each group of 3 bit of binary
input number, then replace each group of
binary number from its equivalent octal
digits.
 That will be octal number of given number
number.
GROUPING METHOD

 So, these are following steps to convert a


binary number into octal number:-
 Take binary number

 Divide the binary digits into groups of


three starting from right.
 Convert each group of three binary digits
to one octal digit.
EXAMPLE

 Convert binary number 1010111100 into octal


number. Since there is no binary point here and
no fractional part. So,
 = (1010111100)2

 = (001 010 111 100)2

 = (1 2 7 4)8

 = (1274)8
ANOTHER EXAMPLE

 Convert binary number 0110011 into octal


number. So,
OTHER BASE TO OTHER BASE
 2. Binary to Hexadecimal Number System
 To convert any binary value into its
equivalent hexadecimal value, we have to
follow these two steps:-
 (a) First convert the given binary Number
into decimal Number.
 (b) Now, convert this decimal Number into
its equivalent hexadecimal Number.
BINARY TO HEXADECIMAL EXAMPLE

 Convert binary number 1101010 into


hexadecimal number.
 First convert this into decimal number:

 = (1101010)2

 = 1x26+1x25+0x24+1x23+0x22+1x21+0x20

 = 64+32+0+8+0+2+0

 = (106)10
 Then, convert it into hexadecimal number
 = (106)10
= 16 106 Remainders
 16 6 10
 0 6

 =(6 10)16 but we know that in hexadecimal 10=A


 = So, Answer will be (6A)16 .
ANOTHER METHOD (GROUPING METHOD)

 These are following steps to convert a


binary number into hexadecimal number:-
 Take binary number.

 Divide the binary digits into groups of four


digits starting from right.
 Convert each group of four binary digits to
one hexadecimal digit.
EXAMPLE-1

 Convert binary number 1010101101001 into


hexadecimal number.

 = (1010101101001)2
 = (1 0101 0110 1001)2

 = (0001 0101 0110 1001)2

 = (1 5 6 9)16

 = (1569)16
EXAMPLE-2
DECIMAL TO BASE N CONVERSION

 To convert from Decimal to a different number


base such as base 3, base 4 or base 5, we just
follow the same steps as followed for
converting from Decimal to binary,octal and
hexadecimal.
 Divide the decimal Number by the number
base until quotient is zero.
 Collect the remainders in reverse order.
DECIMAL TO BASE 3 NUMBER CONVERSION

 Convert (123)10 into base 3 number:-


 3 123 Remainders
 3 41 0
 3 13 2
 3 4 1
 3 1 1
 0 1
 Answer will be (123)10 = (11120)3
DECIMAL TO BASE 4 NUMBER CONVERSION

 Convert (123)10 into base 4 number:-


 4 123 Reminders
 4 30 3
 4 7 2
 4 1 3
 4 0 1
 Answer will be (123)10 =(1323)4
DECIMAL TO BASE 5 NUMBER CONVERSION

 Convert (123)10 into base 5 number:-


 5 123 Remainders
 5 24 3
 5 4 4
 5 0 4
 Answer will be (123)10 =(443)5
BASE 3 NUMBER TO DECIMAL CONVERSION

 Convert (1121)3 into decimal number


 =1x33 + 1x32 + 2x31 + 1x30

 =1x27 + 1x9 + 2x3 + 1x1

 27+9+6+1

 43

 Answer will be (1121)3 =(43)3

 In the same way, we can convert form base 4


and base 5 to decimal number system.
OCTAL TO BINARY CONVERSION

 In octal to binary conversion, there are same


methods to be followed. In which, we follow two
steps:-
 (a) In first step, we convert the given octal
number into its decimal number.
 (b) In second step, we convert decimal number
to its binary equivalent.
OCTAL TO BINARY CONVERSION

 Convert (456)8 into its binary equivalent.


 (a) First convert this into decimal number-

 =4x82+5x81+6x80

 =4x64+5x8+6x1

 =256+40+6

 =(302)10
 (b) Now convert decimal into its binary equivalent:-
 2 302 Remainders
 2 151 0
 2 75 1
 2 37 1
 2 18 1
 2 9 0
 2 4 1
 2 2 0
 2 1 0
 2 0 1
 Answer will be = (100101110)2
ANOTHER METHOD (DISTRIBUTION METHOD)

 In this method, we convert each digit of given


octal number into its individual binary
equivalent in 3 bits.
 Then, combine them all into one.

 And now, we get our binary equivalent of any


given octal number.
EXAMPLE-1

 Convert (456)8 into its binary number.


 = (4 5 6)8
 =(100 101 110)2

 =(100101110)2

 This is our final answer.


HEXADECIMAL TO BINARY CONVERSION

 In hexadecimal to binary conversion, there are


same methods to be followed. In which, we
follow two steps:-
 (a) In first step, we convert the given
hexadecimal number into its decimal number.
 (b) In second step, we convert this decimal
number into its binary equivalent.
 Convert (A6)16 into its binary equivalent.
 (a) First convert this into decimal number-

 =Ax161+6x160

 =10x16+6x1

 =160+6

 =(166)10
 (b) Now convert decimal into its binary equivalent:-
 2 166 Remainders
 2 83 0
 2 41 1
 2 20 1
 2 10 0
 2 5 0
 2 2 1
 2 1 0
 2 0 1
 Answer will be = (10100110)2
ANOTHER METHOD (DISTRIBUTION METHOD)

 In this method, we convert each digit of given


hexadecimal number into its individual binary
equivalent in 4 bits.
 Then, combine them all into one.

 And now, we get our binary equivalent of any


given hexadecimal number.
EXAMPLE

 Convert (A6)16 into its equivalent.


 = (10 6)16
 =(1010 0110)2

 =(10100110)2

 Our final answer is =(10100110)2


OCTAL TO HEXADECIMAL CONVERSION

 Octal to Hexadecimal Conversion can be


implemented in two various ways. In first ways
there are two following steps:-
 (a) First convert the octal number into its
decimal equivalent.
 (b) Then convert this intermediate decimal
number into its hexadecimal equivalent.
OCTAL TO HEXADECIMAL EXAMPLE

 Convert (123)8 into hexadecimal:-


 (a) First convert (123)8 into decimal
(b) Converted decimal number =(83)10
 16 83 Remainders
 16 5 3
 16 0 5

 So, the final answer will be = (53)16


ANOTHER METHOD

 In this method, there are again two steps:-


 (a) In first step, we convert the given octal
number into its binary equivalent using
distribution method.
 (b) In second step, we convert the binary value
into its hexadecimal number using grouping
method.
 Example- Convert (123)8 into hexadecimal
number.
 (a) (123)8

 (1 2 3)8
 (001 010 011)2
 (001010011)2
 = (001010011)2
 Using grouping method-

 (0000 0101 0011)2


 (0 5 3)16
 Answer will be= (53)16
HEXADECIMAL TO OCTAL CONVERSION

 Hexadecimal to Octal Conversion can be


implemented in two various ways. In first ways
there are two following steps:-
 (a) First convert the hexadecimal number into
its decimal equivalent.
 (b) Then convert this intermediate decimal
number into its octal equivalent.
EXAMPLE

 Convert (A52)16 into Octal number.


 (a) First we convert this hexadecimal number
into decimal number.
 =Ax162+5x161+2x160

 =10x256+5x16+2x1

 =2560+80+2

 =(2642)10
(b) In second step, we convert intermediate
decimal result (2652)10 into its octal number.
 8 2642 Remainders
 8 330 2
 8 41 2
 8 5 1
 8 0 5

 So, our answer will be =(5122)8


ANOTHER METHOD

 In this method, there are again two steps:-


 (a) In first step, we convert the given
hexadecimal number into its binary equivalent
using distribution method.
 (b) In second step, we convert the binary value
into its octal number using grouping method.
EXAMPLE

 Convert (A52)16 into Octal number.


 (a) In first step we convert the hexadecimal
number into binary number using distribution
method.
 = (A52)16

 = (10 5 2)16
 =(1010 0101 0010)2

 =(101001010010)2
 (b) In second step, we follow the grouping
method.
 As we know, octal value is made up of 3 binary
digit, so we make group of three digits from right
to left of intermediate binary value.
 =(101001010010)2

 =(101 001 010 010)2


 =( 5 1 2 2)8
 =(5122)8

 So, our final result is =(5122)8


FRACTIONAL NUMBERS

 Fractional numbers are those number which


contain a decimal(.) itself.
 It is divided into two parts: Integer part and
Fractional part.
 For example:- number is 123.2120

 Integer part of this number will be 123 and


fractional part will be .2120
BINARY TO DECIMAL FRACTIONAL CONVERSION

 To convert any binary fraction to Decimal


fraction, the following rules are followed:-
 (a) Write the binary number.

 (b) Multiply each digit of given number with


power of position.
 (c) Before the point, power will be in terms of
positive number and after the point power will
be in negative number.
EXAMPLE

 Convert (1011.011)2 into decimal fractional


value:
 =(1x23+0x22+1x21+1x20)+(0x2-1+1x2-2+1x2-3)

 =(8+0+2+1)+(0+1/4+1/8)

 =(11)+(0.25+0.125)

 =(11.375)10

 This is your answer.


ONE MORE EXAMPLE

 Convert (110.11)2 into decimal fractional value:


 =(1x22+1x21+0x20)+(1x2-1+1x2-2)

 =(4+2+0)+(1/2+1/4)

 =(6)+(0.50+0.25)

 =(6.75)10

 This is your answer.


DECIMAL TO BINARY FRACTIONAL CONVERSION

 To convert decimal fraction to binary fraction,


following rules are followed:-
 (a) Write decimal number.

 (b) Integer part is divided by 2 and remainders


are noted down from bottom to top.
 (c) The fractional part is multiplied by 2 until
fractional part becomes same or approximately
near to 0 then stop the process.
 (d) Merge the results of Integer and fractional
value and you will get your final answer.
EXAMPLE

 Convert (34.4)10 into binary number.


 First we convert (34) into its binary equivalent.
 Now, here we convert the fractional part.
ONE MORE EXAMPLE
 Note: Keep multiplying the fractional part with
2 until decimal part 0.00 is obtained.
 (0.25)10 = (0.01)2

 Answer: (10.25)10 = (1010.01)2


DECIMAL TO OCTAL FRACTIONAL CONVERSION

 To convert decimal fraction to octal fraction,


following rules are followed:-
 (a) Write decimal number.
 (b) Integer part is divided by 8 and remainders
are noted down from bottom to top.
 (c) The fractional part is multiplied by 8 until
fractional part becomes same or approximately
near to 0 then stop the process.
 (d) Merge the results of Integer and fractional
value and you will get your final answer.
EXAMPLE

 Convert (34.4)10 into octal number.


 First we convert (34) into its octal number.
 Now, here we convert the fractional part.
OCTAL TO DECIMAL FRACTIONAL CONVERSION

 To convert any octal fraction to Decimal


fraction, the following rules are followed:-
 (a) Write the octal number.

 (b) Multiply each digit of given number with


power of position.
 (c) Before the point, power will be in terms of
positive number and after the point power will
be in negative number.
EXAMPLE

 Convert octal number (7.12172)8 into decimal


form.
 = 7x80 + 1x8-1 + 2x8-2 + 1x8-3 + 7x8-4 +
2x8-5
 = 7 + 0.125 + 0.03125 + 0.001953125 +
0.001708984375 + 0.00006103515624
 = 10.1599...

 = (10.16)10 (approx. value)


ONE MORE EXAMPLE

 Convert ( 2 1 . 2 1)8 =( ? )10


 = (2 1 . 2 1)8

 = (2 x 81 + 1 x 80)+ (2 x 8-1 + 1 x 8-2)

 = (2 x 8 + 1 x 1) + (2 x ( 1 / 8 ) + 1 x ( 1 / 64 ))

 = (16 + 1) + ( 0. 2 5 ) + ( 0 . 0 1 5 6 2 5 )

 = 17 + 0. 265625

 = 17 . 265625

 Therefore (2 1 . 2 1)8 = ( 1 7 . 2 6 5 6 2 5 )10


DECIMAL TO HEXADECIMAL FRACTIONAL
CONVERSION
 To convert decimal fraction to Hexadecimal
fraction, following rules are followed:-
 (a) Write decimal number.
 (b) Integer part is divided by 16 and remainders
are noted down from bottom to top.
 (c) The fractional part is multiplied by 16 until
fractional part becomes same or approximately
near to 0 then stop the process.
 (d) Merge the results of Integer and fractional
value and you will get your final answer.
EXAMPLE
ONE MORE EXAMPLE
HEXADECIMAL TO DECIMAL FRACTIONAL
CONVERSION
 To convert any hexadecimal fraction to Decimal
fraction, the following rules are followed:-
 (a) Write the hexadecimal number.

 (b) Multiply each digit of given number with


power of position.
 (c) Before the point, power will be in terms of
positive number and after the point power will be
in negative number.
EXAMPLE
ONE MORE EXAMPLE

 Convert hexadecimal number (1F.01B)16 into


decimal number.
 Since value of Symbols: B and F are 11 and 15
respectively. Therefore equivalent decimal
number is,
 = (1 15 . 0 1 11)16

 = (1x161+15x160 +0x16-1+1x16-2+11x16-3)10

 = (31.0065918)10 which is answer.


BINARY TO OCTAL FRACTIONAL CONVERSION

 Binary to octal fractional Conversion is very


simple. We have to just follow these steps-
 (a) Take integer part and make grouping of 3
digits from right to left.
 (b) Take fractional part and make grouping of 3
digits from left to right.
 (c) Combine them with point.

 (d) Here is the answer.


EXAMPLE

 Convert binary number (0110 011.1011)2 into


octal number. Since there is binary point here
and fractional part. So,
 (0110 011.1011)2

 = (0 110 011 . 101 1)2

 = (110 011 . 101 100)2

 = (6 3 . 5 4)8

 = (63.54)8
OCTAL TO BINARY FRACTIONAL CONVERSION

 In octal to binary fractional Conversion, we


follow these steps-
 (a) Write octal number.

 (b) Write the binary equivalent of each digit in 3


bits either they are integer digits or fractional
digits.
 (c) Combine them with point.

 (d) Here is your answer.


EXAMPLE

 Convert(541.63)8 into binary number.


BINARY TO HEXADECIMAL FRACTIONAL
CONVERSION
 Binary to Hexadecimal fractional Conversion is
very simple. We have to just follow these steps-
 (a) Take integer part and make grouping of 4
digits from right to left.
 (b) Take fractional part and make grouping of 4
digits from left to right.
 (c) Combine them with point.

 (d) Here is the answer.


HEXADECIMAL TO BINARY FRACTIONAL
CONVERSION
 In hexadecimal to binary fractional Conversion,
we follow these steps-
 (a) Write hexadecimal number.

 (b) Write the binary equivalent of each digit in 4


bits either they are integer digits or fractional
digits.
 (c) Combine them with point.

 (d) Here is your answer.


EXAMPLE FOR BOTH CONVERSIONS
OCTAL TO HEXADECIMAL FRACTIONAL
CONVERSION
 In octal to hexadecimal fractional Conversion, we
have to follow these two steps-
 (a) In this step, we first convert the given octal
number into its equivalent fractional binary
number.
 (b) In second step, we convert fractional binary
number into its equivalent fractional
Hexadecimal number.
 (c) Here is your answer.
EXAMPLE
 Convert (635.175)8 into Hexadecimal-
HEXADECIMAL TO OCTAL FRACTIONAL
CONVERSION
 In Hexadecimal to octal fractional Conversion, we
have to follow these two steps-
 (a) In this step, we first convert the given
Hexadecimal number into its equivalent
fractional binary number.
 (b) In second step, we convert fractional binary
number into its equivalent fractional octal
number.
 (c) Here is your answer.
EXAMPLE

 Convert(08B.FCD)16 to octal number.


BINARY ARITHMETIC

 Addition, subtraction, multiplication and


division are the four types of operation on
which all the arithmetic operation depends of
decimal number system.
 These are the pillars of binary arithmetic also.

 The first and perhaps the most important of


them all is binary addition and it is the easiest
of them all also.
BINARY ADDITION

 Binary number system uses only two digits 0


and 1 due to which their addition is simple.
 There are four basic operations for binary
addition, as mentioned .
EXAMPLE-1

 Let us consider the addition of 11101 and


11011.
EXAMPLE-2

 Add 0011010 and 001100


BINARY SUBTRACTION

 Subtraction and Borrow, these two words will


be used very frequently for the binary
subtraction.
 There are four rules of binary subtraction.
EXAMPLE-1

 Consider the following example


 Subtract 1010 from 1100.
 The above subtraction is carried out through the
following steps.
0–0=0
 For 0 – 1 = 1, taking borrow 1 and then 10 – 1 =
1
 For 1 – 0 , since 1 has already been given, it
becomes 0 – 0 = 0
1–1=0
 Therefore the result is 0010.
EXAMPLE-2

 Subtract (101110) from (11100101)


BINARY MULTIPLICATION
 Binary multiplication is similar to decimal
multiplication.
 It is simpler than decimal multiplication
because only 0s and 1s are involved.
 There are four rules of binary multiplication.
EXAMPLE-1
 Multiply binary value 1001 by binary 101.
EXAMPLE-2
 Multiply binary value 1011 by binary 1101.
BINARY DIVISION

 The binary division is much easier than the


decimal division when you remember the
following division rules. The main rules of the
binary division include:
 1÷1 = 1

 1÷0 = 0

 0÷1 = Meaningless

 0÷0 = Meaningless
EXAMPLE-1

 Solve the following binary calculation: 101101


÷ 101
EXAMPLE-2

 Divide 11010 from 101


COMPLIMENTS

 Compliments are used in digital computers to


simplify the subtraction and for logical
manipulations.
 There are two categories of compliments:-

 (a) the radix (r's) compliment

 (b) the diminished radix (r-1)'s compliment

 When value of r is substituted, two types of


compliments are received for binary and
 To be continued...
 two types of compliments are received for
decimal numbers.
 The two binary compliments are 2's
compliments and 1's compliments.
 And the two decimal compliments are 10's
compliments and 9's compliments.
BINARY SYSTEM COMPLEMENTS

 1's complement
 The 1's complement of a number is found by
changing all 1's to 0's and all 0's to 1's.
 Example of 1's Complement is as follows:-
BINARY SYSTEM COMPLIMENTS

 2's complement
 The 2's complement of binary number is
obtained by adding 1 to the Least Significant
Bit (LSB) of 1's complement of the number.
 2's complement = 1's complement + 1

 To be continued.....
DECIMAL SYSTEM COMPLIMENTS
 9's Compliments
 The 9's complement of a number is calculated
by subtracting each digit of the number by 9.
DECIMAL SYSTEM COMPLIMENTS
 The 10's complement
 The 10's compliment of a number is calculated
by subtracting each digit by 9 and then adding
1 to the result.
 Simply, by adding 1 to its 9's complement we
can get its 10's complement value.
SUBTRACTION USING 9'S COMPLIMENT

 With the help of the 9's complement, the


process of subtraction is done in a much easier
way.
 For subtraction, we first have to find the 9's
complement of the subtrahend and then we
will add this complement value with the
minuend.
 There are two possible cases when we subtract
the numbers using 9's complement.
CASE 1: WHEN THE SUBTRAHEND IS SMALLER
THAN THE MINUEND.
 For subtracting the smaller number from the
larger number using 9's complement, we will
find the 9's complement of the subtrahend,
and then we will add this complement value
with the minuend.
 By adding both these values, the result will
come in the formation of carry.
 At last, we will add this carry to the result
obtained previously.
EXAMPLE-1
EXAMPLE-2
CASE 2: WHEN THE SUBTRAHEND IS GREATER
THAN THE MINUEND.
 In this case, when we add the complement
value and the minuend, the result will not come
in the formation of carry.
 This indicates that the number is negative, and
for finding the final result, we need to find the
9's complement of the result.
EXAMPLE-1
EXAMPLE-2
10'S COMPLIMENT

 The 10's complement is also used to find the


subtraction of the decimal numbers.
 The 10's complement of a number is calculated
by subtracting each digit by 9 and then adding
1 to the result.
 Simply, by adding 1 to its 9's complement we
can get its 10's complement value.
EXAMPLE
SUBTRACTION USING 10'S COMPLIMENT

 For subtracting two numbers using 10's


complement, we first have to find the 10's
complement of the subtrahend and then we
will add this complement value with the
minuend.
 There are two possible cases when we subtract
the numbers using 10's complement.
CASE 1: WHEN THE SUBTRAHEND IS SMALLER
THAN THE MINUEND.
 For subtracting subtraction using 10's
complement, we will find the 10's complement
of the subtrahend and then we will add this
complement value with the minuend.
 By adding both these values, the result will
come in the formation of carry.
 We ignore this carry and the remaining digits
will be the answer.
EXAMPLE -1
EXAMPLE-2
CASE 2: WHEN THE SUBTRAHEND IS GREATER
THAN THE MINUEND.
 In this case, when we add the complement
value and the minuend, the result will not come
in the formation of carry.
 This indicates that the number is negative and
for finding the final result,
 we need to find the 10's complement of the
result obtained by adding complement value of
subtrahend and minuend.
EXAMPLE -1
EXAMPLE-2
INTRODUCTION OF BITS, BYTES & MORE

 Bit:- The bit is a basic unit of information in


computing and digital communications.
 The bit represents a logical state with one of
two possible values commonly represented as
either 1 or 0.
 But other representations such as true/false,
yes/no, or on/off are common.
CONVERSION TABLE OF BITS/BYTES

 1 Nibble = 4 bits
LOGIC GATES

 The logic gates are the basic building blocks of


a digital system.
 Logic Gates are a block of hardware that
produces signals of binary 1 or 0 when input
logic requirements are satisfied.
 The seven basic logic gates includes: AND, OR,
XOR, NOT, NAND, NOR, and XNOR.
 AND, OR, NOT gate are also known as universal
gates.
 The relationship between input output binary
variables for each gate can be represented in a
tabular form by a truth table.
 Each gate has one or two binary input variables
designated by A and B and one binary output
variable designated by x.
AND GATE

 The AND gate is an electronic circuit which


gives a high output only if all its inputs are high.
 The AND operation is represented by a dot (.)
sign.
OR GATE

 The OR gate is an electronic circuit which gives


a high output if one or more of its inputs are
high.
 The operation performed by an OR gate is
represented by a plus (+) sign.
NOT GATE

 The NOT gate is an electronic circuit which


produces an inverted version of the input at its
output.
 It is also known as an Inverter.
NAND GATE:

 The NOT-AND (NAND) gate which is equal to an


AND gate followed by a NOT gate.
 The NAND gate gives a high output if any of the
inputs are low.
 The NAND gate is represented by a AND gate
with a small circle on the output.
 The small circle represents inversion.
NOR GATE

 The NOT-OR (NOR) gate which is equal to an OR


gate followed by a NOT gate.
 The NOR gate gives a low output if any of the
inputs are high.
 The NOR gate is represented by an OR gate
with a small circle on the output.
 The small circle represents inversion.
EXCLUSIVE-OR/ XOR GATE:

 The 'Exclusive-OR' gate is a circuit which will


give a high output if one of its inputs is high but
not both of them.
 The XOR operation is represented by an
encircled plus sign.
EXCLUSIVE-NOR/XNOR GATE

 The 'Exclusive-NOR' gate is a circuit that does


the inverse operation to the XOR gate.
 It will give a low output if one of its inputs is
high but not both of them.
 The small circle represents inversion.
FLIP FLOP

 A flip flop is an electronic circuit with two stable


states that can be used to store binary data.
 The stored data can be changed by applying
varying inputs.
 Flip-flops are the fundamental building blocks
of digital electronics systems used in
computers, communications, and many other
types of systems.
ENCODER

 An encoder is a combinational circuit that


converts binary information in the form of a
2^N input lines into N output lines, which
represent N bit code for the input.
 Encoders are used to translate linear motion
into a digital signal.
 Usually this is for the purpose of monitoring or
controlling motion parameters such as speed,
rate, direction, distance or position.
BLOCK DIAGRAM OF ENCODER
DECODER

 A decoder is a combinational circuit that


changes a code into a set of signals.
 It is called a decoder because it does the
reverse of encoder.
 Decoder circuit that has ‘n’ input lines and
maximum of 2n output lines.
BLOCK DIAGRAM OF DECODER
MULTIPLEXER
 Multiplexer is a combinational circuit that has
maximum of 2^n data inputs, ‘n’ selection lines
and single output line.
 One of these data inputs will be connected to the
output based on the values of selection lines.
 Since there are ‘n’ selection lines, there will be
2^n possible combinations of zeros and ones.
 So, each combination will select only one data
input. Multiplexer is also called as Mux.
BLOCK DIAGRAM OF MULTIPLEXER
DEMULTIPLEXER

 A De-multiplexer (De-Mux) can be described as


a combinational circuit that performs the
reverse operation of a Multiplexer.
 A De-multiplexer has a single input, 'n' selection
lines and a maximum of 2^n outputs.
BLOCK DIAGRAM OF DEMULTIPLEXER
COUNTER

 Counter is a sequential circuit.


 A digital circuit which is used for a counting
pulses is known counter.
 Counter is the widest application of flip-flops.

 It is a group of flip-flops with a clock signal


applied.
BUS
 In computer architecture, a bus is a
communication system which
transfers data between components inside
a computer.
 A bus is a set of physical connections which
can be shared by multiple h/w components to
communicate.
 The purpose of buses is to reduce the number
of pathways needed for communication
between the components.
BUS ARCHITECTURE
TYPES OF BUS

 There are generally three types of bus in


computer architecture, which are as follows-
 1. Data bus

 2. Control bus

 3. Address bus
1. DATA BUS

 Data bus transfers the instructions coming


from or going to the processor.
 It is a bidirectional bus.

 The data is transferred between peripherals,


memory and the CPU.
2. CONTROL BUS

 It is also called as Command Bus which is used


to send out signals to coordinate and manage
the activities of the components.
 It transports orders and synchronisation signals
coming from control unit and travelling to all
other h/w components.
 It is a bidirectional bus.


3. ADDRESS BUS
 Sometimes also known as Memory Bus.
 It transports memory addresses which the
processor wants to access in order to read or
write data.
 It is unidirectional bus.
 It stores the information about where the data is
to be transferred.
 The components pass memory addresses to one
another over the address bus.
CHARACTERISTICS OF A SYSTEM BUS

 1. Bus Width
 The size of a bus also known as its width.

 The term width is referred as no. of bits that a


bus can transmit at once.
 This amount, expressed in bits, corresponds to
the number of physical lines over which data is
sent simultaneously.
CHARACTERISTICS OF A SYSTEM BUS

 2. Bus Speed
 The bus speed is also defined by its frequency.

 The no. of data packets sent or received per


second.
 Each time that data is sent and received is
called a cycle.
HOW TO CALCULATE BUS SPEED
 It is possible to find the maximum transfer
speed of the bus.
 For this we have to multiply amount of data
transferred per unit time by its width.
 A bus with a width of 16 bits and a frequency of
133 Mhz, therefore transfer speed is equal to:-
 16*133*106=2128*106 bits/s

 Or 2128*106/8=266*106 bytes/s

 Or 266*106/1000=266*103 KB/s

 Or 266*103/1000=266 MB/s
PRIMARY BUSES WITHIN A COMPUTER

 There are generally two buses within a computer-


 1. Internal Bus- It is also known as front side bus.

 This bus allows the processor to communicate


with the system’s central memory(RAM).
 2. Expansion Bus- This bus is also known as
input/output bus.
 This bus allows motherboard components (USB,
hard drives, ports, etc.) to communicate with one
another.
CHIPSET

 In a computer system, a chipset is a set of


electronic components in an integrated circuit
known as a "Data Flow Management System".
 This DFDM manages the data flow between the
processor, memory and peripherals.
 It is usually found on the motherboard.
COMPONENTS OF CHIPSET
 Chipset has generally two main components-
 1. North Bridge- Also called as Memory
Controller.
 It controls the data transfers between processor
and RAM.
 It is located near to processor.
 Sometimes called as Graphic and Memory
Controller Hub.
 to be continued....
COMPONENTS OF CHIPSET

 2. South Bridge- Also called as input/output


controller or expansion controller.
 It handles communications between
peripherals devices.
 It is also known as input/output controller hub.
CHIPSET
BUS ARBITRATION

 Bus Arbitration is defined as a process by which


the requesting processor may be granted the
access to the bus.
 Bus arbitration is a process by which next
device becomes the bus controller by
transferring bus mastership to another bus.
 OR

 Arbitration is process in which more than one


device is controlling the bus and only one
device can control bus at a time.
TYPES OF BUS ARBITRATION

 There are two approaches to bus arbitration:


 1. Centralized Arbitration

 a. Daisy chaining

 b. Polling method (Rotating Priority Method)

 c. Independent request

 2. Distributed Arbitration
1. CENTRALIZED BUS ARBITRATION

 In centralized bus arbitration, a single bus


arbiter performs the required arbitration.
 There are three different arbitration schemes
that use the centralized bus arbitration
approach. There schemes are:
 a. Daisy chaining

 b. Polling method

 c. Independent request
(A) DAISY CHAINING

 It is simple and cheaper method.


 All masters make use of the same line for bus
request.
 In response to the bus request, the controller
sends a bus grant if the bus is free.
 The bus grant signal serially propagates
through each master until it encounters the
first one that is requesting access to the bus.
 This master blocks the propagation of the bus
grant signal, activates the busy line and gains
control of the bus.
 Therefore any other requesting module will not
receive the grant signal and hence cannot get
the bus access.
 If one device fails then entire system will stop
working.
Daisy Chaining
(B) POLLING/ROTATING PRIORITY METHOD

 In this method, the devices are assigned


unique priorities and complete to access the
bus.
 But the priorities are dynamically changed to
give every device an opportunity to access the
bus.
 The method is also quite simple.
 If one device fails then entire system will not
stop working.
(C) INDEPENDENT REQUEST

 In this scheme, each master has a separate


pair of bus request and bus grant lines and
each pair has a priority assigned to it.
 The built in priority decoder within the
controller selects the highest priority request
and provide the corresponding bus grant signal.
Independent Request
2. DISTRIBUTED ARBITRATION

 In this scheme, all devices can claim for bus.


 Each bus arbiter has a bus request output line
and bus acknowledgement input line.
 The bus request output line works as an input
for priority encoder and generates 2 bit code.
 This code represents the priority of requesting
bus.
REGISTER
 Register is a very fast computer memory, used
to store data/instruction in-execution.
 A register is a group of flip-flops with each flip-
flop capable of storing 1 bit of information.
 An n bit register has a group of n flip-flops and
is capable of storing binary information of n
bits.
 The flip-flops hold the binary information and
gates control when and how new information is
transferred into a register.
TYPES OF REGISTERS
 Following are some commonly used registers:
 Accumulator: This is the most common register,
used to store data taken out from the memory.
 General Purpose Registers: This is used to store
data intermediate results during program
execution.
 Special Purpose Registers: Users do not access
these registers. These registers are for Computer
system-
To be continued…..
 MAR: Memory Address Register are those registers
that holds the address for memory unit.
 MBR: Memory Buffer Register stores instruction
and data received from the memory and sent from
the memory.
 PC: Program Counter points to the next instruction
to be executed.
 IR: Instruction Register holds the instruction to be
executed.
REGISTER TRANSFER LANGUAGE
 The symbolic notation which are used to
describe the micro-operation transfers amongst
registers is called Register transfer language.
 The operations executed on data which is
stored in registers are called micro operations.
Ex:- Shift, Clear, Load etc.
 This language is a procedure for writing
symbols to specify a given computational
process.
REGISTER TRANSFER
 Information transferred from one register to
another is designated in symbolic form by
means of replacement operator.
 R2 ← R1
 It denotes the transfer of content of register R1
into register R2. Content of source register R1
doesn't change after this transfer.
 Normally we want the transfer to occur only in
predetermined control condition.
 This can be shown by following if-
then statement: if (P=1) then (R2 ← R1).
 P is a control signal generated in the control
section.
 A control signal is a Boolean variable that is
equal to 1 or 0.
 The control signal is shown as:
P: R2 ← R1
 The control condition is terminated with a colon.
It shows that transfer operation can be executed
only if P=1.
BUS TRANSFER
 A digital system composed of many registers, and
paths must be provided to transfer information from
one register to another register.
 A bus structure is more efficient for transferring
information between registers in a multi-register
configuration system.
 A bus consists of a set of common lines, one for
each bit of register, through which binary
information is transferred one at a time.
 Control signals determine which register is selected
by the bus during a particular register transfer.
 The following block diagram shows a Bus system
for four registers.
 It is constructed with the help of four 4 * 1
Multiplexers each having four data inputs (0
through 3) and two selection inputs (S1 and S2).
 We have used labels to make it more convenient
for you to understand the input-output
configuration of a Bus system for four registers.
WORKING
 The two selection lines S1 and S2 are
connected to the selection inputs of all four
multiplexers.
 The selection lines choose the four bits of one
register and transfer them into the four-line
common bus.
 When both of the select lines are at low logic,
i.e. S1S0 = 00, the 0 data inputs of all four
multiplexers are selected and applied to the
outputs that forms the bus.
 This, in turn, causes the bus lines to receive the
content of register A since the outputs of this
register are connected to the 0 data inputs of
the multiplexers.
 Similarly, when S1S0 = 01, register B is
selected, and the bus lines will receive the
content provided by register B.
FUNCTION TABLE SHOWS THE SELECTED
REGISTER
MEMORY TRANSFER
 Memory transfer means reading data from
memory or writing data into memory.
 In memory transfer, there are mainly two types of
operations are performed-
 1. Read Operation
 2. Write Operation
 The transfer of information from a memory unit
to the user end is called a Read operation.
 The transfer of new information to be stored in
the memory is called a Write operation.
 A memory word is designated by the letter M.
1. MEMORY READ (READ OPERATION)

 The address register is designated by AR and


the data register by DR.
 Thus, a read operation can be stated as:

Read: DR ← M [AR]
 The Read statement causes a transfer of
information into the data register (DR) from the
memory word (M) selected by the address
register (AR).
2. MEMORY WRITE (WRITE OPERATION)

 The corresponding write operation can be


stated as:
Write: M [AR] ← R1
 The Write statement causes a transfer of
information from register R1 into the memory
word (M) selected by address register (AR).
PROCESSOR/CPU

 The part of computer that performs data


processing operations is called CPU or
Processor.
 CPU is made up of three major parts:

 1. Memory Unit(Registers), 2. Control Unit, 3.


Arithmetic and logic unit.
PROCESSOR/CPU ORGANISATION

 Most of the computers fall into one of three


types of CPU organisation:
 1. Single Accumulator Organisation

 2. General Register Organisation

 3. Stack Organisation
1. SINGLE ACCUMULATOR ORGANISATION

 Accumulator based CPU consists of the


following units:
 1. Data Processing Unit

 2. Program Control Unit

 3. Memory and Input/Output Interface

 To be continued.....
1. DATA PROCESSING UNIT

 This is the unit where data is processed to get


the output i.e; some results.
 This unit can be subdivided into two major
parts:
 (a) Arithmetic Logic Unit (ALU)

 (b) Accumulator (AC)

 To be continued.....
(A) ARITHMETIC LOGIC UNIT (ALU)

 This unit performs all arithmetic and logical


operations.
 The necessary data is supplied by the AC and
other registers.
 It performs the required operation on the
operands contained in the instructions.
 The result of all operations are stored back in
AC.
(B) ACCUMULATOR (AC)
 This is the main register of ALU.
 The data is first loaded in AC before it is
transferred to ALU for any operation.
 In performing these operations, operand is held
in AC.
 After operation, result is again stored in AC.
 AC is also referred as Primary Register.
 It is one of the most complicated register bcoz it
serves as a processor register.
2. PROGRAM CONTROL UNIT
 This is the subsystem of CPU which helps in
making various parts of CPU to work in a proper
sequence.
 It controls various parts of CPU.
 It also controls the movement of data within CPU
registers, I/O devices and memory.
 This unit basically consists of three parts:
 (a) Program Counter, (b) Instruction Register
 (c) Control Circuits
(A) PROGRAM COUNTER

 It’s a type of CPU register which is used to store


address of next instruction which is to be
executed.
 This register goes through a counting sequence
and causes the computer to read sequential
instructions previously stored in memory.
(B) INSTRUCTION REGISTER

 This register is one of the high speed registers


under PC unit of CPU.
 It holds the opcode (operation code) of the
current instruction.
 Opcode of an instruction is a group of bits that
define such operations such as add, subtract,
multiply, division, shift, complement etc.
(C) CONTROL CIRCUITS

 Most important part of Program Control Unit.


 It is responsible for all most every operation
that takes place in CPU.
 These circuits provide the necessary control
signals for fetching instructions decoding the
opcode.
 In most of the cases the output of the
instruction register is given to these circuits.
3. MEMORY AND I/O INTERFACE UNIT

 I/O devices and Memory are connected


together to combine this unit.
 This unit consists of:

 (a) Data Register

 (b) Address Register

 To be continued.....
(A) DATA REGISTER (DR)

 This register acts as a buffer between CPU and


Main Memory.
 It is used as input register to store an operand
during the execution of an instruction.
(B) ADDRESS REGISTER (MAR)

 This register contains the address of present


instruction which is obtained from Program
Control Unit.
 In most of the cases, the address is contained
in the memory, hence it is also known as
Memory Address Register.
2. GENERAL REGISTER ORGANIZATION
 Generally CPU has seven general registers.
 Register organization shows how registers are
selected and how data flow between register and
ALU.
 A decoder is used to select a particular register.
 The output of each register is connected to two
multiplexers to form the two buses A and B.
 The selection lines in each multiplexer select the
input data for the particular bus.
2. GENERAL REGISTER ORGANIZATION
 The A and B buses form the two inputs of an ALU.
 The operation select lines decide the micro
operation to be performed by ALU.
 The result of the micro operation is available at the
output bus.
 The output bus connected to the inputs of all
registers.
 Thus by selecting a destination register, it is
possible to store the result in it.
 EXAMPLE:
 To perform the operation R3 = R1+R2 We
have to provide following binary selection
variable to the select inputs.

 1. MUX A Selector (SEL A : 001) -To place the


contents of R1 into bus A.
 2. MUX B Selector (SEL B : 010) - to place the
contents of R2 into bus B
 3. ALU operation Selector (SEL OPR : 00010) –
to perform the arithmetic addition.
 4. Decoder destination Selector (SEL D : 011) –
to place the result available on output bus in R3.
 The data from the two source registers
propagates into multiplexers and then to ALU
as output during one clock cycle interval.
 Then, when the next clock termination occurs,
the binary information from output bus is
transferred into destination register R3.
CONTROL WORD

 The combined value of a binary selection


inputs specifies the control word.
 It consist of four fields SELA, SELB and SELD or
SELREG, contains three bit each and SELOPR
field contains five bits.
 Thus the total bits in the control word are 14-
bits.
CONTROL WORD

 1. The three bit of SELA select a source


registers of the a input of the ALU.
 2. The three bits of SELB select a source
registers of the b input of the ALU.
 3. The three bits of SELD or SELREG select a
destination register using the decoder.
 4. The five bits of SELOPR select the operation
to be performed by ALU.
Control word for R2=R1+R3

001 011 010 00010


STACK ORGANIZATION

 A useful feature that is included in the CPU of


most computers is a stack or last-in, first-out
(LIFO) list.
 A stack is a storage device that stores
information in such a manner that the item
stored last is the first item retrieved.
 The stack in digital computers is essentially a
memory unit with an address register that can
count only.
 The register that holds the address for the
stack is called a stack pointer (SP) because its
value always points at the top item in the stack.
 The two operations of a stack are the
insertion(push) and deletion(pop) of items.
 These operations are simulated by
incrementing or decrementing the stack pointer
register.
1. REGISTER STACK
 A stack can be placed in a portion of a large
memory or it can be organized as a collection of
a finite number of memory words or registers.
 Following figure shows the organization of a 64-
word register stack.
 The stack pointer register SP contains a binary
number whose value is equal to the address of
the word that is currently on top of the stack.
 Three items are placed in the stack: A, B, and C,
in that order.
 Item C is on top of the stack so that the content
of SP is now 3.
THE PUSH OPERATION
 The push operation is implemented with the
following sequence of micro operations;

 SP ← SP + 1 Increment stack pointer


 M[SP] ← DR Write item on top of the stack
 If (SP = 0) then (FULL ←1) Check if stack is full
 EMPTY ← 0 Mark the stack not empty
THE POP OPERATION

 The pop operation consists of the following


sequence of microoperations:
 DR ← M[SP] Read item from the top of stack
 SP ← SP - 1 Decrement stack pointer
 If (SP = 0) then (EMPTY ← 1) Check if stack is
empty
 FULL ← 0 Mark the stack not full
2. MEMORY STACK

 A stack can also be implemented in a random-


access memory attached to a CPU.
 The implementation of a stack in the CPU is
done by assigning a portion of memory to a
stack operation and using a processor register
as a stack pointer.
 Figure shows a portion of computer memory
partitioned into three segments: program, data,
and stack.
 The program counter PC points at the address
of the next instruction in the program.
 The address register AR points at an array of
data.
 The stack pointer SP points at the top of the
stack.
 The three registers are connected to a common
address bus, and either one can provide an
address for memory.
 SP is used to push or pop items into or the
stack. The initial value of SP is 4001 and the
stack grows with decreasing addresses.
 Thus the first item stored in the stack is at
address 4000, the second item is stored at
address 3999, and the last address that can
be used for the stack Is 3000.

to be continued……
 We assume that the items in the stack
communicate with a data register DR .
 A new item is inserted with the push operation
as follows:
 SP ← SP - 1

 M[SP] ← DR
 The stack pointer is decremented so that it
points at the address of the next word.
 A memory write operation inserts the word from
DR into the top of the stack. A new item is
deleted with a pop operation as follows:
 DR ← M[SP]

 SP ← SP + 1
3. REVERSE POLISH NOTATION
 Reverse Polish Notation is a way of expressing
arithmetic expressions that avoids the use of
brackets to define priorities for evaluation of
operators.
 Arithmetic Expression:- A+B

 A+B- Infix Notation

 +AB- Prefix Notation

 AB+ - Postfix Notation

 Postfix Notation is called as Reverse Polish


Notation.
 In ordinary notation, one might write
(3 + 5) * (7 – 2)
 and the brackets tell us that we have to add 3 to 5,
then subtract 2 from 7, and multiply the two results
together.
 In RPN, the numbers and operators are listed one
after another and an operator always acts on the most
recent numbers in the list.
 The most recent number goes on the top of the stack.
An operator takes the appropriate number of
arguments from the top of the stack and replaces
them by the result of the operation.
 In this notation the above expression would be
35+72–*
Reading from left to right, this is interpreted as
follows:

 Push 3 onto the stack.


 Push 5 onto the stack. Reading from the top, the
stack now contains (5, 3).
 Apply the + operation: take the top two numbers
off the stack, add them together, and put the
result back on the stack.
 The stack now contains just the number 8.
 Push 7 onto the stack.
 Push 2 onto the stack. It now contains (2, 7, 8).

 Apply the – operation: take the top two


numbers off the stack, subtract the top one
from the one below, and put the result back on
the stack. The stack now contains (5, 8).
 Apply the * operation: take the top two
numbers off the stack, multiply them together,
and put the result back on the stack. The stack
now contains just the number 40.
INSTRUCTION

 Computer instructions are a set of machine


language instructions that a particular
processor understands and executes.
 A computer performs tasks on the basis of the
instruction provided.
 An instruction comprises of groups called
fields. These fields include:
FIELDS OF INSTRUCTION
 These fields include:
 The Operation code (Opcode) field which
specifies the operation to be performed.
 The Address field which contains the location of
the operand, i.e., register or memory location.
 The Mode field which specifies how the
operand will be located.
ADDRESSING MODES

 The different ways of specifying the location of


an operand in an instruction are called as
addressing modes.
 OR

 Addressing mode is the way by which you get to


know that how you are accessing the operands
in your instructions.
TYPES OF ADDRESSING MODES
 Implied / Implicit Addressing Mode
 Stack Addressing Mode

 Immediate Addressing Mode

 Direct Addressing Mode

 Indirect Addressing Mode

 Register Direct Addressing Mode

 Register Indirect Addressing Mode

 Relative Addressing Mode

 Indexed Addressing Mode

 Base Register Addressing Mode


1. IMPLIED ADDRESSING MODE-

 In this addressing mode, the definition of the


instruction itself specify the operands implicitly.
 It is also called as implicit addressing mode.

 Examples-

 The instruction “Complement Accumulator” is


an implied mode instruction.
 In a stack organized computer, Zero Address
Instructions are implied mode instructions.
2. STACK ADDRESSING MODE-
 In this addressing mode, the operand is
contained at the top of the stack.
 Example-

 ADD

 This instruction simply pops out two symbols


contained at the top of the stack.
 The addition of those two operands is
performed.
 The result so obtained after addition is pushed
again at the top of the stack.
3. IMMEDIATE ADDRESSING MODE-

 In this addressing mode, the operand is


specified in the instruction explicitly.
 Instead of address field, an operand field is
present that contains the operand.
 Examples-

 ADD 10 will increment the value stored in the


accumulator by 10.
4. DIRECT ADDRESSING MODE-
 In this addressing mode, the address field of
the instruction contains the effective address
of the operand.
 Only one reference to memory is required to
fetch the operand.
 Example-

 ADD X will increment the value stored in the


accumulator by the value stored at memory
location X.
 AC ← AC + [X]
5. INDIRECT ADDRESSING MODE-
 In this addressing mode, the address field of
the instruction specifies the address of
memory location that contains the effective
address of the operand.
 Two references to memory are required to fetch
the operand.
 Example-

 ADD X will increment the value stored in the


accumulator by the value stored at memory
location specified by X.
6. REGISTER DIRECT ADDRESSING MODE-

 In this addressing mode, the operand is


contained in a register set.
 The address field of the instruction refers to a
CPU register that contains the operand.
 Example-

 ADD R will increment the value stored in the


accumulator by the content of register R.
 AC ← AC + [R]
7. REGISTER INDIRECT ADDRESSING MODE-

 In this addressing mode, the address field of


the instruction refers to a CPU register that
contains the effective address of the operand.

 Example-
 ADD R will increment the value stored in the
accumulator by the content of memory location
specified in register R.
 AC ← AC + [[R]]
8. RELATIVE ADDRESSING MODE-

 In this addressing mode, Effective address of


the operand is obtained by adding the content
of program counter with the address part of the
instruction.

 Effective Address
 = Content of Program Counter + Address part
of the instruction
9. INDEXED ADDRESSING MODE-

 In this addressing mode, Effective address of


the operand is obtained by adding the content
of index register with the address part of the
instruction.

 Effective Address
 = Content of Index Register + Address part of
the instruction
10. BASE REGISTER ADDRESSING MODE

 In this addressing mode,


 Effective address of the operand is obtained by
adding the content of base register with the
address part of the instruction.

 Effective Address
 = Content of Base Register + Address part of
the instruction

You might also like