Athira Sudarsan

Embed Size (px)

Citation preview

  • 7/28/2019 Athira Sudarsan

    1/63

  • 7/28/2019 Athira Sudarsan

    2/63

    Basic Terminology

    Computer

    A device that accepts input,

    processes data, stores

    data, and produces output,

    all according to a series ofstored instructions.

    Hardware

    Includes the electronic and

    mechanical devices that

    process the data; refers to

    the computer as well as

    peripheral devices.

    Software

    A computer program that tellsthe computer how to performparticular tasks.

    Network Two or more computers and

    other devices that areconnected, for the purpose ofsharing data and programs.

    Peripheral devices

    Used to expand thecomputers input, output andstorage capabilities.

  • 7/28/2019 Athira Sudarsan

    3/63

    Brief History

    From ENIAC (Electronic Numerical Integrator andComputer) John Mauchly and John P Eckert,University of Pennsylvania (1943 - 1946)

    For war purposes, ballistic trajectory

    Weighted 30 tons, consumes 140 kwatts of electricpower, 15.000 square feet of space, only 5000addition per second

    Not a digital computer, it was a decimal computer(analog)

    John von Neuman proposed : EDVAC (ElectronicDiscrete Variable Computer) - first stored programcomputer -1945

    1946 Von Neuman and his gang proposed IAS(Institute for Advanced Studies)

  • 7/28/2019 Athira Sudarsan

    4/63

    ENIAC

  • 7/28/2019 Athira Sudarsan

    5/63

    ENIAC

  • 7/28/2019 Athira Sudarsan

    6/63

    IAS

  • 7/28/2019 Athira Sudarsan

    7/63

    2.1. Evolution - History of Commercialcomputers

    First Generation : 1950 Mauchly & Eckert developedUNIVAC I, used by Census Beureau

    Then appeared UNIVAC II, and later grew to UNIVAC1100 series (1103, 1104,1105,1106,1108) - vacuumtubes and later transistor

    Second Generation : Transistors, IBM 7094 (althoughthere are NCR, RCA and others tried to develop theirversions - commercially not successful)

    Third Generation : Integrated Circuit (IC) - SSI. IBMS/360 was the successful example

    Later generations (possibly fourth and fifth) : LSI andVLSI technology

  • 7/28/2019 Athira Sudarsan

    8/63

    4th Generation Computers

    1971-Present: Microprocessors

    Miniaturization took over From SSI (10-100 components per chip) to

    MSI (100-1000), LSI (1,000-10,000), VLSI(10,000+)

    Thousands of ICs were built onto a single silicon

    chip(VLSI), which allowed Intel, in 1971, to

    create the worlds first microprocessor, the 4004,which was a fully functional, 4-bit system that ran at

    108KHz.

  • 7/28/2019 Athira Sudarsan

    9/63

    2.1. Evolution - history of commercial computers

    Table 2.1

    Approx Speed

    Generation Time Technology opr/sec)

    --------------------------------------------------------------------------1. 1946-57 Vacuum tube 40,000

    2. 1958-64 Transistor 200,000

    3. 1965-71 SSI & MSI 1,000,000

    4. 1972-77 LSI 10,000,0005. 1978- VLSI 100,000,000

    --------------------------------------------------------------------------

  • 7/28/2019 Athira Sudarsan

    10/63

  • 7/28/2019 Athira Sudarsan

    11/63

    Functional Units

    Figure. Basic functional units of a computer.

    Processor

    ANDARITHMETIC

    LOGIC

    CONTROL

    OUTPUT

    MEMORY

    INPUT

  • 7/28/2019 Athira Sudarsan

    12/63

    INPUT UNIT:

    Converts the external world data to a binary format, which

    can be understood by CPU

    Eg: Keyboard, Mouse, Joystick etc

    OUTPUT UNIT:

    Converts the binary format data to a format that a commonman can understand

    Eg: Monitor, Printer, LCD, LED etc

  • 7/28/2019 Athira Sudarsan

    13/63

    Memory Unit Store programs and data

    Two classes of storage

    Primary storage (RAM, SRAM and DRAM) Fast

    Programs must be stored in memory while they are beingexecuted

    Temporary memory-data lost when power gone

    Higher cost

    Secondary storage larger and cheaper(storehouse)

    Stores bulk of programs and databases.

    Floppy disk, hard disk and Magnetic tape,CD,etc

  • 7/28/2019 Athira Sudarsan

    14/63

    Central Processing Unit (CPU)

    Control unit+ ALU

    Brain of computer

    Perform all calculations

    Takes all decisions

    Control all units

    Eg:-Intel Pentium

  • 7/28/2019 Athira Sudarsan

    15/63

    Arithmetic and Logic Unit (ALU)

    Most computer operations are executed in

    ALU of the processor.

    Load the operands into memory bring

    them to the processor perform operation

    in ALU store the result back to memory

    or retain in the processor.

    Registers

    Fast control of ALU

  • 7/28/2019 Athira Sudarsan

    16/63

    Control Unit

    All computer operations are controlled by thecontrol unit.

    The timing signals that govern the I/O transfersare also generated by the control unit.

    Control unit is usually distributed throughout themachine instead of standing alone.

    Operations of a computer: Accept information in the form of programs and data through

    an input unit and store it in the memory Fetch the information stored in the memory, under program

    control, into an ALU, where the information is processed

    Output the processed information through an output unit

    Control all activities inside the machine through a control unit

  • 7/28/2019 Athira Sudarsan

    17/63

    Framework

  • 7/28/2019 Athira Sudarsan

    18/63

    Get

    instructio

    n from

    memory

    Framework

  • 7/28/2019 Athira Sudarsan

    19/63

    Read

    from

    register

    file

    Get

    instructio

    n from

    memory

    Framework

  • 7/28/2019 Athira Sudarsan

    20/63

    Read

    from

    register

    file

    Use ALUGet

    instructio

    n from

    memory

    Framework

  • 7/28/2019 Athira Sudarsan

    21/63

    Read

    from

    register

    file

    Use ALUGet

    instructio

    n from

    memory

    Access

    memory

    Framework

  • 7/28/2019 Athira Sudarsan

    22/63

    Read

    from

    register

    file

    Use ALUGet

    instructio

    n from

    memory

    Access

    memory

    Framework

    Write register file

  • 7/28/2019 Athira Sudarsan

    23/63

    What *exactly* is memory?

    Interface:

    reads: input

    output writes:

    input

    output

    Variation Multi-ported

    May read or write multiple items at the same time

    Must add inputs / outputs

    Address

    Data contained in address

    Address & Data to place in address

    None

  • 7/28/2019 Athira Sudarsan

    24/63

    ALU DATAPATH and CONTROL Processors Datapath

    Control unit

    Datapath-collection of units-memory, programcounter, registers, Arithmetic logic unit, and

    control unit. Control unit-how data flows through datapath.

    Memory unit: holds data and instructions

    Various locations-specific address

    Store and give data to datalines in response to address givenby address lines and control signals.

    Read and write signals

  • 7/28/2019 Athira Sudarsan

    25/63

    ALU DATAPATH and CONTROL

    Data saved

    Address LocationsAddress

    0006

    0005

    0004

    0003

    0002

    0001

    Address lines

    MEMORY UNIT

    Read signal

    Write signal

    Data lines

  • 7/28/2019 Athira Sudarsan

    26/63

    ALU DATAPATH and CONTROL

    Registers Temporary high speed memory.

    Store instructions, data, results.

    General purpose Registers(GPRs)-data/address Instruction register

    Program counter (PC) instruction pointer

    Holds address of current or next instruction

    Incremented after each fetching

  • 7/28/2019 Athira Sudarsan

    27/63

    ALU DATAPATH and CONTROL

    Control unit Flow of information

    Generates control signals

    ALU control, memory write, memory read,input read, output write, etc.

    ALU Arithmetic and logical operation

    Integer arithmetic add, subtract etc.)

    Bitwise logic operations (AND,OR, NOT, XOR)

    Bit shifting operations

    Operands

    Code from control unit

    (Control signals)

    Output

  • 7/28/2019 Athira Sudarsan

    28/63

    Working of ALU based on Datapath

    and control

    Register(2)

    Register(1)

    Register(0)

    A B

    R

    Write(2)

    Write(1)

    Write(0)Read(2)

    Read(2)

    Read(2)

    F D

    M hi h

  • 7/28/2019 Athira Sudarsan

    29/63

    Memory hierarchy

  • 7/28/2019 Athira Sudarsan

    30/63

    Memory Hierarchy

    Memory Hierarchy- comparing cost and

    performance

    Response time, cost and size

    4 major storage levels Internal-processor registers, cache

    Main- RAM

    Secondary storage-online

    Tertiary offline storage

    M Hi h

  • 7/28/2019 Athira Sudarsan

    31/63

    Memory Hierarchy Top level-CPUs General purpose registers

    Fast access

    Small size Expensive

    Level one cache size small, but greater than CPU reg.

    Level two and level three caches

    Main memory Low cost, general purpose (RAM)

    Secondary Solid state memory Cheaper, large in size

    Virtual memory Work like main memory, hard disk, slower, low cost

  • 7/28/2019 Athira Sudarsan

    32/63

    Cache memory

    Cache very high speed memory used by CPU

    to reduce the average time to access memory

    smaller, faster memory which stores copies of the

    data

    Read or write from cache if copy present-faster

  • 7/28/2019 Athira Sudarsan

    33/63

    If requested data in cache- cache hit -faster

    Otherwise- cache miss -access from originalmemory-slower

  • 7/28/2019 Athira Sudarsan

    34/63

    Cache memory

    Cache- small Based on the principle locality of reference

    Same value or place where it is stored is accessed

    often Temporal locality-at one point of time a particular

    memory accessed- likely that same location

    referenced again in near future

    Spatial locality -if one memory accessed at a time,likely that nearby memory loc. referenced in near

    future.

    so store a copy of data in nearby loc. to cache

  • 7/28/2019 Athira Sudarsan

    35/63

    Cache memory- Bookshelf analogy

    College libraryhard disk

    Your book shelf- main memory Your study table- cache memory

    Easiness of access

    Book shelf (main) easier than college shelf (harddisk)

    Study table (cache) easier than book shelf

    Temporal locality- one book in bookshelf usedagain and again in nearby time, so keep on

    study table Spatial locality- more books in book shelf may b

    used, better to keep on study table

  • 7/28/2019 Athira Sudarsan

    36/63

    Main memory

    Working memory of CPU

    RandomAccess Memory

    Read Only Memory RAM-main memory

    Constructed from ICs

    Need electrical power to maintain data Volatile memory

    Access time nanoseconds.

    RAM divided into two-SRAM,DRAM

  • 7/28/2019 Athira Sudarsan

    37/63

    SRAM Flipflops-storage

    Data unchanged unless new data entered DRAM

    Capacitors-storage

    Data changes due to charge leakage

    Refresh storage elements periodically

    ROM Permanent storage

    Non-volatile-data retains even after power down(off)

    Quick and accurate

    Data cant be altered

    PROM

  • 7/28/2019 Athira Sudarsan

    38/63

    PROM Already programmed or blanked state

    Program entered externally

    Never be altered

    Unique purpose programming

    Mistakes cannot be corrected

    EPROM Purchased blank or programmed one

    Can be erased if needed

    Data/ programs retrieved several times

    Reprogram- erase data by a UV light burst

    Erased and mistakes corrected

    Can add improvements in program

    EEPROM-electrically erasable PROM Erased and programmed by electric current

    No need to remove from computer for programming

  • 7/28/2019 Athira Sudarsan

    39/63

    Secondary memory

    No direct access by CPU

    Computer uses I/O channels to access

    Non-volatile Hard disk drives

    Time taken to access data-few

    milliseconds Optical storage-CD,DVD drives, USB,

    floppydisks, magnetic tapes etc.

  • 7/28/2019 Athira Sudarsan

    40/63

    Virtual memory Operating system uses hard disk space acting like main

    memory-Creates the illusion that more memory existsthan is available in system

    Main memory as a cache for secondary storage

    To extend the size of physical memory

    If a program is large, divide into segments

    Active segments in main memory Inactive segments in secondary memory

    If not in main memory, copied from secondary storage

    New segment replaces non using segment in main

    memory OS swaps segments btw main and secondary memory

    Called virtual memory

  • 7/28/2019 Athira Sudarsan

    41/63

    Virtual memory Memory Management Unit (MMU) controls

    virtual memory Managed both in hardware (MMU) and thesoftware (The operating systems)

    CPU generates the logical address

    Two types of addresses in virtual memorysystems

    Virtual addresses Referenced by processes

    Physical addresses Describes locations in main memory (real) Memory management unit (MMU)

    Translates virtual addresses to physical address

  • 7/28/2019 Athira Sudarsan

    42/63

    Advantages of Virtual Memory

    Simplified addressing scheme: theprogrammer does not need to bother about the

    exact locations of variables/instructions in the

    physical memory.

    It is taken care of by the operating system.

    For a programmer, a large virtual memory will

    be available, even for a limited physical memory.

    Simplified access control

  • 7/28/2019 Athira Sudarsan

    43/63

  • 7/28/2019 Athira Sudarsan

    44/63

    Operating system Program acts as interface btw user and

    hardware Collection of programs coordinates h/w and s/w,

    regulates the way user communicates

    Microsoft windows, Mac OS X, Linux, Android

    Important part of OS- kernel

    Controls low level process

    How memory read/written

    Order of execution How info received and sent by

    i/p o/p devices

    O ti t

  • 7/28/2019 Athira Sudarsan

    45/63

    Operating system User interface- allow user to control and use

    programs

    Graphical (icons) or text based(command line) Windows and MS-DOS

    Application programming interface- set ofservices and programs, let apps interact

    OS takes control of system-direct to h/w Stays in background

    Provides channels of communications to applicationprograms

    Classificationof OS

    Based on user interface- GUI,TUI Based on number of users the computer can support-

    time sharing OS

    OS divides the working time of CPU for the users

  • 7/28/2019 Athira Sudarsan

    46/63

    Operating system

    Multiprocessing OS is similar to a time sharing

    OS except more than one CPU available

    Time sharing OS- allows resources (CPU,

    applications etc.)to be shared among severaljobs(Supercomputer)

    Batch processing OS-jobs by sequence of

    control statements in machine readable form Industries

    Real-time OS-respond quickly to external world

    signals -Aeroplane

  • 7/28/2019 Athira Sudarsan

    47/63

    Operating systems

    MS-DOS-16 bit, command line interface

    WINDOWS- 32 BIT-GUI

    OS/2-32 bit

    UNIX-multiuser, multitasking OS Scientific research, engineering etc.

    LINUX- stable OS

    Hierarchical relation btw

  • 7/28/2019 Athira Sudarsan

    48/63

    Hierarchical relation btw

    H/W,S/W and User

    User

    Applicationprograms

    Utilityprograms

    OS

    ComputerHardware

  • 7/28/2019 Athira Sudarsan

    49/63

  • 7/28/2019 Athira Sudarsan

    50/63

    Functions of OS

    Starting the computer: bootprogram Diagnostic programs-for primary memory

    Attached system devices

    Prepare computer to normal working mode

    Running application programs: Steps1. OS accepts user command

    2. reads from secondary memory to RAM

    3. OS give control to application to execute

    4. Control restored to OS when program ends

  • 7/28/2019 Athira Sudarsan

    51/63

    Running utility programs: Give user control over various features of

    computer

    Resident utility pgms- in RAM (INPUT MONITORINGPROGRAMS)

    Transient pgm- read into RAM upon request (FILECOPYING PROGRAM)

    Managing files:

    information organized into files

    Need to organize these

  • 7/28/2019 Athira Sudarsan

    52/63

    Programming concepts

    Computer programming

    Skill of writing useful, maintainable, extensible

    instructions by computing system to perform a

    meaningful task High level or low level (machine)languages

    Written in programming language

    Computer understand Machine codeprogram-set of binary

    But difficult for human

    Di d f hi l

  • 7/28/2019 Athira Sudarsan

    53/63

    Disadv of machine language Difficult ot understand or debug

    Entry slow

    Difficult to remember codes

    Long programs

    Errorprone

    Preferred for less computations only Assembly language

    Use meaningful words-mnemonics (ADD,SUB etc)

    Unique program for each processor

    Advantages

    Faster execution

    Easy to understand and debug

  • 7/28/2019 Athira Sudarsan

    54/63

    Disadv of ALP Skilled programmer required

    Not portable program Lengthier

    Preferred for medium computations only

    High level languages- similar to

    grammatical languages-English

    BASIC, FORTRAN, COBOL, PASCAL,C,

    etc.

    Operation oriented rather than computeroriented- user friendly

    Portable- no need for knowledge of CPU

    f

  • 7/28/2019 Athira Sudarsan

    55/63

    Advantages of HLP:

    Instructions very clear

    Easier, faster- to write Portable

    Not CPU oriented

    Universal language- easier to document Preferred for large computations

    Limitations

    Thorough idea about rules of language Lower execution speed

    More h/w, s/w support

    Costlier as features increases

  • 7/28/2019 Athira Sudarsan

    56/63

    MICROPROCESSOR

    All functions of CXPU in an IC

    Intel 4004-4 bit IC- first mp

    ROM,DRAM, I/O devices, 4 bit CPU

    Intel 8008-8 bit mp

    Intel 8085- popular mp

  • 7/28/2019 Athira Sudarsan

    57/63

    8085 Microprocessor

    Features of 8085

    No: of data lines - 8

    Word length - 8 bit

    No: of address lines - 16

    Operating frequency - 3.125MHz

    Supply voltage - 5V

    Technology - NMOS

    No: of pins - 40

  • 7/28/2019 Athira Sudarsan

    58/63

    Organization of 8085

    Register section- temperory storage

    ALU- h/w for computations

    Interface section-communicates to outside

    Timing and control section- coordinating

    and controlling various activities

    Architecture of 8085

  • 7/28/2019 Athira Sudarsan

    59/63

    Architecture of 8085

  • 7/28/2019 Athira Sudarsan

    60/63

    Description of Architecture of 8085

    Registers 6 GPRs - 8 bit-B,C,D,E,H and L

    16 bit- Reg pairs- BC,DE, HL

    one accumulator, one flag reg. 2 16-bit reg- Stack pointer and program counter

    Accumulator-A 8-bit, part of ALU

    Store data to perform operations

    Store result of operation

  • 7/28/2019 Athira Sudarsan

    61/63

    Program counter(PC) 16-bit -instruction sequencing

    Memory pointer-16 bit address Sequence execution

    Points to memory address from which nextinstruction to be fetched

    One byte fetched, PC incremented by one to pointto next

    Stack pointer (SP)

    16-bit- memory pointer

    Points location in main memory-stack Stack to store current status of

    microprocessor

  • 7/28/2019 Athira Sudarsan

    62/63

    Instruction register/Decoder Temporarily stores current instruction of program

    Decoder interprets instruction- converts to machinecode

    Timing and control unit

    Provide clock signals-maintain timing inside

    mp

    Control unit generate signals to carryout

    instruction

    Connection btw blocks open /closed

  • 7/28/2019 Athira Sudarsan

    63/63

    Arithmetic logic unit

    Takes data from memory/GPRs and accumulator

    1.Arithmetic: Addition, subtraction, increment,decrement, compare

    2. Logical : AND,OR,EXOR,NOT,SHIFT/ROTATE,

    CLEAR

    Flag register 5 flip flops- set or reset after an operation

    Zero(Z), Carry(CY), Sign(S), Parity (P), Auxiliary

    Carry (AC) flags

    Accumulator+ Flag register Program Status Word(PSW)