IFSM 310 - PowerPoint PPT Presentation

1 / 58
About This Presentation
Title:

IFSM 310

Description:

IFSM 310 Hardware Software Concepts CONTENTS Binary, Hex, and Decimal N=2k Excess-8 and Excess-50 notation SEEMMMM format Example: Audio Binary, Hex, and Decimal ... – PowerPoint PPT presentation

Number of Views:367
Avg rating:3.0/5.0
Slides: 59
Provided by: binaryuniv
Category:

less

Transcript and Presenter's Notes

Title: IFSM 310


1
DATA REPRESENTATIONS
IFSM 310
Hardware Software Concepts
2
CONTENTS
  • Binary, Hex, and Decimal
  • N2k
  • Excess-8 and Excess-50 notation
  • SEEMMMM format
  • Example Audio

3
Binary, Hex, and Decimal
  • Introduction
  • At the most basic level, the computer is storing
    (representing) numbers, music, graphics, letters
    etc in electrical states. These states can be
    OFF-ON POSITIVE-NEGATIVE ZERO-ONE etc.

4
Binary, Hex, and Decimal
bit
bit
bit
bit
bit
bit
bit
bit
  • - - -
  • 1 1 0 1 1 0 1 0

5
Binary, Hex, and Decimal
bit
bit
bit
bit
bit
bit
bit
bit
  • The states can be created using capacitors
  • Each of the capacitors is called a bit.
  • 8 Bits is a byte.
  • So, each state can be either a 1 or 0. This
    is called a binary state hence computer science
    studies how computers can be used to represent
    the real world in binary ways.
  • So, it makes sense to study binary number systems
    and other number systems that relate to binary
    systems like base 8 and base 16.

6
Binary, Hex, and Decimal
  • Number Systems
  • Recall that a number like 34,563 (base 10) can be
    expressed as
  • 3x10,000 4x1,000 5x100 6x10 3x1.
  • The values 10,000 1,000 100 10 and 1 come from
    the powers of 10.
  • Hence the name Base 10 or decimal.

7
Binary, Hex, and Decimal
  • Consider the Base 2 numbers. They are created the
    same way base 10 numbers are, using the position
    and the power of 2
  • The base 2 number 110101
  • 1x32 1x16 0x8 1x4 0x2 1x1 53

8
Binary, Hex, and Decimal
  • Ex 1010011 64162183
  • Ex 11111111 128 64 32168421255
  • Note
  • this is the largest value you can make with 8
    bits
  • There are 256 unique representations, because we
    start with 00000000

9
Binary, Hex, and Decimal
  • You try a few
  • Change 1001 to decimal
  • Change 1110110 to decimal

10
Binary, Hex, and Decimal
  • Solution
  • 1001 1x8 0x4 0x2 1x1 9 (dec)
  • 1110110 1x64 1x32 1x16 0x8 1x4 1x2 0x1
  • 64 321642
  • 96 22 118 (dec)

11
Binary, Hex, and Decimal
  • How about changing Decimal to Binary?
  • First note the powers of 2
  • 1, 2, 4, 8,16, 32, 64,128, 256, 512, 1024
  • There are a lot of methods to do this, this is
    the one other students have found to be the
    easiest
  • Keep subtracting the largest power of 2 until
    there is no remainder, mark the appropriate bit
    with a 1 for the power of two.

12
Binary, Hex, and Decimal
  • Example Change 23 to binary
  • 23-16 7 mark the 16 bit
  • 7-4 3 mark the 4 bit
  • 3-2 1 mark the 2 bit
  • Mark the 1 bit
  • Solution 10111

Bit 16 8 4 2 1
mark 1 0 1 1 1
13
Binary, Hex, and Decimal
  • Example Change 146 to binary
  • 146-128 18 mark the 128 bit
  • 18-16 2 mark the 16 bit
  • 2-2 0 mark the 2 bit
  • Solution 1001 0010

14
Binary, Hex, and Decimal
  • It is easier to see it in the table

Bit 128 64 32 16 8 4 2 1
mark 1 0 0 1 0 0 1 0
15
Binary, Hex, and Decimal
  • You try a few
  • Change 77 to binary
  • Change 528 to binary

16
Binary, Hex, and Decimal
  • Solutions
  • Change 77 to binary 100 1101
  • Change 528 to binary 10 0001 0000

17
Binary, Hex, and Decimal
  • HEXADECIMAL or Base 16
  • Some interactions with the computer use base 16
    to communicate. We use
  • A10
  • B11
  • C12
  • D13
  • E14
  • F15

18
Binary, Hex, and Decimal
  • We still use the basic POWERS OF 16
  • 1601 16116
  • 162256 1634096
  • EXAMPLE FA4 Fx256 Ax16 4x1
  • Or..15x256 10x16 4x1
  • 3840 160 4 4004
  • (remember F15, A10)

19
Binary, Hex, and Decimal
  • What is nice about Hex, is that we can convert to
    binary very easily, by using in groups of 4
  • FA4 15 10 4
  • 1111 1010 0100
  • Because ..
  • F 15 (dec) 1111 (bi)
  • A 10(dec) 1010 (bi)
  • 4 4 (dec) 0100

20
Binary, Hex, and Decimal
  • And Visa Versa
  • Convert 1 0111 1101 to Hex
  • The first group 1 is just 1 (hex)
  • The second group 0111 7 (hex)
  • The third group 1101 D (hex)
  • So, the answer is 17D
  • Note 0001(bi) is the same as 1(bi)

21
Binary, Hex, and Decimal
  • You try a few
  • A) Convert A6 (hex) to decimal
  • B) Convert FD (hex) to binary then to decimal
  • C) Convert 1101 1110 1010 to Hex
  • D) Convert 12ED to decimal and binary

22
Binary, Hex, and Decimal
  • Solutions
  • A) Convert A6 (hex) to decimal
  • 166 dec
  • B) Convert FD (hex) to binary then to decimal
  • 1111 1101 and 253
  • C) Convert 1101 1110 1010 to Hex
  • DEA
  • D) Convert 12ED to decimal and binary
  • 4845 and 1 0010 1110 1101

23
N2k
  • Two basic questions in computer science are
  • If I want to represent N things, how many bits do
    I need?
  • And
  • If I have K bits, how many things can I
    represent?
  • The relationship is
  • N2k

24
N2k
  • Lets start with
  • If I have K bits, how many things can I
    represent?

25
N2k
  • Look for the pattern

Bits of things How?
1 2 0,1
2 4 00, 01, 10, 11
3 8 000, 001, 010, 011, 100, 101, 110, 111
4 16 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111
26
N2k
  • Look for the pattern

Bits of things The relationship is.
1 2 Note 2 21
2 4 Note 4 22
3 8 Note 8 23
4 16 Note 16 24
27
N2k
  • Generally speaking,

Bits of things The relationship is.
k n n2k
28
N2k
  • The second question is
  • If I want to represent N things, how many bits
    do I need?

29
N2k
  • Suppose I want to make a new Video Card that has
    14 colors (for the color impaired)
  • Then, notice
  • 2 bits gives me 4 unique colors TOO SMALL
  • 3 bits gives 8 unique colors TOO SMALL
  • 4 bits gives 16 unique colors. TOO BIG???
  • TOO BIG is ok, there are 2 extra colors. I cant
    avoid this because the number of bits is an
    INTEGER there is no ½ bit

30
N2k
  • Suppose I want to make a new Video Card that has
    1,400 colors.
  • Solution

Bits of things notes
5 2532 way too small, try a larger number
10 2101024 still too small
11 2112048 Got it!
12 2124096 Truly TOO BIG, because 211 works!
31
N2k
  • Observations
  • 1) The ANSWER IS 11 bits.
  • 2) 12 bits will work, but since 11 works too, it
    is THE answer.
  • 3) 2,048 gt 1,400 so there are a lot of extra
    values that are not used.
  • Most designers use POWERS OF 2

32
N2k
  • Student Questions
  • A telephone stores 100 phone numbers, how many
    bits does it use to access each address location?
  • My main memory has 64MB address locations, how
    many bits do I need to access each address
    location? M1,048,576 220
  • A new TV designer wants to store 512 preset
    stations how many bits are needed to access each
    preset station?

33
Excess-50 notation
  • Background
  • Computers work with numbers of all types Natural
    numbers, Integers, rational and irrational and
    complex numbers.
  • What is easy for humans is rather complicated for
    complicated for computers.
  • There a many number systems that can represent
    numbers. In this class we will only investigate
    three direct binary representation for natural
    numbers, excess notation for integers, and
    SEEMMMM format for rational numbers.

34
Excess-50 notation
  • Easier Softer way Excess50.
  • There will be NO BINARY representations in
    excess50.
  • 55 (excess50) 5 dec
  • 52 (excess50) 2 dec
  • 45 (excess50) -5 dec
  • 99 (excess50) 49 dec
  • 39 (excess50) -11 dec

35
Excess-50 notation
  • 3 (dec) 53 (excess50)
  • -3 (dec) 47 (excess50)
  • -6 (dec) 44 (excess50)
  • 55 (dec) out of range
  • -129 (dec) out of range

36
SEEMMMM format
  • SEEMMMM format
  • Background This is the easiest format I have
    seen to represent floating point (rational)
    numbers
  • This format is typical of real formats used in
    representing floating point numbers.
  • IT ILLUSTRATES the point without getting into too
    much detail!

37
SEEMMMM format
  • Pick a number, any number.
  • 45.7909
  • I can always place a number into this format
  • .457909 x E2The 457909 is the mantissa, 2 is
    the exponent the sign is positive

38
SEEMMMM format
  • So, all floating point numbers have
  • SIGN
  • MANTISSA
  • EXPONENT

This is all I need to know about a number to
represent it (or recreate it!)
39
SEEMMMM format
  • SEEMMMM has the following
  • S sign, 5 for negative 0 for Positive
  • EE exponent, excess50 notation
  • MMMM mantissa regular decimal digits
  • If my mantissa has more than 4 digits, well
    round to the nearest value

40
SEEMMMM format
  • EXAMPLE
  • How would 45.7909 look in SEEMMMM format?
  • STEP 1 get into .ZMMM format with Z nonzero
    (note the exponent)
  • 45.7909 .4579 (rounded) E2

41
SEEMMMM format
  • STEP 2 Convert the exponent into excess50
    notation
  • 2 (dec) 52 (excess50)
  • STEP 3 construct the SEEMMMM including the sign
  • 0524579answer

42
SEEMMMM format
  • Example Convert .00078 to SEEMMMM format
  • .00078 .7800 E-3
  • -3 (dec) 47 (excess50)
  • 0477800 .answer

43
SEEMMMM format
  • Example Convert 92,821,376 to SEEMMMM format
  • 92,821,376 .9282 E8
  • 8 (dec) 58 excess50
  • 5589282 answer (note the sign!)

44
SEEMMMM format
  • Example Construct the original floating point
    from 5568376 (SEEMMMM)
  • 5 ? negative value
  • 56 ? exponent is 6
  • - .8376 E6 - 837,600 .answer

45
SEEMMMM format
  • Example Construct the original floating point
    from 0477869
  • 0 ? positive
  • 47 ? exponent -3
  • .7869 E-3 .0007869 .answer

46
SEEMMMM format
  • Student problems
  • Convert 3.56008 to SEEMMMM format
  • Convert .009876 to SEEMMMM format
  • Convert 5509999 (SEEMMMM) to decimal
  • Convert 0458001 (SEEMMMM) to decimal

47
DATA REPRESENTAION
EXAMPLE Audio
48
INTRODUCTION
  • Real World -- analog/continuous data
  • Vs
  • Computer World -- digital/discrete data
  • This is the problem!

49
AUDIO DATA
  • Audio data is an analog source
  • Can be viewed as a waveform

The digital waveform approximates the analog wave
50
AUDIO
  • Changing the analog waveform to digital format is
    called digitizing. Another term is Pulse Code
    Modulation or PCM
  • What information needs to be collected?
  • method used to digitize the sound (like MP3)
  • sampling rate in samples per sec (50KHz)
  • Data transfer rate
  • Number of bits per sample (4,8,16, 32,)
  • Recorded in mono or stereo

51
AUDIO
  • Example
  • CD quality, you sample at 44.1 kHz, stereo, with
    16 bits per sample (or 2bytes/sample).
  • Question How much space will a one-minute
    CD-quality song require?
  • Ans 44,100samples/sec x 2bytes/sample x 2
    (stereo) x 60 sec/min 10,584,000 bytes
  • Convert to MB you divide by M1048576 Gives
    you 10.09MB

52
AUDIO
  • Example continued
  • How long will this take to download from the
    internet via a ISDN connection at 64kbps?
  • Ans 10,584,000 bytes x 8bits/byte / (64(1024)
    bits/sec) x 1min/60sec 21.5 minutes! Formula
    is SIZE/RATE TIME
  • remember K1024

53
AUDIO
  • Based on the previous example, the need for
    compression or coding music is very important
  • Lets look at MP3 audio format (MP3The
    compression standard for MPEG-1 Layer 3 audio)
  • It is a lossy data compression standard (as
    opposed to lossless data compression)
  • This means that DATA IS LOST DURING THE
    COMPRESSION PHASE

54
AUDIO
  • MP3 audio format
  • They say MP3 Coding to mean the process of
    changing the digital music into a compressed
    format (encoding) and then converting the MP3
    file from a series of 0s and 1s into audible
    sound (decoding)

55
AUDIO
  • How it works
  • The human auditory system 2kHz -20KHz
  • More sensitive between 2.5-5KHz less sensitive
    over 16KHz
  • audio signal a masking If another tone lies
    below this masking threshold, it will be masked
    by the louder tone and remains inaudible.

56
AUDIO
57
AUDIO
  • How it works
  • So, eliminate or use less encoding for
  • Below 2.5 KHz and above 20KHz (or 16KHz)
  • Tones hidden by other tones
  • And Sample more between 2.5 and 5KHz

58
Background Image
  • World map of major Internet routers pathways
Write a Comment
User Comments (0)
About PowerShow.com