1 computer architecture (lecture) by baljinder singh assistant professor (cse/it) beant college of...

57
1 COMPUTER ARCHITECTURE COMPUTER ARCHITECTURE (LECTURE) (LECTURE) By Baljinder Singh Baljinder Singh Assistant Professor (CSE/IT) Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Beant College of Engg. & Technology, Gurdaspur Gurdaspur

Upload: joleen-martin

Post on 25-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

1

COMPUTER ARCHITECTURECOMPUTER ARCHITECTURE

(LECTURE)(LECTURE)

By

Baljinder SinghBaljinder SinghAssistant Professor (CSE/IT)Assistant Professor (CSE/IT)

Beant College of Engg. & Technology, GurdaspurBeant College of Engg. & Technology, Gurdaspur

Page 2: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

2

CONTENTSCONTENTS

Principles of computer design.

Software hardware interaction.

Cost benefit concept of layers in architecture design.

Introduction to 8085.

Number System.

Binary Arithmetic.

Carry look ahead adder.

Page 3: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

3

Digital ComputerDigital Computer Digital Computer:- Digital Computer:- The digital computer is a digital The digital computer is a digital

system that performs various computational tasks. system that performs various computational tasks. The digital means that having two discrete values i.e The digital means that having two discrete values i.e 0 & 1, HIGH & LOW, TRUE& FALSE, ON & OFF.0 & 1, HIGH & LOW, TRUE& FALSE, ON & OFF.

so digital computer uses the binary no. system , so digital computer uses the binary no. system , which has two digits: 0 and 1.which has two digits: 0 and 1.

0 0

1 Bit 1 Bit

So information is represented in So information is represented in digital computers in groups of bits. To represents digital computers in groups of bits. To represents various letters, digits & special symbol we use various letters, digits & special symbol we use various coding schemes.various coding schemes.

Page 4: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

4

Digital Signal Digital Signal

Page 5: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

5

Basics Computer OrganizationBasics Computer Organization

Page 6: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

6

Conttd…Conttd… A computer system is subdivided into two functional

entities:1. Hardware

2. Software The H/W of the computer consists

of all the electronics components and electromechanical devices.

Computer S/W consists of the instructions and data that the computer manipulates to perform various data processing tasks. A sequence of instructions for the computer is called a program. The s/w various categories:

1. Application software 2. System software 3. Utilities software

Page 7: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

7

Conttd….Conttd…. The H/W of computer divided into three major parts:The H/W of computer divided into three major parts:

CPU:- CPU:- The central processing unit contains an arithmetic and The central processing unit contains an arithmetic and logic unit for manipulating data, a no. of registers for storing logic unit for manipulating data, a no. of registers for storing data , and controls circuits for fetching and executing data , and controls circuits for fetching and executing instructions. instructions.

Memory:- Memory:- The memory of computer contains storage for The memory of computer contains storage for instruction s and data. It is called RAM. It divide into two instruction s and data. It is called RAM. It divide into two parts : 1) Primary 2) Secondary.parts : 1) Primary 2) Secondary.

IOP:- IOP:- The input and output processors (IOP) contains The input and output processors (IOP) contains electronics circuits for communicating & controlling the electronics circuits for communicating & controlling the transfer of information between the computer and console transfer of information between the computer and console world world

Page 8: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

8

Conttd…Conttd…

Fig:- Block Diagram of digital computerFig:- Block Diagram of digital computer

Page 9: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

9

Conttd….Conttd…. Computer Organization:- Computer Organization:- Computer Organization is Computer Organization is

concerned with the way the hardware components operate and concerned with the way the hardware components operate and the way they are connected together to form the computer the way they are connected together to form the computer system system

Computer Design:- Computer Design:- Computer design is concerned with the Computer design is concerned with the h/w design of computer. Once the computer specification are h/w design of computer. Once the computer specification are formulated, it is the task of the designer to develop the formulated, it is the task of the designer to develop the hardware for the system. It means what hardware should be hardware for the system. It means what hardware should be used and how the parts are connected together.used and how the parts are connected together.

Computer Architecture:- Computer Architecture:- Computer architecture is Computer architecture is concerned with the structure and behavior of the computer as concerned with the structure and behavior of the computer as seen by the user. It includes the information, formats, the seen by the user. It includes the information, formats, the instruction set, and techniques for addressing memory. It also instruction set, and techniques for addressing memory. It also concerned with various functional modules, such as processors concerned with various functional modules, such as processors and memory, and structuring them together into computer and memory, and structuring them together into computer system. system.

Page 10: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

10

Concepts of layers in C.A Concepts of layers in C.A

Fig:- Layered View of Computer SystemFig:- Layered View of Computer System

Application Program

Application Design

System Design

Computer Design

Logic Design

Circuit Design

Computer Design

Computer Organization

C.A

Software

Hardware

High Level

Low Level

Page 11: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

11

Conttd…Conttd…

Hardware Designer(Construction

Engineer)

Computer Architecture

(Building Architecture)

Thinks about circuits, Components , Timing , Functionality, Ease of use debugging.

Thinks about high level components, How they fit together & work together to deliver performance.

C.A= Machine Organization + Instruction Set Architecture (what’s machine look like) ( How u Talk to machine)

Page 12: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

12

The internal architecture of the 8085 CPU is capable of performing the following operations:

Store 8-bit data (Registers, Accumulator)

Perform arithmetic and logic operations (ALU)

Test for conditions (IF / THEN)

Sequence the execution of instructions

Store temporary data in RAM during execution

The 8085: CPU Internal StructureThe 8085: CPU Internal Structure

Page 13: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

13

Intel 8085 Pin Intel 8085 Pin ConfigurationConfiguration

Page 14: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

14Signals and I/O Pins

Page 15: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

15

Intel 8085 CPU Block Intel 8085 CPU Block DiagramDiagram

Page 16: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

16

The 8085: CPU Internal StructureThe 8085: CPU Internal Structure

Page 17: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

17

The 8085: RegistersThe 8085: Registers

Page 18: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

18

Registers Six general purpose 8-bit registers: B, C, D, E, H, L They can also be combined as register pairs to

perform 16-bit operations: BC, DE, HL Registers are programmable (data load, move, etc.)

Accumulator Single 8-bit register that is part of the ALU !

Used for arithmetic / logic operations – the result is always stored in the accumulator.

The 8085: CPU Internal StructureThe 8085: CPU Internal Structure

Page 19: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

19

The Program Counter (PC) This is a register that is used to control the sequencing of the execution

of instructions. This register always holds the address of the next instruction. Since it holds an address, it must be 16 bits wide.

The Stack pointer The stack pointer is also a 16-bit register that is used to point into

memory. The memory this register points to is a special area called the stack. The stack is an area of memory used to hold data that will be retreived

soon. The stack is usually accessed in a Last In First Out (LIFO) fashion.

The 8085: CPU Internal StructureThe 8085: CPU Internal Structure

Page 20: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

20

The 8085 and Its BussesThe 8085 and Its Busses The 8085 is an 8-bit general purpose microprocessor that can

address 64K Byte of memory. It has 40 pins and uses +5V for power. It can run at a

maximum frequency of 3 MHz. The pins on the chip can be grouped into 6 groups:

Address Bus. Data Bus. Control and Status Signals. Power supply and frequency. Externally Initiated Signals. Serial I/O ports.

Page 21: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

21

The 8085 Bus StructureThe 8085 Bus Structure

The 8-bit 8085 CPU (or MPU – Micro Processing Unit) communicates with the other units using a 16-bit address bus, an 8-bit data bus and a control bus.

Page 22: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

22

The Address and Data BussesThe Address and Data Busses

The address bus has 8 signal lines A8 – A15 which are unidirectional.

The other 8 address bits are multiplexed (time shared) with the 8 data bits. So, the bits AD0 – AD7 are bi-directional and serve as A0

– A7 and D0 – D7 at the same time. During the execution of the instruction, these lines carry

the address bits during the early part, then during the late parts of the execution, they carry the 8 data bits.

In order to separate the address from the data, we can use a latch to save the value before the function of the bits changes.

Page 23: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

23

The Control and Status SignalsThe Control and Status Signals There are 4 main control and status signals. These are:

ALE: Address Latch Enable. This signal is a pulse that become 1 when the AD0 – AD7 lines have an address on them. It becomes 0 after that. This signal can be used to enable a latch to save the address bits from the AD lines.

RD: Read. Active low. WR: Write. Active low. IO/M: This signal specifies whether the operation is a

memory operation (IO/M=0) or an I/O operation (IO/M=1).

S1 and S0 : Status signals to specify the kind of operation being performed .Usually un-used in small systems.

Page 24: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

24

Frequency Control SignalsFrequency Control Signals There are 3 important pins in the frequency control group.

X0 and X1 are the inputs from the crystal or clock generating circuit.

The frequency is internally divided by 2. So, to run the microprocessor at 3 MHz, a clock

running at 6 MHz should be connected to the X0 and X1 pins.

CLK (OUT): An output clock pin to drive the clock of the rest of the system.

We will discuss the rest of the control signals as we get to them.

Page 25: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

25

Numbering SystemNumbering System

Many number systems are in use in digital technology. The Many number systems are in use in digital technology. The

most common number system are:-most common number system are:-

1. 1. Binary (With Radix 2)Binary (With Radix 2)

2.2. Decimal(With Radix 10)Decimal(With Radix 10)

3.3. Octal(With Radix 8)Octal(With Radix 8)

4.4. Hexadecimal(With Radix 16)Hexadecimal(With Radix 16)

Page 26: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

26

Numbering SystemNumbering System

Number System

Radix(Base)

Binary 0,1

Decimal 0,1,2,3,4,5,6,7,8,9

Octal 0,1,2,3,4,5,6,7

Hexadecimal 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Page 27: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

27

Decimal System :- The decimal system is composed of 10 numerals or symbols. These 10 symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; using these symbols as digits of a number, we can express any quantity. The decimal system, also called the base-10 system because it has 10 digits.

410 310 210 110 010 110 210 310 410 510

Decimal NumberDecimal Number

Page 28: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

28

In the binary system, there are only two symbols or possible digit values, 0 and 1. This base-2 system can be used to represent any quantity that can be represented in decimal or other number system.

42 32 22 12 02 12 22 32 42 52

In digital systems the information that is being processed is usually presented in binary form. Binary quantities can be represented by any device that has only two operating states or possible conditions. Eg. a switch has only open or closed. We arbitrarily (as we define them) let an open switch represent binary 0 and a closed switch represent binary 1. Thus we can represent any binary number by using series of switches.

Binary SystemBinary System

Page 29: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

29

• The Binary counting sequence is shown in the table:

Binary CountingBinary Counting

Page 30: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

30

Any binary number can be converted to its decimal equivalent simply by summing together the weights of the various positions in the binary number which contain 1.

Example 1:

convert 110112 to decimal value

1 1 0 1 1

42 32 22 12 02

=

16+8+2+1=

1027

Solve:

Binary to Decimal ConvertionBinary to Decimal Convertion

Page 31: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

31

Example 2 :Convert 101101012 to decimal value

Solve:

1 0 1 1 0

72 62 52 42 32

=

128 + 32 + 16 + 4 + 1=

10181

1 0

22 12

1

02

You should noticed the method is find the weights (i.e., powers of 2) for each bit position that contains 1, and then to add them up.

Page 32: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

32

I.I. There are two methods to convert it:-There are two methods to convert it:-

Revese of Binary-To-Digital Method

1045 = 32 + 8 + 4 + 1= 52 32 22 020 0

1 1 1 100=2

Decimal number write as the sum of square

0 & 1 is write on the byte

Example 1: Convert 4510 to the binary value

Solve =

Decimal to Binary ConversionDecimal to Binary Conversion

Page 33: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

33

ii. Repeat division method The numbers is divide by 2.

Balance for the question is written until the last answer.

2510 = ?2

252= 12 balance 1

122= 6 balance 0

62= 3 balance 0

32= 1 balance 1

12= 0 balance 1 MSB

LSB

.. . Answer = 110012

Example : convert 2510 to binary

Solve =

Page 34: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

34

The Flow chart for repeated-division method is as follow:The Flow chart for repeated-division method is as follow:

Page 35: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

35

The octal number system has a base of eight, meaning that it has eight possible digits: 0,1,2,3,4,5,6,7.

48 38 28 18 08 18 28 38 48 58

Use to represent long binary numbers in computers and microprocessors.

Octal Number SystemOctal Number System

Page 36: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

36

Convert from octal to decimal by multiplying each octal digit by its positional weight.

)8( 2

Example 1: Convert 1638 to decimal value

Solve = 1 x 6 x )8( 1 1x )8( 0

= 1 x 64 + 6 x 8 + 1 x 1

11510 =

)8( 2

Example 2: Convert 3338 to decimal value

Solve = 3 x 3 x )8( 1 3 x )8( 0

= 3 x 64 + 3 x 8 + 3 x 1

21910 =

Octal to Decimal ConversionOctal to Decimal Conversion

Page 37: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

37

Convert from decimal to octal by using the repeated division method used for decimal to binary conversion.

Divide the decimal number by 8 The first remainder is the LSB and the last is the MSB.

35910 = ?8

3598= 44 balance 7

448= 5 balance 4

58= 0 balance 5 MSB

LSB

.. . Answer = 5478

Example : convert 35910 to Decimal Value

Solve =

Decimal to Octal ConversionDecimal to Octal Conversion

Page 38: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

38

Convert from octal to binary by converting each octal digit to a three bit binary equivalent

Octal digit 0 1 2 3 4 5 6 7

Binary Equivalent

000 001 010 011 100 101 110 111

Convert from binary to octal by grouping bits in threes starting with the LSB.

Each group is then converted to the octal equivalent Leading zeros can be added to the left of the MSB to fill out the

last group.

Octal to Binary ConversionOctal to Binary Conversion

Page 39: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

39

Page 40: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

40

Can be converted by grouping the binary bit in group of

three starting from LSB

Octal is a base-8 system and equal to two the power of

three, so a digit in Octal is equal to three digit in binary

system.

Binary to Octal ConversionBinary to Octal Conversion

Page 41: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

41

Page 42: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

42

The hexadecimal system uses base 16. Thus, it has 16 possible digit symbols. It uses the digits 0 through 9 plus the letters A, B, C, D, E, and F as the 16 digit symbols.

416 316 216 116 016 116 216 316 416 516

Use to represent long binary numbers in computers and microprocessors.

These digits can use to program machine language.

Hexadecimal Number SystemHexadecimal Number System

Page 43: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

43

Page 44: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

44

(3 A E) = ( 0011 1010 1110 )

(Hexa to Binary)

16 2

(2 A F) = 2 * 16 + 10 *16 + 15 * 16 2*256 + 10*16 + 15*1

(687)(Hexa to Decimal)

12 0

10

(5 A 8) = ( 0101 1010 1000 ) (010 110 101 000)

= (2650)(Hexa to Octal)

2

28

Page 45: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

45

Representation of Data in ComputerRepresentation of Data in Computer

The binary no. system is most nature for computer. The binary no. system is most nature for computer. Computer stores information in flip-flops. Which are Computer stores information in flip-flops. Which are two state devices. Three systems are widely used for two state devices. Three systems are widely used for representing both positive and negative numbers:representing both positive and negative numbers:

1. Sign magnitude representation1. Sign magnitude representation

2. 1’s complement representation2. 1’s complement representation

3. 2’s complement representation3. 2’s complement representation

Integers are represented using fixed Integers are represented using fixed point representation. Real no. in floating point point representation. Real no. in floating point representation.representation.

Page 46: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

46

Conttd…Conttd… Sign Magnitude Representation:-Sign Magnitude Representation:-

-> 0 for Positive-> 0 for Positive

-> 1 for Negative-> 1 for Negative

The sign of no. is represented using the The sign of no. is represented using the left most bit. A no. of n bits can be represented as n+1 bit left most bit. A no. of n bits can be represented as n+1 bit number, where (n+1) bit is sign bit and rest n bits represents number, where (n+1) bit is sign bit and rest n bits represents its magnitude. its magnitude.

+12 [ 0, 0001100]+12 [ 0, 0001100]

-12-12 [ 1, 0001100] [ 1, 0001100]

N-bits magnitude1-bit sign

Page 47: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

47

Conttd…Conttd… 1’s Complement Representation:- In 1’s complement

representation , negative values are obtained by complementing each bit of the corresponding positive number.

Disadvantage :+0 is represented as 0000000+1 is represented as 1111111

2’s Complement Representation:- In 2’s complement representation, negative number is obtained by adding 1 to 1’s complement representation.

1. Only one representation for 0.2. Subtraction is carried out like addition.

Page 48: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

48

Binary ArithmeticBinary ArithmeticAddition’s

Input Sum Carry

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

SubtractionInput Difference Borrow

0 0 0 0

0 1 1 1

1 0 1 0

1 1 0 0

Page 49: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

49

Signed Addition or SubtractionSigned Addition or Subtraction 2’s complement representation is best choice for 2’s complement representation is best choice for

addition of two signed numbers or for finding addition of two signed numbers or for finding difference of two no. If X and Y two positive difference of two no. If X and Y two positive number then:number then:

X – y = x + 2’s complement of y-x – y = 2’s complement of x + 2’s complement of y

-X + y = 2’s complement of x + y

Page 50: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

50

Number Binary Equivalent 2’s Complement

55 00110111 11001001

27 00011011 11100101

(1) 55 + 27(2) -55 + 27(3) 55 – 27(4) -55 – 27

Exa :- Find the value using 2’s complement arithmetic.

55 00110111 + 27 00011011 82 01010010

- 55 11001001 + 27 00011011 - 28 111001002’s comp of 11100100 =00011100

55 00110111 - 27 11100101 28 00011100

- 55 11001001 - 27 11100101 - 82 10101110

Page 51: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

51

Carry Look Ahead AdderCarry Look Ahead Adder In ripple carry adders, the carry propagation time is the major In ripple carry adders, the carry propagation time is the major

speed limiting factor.speed limiting factor.

Most arithmetic operations, are implemented using several add/subtract steps. Thus, improving the speed of addition will improve the speed of all other arithmetic operations.

So, reducing the carry propagation delay of adders is of great importance.

The principle of carry look-ahead solves this problem by calculating the carry signals in advance, based on the input signals.

Page 52: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

52

Conttd….Conttd…. This type of adder circuit is called as carry look-ahead adder This type of adder circuit is called as carry look-ahead adder

(CLA adder). It is based on the fact that a carry signal will be (CLA adder). It is based on the fact that a carry signal will be generated in two cases: generated in two cases:

(1) when both bits Ai and Bi are 1, or (1) when both bits Ai and Bi are 1, or (2) when one of the two bits is 1 and the carry-in (2) when one of the two bits is 1 and the carry-in

(carry of the previous stage) is 1. (carry of the previous stage) is 1.

The Figure shows the full adder circuit used to add the operand bits in the ith column; namely Ai & Bi and the carry bit coming from the previous column (Ci ).

Page 53: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

53

Conttd….Conttd…. In this circuit, the 2 internal signals Pi and Gi are given by:

Pi = Ai Bi =……………………..(1) ⊕ Gi = AiBi=……………….……(2) The output sum and carry can be defined as :

Si = P Ci=……………………(3) ⊕Ci+1 = Gi + CiPi+=…………(4)

Gi is known as the carry Generate signal since a carry (Ci+1) is generated whenever Gi =1, regardless of the input carry (Ci).

Pi is known as the carry propagate signal since whenever Pi =1, the input carry is propagated to the output carry, i.e., Ci+1. = Ci

Page 54: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

54

Conttd….Conttd…. C1 = G0 + P0C0 C2 = G1 + P1C1 = G1 + P1 (G0 + P0C0) = G1 + P1G0 +

P1P0C0

C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0 C4 = G3 + P3C3 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0

Page 55: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

55

Conttd…Conttd… First level: Generates all the P & G signals. Four sets of P & G logic (each

consists of an XOR gate and an AND gate). Output signals of this level (P’s & G’s) will be valid after 1τ.

Second level: The Carry Look-Ahead (CLA) logic block which consists of four 2-level implementation logic circuits. It generates the carry signals (C1, C2, C3, and C4) as defined by the above expressions. Output signals of this level (C1, C2, C3, and C4) will be valid after 3τ.

Third level: Four XOR gates which generate the sum signals (Si) (Si = Pi Ci). Output signals of this level (S0, S1, S2, and S3) will be valid after ⊕

4τ. Thus, the 4 Sum signals (S0, S1, S2 & S3) will all be valid after a total

delay of 4τ compared to a delay of (2n+1)τ for Ripple Carry adders. For a 4-bit adder (n = 4), the Ripple Carry adder delay is 9τ. The disadvantage of the CLA adders is that the carry expressions (and

hence logic) become quite complex for more than 4 bits. Thus, CLA adders are usually implemented as 4-bit modules that are used

to build larger size adders.

Page 56: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

56

Review of LectureReview of Lecture

We have learned today the following topicsWe have learned today the following topics

Principles of computer design.

Software hardware Interaction.

Cost benefit concept of layers in architecture design.

Introduction to 8085.

Number System.

Binary Arithmetic.

Carry look ahead Adder.

Page 57: 1 COMPUTER ARCHITECTURE (LECTURE) By Baljinder Singh Assistant Professor (CSE/IT) Beant College of Engg. & Technology, Gurdaspur

57

THANKSTHANKS