Interrupts and Bus Structure Overview
Interrupts and Bus Structure Overview
Interrupts: a review
An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services the interrupt When the CPU finishes servicing the interrupt, it returns to the original execution stream at the point where it left off. Interrupt driven I/O for interfacing with on chip peripherals
Interrupt Constraints
Each interrupt source charaterised by
Minimum time interval between interrupts from the same source Maximum time it takes the CPU to execute interrupt sources handler
Servicing of interrupts must not be delayed beyond the limit imposed by the timing requirement of the source
BUS STRUCTURE
BUS
Bus is the mechanism by which the CPU communicates with memory and I/O devices Bus is not just a collection of wires Bus defines the protocol for communication
Bus (2)
Shared communication link single set of wires used to connect multiple subsystems A Bus is also a fundamental tool for composing large, complex systems
Processor Control Datapath Input
Memory
Output
Bunch of Wires
Electrical Specification
Address:
Data: Control:
Complex commands
Bus Characteristics
Bus signals are usually tri-stated. Address and data lines may be multiplexed. Every device on the bus must be able to drive the maximum bus load:
Bus wires. Other bus devices.
Time Multiplexing
Share a single set of wires for multiple pieces of data Saves wires at expense of time
Master
data(15:0)
req
Servant
data(15:0)
Master
addr data
req
Servant
addr data
mux
demux
mux
demux
data(8)
addr/data
req data
15:8 7:0
req addr/data
addr data
data serializing
address/data muxing
Block transfers:
Allow the bus to transfer multiple words in back-to-back bus cycles Only one address needs to be sent at the beginning The bus is not released until the last word is transferred Cost: (a) increased complexity (b) decreased response time for request
Advantages of Bus
Versatility:
New devices can be added easily
Low Cost:
A single set of wires is shared in multiple ways
Disadvantages of Bus
It creates a communication bottleneck
The bandwidth of the bus can limit the maximum I/O throughput
Parallel communication
Multiple data, control, and possibly power wires One bit per wire High data throughput with short distances Typically used when connecting devices on same IC or same circuit board Bus must be kept short long parallel wires result in high capacitance values which requires more time to charge/discharge Data misalignment between wires increases as length increases Higher cost, bulky
Serial communication
Single data wire, possibly also control and power wires Words transmitted one bit at a time Higher data throughput with long distances Less average capacitance, so more bits per unit of time Cheaper, less bulky More complex interfacing logic and communication protocol Sender needs to decompose word into bits Receiver needs to recompose bits into word Control signals often sent on same wire as data increasing protocol complexity
Synchronous Bus
Includes a clock in the control lines A fixed protocol for communication that is relative to the clock Advantage: involves very little logic and can run very fast Disadvantages:
Every device on the bus must run at the same clock rate To avoid clock skew, they cannot be long if they are fast
Asynchronous Bus
Asynchronous Bus:
It is not clocked It can accommodate a wide range of devices It can be lengthened without worrying about clock skew It requires a handshaking protocol
Bus Arbitration
One of the most important issues in bus design:
How is the bus reserved by a device that wishes to use it?
Master-slave arrangement:
Only the bus master can control access to the bus:
It initiates and controls all bus requests
req data
1 2
3 4
1 2
3 4
taccess
1. Master asserts req to receive data 1. Master asserts req to receive data
Strobe protocol
Handshake protocol
A strobe/handshake combination
Master req wait data Servant
req wait
data
req wait
1 2 3
2 taccess
1. Master asserts req to receive data 2. Servant puts data on bus within time taccess (wait line is unused) 3. Master receives data and deasserts req 4. Servant ready for next request
2. Servant can't put data within taccess, asserts wait ack 3. Servant puts data on bus and deasserts wait 4. Master receives data and deasserts req 5. Servant ready for next request
Fast-response case
Slow-response case
Advantage: simple
Device 2 Device N Lowest Priority Grant Release Request
wired-OR Disadvantages: Cannot assure fairness: A low-priority device may be locked out indefinitely The use of the daisy chain grant signal also limits the bus speed
Grant
Bus Arbiter
Req
7(b):
P1 de-asserts req.
Processor-local bus
Peripheral
Peripheral
Peripheral
Bridge
Multi-level Buses
Processor-local bus
High speed, wide, most frequent communication Connects microprocessor, cache, memory controllers, etc.
Peripheral bus
Lower speed, narrower, less frequent communication Typically industry standard bus (ISA, PCI) for portability
Bridge
Single-purpose processor converts communication between busses
All transfers are (unlimited) bursts Address phase starts by asserting FRAME# Next cycle initiator asserts cmd and address
FRAME# de-asserted when master intends to complete only one more data transfer
Bridge
A bridge is a slave on the fast bus and master of the slow bus Takes command from the fast bus on which it is slave Issues commands on the slow bus Returns results from slow bus to fast bus Also functions as protocol translator
Serial Buses
Serial Protocol
Used for moving data quickly from one device to another Serial protocols like I2C & SPI are meant for short distances inside the box
Low complexity Low cost
Serial Intefaces
USB, IEEE 1394, IrDA
Bus Protocol
data transfer
token
Host controller initiates data transfer by generating token packet Data transferred Handshake packet for completion
port
Hub
port
port
device
USB Organization
USB Hubs
Hubs are bridges
Increase the logical and physical fan-out of the network.
A hub has a single upstream connection Many downstream connections.
Hubs are themselves USB devices Hubs detect topology changes due insertion/deletion of devices. They also source power to the USB network