64
Interrupts & Busses COMP375 Computer Architecture and Organization

Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupts& Busses

COMP375 Computer Architecture and Organization

Page 2: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

“Lots of people want to ride with you

in the limo, but what you want is

someone who will take the bus with

you when the limo breaks down.”Oprah Winfrey

Page 3: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Immediate Attention

• Interrupts are a way that a running program can be stopped to allow the operating system to do something immediately

• Some activities require the CPU to respond quickly. A very short program may be all that is necessary to handle a situation, but that program has to be run very quickly after the situation occurs

• When a program does something wrong (divide by zero or bad pointer), the operating system needs to take over

Page 4: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupts and Exceptions

• An interrupt is a change in program defined flow of execution

• When an interrupt occurs, the hardware executes the instructions at a specified address instead of following the normal program flow

• User programs are interrupted all the time

Page 5: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Transfer of Control via Interrupt

graphic from Stallings textbook

Page 6: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Types of Interrupts

• External – Generated by an I/O device

• Internal – Exception within a program

• Program Generated – Used to transfer control to the operating system

Page 7: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupt Action

• When an interrupt occurs, the program counter and status flags are saved in a special location

• New program counter and status flags are loaded. These values could be determined by the type of interrupt

Page 8: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupt Service Routines (ISR)Entry Point

• It is possible for all interrupt service routines to start at the same location. The software can determine what kind of interrupt

• The hardware can assist by using the interrupt type as an index into a table of ISR addresses

• Each interrupt may have a different ISR entry point or classes of interrupts may have a common entry point

Page 9: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupt Vector Points to ISRs// Divide error

… Interrupt Service Routine …

// Page Fault

… Interrupt Service Routine …

// Floating Point overflow…

… Interrupt Service Routine …

// Bad Address

… Interrupt Service Routine …

// Incorrect opcode

… Interrupt Service Routine …

Interrupt

Vector

1: 1234

2: 2341

3: 5634

4: 4327

5: 4644

etc.

Page 10: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Interrupt Vector

• In the Intel Pentium each interrupt type has a number associated with it, called the interrupt request queue (IRQ) number

• When a device interrupts, the IRQ is used as an index into a table of ISR addresses

• The operand of the int instruction provides an index into a table of ISR addresses

Page 11: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

After handling an interrupt, the OS returns control to

A. The instruction that caused the interrupt

B. The instruction after the one that caused the interrupt

C. Does not return to the program

D. All of the above

E. None of the above

Page 12: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Multiple Interrupts

• An interrupt event can occur while the processor is handling a previous interrupt

• If the return address is always stored at a fixed location, the occurrence of an interrupt while handling a previous interrupt will overwrite the previous return address

• Most interrupt service routines start with interrupts disabled. This prevents an interrupt service routine from being interrupted

Page 13: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Masking Interrupts

• Some interrupts can be temporarily disabled. Most processors can disable external interrupts

• Most internal interrupts cannot be disabled

• It is generally problematic to disable interrupts for a lengthy period of time

Page 14: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Intel EFLAGS Register

Page 15: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Definition Of A Bus

• Digital interconnection mechanism

• A set of parallel wires with rules for putting and retrieving information on the wires

• A digital communication mechanism that allows two or more functional units to transfer control signals or data

• The connection medium allowing the CPU, memory and I/O controllers to communicate

Page 16: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Basic Computer Components

CPU

cache I/O Controller

I/O Device

MemoryBus

Page 17: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

More Complex Modern Bus

Page 18: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Many Busses

• The Bus we are talking about today is different from the bus that connects the registers in the CPU

• The system bus is on the motherboard and is up to 30 cm in length

• The internal CPU bus is on the chip and is less than a millimeter in length

Page 19: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Physical Connections

© D. Comer

Page 20: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Physical Bus Interface

© D. Comer

Page 21: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

External and Internal• Internal buses

– connect the primary computer components

– transfer data at up to 20 GB/sec

– about 30 – 40 cm maximum length

• External buses

– USB, IEEE-1394 and Firewire

– USB 2.0 runs at 280 Mb/sec

– USB 3.0 runs at 5 Gb/sec and USB 3.1 at 10 Gb/sec

– USB cables can be 5m in length

– Allow hot swapping of devices

Page 22: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bus Design Issues

• Dedicated or Multiplexed

• Width

• Access Protocol

• Arbitration

• Timing

• Operation

Page 23: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bus Lines

• Transfer of data

• Address information

• Control of the bus

– Memory fetch or store

– Ready

– Bus Request and Bus Grant

– Interrupt and Interrupt Acknowledge

– Clock

Page 24: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bus Width

• The width of a bus is the number of lines.

• The more data lines, the more data that can be transferred simultaneously

• A “32 bit bus” has 32 data lines

• The more address lines, the larger the maximum amount of memory that can be accessed

• The greater the width, the more hardware required to implement the bus

Page 25: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Address Limits

• Each wire can be grounded or attached to a voltage source

• Each wire can be 1 or 0

• The number of wires determines the maximum number of bits in the address

• The maximum amount of addressable memory is

2number of address wires

• A 32 bit processor can address 4 GB

Page 26: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

How much memory can you address with 24 bits?

1. 16 M bytes

2. 24 M bytes

3. 2 G bytes

4. 4 G bytes

Page 27: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Example Bus Width• 32-bit Pentium processor has a 64-bit data bus

• Itanium is a 64-bit processor with a 128-bit data bus

• Address bus width– Determines the system addressing capacity

– N address lines directly address 2N memory locations

• 8086: 20 address lines

– Can address 1 MB of memory

• Pentium: 32 address lines

– Can address 4 GB of memory

• Itanium: 64 address lines

– Can address 264 bytes of memory

• AMD Athlon™ 64: 40 address lines

– Can address 1 TB of memory

Page 28: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Dedicated or Multiplexed

• With a dedicated bus there are separate wires for data and addresses

• With a multiplexed bus, the same lines are used at different times to hold either data or addresses

Page 29: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Dedicated Bus

• A store operation can put both the address and the data on the bus at the same time

• Having separate data and address lines simplifies the bus protocol

Page 30: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Multiplexed Bus

• Multiplexed buses require fewer lines

• Chips can be limited in the number of pins that can be physically attached

• For a given number of pins, it is usually advantageous to transfer more data

• Data and addresses may appear on the bus at different times

Page 31: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Fetch-Store Paradigm

• A processor can fetch a value from memory or store a value to memory

• Fetch and store are also used to transfer data to an I/O device

• Only one device at a time can put a value on the bus data or address lines

Page 32: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Fetch

1. Use control lines to obtain access to bus

2. Place an address on the address lines

3. Use control lines to request a fetch operation

4. Wait until operation complete

5. Read the value from the data lines

6. Set controls line to allow another device to use the bus

Page 33: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Store

1. Use control lines to obtain access to bus

2. Place an address on the address lines

3. Place value on the data lines

4. Use control lines to specify a store function

5. Wait until operation complete

6. Set controls line to allow another device to use the bus

Page 34: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Block Transfers

• With cache systems, memory requests to the RAM are for a whole line of data

• The CPU requests an address and the RAM provides a series of data values

• I/O controllers may still communicate with the CPU or the memory with arbitrarily sized data

Page 35: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Wait States

• Some devices are not as fast as the CPU

• When the CPU requests data from RAM or an I/O device, it may not be able to get it the next clock cycle

• A wait state is created when the CPU must wait for a device to be ready

• The CPU needs to wait until a device signals it is ready to provide the data

Page 37: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Timing Diagrams – Data Lines

• Multiple data or address lines are often shown as a block

• Data or address lines can be

– all one or all zero

– mixed with some zero and some one

– undetermined, value is unimportant

Page 38: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Memory read with no wait states

©S. Dandamudi

Page 39: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Memory read with a wait state

©S. Dandamudi

Page 40: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Block transfer of data

©S. Dandamudi

Page 41: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

If the bus has a 2.0 GHz clock, how long is each clock cycle?

A. 500 microsecond

B. 2.0 millisecond

C. 2.0 nanosecond

D. 5.0 nanosecond

E. 0.5 nanosecond

Page 42: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Cycles and Bus Width

• If a bus is n bits wide, it can transfer n bits (or n/8 bytes) every cycle

• If you need to transfer more than n bits, it will take multiple cycles

• To transfer x bytes over an n bit wide bus, it takes 8x / n cycles plus any cycles previous to the data transfer

Page 43: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

How many clock cycles does it take to transfer 96 bytes over a 128 bit wide

bus?

• A 128 bit wide bus can transfer 128/8 = 16 bytes each cycle

• 96 bytes / 16 bytes/cycle = 6 cycles

• If there was a 4 cycle delay before the data was available, the total time would be 6 + 4 = 10 cycles

Page 44: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

How many clock cycles does it take to transfer 64 bytes over a 64 bit wide bus?

A. 1 cycle

B. 2 cycles

C. 4 cycles

D. 8 cycle

E. 16 cycles

Page 45: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

How many bus clock cycles does it take from when the CPU first requests the data until 32 bytes have been read?

A. 2 cycles

B. 3 cycles

C. 4 cycles

D. 7 cycles

E. 8 cycles

A bus protocol requires the CPU to

put the address on the 64 bit wide

bus during the first clock period.

On the fourth clock period and

every clock period afterwards data

is retrieved from the RAM.

Page 46: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

How much time does it take for7 cycles on a 1.0 GHz bus?

A. 7.0 nsec

B. 14.0 nsec

C. 3.5 nsec

D. 7.0 μsec

Page 47: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

If every instruction requires two memory access of 7.0 nsec, what is the maximum execution speed in MIPS?

A. 71 MIPS

B. 11 MIPS

C. 45 MIPS

D. 22 MIPS

E. Cannot be determined

Page 48: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Synchronous or Asynchronous

• In a synchronous bus, a clock signal provides timing for all operations

• A device presents the address on a given clock pulse and expects the data during another predefined clock pulse

• In an asynchronous bus, a device waits for a ready signal to know when data is available

Page 49: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Asynchronous Bus

©S. Dandamudi

Page 50: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Arbitration• Only one device can put data on the bus at a time. Many

devices can sense the data, but only one can assert it

• The bus arbitration protocol determines which device gets to use the bus at any given time

• Bus arbitration can be centralized or distributed

Page 51: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Centralized Arbitration

Page 52: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Daisy Chain Bus

The devices determine who gets to use the bus

Page 53: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Multiple Buses• A single computer usually has several buses.

• Different devices have different requirements

• A 56K modem only needs about 7 KB/sec bandwidth while a graphics device may need 70 MB/sec or more

• Multiple buses allow devices using different technologies to connect to the same computer

Page 54: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bridging Buses

• A bridge is a device that connects two buses

• A bridge converts the addresses and protocols of one bus to another

Bridge

Page 55: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bus Hierarchy

Page 56: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Chipsets

• The chipset controls the bus

• Intel Pentium® processors are available with system bus speeds of 400, 533, 800, 1066 MHz and more

• The Intel X38 Express chipset operates at 1333 MHz and can transfer data at up to 21.2 GB/s

Extreme Processing Power

Choose from the latest Intel® processors, which use the

new Intel X38 Express chipset – state-of-the-art

processing designed to drive your system and digital

entertainment experience further and faster than ever

before.

PC

advertisement

Page 57: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Bus Standards

• To allow different equipment to connect together, devices need to follow standards

• Bus designs are often developed by individual companies and then standardized by industry organizations

Page 58: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

ISA Bus• The Industry Standard Architecture (ISA) bus was used in

the first 8088 PCs

• It was originally a 8 bit data bus with 20 dedicated address lines

• Bus design similar to 8088 local bus

• The bus was updated to have 16 data lines and operate at 8.33 MHz providing 8 MB/second bandwidth

• Updated again to the Extended ISA (EISA)

Page 59: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

PCI Bus

• The Peripheral Component Interconnection (PCI) bus was developed by Intel in the early 1990s

• PCI has 64 data lines running at 66 MHz providing up to 528 MB/sec bandwidth

• Data and address lines are multiplexed

• Centralized arbitration

Page 60: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

PCI Express

• Now on version 3.0, PCIe is a high speed replacement for PCI that can transfer up to 16 GB/s

• Structured around point-to-point serial links instead of a shared bus

• Allows more than one pair of devices to communicate with each other at the same time

Page 61: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

SCSI Bus

• Pronounced “scuzzy”

• Small Computer System Interface

– Supports both internal and external connection

• Comes in multiple bus widths

• Allows the connection of up to 16 devices. Each device has a bus ID

• Popular for hard drive

Page 62: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Fiber Optic SCSI Buses

• The original SCSI bus systems involved multiple parallel

wires

• Some newer SCSI standards run over fiber optic cables

• Fiber optics uses only one "wire"

• Data is transmitted serially

Page 63: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Beyond Buses• Although there are several devices that communicate

over the bus, only one device can send data at a time

• Other interconnection schemes allow multiple simultaneous connections

• There are many designs of switching fabrics to interconnect devices

• Most switching fabrics can be expensive to implement

Page 64: Interrupts & Busses - NCATwilliams.comp.ncat.edu/COMP375/Buses.pdf · Bus Width •The width of a bus is the number of lines. •The more data lines, the more data that can be transferred

Crossbar Switch

© D. Comer