chapter 03: computer arithmetic - devi ahilya … 11: design of alu chapter 03: computer arithmetic

35
Lesson 11: Design of ALU Chapter 03: Computer Arithmetic

Upload: lamdieu

Post on 22-Apr-2018

236 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Lesson 11:Design of ALU

Chapter 03: Computer Arithmetic

Page 2: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

2

Objective

• Understand the units in ALU

Page 3: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

3

ALUs

Page 4: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

4

ALU

• Each processor has an ALU• At ALU the arithmetic and logic operations

performed. • ALU performs two types of operations.• 1. Fixed point operations• 2. Floating point operations

Page 5: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

5

ALU Design

Combinational Logic Circuits-based ALUs

Sequential Logic Circuits Based ALUs

Bit Slice Processors

Page 6: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

6

ALUs

Fixed Point ALUs

Floating Point Point ALUs

Bit Slice Processors Based ALUs

Page 7: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

7

ALU Operations

Page 8: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

8

ALU two types of operations

1. Fixed point operations2. Floating point operations

Page 9: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

9

Fixed Point (Integer) ALU Operations

Add

Unsigned Multiply

AND Add with carry

Subtract

Multiply

Subtract with Borrow

Divide Unsigned DivideOR

XOR

NOT

L-Shift

R-Shift

Arth R-Shift

TESTCMP

Page 10: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

10

Floating Point ALU Operations

FAdd FSub FMul FDiv

Page 11: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

11

Complex ALU Operations

MAC VLIW operations

Page 12: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

12

Common arithmetic operations

1. Addition, subtraction2. Addition-with-carry (from a previous

operation)

Page 13: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

13

Common arithmetic operations

3. Subtraction with borrow from a previous operation. Common circuit for addition and subtraction.

• ALU common flag for carry and borrow (many processors) or common flag for carry and not-borrow (8096)

• Carry flag an output carry from a chain of bit-adders

Page 14: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

14

Common arithmetic operations

4. Division5. Increment and decrement6. Logical shift left and logical shift right

Page 15: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

15

Logical Shift

• 0b00100111 after ‘logical left shift’= 0b01001110• 0b00100111 after ‘logical right shift’= 0b00010011

Page 16: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

16

Common arithmetic operations

• Arithmetic shift left and logical shift right • Arithmetic shift left and logical shift left same. • Arithmetic shift right and logical shift right are

different.

Page 17: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

17

Arithmetic Shift

• 0b00100111 after arth. left shift’= 0b01001110• 0b00100111 after arth. right shift’= 0b00010011• 0b10100111 after arth. right shift’= 0b11010011

Page 18: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

18

Common logic operations

• NOT• AND, OR, XOR• COMPARE• TEST

Page 19: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

19

Logic Operations • 0b00100111 after NOT= 0b11011000• 0b00100111 and 0b11011001 after AND =

0b00000001• 0b00100111 and 0b11011001 after OR =

0b11111111• 0b00100111 and 0b11011001 after XOR =

0b11111110

Page 20: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

20

Compare Operations

• 0b00100111 and 0b11011001 after operation Sign Flag = 1, Zero Flag = 0

• 0b11011001 and 0b 00100111 after operation Sign Flag = 0, Zero Flag = 0

• 0b 00100111 and 0b 00100111 after operation Sign Flag = 0, Zero Flag = 1

Page 21: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

21

TEST Operations

• 0b00100111 and 0b11011000 after operation Test Flag = 0, Zero Flag = 1

• 0b11011001 and 0b 11011001 after operation Test Flag = 1, Zero Flag = 0

• 0b 00100111 and 0b 00000111 after operation Test Flag = 0, Zero Flag = 0

Page 22: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

22

Combinational Logic Circuits-based ALUs

Page 23: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

23

An ALU using combinational circuits

Page 24: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

24

Combinational Circuits Based ALU

k-Input X Select Circuitk-Input Y

XOR OR ADD

Result Flags

Bus

Page 25: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

25

Sequentias Circuits-based ALUs

Page 26: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

26

An ALU using sequential circuit

Page 27: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

27

Sequential Logic Circuits Based ALU

k-Input X Select/Controlk-Input Y

AND OR ADD

Result Flags

Bus

Control Unit Registers

For intermediate

results

Page 28: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

28

Bit Slice Circuits-based ALUs

Page 29: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

29

Bit Slice Processors Circuit Based ALU

k-Input X Select/Controlk-Input Y

P2

P3 P5

Result Flags

Bus

P1

P4

For intermediate

results

Bit Slice ALUs

Page 30: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

30

Bit Slice

Page 31: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

31

Summary

Page 32: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

32

ALUs

Fixed Point ALUs

Floating Point Point ALUs

Bit Slice Processors Based ALUs

Page 33: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

33

ALU Operations

Add

Unsigned Multiply

AND Add with carry

Subtract

Multiply

Subtract with Borrow

Divide Unsigned DivideOR

XOR

NOT

L-Shift

R-Shift

Arth R-Shift

TESTCMP

Page 34: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

Schaum’s Outline of Theory and Problems of Computer ArchitectureCopyright © The McGraw-Hill Companies Inc. Indian Special Edition 2009

34

ALU Design

Combinational Logic Circuits-based ALUs

Sequential Logic Circuits Based ALUs

Bit Slice Processors

Page 35: Chapter 03: Computer Arithmetic - Devi Ahilya … 11: Design of ALU Chapter 03: Computer Arithmetic

End of Lesson 11 onDesign of ALU