Combinational Logic II - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Combinational Logic II

Description:

Serial construction of an 8-bit comparator. Koling Chang - ECS154A - Fall 2003. Page 10 ... Representation ( does not have same positive number representations ) ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 28
Provided by: KC96
Category:

less

Transcript and Presenter's Notes

Title: Combinational Logic II


1
Combinational Logic II
  • Instructor Koling Chang
  • email kchang_at_cs.ucdavis.edu

2
Outline
  • Comparator
  • XOR
  • Adder
  • Fixed-point Arithmetic
  • ALU

3
Comparators
  • Compare two sets of input signals (A,B) and
    generate 1 or 0 (True or False) on the following
    signal lines
  • AB
  • AgtB
  • AltB

4
Comparator
  • Logic for AB using XOR gates

All 0s if AB
5
Using XOR
  • A XOR B AB AB
  • If A!B, AB
  • A XOR B AAAA A A 1
  • Using XOR as Controlled Inverter
  • If A 1 then AXORB B, else A XOR B B
  • Used as the sum of an adder

6
gt And lt
A3
B3
A2
A3 B3
B2
gt
A3-2 B3-2
A1
B3
A0
A3-1 B3-1
B0
7
Comparator (cont.)
  • 4-bit magnitude comparator chip

8
Larger Size Comparator
  • Using multiple small comparators to build a large
    one using expansion inputs
  • If A1 ! B1, then A!B
  • If A1 B1, A2B2, then AB
  • How about gt and lt?

9
Comparator (cont.)
  • Serial construction of an 8-bit comparator

10
Adders
  • 1
  • 1
  • 10

A
B
C
O
11
Adders
  • Half-adder
  • Adds two bits
  • Produces a sum and carry
  • Problem Cannot use it to build larger inputs
  • Full-adder
  • Adds three 1-bit values
  • Like half-adder, produces a sum and carry
  • Allows building N-bit adders
  • Simple technique
  • Connect Cout of one adder to Cin of the next
  • These are called ripple-carry adders

12
Adders (cont.)

13
Adders (cont.)
  • A 16-bit ripple-carry adder

14
Adders (cont.)
  • Ripple-carry adders can be slow
  • Delay proportional to number of bits
  • Carry lookahead adders
  • Eliminate the delay of ripple-carry adders
  • Carry-ins are generated independently
  • C0 A0 B0
  • C1 C0(A1B1)A1B1 A0 B0 A1 A0 B0 B1 A1 B1
  • C2 C1(A2B2)A2B2 A2A0B0A1A2A0B0B1A2A1B1
    B2A0B0A1 B2A0B0B1 B2A1B1A2B2
  • Requires complex circuits
  • Usually, a combination carry lookahead and
    ripple-carry techniques are used

15
Carry Lookahead
  • All logic function can be in the form of SOP.
  • Only two-level of gate delay
  • generate gi xiyi
  • propagate pi xiyi
  • carry ci gipici-1

16
Carry Lookahead (cont.)
A
B
Ai
Bi
A
B
O
Oi
O
C
Ci
C
g
p
Carry-lookahead circuit
17
Adders (cont.)
  • 4-bit carry lookahead adder

18
Fixed-Point Arithmetic
  • Number Representation
  • Unsigned
  • Signed
  • Sign and magnitude
  • 1s complement
  • 2s complement
  • Excess-M Representation ( does not have same
    positive number representations )

19
Number Representation
20
2s Complement
  • Same positive number presentation
  • Leading sign bit
  • Defined as N 2n N N 1
  • Addition logic Subtraction logic
  • Easy overflow detection
  • Widely used by all processors

21
2s Complement Example
  • 5 0101 B
  • -5 24 5 16-5 11 1011B

22
Overflow Detection
  • Unsigned Numbers
  • If there is a carry-out from the MSB
  • Signed Numbers
  • Adding two positive numbers results a negative
    number
  • Adding two negative numbers yields a positive
    number.

23
1s Complement
  • Similar logic operations with 2s complement with
    end-around carry
  • 0101 0011 0101 1100
  • 1 0001
  • 0010
  • Frequently used in checksum calculation
  • byte order independent
  • cumulative and associative
  • deferred carries
  • incremental update

24
Arithmetic and Logic Unit
  • Preliminary ALU design

Cin F1F0 or just F0
25
Arithmetic and Logic Unit (cont.)
  • Final design

Cin F0
26
Arithmetic and Logic Unit (cont.)
  • 16-bit ALU

27
Arithmetic and Logic Unit (cont.)

4-bit ALU
Write a Comment
User Comments (0)
About PowerShow.com