1 2-bits, 4-bits, 6-bits, a dollar The ripple carry adder o We have - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 2-bits, 4-bits, 6-bits, a dollar The ripple carry adder o We have - - PDF document

Starting out slow The CPU s workhorse o Logical operations are easiest, because they map Constructing a basic ALU directly onto the hardware. o Of course we will need to CS240 Computer Organization array this to a full 32- Department of


slide-1
SLIDE 1

1

CS240 Computer Organization

Department of Computer Science Wellesley College

The CPU’s workhorse

Constructing a basic ALU

  • Logical operations are

easiest, because they map directly onto the hardware.

  • Of course we will need to

array this to a full 32- bits.

ALU 14-2

Starting out slow

ALU 14-3

Addition is next

a b CarryIn Sum CarryOut 1 1 1 1 1 1 1 1 1 1 1 1

ALU 14-4

CarryOut

a b CarryIn Sum CarryOut 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

*A CarryOut occurs as either as CarryGenerate + CarryProprogate.

slide-2
SLIDE 2

2

ALU 14-5

2-bits, 4-bits, 6-bits, a dollar

  • We have a 1-bit ALU that

performs AND, OR, and addition.

  • We create a full 32-bit

adder by arraying the results.

ALU 14-6

The ripple carry adder

ALU 14-7

Adding subtraction

  • Subtraction is the same as adding the negative version of

an operand. This is how adders perform subtraction and why twos-complement is so very nice.

ALU 14-8

NOR and NAND

  • A MIPS ALU also needs a NOR function. We implement

this by noting that (a + b) = a b.

slide-3
SLIDE 3

3

ALU 14-9

We’re getting there . . .

  • . . . but we’re not home

yet.

  • One instruction that still

needs support is the set

  • n less than (slt)

instruction which produces 1 if a < b.

  • We start by expanding

the input to the mux for Less.

ALU 14-10

Top 1-bit ALU

ALU 14-11

32-bit ALU

(Illustrates what we do with that blasted Set out and how the Less values get set.)

ALU 14-12

Finally

(Adds support for MIPS branch if equal and branch if not equal by testing whether result of

  • peration equals

zero.)

slide-4
SLIDE 4

4

ALU 14-13

Black box representing ALU

ALU 14-14

Carry lookahead

  • Carry generate

gi = ai bi.

  • Carry propagate

pi = ai + bi.

  • Using these define

ci+1 = gi + pi (ci).

  • Now unwind the

recursion to get a sequence of equations

  • nly four gates deep.