Beruflich Dokumente
Kultur Dokumente
BEC 30303
Computer Architecture and Organization
Chapter 3:
Input/Output
OUTLINE
Bus structure
Bus operation
Arbitration
Accessing IO devices
Interrupts
Interface circuits
Interconnection standards
BUS STRUCTURE
Processor
Input
Control
Memory
Datapath
Output
ADVANTAGES OF BUS
Versatility:
New devices can be added easily
Peripherals can be moved between computer
systems that use the same bus standard
Low Cost:
A single set of wires is shared in multiple ways
Processor
I/O
Device
I/O
Device
I/O
Device
Memory
DISADVANTAGES OF BUS
It creates a communication bottleneck:
The bandwidth of that bus can limit the maximum
I/O throughput
The maximum bus speed is largely limited by:
The length of the bus
The number of devices on the bus
The need to support a range of devices with:
Widely varying latencies
Widely varying data transfer rates
Address lines
Bus
Data lines
Control lines
Address
decoder
Control
circuits
Data and
status registers
I/O
interface
Input device
MASTER/SLAVE STRUCTURE
A bus transaction includes two parts:
Sending the address (master)
Receiving or sending the data (slave)
Master: starts the transaction by sending address
Slave is the one who responds to the address by:
Sending data to the master if the master ask for
data
Receiving data from the master if the master wants
to send data
10
MASTER/SLAVE CONNECTION
Bus
Slave
Bidirectional
11
BUS OPERATION
BUS OPERATION
If one component wants to send/receive data to/from
another component, it must:
Obtain the bus i.e. request to use the bus
If devices go randomly then we have choose
with two components trying to send data on the
bus
Transfer the information on the bus once access is
granted
address, data, control
13
OUTPUT OPERATION
Output = proc. sending data to the IO devices
Step 1: Request Memory
Processor
Memory
Data
Memory
Data
(I/O Device Address
and then Data)
Memory
14
INPUT OPERATION
Input = proc. receiving data from IO devices
Step 1: Request Memory
Processor
Memory
Memory
15
16
BUS TYPES
Dedicated:
bus line is permanently assigned either to one
function or to a physical subset of computer
component
Physical dedication associated with the use of
multiple buses, each bus it is connected with only a
subset of the modules.
Example:
I/O to interconnect all I/O module, then this bus is
connected to the main bus through a kind of
adapter module I / O.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
17
ARBITRATION
ARBITRATION
Why do we need arbitration?
Relate to the bus structure
Who grants requests?
Assign an arbitrator (controlling bus access by the
master)
Arbitration goals:
Prevent more than one bus user at a time
Give all devices a fair chance to access the bus
19
ARBITRATION METHODS
Centralized:
Centralized bus arbitration requires hardware
(arbiter) that will grant the bus to one of the
requesting devices. This hardware can be part of
the CPU or it can be a separate device on the
motherboard.
Decentralized:
Decentralized arbitration there isn't an arbiter, so
the IO devices have to decide who goes next. This
makes the devices more complicated, but saves
the expense of having an arbiter (no extra logic).
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
20
ARBITRATION MECHANISM
An IO module may be required to read or write
directly to memory, without sending data to the CPU.
Because at one point is just a unit that will
successfully transmit data through the bus, then take
a few methods of arbitration.
The goal is to assign a device, the CPU or IO
module, acting as master. Then the master can
initiate data transfer (e.g., read or write) by using
other devices, which work as slave for this particular
data exchange.
Example: multiple interrupts using daisy chain, IO
DMA
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
21
IO DEVICES CONNECTION
When I/O devices were organized into a priority
structure, each device had its own interrupt-request
and interrupt-acknowledge line.
When I/O devices were organized in a daisy chain
structure, the devices shared an interrupt-request
line, and the interrupt-acknowledge propagated
through the devices.
A combination of priority structure and daisy chain
scheme can also used.
22
Processor
I NTR
Device 1
Device 2
Device n
INTA
23
24
Processor
I NTR1
INTA1
Device
Device
Device
Device
IN T R p
INTA p
Priority arbitration
circuit
IO group 2
INTA interrupt acknowledge
INTR interrupt request
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
25
26
DMA (1/2)
Direct Memory Access
A special control unit (called DMA controller) to
transfer a block of data directly between an I/O
device and the main memory, without continuous
intervention by the processor.
DMA controller functions:
For each word, it provides the starting memory
address and all the control signals.
To transfer a block of data, it increments the
memory addresses and keeps track of the number
of transfers.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
27
DMA (2/2)
The processor must initiate the DMA transfer, which
the processor informs the DMA controller of:
Starting memory address
Number of words in the block
Direction of transfer (I/O device to the memory, or
memory to the I/O device)
Informs the processor once transfer is completed
by raising an interrupt signal
28
Processor
System bus
Disk/DMA
controller
Disk
Disk
DMA
controller
Printer
Keyboard
Network
Interface
29
DMA OPERATION
DMA devices are given higher priority than the
processor to access the bus.
Among different DMA devices, high priority is given to
high-speed peripherals such as a disk or a graphics
display device.
Processor originates most memory access cycles on
the bus.
DMA controller can be said to steal memory access
cycles from the bus. This interweaving technique is
called as cycle stealing.
30
31
Priority arbiter
BG bus grant
BR bus request
BBSY bus busy
32
33
Time
Processor asserts
the BG1 signal
BR
BG1
BG2
BR bus request
BBSY
Bus
master
BG bus grant
Processor
DMA controller 2
Processor
BSY busy
34
35
ARB - arbitrator
36
37
38
ARBITRATION ORGANIZATION
39
BUS TIMING
Synchronous
Asynchronous
40
Timing diagram
for master writes
data to slave
Address and
command
Data
t0
t1
t2
Bus cycle
41
42
43
44
Address &
command
appear on the
bus.
Bus clock
Seen by
master
Data reaches
the master.
t AM
Address and
command
Data
Address &
command reach
the slave.
t DM
Seen by
slave
tAS
Data appears
on the bus.
Address and
command
delay
Data
tDS
Timing diagram
for master reads
data from slave
t0
t1
45
46
47
48
Time
1
Clock
Address
Command
Slave-ready
49
50
51
Address
and command
Master-ready
Slave-ready
Data
t0
t1
t2
t3
t4
t5
Bus cycle
52
53
54
ACCESSING IO DEVICES
Memory
Bus
I/O device 1
I/O device n
Multiple I/O devices may be connected to the processor and the memory via a bus.
Bus consists of three sets of lines to carry address, data and control signals.
Each I/O device is assigned an unique address.
To access an I/O device, the processor places the address on the address lines.
The device recognizes the address, and responds to the control signals.
56
57
Data lines
Control lines
Address
decoder
Control
circuits
Data and
status registers
I/O
interface
Input device
I/O device is connected to the bus using an I/O interface circuit which has:
Address decoder, control circuit, and data and status registers.
Address decoder decodes the address placed on the address lines thus
enabling the device to recognize its address.
Data register holds the data being transferred to or from the processor.
Status register holds information necessary for the operation of the I/O device.
Data and status registers are connected to the data lines, and have unique
addresses.
I/O interface circuit coordinates I/O transfers.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
58
59
IO SYNCHRONIZATION (1/2)
Programmed I/O:
Data are exchanged between the processor and
the I/O module
Processor executes a program that gives it direct
control of the I/O operation
When the processor issues a command it must
wait until the I/O operation is complete
If the processor is faster than the I/O module this is
wasteful of processor time
60
IO SYNCHRONIZATION (2/2)
Interrupt-driven I/O:
Processor issues an I/O command, continues to
execute other instructions, and is interrupted by
the I/O module when the latter has completed its
work
Direct memory access (DMA):
The I/O module and main memory exchange data
directly without processor involvement
61
IO COMMANDS (1/2)
There are four types of I/O commands that an I/O
module may receive when it is addressed by a
processor
Control:
used to activate a peripheral and tell it what to do
Test:
used to test various status conditions associated
with an I/O module and its peripherals
62
IO COMMANDS (2/2)
Read:
causes the I/O module to obtain data from the
peripheral and place it in an internal buffer
Write:
causes the I/O module to take data from the data
bus and subsequently transmit that data to the
peripheral
63
IO TECHNIQUES (1/2)
IO techniques classification
64
IO TECHNIQUES (2/2)
Detailed IO
techniques example
65
PROGRAMMED IO (1/2)
There is a close correspondence between the I/Orelated instructions that the processor fetches from
memory and the I/O commands that the processor
issues to an I/O module to execute the instructions
The form of the instruction depends on the way in
which external devices are addressed
Each I/O device connected through I/O modules is
given a unique identifier or address
66
PROGRAMMED IO (2/2)
When the processor issues an I/O command, the
command contains the address of the desired device
Thus each I/O module must interpret the address
lines to determine if the command is for itself
67
MEMORY-MAPPED IO
There is a single address space for memory locations
and I/O devices
A single read line and a single write line are needed
on the bus
68
IO MAPPING (1/2)
Memory mapped I/O:
Devices and memory share an address space
I/O looks just like memory read/write
No special commands for I/O
Large selection of memory access commands
available
Isolated I/O:
Separate address spaces
Need I/O or memory select lines
Special commands for I/O
Limited set
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
69
IO MAPPING (2/2)
Isolated IO
Memory-mapped IO
70
INTERRUPT-DRIVEN IO
The problem with programmed I/O is that the
processor has to wait a long time for the I/O module
to be ready for either reception or transmission of
data
An alternative is for the processor to issue an I/O
command to a module and then go on to do some
other useful work
The I/O module will then interrupt the processor to
request service when it is ready to exchange data
with the processor
The processor executes the data transfer and
resumes its former processing
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
71
INTERRUPT PROCESSING
Example of simple
interrupt processing
72
73
74
75
76
Typical DMA
block diagram
77
DMA OPERATION
78
DMA CONFIGURATION
IO bus
79
80
81
82
IO CHANNEL ARCHITECTURE
83
PARALLEL/SERIAL IO
Parallel IO
Serial IO
84
POINT-TO-POINT/MULTIPOINT
Point-to-point interface
provides a dedicated line
between the I/O module and
the external device
point-to-point
On small systems
(PCs, workstations)
typical point-to-point
links include those to
the keyboard, printer,
and external modem
multipoint
Example: EIA-232
specification
85
POINT-TO-POINT/MULTIPOINT
86
INTERRUPTS
INTERRUPTS
In program-controlled I/O, when the processor
continuously monitors the status of the device, it
does not perform any useful tasks.
Alternative: I/O device alert the processor when it
becomes ready, through sending a hardware signal
called an interrupt to the processor.
At least one of the bus control lines, called an
interrupt-request line is dedicated for this purpose.
Processor can perform other useful tasks while it is
waiting for the device to be ready.
88
INTERRUPT PROCESS
1
2
Interrupt
occurs
here
i
i +1
89
90
INTERRUPT LATENCY
Saving and restoring information can be done automatically by
the processor or explicitly by program instructions.
Saving and restoring registers involves memory transfers:
Increases the total execution time.
Increases the delay between the time an interrupt request
is received, and the start of execution of the interruptservice routine. This delay is called interrupt latency.
In order to reduce the interrupt latency, most processors save
only the minimal amount of information:
Includes only Program Counter and processor status
registers.
Any additional information that must be saved, must be saved
explicitly by the program instructions at the beginning of the
interrupt service routine.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
91
INTERRUPT ACKNOWLEDGE
When a processor receives an interrupt-request, it
must branch to the interrupt service routine.
It must also inform the device that it has recognized
the interrupt request (i.e. telling the IO device, yes I
have received your request and I will response to
you).
This can be accomplished in two ways:
Some processors have an explicit interruptacknowledge control signal for this purpose.
In other cases, the data transfer that takes place
between the device and the processor can be
used to inform the device.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
92
INTERRUPT ENABLE/DISABLE
Interrupt-requests interrupt the execution of a program, and may
alter the intended sequence of events:
Sometimes such alterations may be undesirable, and must not
be allowed.
For example, the processor may not want to be interrupted by
the same device while executing its interrupt-service routine.
Processors generally provide the ability to enable and disable such
interruptions as desired.
One simple way is to provide machine instructions such as
Interrupt-enable and Interrupt-disable for this purpose.
To avoid interruption by the same device during the execution of an
interrupt service routine:
First instruction of an interrupt service routine can be Interruptdisable.
Last instruction of an interrupt service routine can be Interruptenable.
93
MULTIPLE INTERRUPTS
Multiple I/O devices may be connected to the processor and
the memory via a bus, thus can generate multiple interrupt
requests.
Each device operates independently, and hence no definite
order can be imposed on how the devices generate
interrupt requests?
Problems:
How does the processor know which device has generated
an interrupt?
How does the processor know which interrupt service
routine needs to be executed?
When the processor is executing an interrupt service
routine for one device, can other device interrupt the
processor?
If two interrupt-requests are received simultaneously, then
how to break the tie?
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
94
95
96
INTERRUPT IDENTIFIER
The device requesting an interrupt may identify itself directly to
the processor:
Device can do so by sending a special code (4 to 8 bits)
the processor over the bus.
Code supplied by the device may represent a part of the
starting address of the interrupt-service routine.
The remainder of the starting address is obtained by the
processor based on other information such as the range of
memory addresses where interrupt service routines are
located.
Usually the location pointed to by the interrupting device is
used to store the starting address of the interrupt-service
routine.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
97
98
INTERRUPT PRIORITY
Which interrupt request does the processor accept if
it receives interrupt requests from two or more
devices simultaneously?
If the I/O devices are organized in a priority structure,
the processor accepts the interrupt request from a
device with higher priority.
Each device has its own interrupt request and interrupt
acknowledge line.
A different priority level is assigned to the interrupt
request line of each device.
99
IO DEVICE PRIORITY
I/O devices are organized in a priority structure:
An interrupt request from a high-priority device is accepted
while the processor is executing the interrupt service
routine of a low priority device.
A priority level is assigned to a processor that can be changed
under program control.
Priority level of a processor is the priority of the program
that is currently being executed.
When the processor starts executing the interrupt service
routine of a device, its priority is raised to that of the device.
If the device sending an interrupt request has a higher
priority than the processor, the processor accepts the
interrupt request.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
100
PROCESSORS PRIORITY
Processors priority is encoded in a few bits of the
processor status register.
Priority can be changed by instructions that write into
the processor status register.
Usually, these are privileged instructions, or
instructions that can be executed only in the
supervisor mode.
Privileged instructions cannot be executed in the user
mode.
Prevents a user program from accidentally or
intentionally changing the priority of the processor.
101
INTERRUPT MECHANISM
Processor
INTR1
Device 1
I NTRp
Device 2
INTA1
Device p
INTA p
Priority arbitration
102
Processor
I NTR
Device 1
Device 2
Device n
INTA
103
104
Processor
I NTR1
INTA1
Device
Device
Device
Device
INTR p
INTA p
Priority arbitration
circuit
105
106
EXCEPTIONS
Interrupts caused by interrupt-requests sent by I/O
devices.
Interrupts could be used in many other situations
where the execution of one program needs to be
suspended and execution of another program needs
to be started.
In general, the term exception is used to refer to any
event that causes an interruption.
Interrupt-requests from I/O devices is one type of an
exception.
107
EXCEPTION SOURCES
Many sources of errors in a processor. For example:
Error in the data stored.
Error during the execution of an instruction.
When such errors are detected, exception processing
is initiated:
Processor takes the same steps as in the case of
I/O interrupt-request.
It suspends the execution of the current program,
and starts executing an exception-service routine.
108
IO INTERRUPT VS EXCEPTIONS
Differences between handling I/O interrupt-request
and handling exceptions due to errors:
In case of I/O interrupt-request, the processor
usually completes the execution of an instruction in
progress before branching to the interrupt-service
routine.
In case of exception processing, the execution of
an instruction in progress usually cannot be
completed.
109
ANALYZING EXCEPTIONS
Debugger important features:
Trace
Breakpoints
Trace mode:
Exception occurs after the execution of every instruction.
Debugging program is used as the exception-service
routine.
Breakpoints:
Exception occurs only at specific points selected by the
user.
Debugging program is used as the exception-service
routine.
110
PRIVILEGED EXCEPTIONS
Certain instructions can be executed only when the
processor is in the supervisor mode. These are
called privileged instructions.
If an attempt is made to execute a privileged
instruction in the user mode, a privilege exception
occurs.
Privilege exception causes:
Processor to switch to the supervisor mode,
Execution of an appropriate exception-servicing
routine.
111
INTERFACE CIRCUITS
INTERFACE CIRCUITS
I/O interface consists of the circuitry required to
connect an I/O device to a computer bus.
Side of the interface which connects to the computer
has bus signals for address, data and control
Side of the interface which connects to the I/O device
has:
Datapath and associated controls to transfer data
between the interface and the I/O device (called as
a port)
Ports can be classified into parallel and serial ports
113
Address lines
Bus
Connected to
the processor
Data lines
Control lines
Address
decoder
Control
circuits
Data and
status registers
I/O
interface
Input device
IO devices
114
115
PARALLEL/SERIAL PORTS
Parallel port:
transfers data in the form of a number of bits at a
time, normally 8 or 16 to or from the device.
Serial port:
transfers and receives data one bit at a time.
Processor communicates with the bus in the same
way, whether it is a parallel port or a serial port.
Conversion from the parallel to serial and vice versa
takes place inside the interface circuit.
116
Processor
R/W
DATAIN
SIN
Master-ready
Slave-ready
Data
Input
interface
Valid
Encoder
and
debouncing
circuit
Keyboard
switches
117
Processor
R/W
DATAIN
SIN
Master-ready
Slave-ready
Data
Input
interface
Valid
Encoder
and
debouncing
circuit
Keyboard
switches
118
Processor
CPU
R/W
DATAOUT
Data
SOUT
Valid
Output
interface
Idle
Printer
Master-ready
Slave-ready
119
Processor
CPU
R/W
DATAOUT
Data
SOUT
Valid
Output
interface
Idle
Printer
Master-ready
Slave-ready
120
121
122
Bus
PA7
DATAIN
D1
D0
PA0
SIN
Input
status
CA
PB7
DATAOUT
PB0
SOUT
Handshak
e
control
SlaveReady
Master
Ready
R/ W
A31
Address
decoder
A2
A1
A0
RS1
RS0
My-address
CB1
CB2
123
SERIAL PORT
Serial port is used to connect the processor to I/O
devices that require transmission of data one bit at a
time.
Serial port communicates in a bit-serial fashion on
the device side and bit parallel fashion on the bus
side.
Transformation between the parallel and serial
formats is achieved with shift registers that have
parallel access capability.
124
BLOCK DIAGRAM
Serial
input
DATAIN
Example interface
circuit for serial port
D7
D0
DATAOUT
My-address
RS1
RS0
R /W
Ready
Chip and
register
select
Serial
Accept
Receiving clock
I NTR
Status
and
control
ransmission clock
T
125
SERIAL OPERATION
Input shift register accepts input one bit at a time from the
I/O device.
Once all the 8 bits are received, the contents of the input
shift register are loaded in parallel into DATAIN register.
Output data in the DATAOUT register are loaded into the
output shift register.
Bits are shifted out of the output shift register and sent out
to the I/O device one bit at a time.
As soon as data from the input shift reg. are loaded into
DATAIN, it can start accepting another 8 bits of data.
Input shift register and DATAIN registers are both used at
input so that the input shift register can start receiving
another set of 8 bits from the input device after loading
the contents to DATAIN, before the processor reads the
contents of DATAIN. This is called as double-buffering.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
126
127
INTERCONNECTION STANDARDS
129
MOTHERBOARD BUS
Because of electrical reasons only a few devices can be
connected directly to the processor bus.
Motherboard usually provides another bus that can
support more devices.
Processor bus and the other bus (called as expansion
bus) are interconnected by a circuit called bridge.
Devices connected to the expansion bus experience a
small delay in data transfers.
Design of a processor bus is closely tied to the
architecture of the processor.
No uniform standard can be defined.
Expansion bus however can have uniform standard
defined.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
130
BUS STANDARDS
A number of standards have been developed for the
expansion bus.
Three widely used bus standards:
PCI (Peripheral Component Interconnect)
USB (Universal Serial Bus)
131
Processor
Processor bus
Bridge
PCI bus
Additional
memory
SCSI
controller
Ethernet
Interface
USB
controller
Expansion bus on
the motherboard
ISA
Interface
SCSI bus
IDE
disk
Video
Disk
controller
Disk 1
Disk 2
CD-ROM
controller
CDROM
K eyboard
Game
132
Source: http://www.playtool.com/pages/vidslots/mballslots.jpg
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
133
PCI BUS
Peripheral Component Interconnect
Parallel interface connection
PCI main function:
support memory transfers involve a burst of data rather
than just one word.
Advantages:
Low-cost bus
Processor independent
Plug-and-play capability
134
PCI CONCEPT
The bus supports three independent address spaces:
memory, I/O, and configuration.
The master maintains the address information on the
bus until data transfer is completed. But, the address
is needed only long enough for the slave to be
selected. Thus, the address is needed on the bus for
one clock cycle only, freeing the address lines to be
used for sending data in subsequent clock cycles.
The result is a significant cost reduction.
A master is called an initiator, the slave is called a
target.
135
136
137
138
139
ARBITRATION SIGNALS
REQ#
Asserted by initiator to request bus ownership
GNT#
Asserted by system arbiter to grant bus ownership
to the initiator
140
SYSTEM SIGNALS
CLK
PCI operates at 33 or 66 MHz
RST#
Asynchronous reset brings all the PCI specific signals to a
consistent state
141
INTERRUPT SIGNALS
INTA#
Interrupt A is used to request Interrupts.
INTB#
Interrupt B is used to request Interrupts.
INTC#
Interrupt C is used to request Interrupts.
INTD#
Interrupt D is used to request Interrupts.
142
143
144
PCI COMMANDS
145
DEVICE CONFIGURATION
When an I/O device is connected to a computer, several actions are
needed to configure both the device and the software that communicates
with it.
PCI incorporates in each I/O device interface a small configuration ROM
memory that stores information about that device.
The configuration ROMs of all devices are accessible in the configuration
address space. The PCI initialization software reads these ROMs and
determines whether the device is a printer, a keyboard, an Ethernet
interface, or a disk controller. It can further learn bout various device
options and characteristics.
Devices are assigned addresses during the initialization process.
This means that during the bus configuration operation, devices cannot be
accessed based on their address, as they have not yet been assigned one.
Hence, the configuration address space uses a different mechanism. Each
device has an input signal called Initialization Device Select, IDSEL#
Electrical characteristics:
PCI bus has been defined for operation with either a 5 or 3.3 V power
supply
146
147
148
149
150
151
152
PCI VARIATIONS
Same protocol format, but in a different form factor:
PMC: PCI Mezzanine Card
CompactPCI: PCI in Eurocard form factor
Mini PCI: for laptops
PMC
CompactPCI
Mini PCI
Source: xilinx.com
153
USB
Universal Serial Bus
An industry standard developed through a
collaborative effort of several computer and
communication companies, including Compaq,
Hewlett-Packard, Intel, Lucent, Microsoft, Nortel
Networks, and Philips.
154
USB EVOLUTION
USB 1.0:
1996
1.5 Mbit/s (keyboard, etc), 12 Mbit/s (disk)
USB 2.0:
2000
470 Mbit/s
USB 3.0:
2008
5 Gbit/s
USB 3.1:
2014
156 Gbit/s
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
155
USB SPEEDS
Low-speed devices (USB 1.0):
Examples: keyboards, mice, and game peripherals
Bus Rate: 1.5 Mb/s
Maximum Effective Data Rate: 800 B/s
Full-speed devices (USB 1.0):
Examples: phones, audio devices, and compressed video
Bus Rate: 12 Mb/s
Maximum Effective Data Rate: 1.2 MB/s
High-speed devices (USB 2.0):
Examples: video, imaging, and storage devices
Bus Rate: 480 Mb/s
Maximum Effective Data Rate: 53 MB/s
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
156
Source: cypress.com
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
157
ELECTRICAL CHARACTERISTICS
The cables used for USB connections consist of four wires.
Two are used to carry power (+5V) and ground (Vbus, GND).
Thus, a hub or an I/O device may be powered directly from
the bus, or it may have its own external power connection.
The other two wires are used to carry data (D+, D-).
Different signaling schemes are used for different speeds of
transmission.
At low speed, 1s and 0s are transmitted by sending a high
voltage state (5V) on one or the other of the two signal
wires. For high-speed links, differential transmission is
used.
158
DIFFERENTIAL SIGNALING
Source: cypress.com
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
159
DIFFERENTIAL TRANSMISSION
Non-return-to-zero inverted (NRZI) encoded with bit
stuffing across the twisted pair
A logic 1 is represented by no change in voltage level
and a logic 0 is represented by a change in voltage
level
Source: cypress.com
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
160
USB VARIATIONS
Source: cypress.com
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
161
Source: cypress.com
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
162
163
USB OPERATION
In normal operation, a hub copies a message that it
receives from its upstream connection to all its
downstream ports.
As a result, a message sent by the host computer is
broadcast to all I/O devices, but only the addressed
device will respond to that message.
However, a message from an I/O device is sent only
upstream towards the root of the tree and is not seen
by other devices. Hence, the USB enables the host
to communicate with the I/O devices, but it does not
enable these devices to communicate with each
other.
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
164
165
166
USB PROTOCOL
All information transferred over the USB is organized in packets,
where a packet consists of one or more bytes of information.
The information transferred on the USB can be divided into two
categories: control and data.
Control packets perform such tasks as addressing a device to
initiate data transfer, acknowledging that data have been
received correctly, or indicating an error.
Data packets carry information that is delivered to a device.
A packet consists of one or more fields containing different kinds of
information. The first field of any packet is called the packet
identifier (PID), which identifies the type of that packet.
They are transmitted twice. The first time they are sent with their
true values, and the second time with each bit complemented
The four PID bits identify one of 16 different packet types. Some
control packets, such as ACK (Acknowledge), consist only of the
PID byte.
167
USB COMMUNICATION
Consists of a
series of
frames for a
complete
data transfer
168
PACKET TYPES
Token packets:
Initiate transaction
Identify device involved in transaction
Are always sourced by the host
Data packets:
Delivers payload data
Sourced by host or device
Handshake packets:
Acknowledge error-free data receipt
Sourced by receiver of data
Computer Architecture and Organization (BEC30303) | Chapter 3: Input/Output
169
PACKETS CONTENT
Packet format
Token packets
Data packets
Handshake packets
Source: cypress.com
170
PACKETS STRUCTURE
Token packet
SOF packet
Data packet
Handshake packet
171
OUTPUT TRANSFER
Host
Hub
USB device
Token
data 0
ACK
Time
Token
data 0
Communication flow:
from host to hub, then from
hub to USB IO device
layered communication
protocol
ACK
Token
data 1
ACK
Token
data 1
ACK
172
ISOCHRONOUS TRAFFIC
USB key objective: support the transfer of isochronous data.
Devices that generates or receives isochronous data require a time
reference to control the sampling process.
To provide this reference transmission over the USB is divided
into frames of equal length (1 ms long for low-and full-speed data).
The root hub generates a Start of Frame control packet (SOF)
precisely once every 1 ms to mark the beginning of a new frame.
The arrival of an SOF packet at any device constitutes a regular
clock signal that the device can use for its own purposes.
To assist devices that may need longer periods of time, the SOF
packet carries an 11-bit frame number.
Following each SOF packet, the host carries out input and output
transfers for isochronous devices.
This means that each device will have an opportunity for an input or
output transfer once every 1 ms.
173
PACKET TIMING
174
FINISH