+ A A 0 1 0 0 0 1 0 Sum MUX 0 1 1 Result 0 1 1 B - - PowerPoint PPT Presentation

a a 0 1 0 0 0 1 0 sum mux 0 1 1 result 0 1 1 b 1 0 0 b 1
SMART_READER_LITE
LIVE PREVIEW

+ A A 0 1 0 0 0 1 0 Sum MUX 0 1 1 Result 0 1 1 B - - PowerPoint PPT Presentation

9/14/15 WELLESLEY CS 240 1 Processor: Data Path Components Arithmetic Logic Unit (ALU) Condition Codes (sign, overflow , a few bits carry-out, zero) 4 2 1 3 word Operand A


slide-1
SLIDE 1

WELLESLEY CS 240 9/14/15 1

Processor: ¡Data ¡Path ¡Components

ALU

Registers Memory

Instruction ¡ Fetch and ¡ Decode

1 3 2 4

Arithmetic ¡Logic ¡Unit ¡(ALU)

ALU

Operand ¡A Operand ¡B Condition ¡Codes (sign, ¡overflow , carry-­‑out, ¡zero) Result Operation ¡ID

Hardware ¡unit ¡for ¡arithmetic ¡and ¡bitwise ¡operations.

words

word

a ¡few ¡bits a ¡few ¡bits

1

1-­‑bit ¡ALU ¡for ¡bitwise ¡operations

Build ¡an ¡n-­‑bit ¡ALU ¡from ¡n ¡1-­‑bit ¡ALUs. Each ¡bit ¡i in ¡the ¡result ¡is ¡computed ¡from ¡the ¡corresponding ¡bit ¡iin ¡the ¡two ¡inputs.

MUX

A B

1

Operation Result Op A B Result 1 1 1 1 1 1 1 1 1 1 1 1

1-­‑bit ¡adder

A B Carry ¡ in Carry ¡ out Sum 1 1 1 1 1 1 1 1 1 1 1 1

+

A B Sum

Carry ¡in Carry ¡out

Build ¡an ¡n-­‑bit ¡adder ¡from ¡n ¡1-­‑bit ¡adders. Each ¡bit ¡i in ¡the ¡result ¡is ¡computed ¡from ¡the ¡corresponding ¡bit ¡iin ¡the ¡two ¡inpu ts ¡ and ¡the ¡carry ¡out ¡of ¡bit ¡i-­‑1.

Y

  • u ¡will ¡explore ¡what's ¡in ¡the ¡box ¡for ¡lab.
slide-2
SLIDE 2

WELLESLEY CS 240 9/14/15 2

1-­‑bit ¡ALU

a b

1 Operation Result 2

2

Carry ¡in

+

Sum Carry ¡out MUX

32-­‑bit ¡ALU with ¡ripple ¡carry Adding ¡subtraction

A B

1 Operation Result 2

2

Carry ¡in

+

Sum Carry ¡out

1

invert ¡B MUX

MUX

ALU ¡Condition ¡Codes

Zero ¡Flag: 1 ¡if ¡result ¡is ¡00...0 ¡else ¡0 Sign ¡Flag: ¡ sign ¡bit ¡of ¡result Carry ¡ Flag: 1 ¡if ¡unsigned ¡overflow ¡ else ¡0 carry-­‑out ¡bit ¡of ¡result Overflow ¡Flag: ¡ 1 ¡if ¡signed ¡overflow ¡ else ¡0

slide-3
SLIDE 3

WELLESLEY CS 240 9/14/15 3

Compute ¡NOT, ¡NAND, ¡NOR, ¡XOR, ¡<, ¡==, ¡…? Detect ¡overflow?

A B

1 Operation Result 2

2

Carry ¡in

+

Sum Carry ¡out

1

invert ¡B MUX

MUX

1

MUX

invert ¡A

Controlling ¡the ¡ALU

ALU control ¡lines Function 0000 AND 0001 OR 0010 add 0110 subtract 1100 NOR Invert ¡A Invert ¡B Operation ¡ID

ALU

Operand ¡A Operand ¡B Result Control ¡Lines Condition ¡Codes