Docsity

Arithmetic Logic Circuits - Advanced Digital Design - Lecture Slides, Slides of Digital Systems Design

Partial preview of the text

Download Arithmetic Logic Circuits - Advanced Digital Design - Lecture Slides and more Slides Digital Systems Design in PDF only on Docsity!

Lecture 6

Arithmetic Logic Circuits

Outline

• Review of Number Systems

• Adders

– Ripple carry

– Carry Lookahead

– Carry Select

• Combinational Multipliers

• Arithmetic and Logic Unit (ALU)

• General Logic Function Units

• READING: Katz 5.2.1, 5.2.2, 5.2.4, 5.3, 5.5, 4.

0000

0111

0011 1011

11101111 1101 1100

1010 1001 1000

0110

0101

0100

0010

0001

0 100 = + 4 1 100 = - 4

High order bit is sign: 0 = positive (or zero), 1 = negative Three low order bits is the magnitude: 0 (000) thru 7 (111) Number range for n bits = +/-2 - Representations for 0 Cumbersome addition/subtraction Must compare magnitudes to determine sign of result

n-

Sign Magnitude Number System

Docsity.com

Twos Complement Representation

0000

0111

0011 1011

11101111 1101 1100

1010 1001 1000

0110

0101

0100

0010

0001

0 100 = + 4 1 100 = - 4

Only one representation for 0

One more negative number than positive number

like 1's comp except shifted one position clockwise

Addition and Subtraction of Numbers

Sign and Magnitude 4

  • 3 7

result sign bit is the same as the operands' sign

when signs differ, operation is subtract,sign of result depends on sign of number with the larger magnitude

Twos Complement Addition and Subtraction

Twos Complement Calculations 4

  • 3 7

If carry-in to sign = carry-out then ignore carry if carry-in differs fromcarry-out then overflow

Simpler addition scheme makes twos complement the most common choice for integer number systems within digital systems

Circuits for Binary Addition

Half Adder With twos complement numbers, addition is sufficient

Ai 0 0 1 1

Bi 0 1 0 1

Sum 0 1 1 0

Carry 0 0 0 1

Ai Bi 0 1 0 1

0 1 1 0 Sum = Ai Bi + Ai Bi = Ai + Bi

Ai Bi 0 1 0 1

0 0 0 1 Carry = Ai Bi

Carry Half-adder Schematic

A (^) i Sum Bi

Full Adder

A3 B

S

A2 B

S

A1 B

S

A0 B

C3 C2 C1 S

Cascaded Multi-bit Adder

usually interested in adding more than two bits this motivates the need for the full adder

Full Adder Circuit

A

A^ A

B

B B CI CI^ S^

CO

Alternative Implementation: 5 Gates

Half Adder

A B

Half Adder

A + B

CI

S S^ A + B + CI CO A B CO CI (A + B)

S

CO A B + CI (A xor B) = A B + B CI + A CI

Standard Approach: 6 Gates

Adder/Subtractor

A - B = A + (-B) = A + B + 1

A B CO S

  • CI

A B CO S

  • CI

A B CO S

  • CI

A B CO S

  • CI

0 1

Add/Subtract

A 3 B 3 B 3 0 1

A 2 B 2 B 2 0 1

A 1 B 1 B 1 0 1

A 0 B 0 B 0 Sel Sel Sel^ Sel

S 3 S 2 S 1 S 0

Overflow

Carry Lookahead Adder

Critical delay: the propagation of carry from low to high order stages

A

A

B

B CI (^) CO

@0 @

@0 @

@N

@

@

@N+ @N+

late arriving signal two gate delays to compute CO

4 stage adder

final sum and carry

A 0 B 0

C 0 S 0 @

A 1 B 1

C 1 @ S 1 @ A 2 B 2

C 2 @ S 2 @

A 3 B 3

C 3 @ S 3 @ C 4 @

0

1 2

3

Carry Lookahead Circuit

Critical delay: the propagation of carry from low to high order stages

worst case addition

T0: Inputs to the adder are valid T2: Stage 0 carry out (C1) T4: Stage 1 carry out (C2) T6: Stage 2 carry out (C3) T8: Stage 3 carry out (C4)

2 delays to compute sum but last carry not ready until 6 delays later

T0 T2 T4 T6 T

S0, C1 Valid S1, C2 Valid S2, C3 Valid S3, C4 Valid

Carry Lookahead Logic

Reexpress the carry logic as follows: C1 = G0 + P0 C C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 C C3 = G2 + P2 C2 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C C4 = G3 + P3 C3 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 C

Each of the carry equations can be implemented in a two-level logic network Variables are the adder inputs and carry in to stage 0!

Carry Lookahead Implementation

Adder with Propagate and Generate Outputs Increasingly complex logic Pi @ 1 gate delay Ci Si @ 2 gate delays Bi^ Ai

 - C0 C Gi @ 1 gate delay 
  • C
  • C0 P0 P
  • P
  • P - G0 G
  • G
  • G
    • C - P - P
      • P
      • P
  • P
  • P1 G - G
  • G
    • C2 P - P - P
      • P
      • P
      • P - G
      • G
        • C
          • P
          • P
          • P
          • P
          • G
            • C