cisf hardware

Upload: thinesshvarank

Post on 02-Jun-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Cisf Hardware

    1/32

    Computer Hardware: Basic Definitions

    Programming: The planning, scheduling, or performing of a task or event

    Computer program: A sequence of instructions for a computer to execute

    Computer: An electronic, programmable device that can store, retrieve, and processdata

    Modern computers based on the von Neumann architecture

    Information: General, abstract knowledge

    Data: Information to be processed by a computer

    Must be in form computer can understand

    Computer converts data to information

    Computer system consists of 2 general components:

    1. Hardware

    2. Software

    Units

    Unit Quantity symbol

    Bit (binary digit) atomic piece of storage/memory b

    Byte: 8 bits smallest standard size of storage/data BSecond sHertz Speed H

    Common prefixes

    Prefix Value Symbol Quantity

    Tera 240 = 1, 099, 511, 627, 776 t memory, speedGiga 230 = 1, 073, 741, 824 g memory, speed

    Mega 220

    = 1, 048, 576 m memory, speedKilo 210 = 1, 024 k memory, speedMilli 103 (0.001) m timeMicro 106 (0.000001) timeNano 109 (0.000000001) n time

    1

  • 8/11/2019 Cisf Hardware

    2/32

    Computer Hardware: Basic Definitions (2)

    Approximations

    Prefix Approximate Value

    Tera 1012

    = 1, 000, 000, 000, 000Giga 109 = 1, 000, 000, 000Mega 106 = 1, 000, 000Kilo 103 = 1, 000

    2

  • 8/11/2019 Cisf Hardware

    3/32

    Computer Hardware: Basic Components

    Represents physical components

    2 general types

    Computer proper

    1. Main memory

    2. Central Processing Unit (CPU)

    3. Bus

    Peripherals

    Add-ons

    E.g., printer, DVD drive, hard disk

    3

  • 8/11/2019 Cisf Hardware

    4/32

    Computer Hardware: Memory - Intro

    Refers to data storage components of computer

    Hierarchy of memory types:

    Type Speed Cost NatureRegister fastest most expensive volatileCache volatileRAM slowest least expensive volatileROM nonvolatile

    Volatilememory loses its contents when computer is powered off

    Stores everything used by the computer:programs, data, ...

    Stored electronically

    Standard approach uses bi-stable (two-state) device

    Transistors used - electronic switches

    When voltage applied to base, electricity flows from collector to emitter

    Switch is on

    No voltage to base, no flow

    Switch is off

    Transistor represents a bit(binary digit) of data

    Each transistor can represent 2 values:

    on, and

    off

    Values represented as 1 and 0

    Byteconsidered basic unit of storage

    4

  • 8/11/2019 Cisf Hardware

    5/32

    Computer Hardware: Memory - RAM

    RAM stands for Random Access Memory

    Consists of a linear sequence of storage locations (cells, words, ...)

    Each byte has a unique address, numbered from 0 to total amount of memory - 1

    Often, bytes grouped together into words

    Memory generally measured in terms of mega or gigabytes

    RAM is primary storage area for computer during operation

    Often referred to as primary storage, main memory

    Stores both programs and data

    When power turned off, all switches open

    Memory becomes 000000000000000...

    Contents must be loaded during operation

    Physically exists as an array of cells

    Each row and column has a wired connection

    To access a particular memory cell, activate the connections for its row andcolumn

    5

  • 8/11/2019 Cisf Hardware

    6/32

    Computer Hardware: Memory - RAM (2)

    Types of RAM

    Dynamic (DRAM)

    Electricity stored in a capacitorTransistor controls amount (voltage) stored

    If greater than about 50% capacity 1

    If less than about 50% capacity 0

    Capacitors lose charge over time (msec)

    Computer must refreshvalue in each bit on a regular basis

    Done thousands of times per second

    Hence: dynamicRAM

    Static (SRAM)

    Uses multiple transistors per bit

    Value does not need to be refreshed

    Compared to DRAM

    1. Faster (no need to refresh)

    2. More expensive

    3. Larger

    Hence, not used for main memory

    Typical time to access data: 50 nsec

    6

  • 8/11/2019 Cisf Hardware

    7/32

    Computer Hardware: Memory - ROM

    ROM stands for Read Only Memory

    Often called BIOS (Basic InputOutput System)

    Data permanently stored - cannot be changed Hardwired using diodes

    Stores parts of operating system needed to start computer

    7

  • 8/11/2019 Cisf Hardware

    8/32

    Computer Hardware: Seconday Storage - Intro

    Secondary storage refers to memory that is not part of the computer proper

    Examples:

    Disks

    Tapes

    CDR

    DVD

    Flash memory

    These types of memory are nonvolatile:

    They retain their contents when unpowered

    Without secondary storage, programs, data, etc. would need to be typed into acomputer every time it was turned on

    These devices generally are magnetic or optical in nature

    8

  • 8/11/2019 Cisf Hardware

    9/32

    Computer Hardware: Secondary Storage - Magnetic Devices

    1. Disks

    Typical disk structure:

    Bits stored as alignments of magnetic particles

    Microscopic magnetic particles have north and south poles

    One alignment corresponds to a 1 bit, the other to a 0 bit

    Data bits appear sequentially along a track

    Disk addresses consist of track, block, and byte offset

    Block size multiple of 512 bytes

    Data transfer is a whole block at a time

    9

  • 8/11/2019 Cisf Hardware

    10/32

    Computer Hardware: Secondary Storage - Magnetic Devices (2)

    Read/write process: Given a disk address to access

    Disk spins

    Typically 7200 rpm

    8.33 msec per 1 rotation

    Position arm over appropriate track

    Called seek time

    E.g., 0.02 msec to move to adjacent track

    Wait until appropriate block rotates under head - latency time (fast) Called (rotational) latency

    E.g., 0.02 msec to move to adjacent track

    Best case: 0 msec

    Worst case: 8.33 msec

    Read the block

    Called read time

    Requires 8.33/nmsec, wheren is number of blocks per track

    10

  • 8/11/2019 Cisf Hardware

    11/32

    Computer Hardware: Secondary Storage - Magnetic Devices (3)

    Disk pack

    Set of disks packaged as a rigid unit

    Each arm has 2 read/write heads - one for each adjacent surface

    Actuator moves arms as a unit

    Disk address will include surface

    Cylinder: set of tracks that can be read/written for a given position of theactuator

    Data transfers flow through a buffer

    Part of memory reserved for data transfers

    Usually can hold several disk blocks

    Want efficient data transfer

    Factors that affect transfer speed:

    Physical record structure

    File organization

    Buffer management

    11

  • 8/11/2019 Cisf Hardware

    12/32

    Computer Hardware: Secondary Storage - Magnetic Devices (4)

    Disk is a random access device

    Can access disk address independently of others

    2. Tape

    Tape has 8 tracks

    Each track stores one bit

    Bytes stored sequentially along tape

    Tape is sequential access device

    Given an address, must pass over all data that precedes it

    Significantly slower than disk

    Used for long-term storage of files

    12

  • 8/11/2019 Cisf Hardware

    13/32

    Computer Hardware: Secondary Storage - Optical Devices

    CDR and DVD basically the same

    Structure is similar to disk structure, except have continuous spiral instead of sepa-rate tracks

    Bits stored as differences of reflectivity

    Laser shines on disk

    Light is reflected into a sensor

    Bright interpreted as 1, dull as 0

    CDROM

    Plastic substrate has bumps burned in with laser

    Shiny aluminum coated over the substrate

    Laser light shining on a bump reflected away from sensor, so appears dark (rep-resenting a 0)

    Data cannot be changed

    13

  • 8/11/2019 Cisf Hardware

    14/32

    Computer Hardware: Secondary Storage - Optical Devices (2)

    CD-R

    Uses a heat-sensitive, translucent dye instead of bumps

    When heated, dye becomes opaque

    To write a 0, heat spot on CD with write laser

    More powerful than read laser

    Read laser not strong enough to affect dye

    Can only be written once

    14

  • 8/11/2019 Cisf Hardware

    15/32

    Computer Hardware: Secondary Storage - Optical Devices (3)

    CD-RW

    Uses a phase-change chemical

    In crystalline form, is translucent

    In amorphous form, is opaque

    When melted and cooled quickly, becomes amorphous

    When melted and cooled slowly, becomes crystalline

    Initially, compound in crystalline form

    To write a 0, melt and cool quickly

    To overwrite a 0 with a 1, melt and cool slowly

    15

  • 8/11/2019 Cisf Hardware

    16/32

    Computer Hardware: Flash Memory

    Flash memory is like ROM on the motherboard

    However, it uses an EEPROM - EelectronicallyErasableProgrammable ROM

    Using transistors and quantum effects at the atomic level, a charge can be semi-permanantly stored in a memory cell

    The charge can be removed at a later date

    16

  • 8/11/2019 Cisf Hardware

    17/32

    Computer Hardware: Representation

    1. Integers (whole numbers)

    Each digit of a binary integer represents a power of 2

    In decimal (base 10), each digit represents a power of 10:182610= 1 103 + 8 108 + 2 101 + 6 100

    In binary (base 2), each digit represents a power of 2:101101012= 1 2

    7 + 0 26 + 1 25 + 1 24 + 0 23 + 1 22 + 0 21 + 1 20 =1 128 + 0 64 + 1 32 + 1 16 + 0 8 + 1 4 + 0 2 + 1 1 = 18110

    Note that the largest value that can be represented is limited by the amount ofstorage allocated

    If 1 byte is used for integers, the largest integer that can be represented is

    11111111 = 2

    8

    1 = 255 If 2 bytes are used for integers, the largest integer that can be represented is

    1111111111111111 = 216 1 = 65535

    To convert decimal representation to binary: Cast out 2s

    Steps:

    (a) Divide decimal representation by 2

    (b) Write down the remainder

    (c) Repeat the previous 2 steps, using the quotient for the dividend

    (d) Continue until quotient is 0(e) Write the remainders in the reverse order in which they were calculated

    Example: 5310(a) 53/2 = 26R1

    (b) 26/2 = 13R0

    (c) 13/2 = 6R1

    (d) 6/2 = 3R0

    (e) 3/2 = 1R1

    (f) 1/2 = 0R1

    (g) Answer= 110101

    17

  • 8/11/2019 Cisf Hardware

    18/32

  • 8/11/2019 Cisf Hardware

    19/32

    Computer Hardware: Representation (3)

    2. Floating point (real) numbers

    Represented using scientific notation:32.746 107 = 327, 460, 000

    In the computer, only the values are stored:sign mantissa sign exponent

    Since storage is of fixed size, a fixed set of bits are used for the mantissa andexponent

    In addition, the decimal point is assumed to be in a specific location

    For example (base 10):

    (a) Assuming decimal is in front of first digit of mantissa

    (b) 4 digits for mantissa(c) 2 digits for exponent

    327, 460, 000 =.32746 109 +3274 + 09

    This leads to loss of precision(inability to represent all digits in original)

    It increases the range of values that can be represented:

    Largest value: 9999 1099

    (As opposed to 9999999 in decimal using 8 digits)

    Binary representation is used for mantissa, exponent, and signs in the computer

    19

  • 8/11/2019 Cisf Hardware

    20/32

    Computer Hardware: Representation (4)

    3. Characters

    There is no direct correlation between printable characters and binary represen-tation

    Arbitrary codes are used

    ASCII (AmericanStandardCode for InformationInterchange)

    Standard code for representing characters

    Uses 7 bits

    A represented by 6510= 01000001

    a represented by 9710= 01100001

    1 represented by 4910= 00110001

    Note: Character 1 not the same as the integer 1

    Unicode

    Extension of ASCII

    Uses up to 4 bytes

    EBCDIC

    IBM standard for mainframes

    4. Parity bits

    Extra bit to help insure data integrity

    Odd parity means the number of 1s in a byte will add to an odd number

    The parity bit is set to insure this is the case

    For example:00110101 10011010100110100 000110100

    If an extended byte does not have the proper parity, an error has occured

    20

  • 8/11/2019 Cisf Hardware

    21/32

    Computer Hardware: Representation (5)

    5. Hexadecimal

    Used to simplify representation of binary values

    Hexadecimal is base 16 Requires 16 digits

    Uses letters in addition to the digits 0 - 9

    hex digit 0 1 2 3 4 5 6 7 8 9 A B C D E Fvalue 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

    Every byte can be represented by a pair of hex digits

    Example:

    110100102 is represented as 1101 = 1310=D, 0010 = 210= 2, or D216

    21

  • 8/11/2019 Cisf Hardware

    22/32

    Computer Hardware: Central Processing Unit (CPU)

    Brains of computer

    Components:

    1. Registers Special high-speed memory cells local to the CPU

    2. Arithmetic Logic Unit (ALU)

    Performs computations

    3. Control unit (CU)

    Controls operation of the system

    22

  • 8/11/2019 Cisf Hardware

    23/32

    Computer Hardware: Central Processing Unit (CPU) (2)

    Operation based on von Neumannarchitecture

    1. Computer composed of following systems

    (a) Memory(b) CPU

    (c) IO system

    2. Programs are stored in memory

    3. Program statements are executed sequentially

    23

  • 8/11/2019 Cisf Hardware

    24/32

    Computer Hardware: CPU - Registers

    Storage local to CPU

    High-speed memory directly accessible to CPU components

    Examples:1. General purpose registers to hold operands and results of computations

    2. Accumulator - Specially designated register for operands and results

    3. 0

    4. +1

    5. -1

    6. Memory Address Register (MAR)

    Stores address of memory location to be accessed

    Must be large enough to store largest address in memory address space

    E.g., 4GB= 230 memory requires 31 bits

    7. Memory Data Register (MDR)

    Stores data to be retrieved from or saved to memory

    One or more bytes in width

    8. Instruction Register (IR)

    Holds instruction being executed Must be large enough to hold largest instruction

    E.g., 4, 8, 16 bytes

    9. Program Counter (PC)

    Holds address (in memory) of next instruction to be executed

    Must be large enough to store largest address of memory reserved for holdingprograms

    24

  • 8/11/2019 Cisf Hardware

    25/32

    Computer Hardware: CPU - ALU

    Types of operations performed:

    Arithmetic

    Addition

    Subtraction

    Logic

    AND

    1 0

    1 1 00 0 0

    OR1 0

    1 1 10 1 0

    NOT

    1 00 1

    EXCLUSIVE OR

    1 0

    1 1 00 0 1

    Shifts

    Shift left

    11001010

    10010100Shift right

    11001010 01100101

    Rotate left11001010 10010101

    Rotate right11001010 01100101

    25

  • 8/11/2019 Cisf Hardware

    26/32

    Computer Hardware: CPU - ALU (2)

    Operands can be loaded from registers, or from elsewhere

    Results can be stored into a register, or elsewhere

    The control line selects the operation to be performedCan be designed to perform more complex operations

    But requires more circuitry

    26

  • 8/11/2019 Cisf Hardware

    27/32

    Computer Hardware: CPU - CU

    Manages operation of computer

    Operates using following cycle

    1. Retrieve instruction from memory(a) This step referred to as a fetch

    (b) A copyof the instruction is loaded into the IR

    (c) Increment the PC

    It now holds the address of the next instruction to be executed

    2. Decode the instruction

    Each instruction is in binary format

    Instructions of form opcode operands

    There is one opcode for each specific operation the CPU can perform

    Operands may take the form of actual values (e.g., 105, c) or addresses (wherevalues are stored)

    Instructions may have from 0 to 3 operands

    For example:

    10100101 01100000

    11010101 00000110

    10000101 01100001

    8 bit opcode, 8 bit operand

    Performsx= y + 6

    27

  • 8/11/2019 Cisf Hardware

    28/32

    Computer Hardware: CPU - CU (2)

    The instruction decoder circuitreads the opcode of the instruction

    The circuitry of this decoder converts the opcode into signals that carry outthe execution of the instruction; e.g.

    To add the contents of 2 registers and store the results into another register To load the value at a particular memory address into the MDR

    The signals enable various bus lines and devices needed for the task

    3. Execute instruction

    The circuitry carries out the task

    28

  • 8/11/2019 Cisf Hardware

    29/32

    Computer Hardware: CPU - Memory Access

    Execution may require transfer of data between memory and CU

    Fetch (read)

    1. Load address into MAR

    2. Copycontents of address into MDR

    3. A fetch is non-destructive- contents of address are unaffected

    29

  • 8/11/2019 Cisf Hardware

    30/32

    Computer Hardware: CPU - Memory Access (2)

    Store (write)

    1. Load address into MAR

    2. Load value into MDR

    3. Copy contents of MDR into address4. A write is destructive- original contents of address are lost

    30

  • 8/11/2019 Cisf Hardware

    31/32

    Computer Hardware: CPU - Cache Memory

    To speed up processing, CPU may have cache memory

    This is high-speed memory local to CPU

    Access time about 10 nsGenerally a few KB in size

    Operation based on Principle of Locality:

    What has been recently accessed is likely to be accessed again in near future

    Used as follows:When CPU needs something from memory

    Search cache for itemif not found in cacheretrieve from main memorystore in cache

    To see how it improves speed:

    Assume memory fetch requires 50 ns

    Assume memory fetch requires 10 ns Assume data will be found in cache 60% of the time

    Average time to fetch a piece of data:(0.60 10) + (0.4 (10 + 50)) = 6 + 24 = 30 ns on average

    Why not use cache for RAM if so fast?

    Expensive

    31

  • 8/11/2019 Cisf Hardware

    32/32

    Computer Hardware: CPU - Processing Speed

    Speed measured in

    Hertz(mega, giga)

    This refers to how fast the system clock ticks

    MIPS (Millions ofInstructionsPer Second)

    May require more than one clock tick per instruction

    FLOPS (FLOatingPoint operations per Second)

    Considered a more realistic measurement of speed

    The system clock controls the speed at which instructions are executed

    In general, each major step in CPU takes one clock cycle:

    FetchDecode

    Execute

    Fetch data from memory

    Write result to memory

    Bus width affects transfer speeds

    If bus width is 16 bits, but data is 32 bits, requires 2 memory fetches