Sunteți pe pagina 1din 7

02-Oct-10

ECE 352 Digital System Fundamentals


Week 5 Carry-Lookahead Adders Specialized Arithmetic Units Arithmetic Logic Units

This Week
Fall 2010 ECE 352: Digital System Fu undamentals

Read: 4.5, 9.3, CLAs Group A


Post-Demo #1 (Wednesday) Pre-Demo #2 ( (FRIDAY) )

Group B: Demo #1

W5 2

Topics
Fall 2010 ECE 352: Digital System Fu undamentals

Carry-Lookahead Adders Specialized Arithmetic Functions


Incrementing/decrementing Zero-fill Sign-extension Constant multiplication

Arithmetic Logic Units

W5 3

02-Oct-10

Ripple Carry Adder


Fall 2010

Easy to create
Good hierarchy Tileable structures

ECE 352: Digital System Fu undamentals

Small hardware Slow!


Design is limited by the delays in propagating carry through all of the bitwise additions The output bit at position m is not valid until after the carry out of the m-1 position is ready

W5 4

Faster Addition
Fall 2010 ECE 352: Digital System Fu undamentals

For big adders, the carry-chain is very long Separate the carry chain and sum logic Partial Full Adders
Contain only the sum part of a FA
A B half adder COUT

A B half adder

CIN
CIN half adder S

W5 5

COUT

Reassembling RCA Using PFAs


Fall 2010

Can create ripple-carry adder with PFAs


G: Generates a carry at this position P: Propagates a carry through this position

W5 6

ECE 352: Digital System Fu undamentals

02-Oct-10

Generate and Propagate


Fall 2010

Generate
Based on the operand values at just this bit position, will my carry-out for this position be 1 regardless of the value of my carry-in?

ECE 352: Digital System Fu undamentals

Propagate P t
Based on the operand values at just this bit position, do I know that my carry-out for this position will be equal to my carry-in?

W5 7

Carry Look-Ahead Adder


Fall 2010

As usual, can trade area/power for speed


Multi-level logic (ripple carry) reduces area Flattening carry logic increases speed

ECE 352: Digital System Fu undamentals

Worksheet:
Write the two level expressions for C1, C2, and C3 in terms of C0 and the PFA G and P outputs

Sometimes called CLA

W5 8

Carry Look-Ahead Logic


ECE 352: Digital System Fu undamentals Fall 2010

W5 9

02-Oct-10

Extending Carry Look-Ahead


Fall 2010

Can make wider adders


16-bit CLA adder from 4-bit CLA adders

ECE 352: Digital System Fu undamentals

Need to add group G and P outputs to CLA


Indicates if the g group p as a whole will generate g or propagate a carry

Use additional carry look ahead block to handle group carry signals Worksheet: Create a 16-bit CLA

W5 10

Extending Carry Look-Ahead


ECE 352: Digital System Fu undamentals Fall 2010

W5 11

Key to Understanding CLAs


Fall 2010 ECE 352: Digital System Fu undamentals

Remember what the words generate and propagate mean for the carry bits Remember how to use hierarchy in a CLA Read the CLA document posted on Learn@UW its required
Most students find it easier to understand than the book description

W5 12

02-Oct-10

Topics
Fall 2010 ECE 352: Digital System Fu undamentals

Carry-Lookahead Adders Specialized Arithmetic Functions


Incrementing/decrementing Zero-fill Sign-extension Constant multiplication

Arithmetic Logic Units

W5 13

Special Case: Incrementer


Fall 2010

Can simplify the logic if only adding 1

W5 14

ECE 352: Digital System Fu undamentals

Worksheet: Decrementer
Fall 2010 ECE 352: Digital System Fu undamentals

Use contraction to create a decrement-by-2 circuit from a ripple carry adder

A B C C

A B C

A B

CIN S S

CIN S

CIN

W5 15

02-Oct-10

Zero-Fill and Sign Extension


Fall 2010 ECE 352: Digital System Fu undamentals

Sometimes need to represent a value using additional bits


For example, add 4-bit value to an 8-bit value

If unsigned, need to zero-fill


Append 0s to most significant end of vector Example: 0101 becomes 00000101

If signed, need to sign extend


Replicate MSb for additional upper bits Example: 0101 becomes 00000101 Example: 1100 becomes 11111100

W5 16

Multiplication/Division
Fall 2010 ECE 352: Digital System Fu undamentals

General multipliers/dividers more complicated than we deal with in this class Can multiply by constant by performing a series of adds Powers of 2 make multiply/divide easy
Just a shift by log2 of the multiplier/divisor Example: 010102 X 410 = 1010002 Example: 011102 / 210 = 001112

W5 17

Topics
Fall 2010 ECE 352: Digital System Fu undamentals

Carry-Lookahead Adders Specialized Arithmetic Functions


Incrementing/decrementing Zero-fill Sign-extension Constant multiplication

Arithmetic Logic Units

W5 18

02-Oct-10

Arithmetic Logic Units (ALUs)


Fall 2010

Sometimes want one structure with multiple possible functions


Add, subtract, increment, bitwise AND, etc.

ECE 352: Digital System Fu undamentals

Combining arithmetic and logic ALU N mode mode bits can specify up to 2N different modes for the structure
All logic computes on the operands, but use muxes to choose which logic produces output

In some cases, operations similar enough that they can share some or all logic
Use muxes to choose between inputs

W5 19

Arithmetic Logic Unit


Fall 2010 ECE 352: Digital System Fu undamentals

Example: Build a 4-bit ALU with the mode signals and modes listed below Mode Signals F G 0 0 0 1 1 X

O Operation ti A+B AB A& B

W5 20

Next Week
Fall 2010 ECE 352: Digital System Fu undamentals

Read: D Latch and FF, 5.4-5.5 Written HW #3 Due Th 10/7 Group A: Demo #2 Group B: Post #1, #1 Pre #2 Due W 10/6

Arithmetic Logic Units D Latches and FFs, FF Timing Intro to Sequential Circuits, Counters

W5 21