Representing Data - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

Representing Data

Description:

Easy to implement in electronic circuitry ... Augend. Output. Input. 8/19/09. 331_03. 20. Example. 7 14 = 21. 8/19/09. 331_03. 21. S ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 35
Provided by: ronh5
Category:

less

Transcript and Presenter's Notes

Title: Representing Data


1
Representing Data
  • ECE-331, Digital Design
  • Dr. Ron Hayne
  • Electrical and Computer Engineering

2
Binary Number System
  • Binary
  • Positional number system
  • Two symbols, B 0, 1
  • Easily implemented using switches
  • Easy to implement in electronic circuitry
  • Algebra invented by Boole allows easy
    manipulation of symbols

3
General Positional Notation
  • Consider a Positional Number System Using an
    Arbitrary Radix, r

4
Counting Number Representation
  • Then, for Counting Numbers,
  • e.g., Decimal

5
Counting Number Representation
  • e.g., Binary (radix 2)

6
Representation of Fractions
7
Decimal Fraction Example
  • Let p 3

8
Binary Fraction Example
  • Let p 3

9
Radix Conversion
  • Desire to convert (N.F)r1 --gt (N.F)r2
  • R N.F

10
Conversion of N
  • Number Part of R in r1 can be Represented by a
    Polynomial in r2
  • If N is Divided by the Second Radix

11
Conversion of N
  • Repeated Division Yields All Coefficients

12
Counting Number Example
13
Counting Number Example
14
Conversion of F
  • Fraction Part of R in r1 can be Represented by a
    Polynomial in r2
  • If F is Multiplied by the Second Radix

15
Conversion of F
  • Repeated Multiplication Yields All Coefficients

16
Fraction Conversion Example
17
Another Example
  • 23.187510 ?2

18
Conversion Considerations
  • Purpose of Binary Representation is to Put
    Numbers in a Form which can be Manipulated by
    Digital Logic
  • Register Size Limits Resolution
  • Not All Numbers in One Radix Can Be Accurately
    Represented in Another Radix

19
Binary Arithmetic
  • Addition

Input Input Input Output Output
Augend Addend Carry-In Carry-Out Sum
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
20
Example
  • 7 14 21

21
Negative Numbers
  • Signed Magnitude
  • Leftmost bit represents sign
  • 1 negative
  • 0 positive
  • Rightmost bits represent magnitude

22
Signed Magnitude Example
  • Let q 2
  • 2 zeroes
  • Shifting
  • Does not mult/div by radix,
  • Does accountfor sign

23
Negative Numbers
  • Reduced Radix
  • 1s complement, 9s complement, etc.
  • For 1s complement, alternative to subtraction is
    to complement each bit

24
Reduced Radix Example
  • Let q 2
  • 2 zeroes

25
Negative Numbers
  • Radix Complement
  • 2s complement, 10s complement, etc.
  • For 2s complement, alternative to subtraction is
    to take the ones complement and add 1

26
Radix Complement Example
  • Let q 2
  • 1 zero !!!

27
Advantages of Radix Comp.
  • One Zero
  • 2s Complement of Negative Number Yields
    Magnitude
  • Multiplication and Division by Radix Yield Scaled
    Results with Correct Sign if Sign Replicated in
    MSB on Divide

28
2s Complement
  • Forming the 2s Complement is an Operation and
    Can be Done with no Reference to a Negative
    Number
  • 2s Complement Notation is an Agreement to use
    the 2s Complement Representation of a Positive
    Number to Represent the Associated Negative Number

29
Examples
  • 4-bit 2s complement arithmetic
  • 3 - 6 - 3
  • - 4 - 5 ?

30
Binary, Octal, Hexadecimal
  • It Is Easy to Convert Binary Numbers to Other,
    More Convenient Representations by Grouping Bits
    Together and Then Converting by Inspection
  • Octal 0, 1, ... , 7
  • 3-bit groups
  • Hexadecimal 0, ... , 9, A, ... , F
  • 4-bit groups

31
Binary to Octal Example
32
Binary to Hex Example
33
Weighted Codes
  • Arbitrary Weight Assigned to Each Position
  • Binary Coded Decimal (BCD)
  • 8, 4, 2, 1
  • e.g., 1001 8 _ _ 1 9
  • Not all codewords used, e.g., (1101)BCD

34
Non-Weighted Codes
  • Excess 3
  • Used for decimal arithmetic
  • Representation is 3 more than binary value
  • Self-Complementing

35
Non-Weighted Codes
  • Cyclical
  • Sequential codewords differ by only one bit and
    wrap
  • Particularly useful for electro-mechanical
    interfaces where all bits must be mechanically
    aligned to generate code
  • May have minor inaccuracy but no large jumps
  • Reflected Grey Code is most common example
  • e.g., Shaft-encoders

36
Reflected Grey Code
  • Benefits
  • Easy to construct to any resolution (number of
    bits)
  • Cyclic
  • Unique
  • Construct by prepending each codeword with zero
    and mirroring codes, complementing MSB of
    mirrored codewords

37
3-bit Reflected Grey Code
  • Angle Codeword
  • 0-44 0 0 0
  • 45-89 0 0 1
  • 90-134 0 1 1
  • 135-179 0 1 0
  • 180-224 1 1 0
  • 225-269 1 1 1
  • 270-314 1 0 1
  • 315-359 1 0 0

38
End of Lecture
The End
Write a Comment
User Comments (0)
About PowerShow.com