HARDWARE FOR ARITHMETIC Mahdi Nazm Bojnordi Assistant Professor - - PowerPoint PPT Presentation

hardware for arithmetic
SMART_READER_LITE
LIVE PREVIEW

HARDWARE FOR ARITHMETIC Mahdi Nazm Bojnordi Assistant Professor - - PowerPoint PPT Presentation

HARDWARE FOR ARITHMETIC Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 3810: Computer Organization Overview Past lectures High-level stuff mostly on ISA, Assembly, and number representation This


slide-1
SLIDE 1

HARDWARE FOR ARITHMETIC

CS/ECE 3810: Computer Organization

Mahdi Nazm Bojnordi

Assistant Professor School of Computing University of Utah

slide-2
SLIDE 2

Overview

¨ Past lectures

¤ High-level stuff mostly on ISA, Assembly, and number

representation

¨ This lecture

¤ Basics of logic design ¤ Hardware for arithmetic

slide-3
SLIDE 3

Fundamentals of Digital Design

¨ Binary logic: two voltage levels

¤ high and low; 1 and 0; true and false

¨ Binary arithmetic

¤ Based on a 3-terminal device that acts as a switch

V V Conducting V V Non-conducting

slide-4
SLIDE 4

Logic Blocks

¨ A logic block comprises binary inputs and binary outputs ¤ Combinational: the output is only a function of the inputs ¤ Sequential: the block has some internal memory (state) that also

influences the output

¨ Gate: a basic logic block that implements AND, OR, NOT,

etc.

Logic Block … … Binary Inputs Binary Outputs

slide-5
SLIDE 5

Logic Blocks: Truth Table

¨ A truth table defines the outputs of a logic block for

each set of inputs

¤ Example: consider a block with 3 inputs A, B, C and an

  • utput E that is true only if exactly 2 inputs are true

A B C E 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Logic Block A B C E

slide-6
SLIDE 6

Boolean Algebra

¨ Three primary operators are used to realize

Boolean functions

¨ Boolean operations

¤ OR (symbol +)

n X = A + B : X is true if at least one of A or B is true

¤ AND (symbol .)

n X = A . B : X is true if both A and B are true

¤ NOT (symbol )

n X = A : X is the inverted value of A

slide-7
SLIDE 7

Pictorial Representation

¨ Logic gates ¨ What function is the following?

AND OR NOT

slide-8
SLIDE 8

Boolean Algebra Rules

¨ Identity law

¤ A + 0 = A ¤ A . 1 = A

¨ Zero and One laws

¤ A + 1 = 1 ¤ A . 0 = 0

¨ Inverse laws

¤ A . A = 0 ¤ A + A = 1

¨ Commutative laws

¤ A + B = B + A ¤ A . B = B . A

¨ Associative laws

¤ A + (B + C) = (A + B) + C ¤ A . (B . C) = (A . B) . C

¨ Distributive laws

¤ A . (B + C) = (A . B) + (A . C) ¤ A + (B . C) = (A + B) . (A + C)

slide-9
SLIDE 9

DeMorgan’s Law

¨ A + B = A . B ¨ A . B = A + B

= =

slide-10
SLIDE 10

Example: Boolean Equation

¨ Consider the logic block that has an output E that is

true only if exactly two of the three inputs A, B, C are true

¨ Multiple correct equations

¤ Two must be true, but all three cannot be true

n E = ((A . B) + (B . C) + (A . C)) . (A . B . C)

¤ Identify the three cases where it is true

n E = (A . B . C) + (A . C . B) + (C . B . A)

slide-11
SLIDE 11

Implementing Boolean Functions

¨ Can realize any logic block with the AND, OR, NOT

¤ Draw the truth table ¤ For each true output, represent the corresponding inputs as

a product

¤ The final equation is a sum of these products

A B C E 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

slide-12
SLIDE 12

Implementing Boolean Functions

¨ Can realize any logic block with the AND, OR, NOT

¤ Draw the truth table ¤ For each true output, represent the corresponding inputs as

a product

¤ The final equation is a sum of these products

A B C E 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 A.B.C A.B.C A.B.C

slide-13
SLIDE 13

Implementing Boolean Functions

¨ Can realize any logic block with the AND, OR, NOT

¤ Draw the truth table ¤ For each true output, represent the corresponding inputs as

a product

¤ The final equation is a sum of these products

A B C E 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 A.B.C A.B.C A.B.C E = (A.B.C) + (A.B.C) + (A.B.C) Sum of Products

slide-14
SLIDE 14

Universal Gates

¨ Universal gate is a logic that can be used to

implement any complex function

¤ NAND

n Not of AND n A nand B = A.B

¤ NOR

n Not of OR n A nor B = A+B

slide-15
SLIDE 15

Common Logic Block

¨ An n-input decoder takes n inputs, based on which

  • nly one out of 2n outputs is activated

I0 I1 I2 O0 O1 O2 O3 O4 O5 O6 O7 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1

3-to-8 Decoder I0-2 O0-7

slide-16
SLIDE 16

Common Logic Block

¨ A multiplexer (or selector) reflects one of n inputs on

the output depending on the value of the select bits

¤ Example: 2-input mux

slide-17
SLIDE 17

Common Logic Block

¨ A full adder generates the sum and carry for each

bit position

A B Cin Sum Cout 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Sum Cout

slide-18
SLIDE 18

Common Logic Block

¨ A full adder generates the sum and carry for each

bit position

A B Cin Sum Cout 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Sum Cout 1 1 1 1

slide-19
SLIDE 19

Common Logic Block

¨ A full adder generates the sum and carry for each

bit position

A B Cin Sum Cout 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Sum Cout 1 1 1 1 Equations: Sum = Cin.A.B + B.Cin.A + A.Cin.B + A.B.Cin Cout = A.B.Cin + A.B.Cin + A.Cin.B + B.Cin.A = A.B + A.Cin + B.Cin

slide-20
SLIDE 20

Common Logic Block

¨ A full adder generates the sum and carry for each

bit position

1 1 1 1 Sum Cout 1 1 1 1 Equations: Sum = Cin.A.B + B.Cin.A + A.Cin.B + A.B.Cin Cout = A.B.Cin + A.B.Cin + A.Cin.B + B.Cin.A = A.B + A.Cin + B.Cin