To the Student - PowerPoint PPT Presentation

1 / 76
About This Presentation
Title:

To the Student

Description:

To look the insides of computers. To learn the jargon of computers ... radix point * Wang-Jiunn Cheng 28. Basic Computer Concept. Storage Integers ... – PowerPoint PPT presentation

Number of Views:128
Avg rating:3.0/5.0
Slides: 77
Provided by: cwin
Category:
Tags: radix | student

less

Transcript and Presenter's Notes

Title: To the Student


1
To the Student
  • What are we here for?
  • To look the insides of computers
  • To learn the jargon of computers
  • 200-MHz CPU, 8MB RAM, CD-ROM, , etc.
  • This course will provide a foundation, but it is
    NOT the end.
  • The more you learn, the better prepared you will
    be.
  • The most rewarding skill you can develop is the
    ability to learn on your own.

2
The Study of Algorithms(I)
  • A set of steps that defines a task is performed
    (an ordered set of unambiguous, executable steps
    that define a terminating activity.)
  • Problem to be solving in general.
  • Algorithm a solution for solving a problem.
  • Program a machine-compatible representation of
    an algorithm.

3
The Study of Algorithms(II)
  • Software a collection of programs and the
    algorithms.
  • Programming Language to transform the conceptual
    algorithm into a set of instructions .
  • Hardware a machine to realize or execute
    instructions unambiguously.

4
The Euclidean algorithm
  • To fine the Greatest Common Divisor of two
    positive integers
  • Step 1. Assign two input values M and N (larger
    and smaller respectively).
  • Step 2. Divide M by N, and call the remainder R.
  • Step 3. If R is not 0, the assign M of N, assign
    N of R, and return to step 2 otherwise, the GCD
    is the value of N.

5
The Origins of Computing Machines
  • 16??-17??-18??-19??
  • Gear-driven calculators
  • Information as holes in paper cards
  • Vacuum tubes
  • Transistors
  • Integrated circuits
  • Optic
  • ...

6
The Evolution of Computer Science
Execution of
Limitations of
Algorithms
Analysis of
Communi- cation of
Representation of
Discovery of
The central role of algorithms in computer science
7
CHAPTER ONEData Storage
  • Storage of Bits
  • Main Memory
  • Mass Storage
  • Representing Information as Bit Patterns
  • The Binary System
  • Storing Integers
  • Storing Fractions
  • Data Compression
  • Communication Errors

8
Storage of Bits
  • BIT binary digit
  • 0 and 1
  • on and off (a switch)
  • open and closed (a relay)
  • raised and lowered (a flag)
  • reflected and scattered (a laser beam)
  • any device with two states

9
Boolean Operations
  • 1815-1864 mathematician George Boole
  • truth or falseness manipulation
  • P AND Q (both P and Q)
  • P OR Q (ether P or Q)
  • P XOR Q (ether P or Q but not both)
  • NOT P

10
Gates and Flip-Flops
  • Gate a device that produces the output of
    Boolean operation
  • AND gate, OR gate, NOT gate, XOR
  • Flip-Flop a circuit that produces an output
    value of 0 or 1 that remains constant until a
    temporary pulse from another circuits causes it
    to change to the other value.

11
A Simple Flip-Flop Circuit
Input
Output
Input
12
Other Storage Techniques
  • Magnetic core a small donut-shaped ring magnetic
    material with two directions of magnetic field.
  • Capacitor charged or discharged
  • Nonvolatile (core) versus volatile (capacitor)
    storage.
  • a refresh circuit to replenish/charge a capacitor
    periodically, so the capacitor-type of storage is
    often called dynamic memory.

13
Hexadecimal Notation
  • Bit pattern Hexadecimal
  • 0000 0
  • 0001 1
  • 0010 2
  • 0011 3
  • 0100 4
  • 0101 5
  • 0110 6
  • 0111 7
  • 1000 8
  • 1001 9
  • 1010 A
  • 1011 B
  • 1100 C
  • 1101 D
  • 1110 E
  • 1111 F

14
Main Memory(I)
  • Byte a typical storage with size of eight bits
  • KB (kilobyte) 210 1,024 1,000 103
  • MB (megabyte) 220 1,048,576 1,000,000 106
  • GB (gigabyte) 230 1,024MB 1,000,000,000
    109

15
Main Memory(II)
  • Address to identify individual storage
    cells(bytes) in a machines main memory.
  • Each cell has a unique name.
  • Addressed as 0, 1, 2, N-1, where N 2n bytes
    in main memory
  • each cell can be accessed individually, so often
    referred as random access memory (RAM)
  • DRAM, SRAM, SDRAM,

16
Main Memory(II)
  • MSB
  • most significant bit (high-order end) of a cell
  • LSB
  • least significant bit (low-order end) of a cell

17
Mass Storage
  • Due to volatility and limited size of a
    computers main memory, most computer systems are
    provided with additional nonvolatile and larger
    size of storage devices such as magnetic
    disks/tapes, CDs, etc.

18
Magnetic Disks(I)
  • Organization
  • Track a concentric circle of a disk surface
  • Sector an arc of a track
  • Cylinder a set of tracks
  • Types
  • Floppy disk 3½-inch diskette with 300 rpm and
    1.44MB
  • Hard disk case is sealed at the factory with
    such as 7,200 rpm and 9GB

19
Magnetic Disks(II)
  • Performance
  • Seek time
  • Rotation delay or latency time
  • Transfer time
  • Measurement
  • Access time seek time rotation delay
  • Transfer rate
  • Comparison
  • nanoseconds(109)
  • milliseconds (103)

20
Compact Disks
  • CD-ROM
  • a single spiraled track with 550630 MB
  • CD-WORM
  • write-once-and-read-many-times
  • DVD
  • digital versatile disk
  • 10GB
  • MO
  • etc.

21
File Storage and Retrival
  • Physical record - a sector of a disk
  • Logical record - a natural block of data
  • Buffer - main memory to store logical records
  • Decreasing degrees of random access
  • main memory - individual bytes
  • magnetic disk - entire sector of data
  • compact disk - entire sector but more time to
    locate spiraling track
  • magnetic tape

22
Representing Text
  • ASCII American Standard Code for Information
    Interchange
  • 7-bit, 128 bit patterns
  • ANSI American National Standards Institute
  • Unicode
  • 16-bit, 65536 bit patterns
  • natural language supports
  • Chinese, Japanese, etc.
  • ISO International Organization for
    Standardization

23
Representing Numeric Values(I)
  • Base ten system - decimal system
  • Base two system - binary system
  • Numeric conversion between number bases
  • Base 10 to base 2
  • Base 2 to base 10
  • Base 10 to another base
  • Another base to base 10
  • etc.

24
Representing Numeric Values(II)
  • 2-10 Decoding the binary representation
  • 10-2 Encoding the binary representation
  • one byte 0255
  • two bytes 065535
  • two ASCII codes 00 99

25
Representing Numeric Values(III)
  • Fractional part of numbers 4Âľ
  • Floating-point notation
  • Too large of values or too small of fractions
  • Errors of overflow or truncation
  • etc.

26
Representing Images
  • Bit map techniques - vector techniques
  • Pixel - picture element
  • three components per pixel (RGB)
  • 3-byte-per-pixel of 1280x1024 pixels
  • disadvantage not easy to be rescaled
  • Scalable fonts
  • TrueType fonts (Microsoft and Apple)
  • PostScript (Adobe Systems)

27
The Binary System
  • Binary addition
  • carry
  • Fractions in binary
  • radix point

28
Storage Integers
  • Twos complement notation
  • The complement of a pattern is by changing all
    the 0s to 1s and all the 1s to 0s
  • Sign and magnitude
  • MSB is the sign bit of the value
  • The problem of overflow
  • Excess notation

29
CHAPTER TWOData Manipulation
  • The Central Processing Unit
  • The Stored-Program Concept
  • Program Execution
  • Arithmetic/Logic Instructions
  • Communication with Other Devices
  • Other Architectures

30
The Central Processing Unit
  • An isolated part of the computer
  • performs operations such as addition on data is
    NOT directly connected to the storage cells
  • Arithmetic/logic unit
  • contains the circuitry that performs data
    manipulation
  • Control unit
  • contains the circuitry for coordinating the
    machines activities

31
The Central Processing Unit
  • CISC architecture
  • Pentium series developed by Intel
  • RISC architecture
  • PowerPC series developed by Motorola and IBM
  • In order to increase performance
  • these CPUs are capable of retrieving multiple
    bytes from memory in a single step.
  • Capable of fetching and executing more than one
    instruction simultaneously

32
Registers
  • Temporary storage of information
  • general-purpose registers
  • holding data immediately applicable to the
    operation of CPU
  • memory hierarchy
  • registers immediately needed
  • cache memory a portion copy of main memory
  • main memory needed in the near future
  • mass storage
  • special-purpose registers
  • see section 2.3

33
CPU/Memory Interface
  • Bus
  • a collection of wires used to connect CPU and
    main memory units
  • extract or read or load data from main memory
  • place or write or store data into main memory

34
Machine Instructions
  • Three categories
  • data transfer (move) group
  • LOAD and STORE instructions
  • I/O instructions
  • arithmetic/logic group
  • logic operations AND, OR, and XOR
  • arithmetic operations
  • other operations SHIFT and ROTATE...
  • control group
  • JUMP or BRANCH instructions
  • conditional and unconditional jumps

35
The Stored-Program Concept
  • John von Neumann
  • To design a control unit
  • To extract/fetch a program from main memory
  • To decode the instructions in program
  • To execute the instructions
  • machine-language
  • op-code field
  • operand fields

36
Program Execution
  • Control unit two special-purpose registers
  • Program counter
  • to hold the address of the next instruction to be
    executed
  • Instruction register
  • to hold the instruction being executed
  • repeat performing a 3-steps algorithm
  • fetch, decode, and execute

37
(No Transcript)
38
(No Transcript)
39
(No Transcript)
40
Number Systems
  • Base 2, 3, , etc.
  • Binary arithmetic
  • Bit (stands for Binary digit, 0 or 1)
  • Byte, Halfword, Word, Doubleword, Short, Long, ,
    etc.

41
Numbers as a Physical Representation
  • Rome I, II, III, IV, V, VI, , etc.
  • Base 2 101102
  • Base 3 2103 1103
  • Base 8 1076543218
  • Base 10 987654321010
  • Base 16 fedcba987654321016

42
Counting in Different Base
  • R Bk
  • 6248 682 281 480

43
CHAPTER FOURPresenting Integer Data
  • Nearly, every high-level computing language
    provides a method for storing, manipulation, and
    calculation of signed integer and real numbers.
  • Thus, we need to consider methods of representing
    and manipulating there numbers within the
    zeros-and-ones constraint of the computer.

44
Unsigned Binary
  • An 8-bit storage location can store any unsigned
    integer of value between 0 and 255.
  • 16-bit storage location
  • 0-65535 (216-1)
  • 32-bit storage location
  • 0-4,294,967,295 (232-1)

45
Storage of a 32-bit Data Word
Memory location
1 byte
31
24
23
16
15
8
7
0
Most significant bits (31-24) bits (23-16) bits
(15-8) least significant bits (7-0)
M
32-bit data word
M1
M2
M3
Next data item
M4
46
Binary-Coded Decimal (BCD)
  • Each decimal digit is individually converted to
    binary with 4 bits per digit.
  • 6810 0110 10002
  • Disadvantage BCD arithmetic is nearly always
    much slower.
  • Advantages
  • easy decimal rounding and precision
  • easy translation to character forms.

47
BCD Multiplication (Example)
  • 76 0111 0110x
    7 0111 42
    101010 7 x 6
    42 49 110001 7 x 7
    49 (1)32 0100
    0010 convert to BCD 4
    0100 1001 convert to BCD 532
    0100 1101 0010
    (13) convert to BCD
    (carry) 0001 0011

    0101 0011 0010 532 BCD

48
Representations for Signed Integers
  • Negative numbers in binary form
  • sign-and-magnitude
  • 1s complement
  • 2s complement
  • the most common method

49
Sign-and-Magnitude(I)
  • Sign most significant bit (leftmost)
  • 0 plus sign, 1 minus sign
  • 37 0100101, - 37 1100101
  • 1 0000 0000 0000 0001
  • - 1 1000 0000 0000 0001
  • - 0 1000 0000 0000 0000
  • - 32767 1111 1111 1111 1111

50
Sign-and-Magnitude(II)
  • A signed 16-bit BCD - 7999 value 7999
  • Disadvantages
  • sign is confusing2 - 4 - 2 but 12 - 4 8
  • - 0 is confusing

51
Nines Decimal Representation
  • Negative each digit - the largest numeral in
    the radix.
  • Advantages no carry, converted independently
    like a mirror
  • Base 10 radix 9s complement

52
9s Complement
  • - 467 999 - 467 532 (3-digit number)
  • - 467 9999 - 467 9532 (4-digit number)
  • 9990 9999 - 9990 9 (represents - 9)
  • normal rules of arithmetic
  • - (- value) value
  • comp base - value
  • base - ( base - value) value
  • modular rotation
  • reach 999, next 000, and then rotated

53
9ComplementCounting Process
54
Wraparound and Modulus Crossing
(1099 End-Around Carry)
300
500 799 999
0 99 499
- 499 - 200 - 0
0 100 499
300
55
Summary of 9s Complement(I)
  • Positive numbers are stated with 0, 1, 2, 3, or 4
    (the same of sign-and-magnitude).
  • Negative numbers are started with 5, 6, 7, 8, or
    9 in complementary form.
  • Negative 0 exists.

56
Summary of 9s Complement(II)
  • To change sign is to subtract each digit from 9
    (the largest digit of base).
  • To add two numbers is to simply add and
    end-around-carry if carry exists.
  • To subtract two numbers is to change sign of the
    subtrahend and then add.

57
1complement
  • Overflow 6465 - 12901000000 01000001
    10000001

58
10s Complement
  • Only a single ZERO
  • Add two numbers adding digits and ignoring the
    carry.
  • Subtract two numbers inverting the subtrahend
    and adding.
  • Negative Modulus - Value
  • 1000 - 247 753 (value of -247)
  • 10s comp 9s comp 1

59
2s Complement
  • A signed 8-bit with range - 128 value 127
  • A signed 16-bit with range - 32768 value
    32767

60
Other Bases
  • Even-numbered base can be split the same way
  • Old-numbered base is split unevenly
  • A 4-digit hexadecimal with 16s Complement
  • positive numbers start with 0-7
  • negative numbers start with 8-F

61
CHAPTER FIVEFloating Point Numbers
  • Real, floating point, numbers can expressed
    numbers with a decimal fraction a limited, fixed
    number of digits of precision with a power.
  • A potential loss of precision better precision
    in terms of larger storage requirements and
    slower calculations.

62
Exponential Notation
  • - 0.0000003579 - 0.3579 10-6

Sign of mantissa
Sign of exponent
- 0.35790 10-6
Location ofdecimal(radix) point
mantissa
base
exponent
63
Floating Point Format
  • SEEMMMMM
  • S sign of mantissa
  • 0 for positive, 5 for negiative
  • E exponent
  • excess-50 (next page)
  • M mantissa
  • stored using sing-and-magnitude format
  • Implied decimal point
  • assumed at the beginning of the five-digit
    mantissa
  • .MMMMM10EE

64
Excess-N notation
  • N is the midvalue of the exponent
  • Two-digit exponent with excess-50value 00 to 99
    stands for -50 to 49and the magnitude range
    of0.00001 10-50 lt N lt 0.99999 1049

65
Overflow and Underflow
  • Overflow magnitude too large
  • Underflow magnitude too small

0
-10-55
0.999991049
10-55
-0.999991049
Overflowregion
Overflowregion
Underflowregion
66
Normalization
  • To maximize the precision, numbers are stored
    with no leading zeros.
  • Normalization process is to eliminate leading
    zeros by adjusting (shifting) the exponent
    .MMMM 10EE
  • 246.8035 0.2468035 103 05324680
  • 1255 10-3 0.1255 101 05112550
  • -0.00000075 -0.75 10-6 54475000

67
Convert Decimal toFloating Point(I)
  • Procedure ConvertToFloat (DecimalIn Real,
    FloatOut Integer)
  • Var Mantissa Real
  • Exponent, Sign, IntegerMantissa Integer
  • Procedure StandardizeNumber
  • Begin
  • Mantissa Abs(Mantissa)
  • ( Adjust the decimal to fall between 0.1 and
    1.0 )
  • While Mantissa gt 1.00 Do
  • Begin
  • Mantissa Mantissa / 10.0
  • Exponent Exponent 1
  • End
  • While Mantissa lt 0.1 Do
  • Begin
  • Mantissa Mantissa 10.0
  • Exponent Exponent - 1
  • End
  • IntegerMantissa Round(10000.0 Mantissa)
  • End

68
Convert Decimal toFloating Point(II)
  • Procedure ConvertToFloat (DecimalIn Real,
    FloatOut Integer)
  • Var Mantissa Real
  • Exponent, Sign, IntegerMantissa Integer
  • Procedure StandardizeNumber
  • ...
  • Begin ( main procedure )
  • If DecimalIn 0.0 Then FloatOut 0
  • Else Begin
  • If DecimalIn gt 0.0 Then Sign 0
  • Else Sign 50000000
  • Exponent 50
  • StandardizeNumber
  • FloatOut Sign Explonent 100000
    IntegerMantissa
  • End
  • End

69
Addition and Subtraction
  • 05199520 04967850 ?
  • alignment 05199520 0510067850
  • add mantissa () means carry 099520 00067850
    (1)0019850
  • normalize result 05210019(850)
  • round result 05210020

70
Multiplication and Division
  • 05220000 x 04712500 ?
  • add explonents 52 47 - 50 49
  • multiply mantissas0.20000 x 0.12500
    0.025000000
  • normalize result 04825000

71
Floating Point in the Computer
  • 32 bits approximately 10-38 to 1038
  • 8-bit (256 levels) exponent excess-128
  • 23-bit mantissa stretched to 24-bit
  • an implicit or hidden leading bit 1 is not
    stored

72
IEEE Standard 754(I)
  • IEEE Computer Society
  • N (-1)S2E-127(1.M)
  • single-precision (32-bit, E8-bit, M23-bit)
  • double-precision (64-bit, E11-bit, M52-bit)

73
IEEE Standard 754(II)
  • 1.MMMMMM
  • an implied most significant bit
  • excess-127 (excess-1023) base 2

Exponent Mantissa Value 0 0 0 0 Âą 0 2-126
0.M 1254 any 2E-127 1.M 255 0 255 Âą
0 special condition
74
IEEE Standard 754(III)
  • special condition (not a number)
  • dividing zero by zero
  • square root of a negative number

75
ConversionBetween Base 10 and Base 2(I)
  • 25375 1100011000111112 1.10001100011111
    214
  • IEEE 754
  • 1-bit sign 0
  • 8-bit exponent 14127 141 100011012
  • 23-bit mantissa 100011000111110000000002

76
ConversionBetween Base 10 and Base 2(II)
  • -25.375 -11001.0112 -1.1001011 24
  • IEEE 754
  • 1-bit sign 1
  • 8-bit exponent 4127 131 100000112
  • 23-bit mantissa 100101100000000000000002

77
Packed Decimal
  • A number converted from decimal to binary to
    decimal may not be the same
  • each decimal digit is stored in BCD form
  • sign is stored in the low-order bits of the last
    byte
  • 1111 unsigned
  • 1100 positive
  • 1101 - negative
Write a Comment
User Comments (0)
About PowerShow.com