Microprocessor, Memory & IO

download Microprocessor, Memory & IO

of 57

Transcript of Microprocessor, Memory & IO

  • 8/3/2019 Microprocessor, Memory & IO

    1/57

    MICROPROCESSOR,MICROPROCESSOR,MEMORY & I/OMEMORY & I/O

  • 8/3/2019 Microprocessor, Memory & IO

    2/57

  • 8/3/2019 Microprocessor, Memory & IO

    3/57

    Generalized Microprocessor

    What the P does? Reads one instruction at a time from memory

    Performs data manipulation

    ea s ata rom nput ev ces an wr tes ata tooutput devices

    When the P is executing a program, it

    communicates frequently with memory and I/Odevices fetch, decode and execute

  • 8/3/2019 Microprocessor, Memory & IO

    4/57

    Generalized Microprocessor

    Can it responds to unexpected event? While printing,can it stop printing temporarily and read any datathat arrive at the input?

    memory response is too slow, can the it wait untilmemory is ready?

    P needs to be able to respond to various situations

    External devices should be able to interrupt andrequest the attention of the P

  • 8/3/2019 Microprocessor, Memory & IO

    5/57

    Generalized Microprocessor

    The communication process can categories as:1. Microprocessor initiated operations

    2. Peripheral (or externally) initiated operations

    Log c c rcu ts, set o s gna s to trans er n ormat on,control signals, clock circuitry

  • 8/3/2019 Microprocessor, Memory & IO

    6/57

    Microprocessor Operations

    1. MPU initiated operations Memory Read: Read data (binary information) from

    memory

    I/O Read: Accepts data from input devices

    I/O Write: Sends data to output devices

    2. Peripheral initiated operations

    Reset: Start again from the beginning

    Interrupt: Stop the ongoing process temporarily

    Wait: Delay the MPU operation

    Bus Request: Request the use of the buses

  • 8/3/2019 Microprocessor, Memory & IO

    7/57

    Microprocessor Operations

    How does the MPU identify a memory or an I/Odevice?

    MPU identifies each memory register or I/O by a

    How does the MPU inform the peripherals when it is

    ready to read or write data? MPU send out appropriate timing signals called

    control signals before it transfers data

  • 8/3/2019 Microprocessor, Memory & IO

    8/57

    Microprocessor Operations

    Steps of the MPU performs any operation:1. Identify the memory location or the peripheral with

    its address

    .

    3. Read/Transfer binary data

  • 8/3/2019 Microprocessor, Memory & IO

    9/57

    P Buses and Signals

    MPU requires three sets of communication linescalled buses:

    Address

    a a

    Control

  • 8/3/2019 Microprocessor, Memory & IO

    10/57

    Address Bus

    Identifies each peripheral or memory location How large? Depends upon internal design of the

    microprocessor

  • 8/3/2019 Microprocessor, Memory & IO

    11/57

    Generalized MPU

    AddressBus

    Clock

    PowerGround

    Am

    A0

    MPU

    The bus is unidirectional thesignals flow from the MPU to

    peripherals or memory

  • 8/3/2019 Microprocessor, Memory & IO

    12/57

    Data Bus

    Transfer data between MPU and external devices(memory, I/O)

    Determines how large a binary number can be

  • 8/3/2019 Microprocessor, Memory & IO

    13/57

    Generalized MPU

    AddressBus

    Clock

    PowerGround

    Am

    A0

    MPU

    The bus is bidirectional the

    signals flow either direction

    Data Bus

    Dn

    D0

  • 8/3/2019 Microprocessor, Memory & IO

    14/57

    Control Bus

    Generated by MPU to indicate its operation Carries commands from the MPU and status signals

  • 8/3/2019 Microprocessor, Memory & IO

    15/57

    Generalized MPU

    AddressBus

    Clock

    PowerGround

    Am

    A0

    MPU

    The bus is unidirectional the

    signals flow from the MPU to

    peripherals or memory

    Data Bus

    Dn

    D0

    Controland Status

    Signals

  • 8/3/2019 Microprocessor, Memory & IO

    16/57

    External Request Signals

    Interrupt the ongoing MPU operations Four categories:

    Reset

    Interrupt Wait

    Bus Request

  • 8/3/2019 Microprocessor, Memory & IO

    17/57

    Generalized MPU

    AddressBus

    Clock

    PowerGround

    Am

    A0

    MPU Data Bus

    Dn

    D0

    Controland Status

    Signals

    ExternalRequests

  • 8/3/2019 Microprocessor, Memory & IO

    18/57

    Request Acknowledge Signals

    MPU informs the external peripherals that it is readyto accept the request

  • 8/3/2019 Microprocessor, Memory & IO

    19/57

    Generalized MPU

    AddressBus

    Clock

    PowerGround

    Am

    A0

    MPU Data Bus

    Dn

    D0

    Controland Status

    Signals

    ExternalRequests

    RequestAcknowledge

  • 8/3/2019 Microprocessor, Memory & IO

    20/57

    Instruction Cycle

    Time period during which a microprocessorprocesses instructions from memory

    Fetch Decode Execute

  • 8/3/2019 Microprocessor, Memory & IO

    21/57

    Fetch an Instruction

    Microprocessor places a memory address on theaddress bus

    Microprocessor reads binary information

    A register is used to hold memory addresses

    The address in the register is incremented after thefetching process is completed

  • 8/3/2019 Microprocessor, Memory & IO

    22/57

    Decode an Instruction Microprocessor interprets the instruction

    Is it a complete instruction? If not, how many morebytes need to be fetched?

    W at type o operat on s requ re an on w at ata? Microprocessor needs an instruction decoder to

    perform these operation

  • 8/3/2019 Microprocessor, Memory & IO

    23/57

    Executing an Instruction Microprocessor performs the data manipulation

    The operations can be classified as:

    Data copy (transfer)

    Arithmetic/logic Decision making

    i.e. Subtraction of two numbers

    Both numbers are loaded into registers Indicate whether the result is +ve, -ve or zero flag

  • 8/3/2019 Microprocessor, Memory & IO

    24/57

    MPU Internal Architecture

    InstructionDecoder

    Flags

    MemoryPointer

    Registers

    InternalBus

    eg s ers

    ALU

  • 8/3/2019 Microprocessor, Memory & IO

    25/57

    MPU Architecture

    AddressBus

    Clock

    PowerGround

    InstructionDecoder

    Data Bus

    Controland Status

    Signals

    ExternalRequests

    RequestAcknowledge

    Flags

    MemoryPointer

    Registers

    Registers

    ALU

  • 8/3/2019 Microprocessor, Memory & IO

    26/57

    Important Concepts MPU should have the following signals to

    communicate with memory and I/O devices

    1. Address bus

    2. a a us

    3. Control signals

    4. External request signal

    5. Request acknowledge signals

    6. Clock and power

  • 8/3/2019 Microprocessor, Memory & IO

    27/57

    Important Concepts MPU should have the following to process data

    internally:

    1. Instruction decoder

    2. eg s ers

    3. Registers as memory pointer

    4. ALU

    5. Flags

  • 8/3/2019 Microprocessor, Memory & IO

    28/57

  • 8/3/2019 Microprocessor, Memory & IO

    29/57

    What is memory? Memory is an essential components of a

    microcomputer system that retain digital data

    Stores binary instruction and data

    Prov es one o t e core unct ons o m crocomputer information retention

    Memory classification:

    Primary memory

    Secondary storage

  • 8/3/2019 Microprocessor, Memory & IO

    30/57

    Primary memory Main memory or internal memory

    Directly accessible to microprocessor

    Use for executing and storing programs

    Fast enough to keep up with the execution speed Two types of main memory:

    Random-access Memory (RAM)

    Read-only Memory (ROM)

  • 8/3/2019 Microprocessor, Memory & IO

    31/57

    RAM P can write into or read from the memory

    Use for information that is likely to altered

    Volatile contents are destroyed when the power isturne o

    Two types of RAM

    Static RAM (SRAM)

    Dynamic RAM (DRAM)

  • 8/3/2019 Microprocessor, Memory & IO

    32/57

    ROM P can read only from the memory

    Use for programs and data that need not be altered

    Non-volatile retains stored information even if thepower s turne o

    Five types of ROM

    Masked ROM

    Programmable ROM (PROM) Erasable Programmable ROM (EPROM)

    Electrically EPROM (EEPROM)

    Flash Memory

  • 8/3/2019 Microprocessor, Memory & IO

    33/57

    DRAM Type of RAM that only holds its data if it is

    continuously accessed by special logic called arefresh circuit

    Refresh circuit reads the contents of each memor

    cell, whether the memory cell is being used at thattime or not

    If not DRAM will lose its contents dynamic

    DRAM is slower than SRAM Require extra circuitry (Refresh circuit)

    Made up of one transistor and one capacitor

    High density

    Cheaper

  • 8/3/2019 Microprocessor, Memory & IO

    34/57

    SRAM Type of RAM that holds its data without external

    refresh, for as long as power is supplied to the circuit

    SRAM is faster than DRAM

    Does not requ re re res c rcu t

    Made up of four to six transistors

    Less density

    More expensive

  • 8/3/2019 Microprocessor, Memory & IO

    35/57

    Secondary Storage Not directly accessible by the microprocessor

    Use to store data (results after completion ofprogram execution, computation etc.)

    Non-vo at e reta ns store n ormat on even t epower is turned off

    Typically less expensive than primary memory

    Data are kept for longer time

    USB flash drive, floppy disk, hard disk, CD, DVD etc.

  • 8/3/2019 Microprocessor, Memory & IO

    36/57

  • 8/3/2019 Microprocessor, Memory & IO

    37/57

    Memory cells Exactly one bit

    A flip-flop or latch withtri-state buffer

    DOUTDIN D Q

    EN

    /WR

    /RD

    EN

  • 8/3/2019 Microprocessor, Memory & IO

    38/57

    4 latches to form

    a 4-bit Register

  • 8/3/2019 Microprocessor, Memory & IO

    39/57

    Memory Decoder

  • 8/3/2019 Microprocessor, Memory & IO

    40/57

    3-to-8 Decoder

  • 8/3/2019 Microprocessor, Memory & IO

    41/57

    8-bit Memory using

    Two 4-bit Memory

  • 8/3/2019 Microprocessor, Memory & IO

    42/57

    Problem 3 addressing lines: A0, A1 and A2 Two 8-bit memory chip with 4 registers

    How to address?

  • 8/3/2019 Microprocessor, Memory & IO

    43/57

  • 8/3/2019 Microprocessor, Memory & IO

    44/57

    Problem 4 addressing lines: A0, A1, A2 and A3 Two 8-bit memory chip with 4 registers

    How to address?

  • 8/3/2019 Microprocessor, Memory & IO

    45/57

  • 8/3/2019 Microprocessor, Memory & IO

    46/57

    Requirement of Memory ChipA memory requires:

    Address lines to identify a memory register

    /EN or /CS enables the chip

    rea s t e c p

    /WR writes the chip

    The number of address lines required is determinedby the number of registers

    2n = number of register where n is the number ofaddress line

    Additional address lines (if available) are used to

    enable the chip (/CS)

  • 8/3/2019 Microprocessor, Memory & IO

    47/57

    Memory Model

  • 8/3/2019 Microprocessor, Memory & IO

    48/57

    No. of Reg.No. of Add. LinesA chip with 256 registers needs 256 binary numbers

    Each address line can assume 2 logic states (0 and 1)

    =x

    xrepresent the number of address lines needed toobtain 256 binary numbers

    2256

    2562

    2562

    loglog

    loglog

    loglog

    =

    =

    =

    x

    x

    x

  • 8/3/2019 Microprocessor, Memory & IO

    49/57

    Memory Writes How the MPU writes into memory?

    1. Places the 16-bit address on the address bus of thememory location where a byte is to be stored

    .

    3. Sends the control signal Memory Write to enable theinput buffer of the memory and then stores the byte

  • 8/3/2019 Microprocessor, Memory & IO

    50/57

    Memory Writes

  • 8/3/2019 Microprocessor, Memory & IO

    51/57

    Memory Reads How the MPU reads from memory?

    1. Places the 16-bit address on the address bus of thememory location from where a byte is to be read

    .

    output buffer of the memory3. Memory places the data byte on the data bus and the

    MPU reads the data byte

  • 8/3/2019 Microprocessor, Memory & IO

    52/57

  • 8/3/2019 Microprocessor, Memory & IO

    53/57

    What is I/O? Means through which the MPU communicates with

    the outside world

    For example:

    e accepts nary ata as nput rom ev ces

    such as keyboards or mouse

    The MPU sends data to output devices such as LEDs orprinter

  • 8/3/2019 Microprocessor, Memory & IO

    54/57

    Two different methods an MPU identifies I/Odevices:

    8 bit address

    16 it a ress

    I/O with 8 bit Addresses

  • 8/3/2019 Microprocessor, Memory & IO

    55/57

    I/O with 8-bit Addresses

    (Peripheral-Mapped I/O) Uses 8 address lines (low-order address bus) to

    identify an input or an output device

    Address range from 00H to FFF 256 nput an 256 output ev ces w c are

    differentiated by the control signals

    I/O Read for input devices

    I/O Write for output devices

    I/O with 16 bit Addresses

  • 8/3/2019 Microprocessor, Memory & IO

    56/57

    I/O with 16-bit Addresses

    (Memory-Mapped I/O) Uses 16 address lines to identify and I/O device

    I/O is connected as if it is a memory register

    Uses the same control signals (Memory Read orMemory Wr te

  • 8/3/2019 Microprocessor, Memory & IO

    57/57