EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

21
ARITHMETIC LOGIC UNIT (ALU) CHAPTER 4

description

-

Transcript of EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Page 1: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

ARITHMETIC LOGIC UNIT (ALU)

CHAPTER 4

Page 2: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Learning Outcomes

• At the end of this lesson, student should able:-– Understanding adder component in ALU such

as Half Adder, Full Adder, Parallel Binary Adder, Binary Code Decimal Adder etc.

– Understanding shift register operation in ALU– Understanding logical operations in ALU– Realize multiplexer in ALU with eight input

multiplexer.

Page 3: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Introduction

• A logic circuit, which is used to perform

arithmetic functions like addition, subtraction,

multiplication, division etc. is called arithmetic

circuit.

• Typically, an addition operation takes less than 1

µs.

• The logic functions that are commonly used are

EX-OR, OR and AND.

Page 4: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Adder

• In electronics an adder is digital circuit that perform

addition of numbers.

• In modern computer adder reside in the arithmetic

logic unit (ALU).

• Adders are important not only in the computer but

also in many types of digital systems in which the

numeric data are processed.

• There are two basic types of adder:-

– Half Adder & Full Adder

Page 5: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

The Half Adder

• The half-adder accepts two binary digits on its inputs and produces two binary digits on its outputs, a sum bit and a carry bit.

Page 6: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Logic Circuits

Simplify to

HOW ???

Page 7: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

• Drawback of half adder is, it doesn’t cater to carry i.e. it fails in multi-bit addition.

• It will add A0 and B0, but in next stage we have to add three bits, which will not be done by the circuit, hence we require a FULL ADDER

Page 8: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Exercise

• Using an AND gate and two NOR gates to construct a half adder

Page 9: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

The Full Adder

• To overcome the drawback of half adder, full adder is designed.

• It consider Carry also.• The logic circuit which can add 3 bits is

known as Full Adder.• The full adder produces a sum and carry

value, which are both binary digits. • It can be combined with other full

adders.

Page 10: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU
Page 11: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Full Adder Logic

Page 12: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

• A full adder can be constructed from two half adders

by connecting A and B to the input of one half adder,

connecting the sum from that to an input to the

second adder, connecting Ci to the other input and

OR the two carry outputs.

• Equivalently, S could be made the three-bit XOR of

A, B, and Ci, and Co could be made the three-bit

majority function of A, B, and Ci.

Page 13: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

The Full-Adder

Page 14: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Exercise

• Write the equation to perform the full adder logic circuits.

Page 15: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Parallel Binary Adder

• Two or more full adders are connected to form parallel binary adders.– To add two binary numbers, a full-adder

is required for each bit in the numbers. – So, for 2-bit numbers, two adders are

needed.

Page 16: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Parallel Binary Adder

• The carry output of each adder is connected to the carry input of the next higher-order adder

Page 17: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Four-Bit Parallel Adders

• A group of 4 bits is called a nibble. A basic 4-bit parallel adder is implemented with four full-adder stages as shown.

Page 18: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Four-Bit Parallel Adders

The carry output of each adder is connected to the carry input of the next higher-order adder as indicated. These are called internal carries.

Page 19: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Parallel Adder Addition

How to performAddition?

Page 20: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Parallel Adder Subtraction

How to performsubtraction?

Page 21: EC303 - CHAPTER 4 ARITHMETIC LOGIC UNIT ALU

Testdefination computer

architecture & organization

cache memory

von nuemann

number systemmnemonic, operandflip-flop (jk flip-flop)