Professional Documents
Culture Documents
f2014-1.0
Copyright (c) 2014 by the University of Waterloo and William D. Bishop, PEng, Robert B. Gorbet, PEng, Carol C.W.
Hulls, PEng and Wayne M. Loucks, PEng. All Rights Reserved.
Contents
This part of the notes contains the following sections.
Course Introduction (starting on page 5) including people, marking scheme, course outline, and
an introduction to interfacing ideas.
Embedded Systems (starting on page 20) The ideas associated with embedded systems, although
not fundamental to the course content, are always present in the system examples. As a result a
small amount of time is spent introducing some of the general terms associated with embedded
systems.
Interfacing Software, Introduction to Synchronization, and Device Drivers (starting on page 33)
(the actual order of the content is different from this list). This section of the notes provides
some new and some review material to provide a common framework to discuss the material
later in the course.
Synchronization, Data Generation and Data Transfer (starting on page 50) Synchronization is
a key component of most, if not all, sections of this course. This section, in combination with
the next one, introduces synchronization requirements in a fairly general model.
Computer Structure (starting on page 80) Processor Structure. A summary of how the processor
executes an instruction and how external interfaces can detect requests by the processor.
Parallel Interfacing (starting on page 150) Examines the role of the interface to match the bus
timing and signalling characteristics with a devices timing and signalling characteristics.
-1
Error Detection and Correction (starting on page 196) Error Detection and Correction including
an introduction to error types, differences in detection and correction and one example of an
error correcting code (the Hamming code). The error environment, the general methods for
dealing with some errors (detection and/or correction), the limitations to error handling, and an
introduction to data words and code words.
Serial Interfacing (starting on page 229) Introduction to serial communication interfacing;
asynchronous communication techniques, synchronous techniques; and serial device interfacing
techniques.
Analog Interfaces (starting on page 321) Digital-to-analog interfacing, Analog-to-digital interfacing, Sample-and-hold circuitry. Includes a discussion of static and dynamic errors.
Buses - Data Transfer (starting on page 433) Examination of operation and timing requirements
for synchronous, asynchronous, partially interlocked asynchronous, semi-synchronous, and split
cycle bus systems. This section of the notes deals exclusively with the transfer of data. Issues
associated with selecting the next bus master are presented elsewhere in the notes.
Buses - Arbitration (starting on page 476) Examination of operation and characteristics of daisy
chained and non-daisy chained bus arbitration techniques.
Direct Memory Access(DMA) (starting on page 545) Examination of DMA operation (software,
hardware and bus needs), DMA characteristics.
Grounding, Shielding and Transmission Line Issues (starting on page 601) Examination of some
of the real-world considerations at the wiring level for digital circuits.
-1
Examples (Signalling and Buses) (starting on page 674) Aspects of existing systems that demonstrate some of the course concepts.
-1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section I:
Course Introduction
f2014-1.0
Course Introduction
I - 0.1
Course Introduction
I-1
Course Introduction
I-2
Course Introduction
Course Syllabus
See the course syllabus for all information regarding deliverables, timing, marking, and due dates.
A copy of the course syllabus is available
on the uwaterloo Desire2Learn site https://learn.uwaterloo.ca.
I-3
Course Introduction
10
of the contract
Announcements
Calendar: Labs, tutorial topics, and due dates are placed here as appropriate
Lectures: Lecture notes (1-up, 2-up, and 4-up versions)
Lab: Lab manual, files for download, marking sheets/rubrics
Course syllabus
Course responsibilities page
I-4
Course Introduction
11
Textbooks
There is no recommended textbook for this course:
No suitable textbook exists
Most textbooks focus on a particular microcomputer system or computer interface
instead of examining the real design issues
Online lecture notes have been provided to assist you with your understanding of the course
material
Lecture attendance is strongly encouraged
Lecture Notes and Lab Manual: The lecture notes and the lab manual are available
online through D2L. The 2-up or 4-up versions of the lecture notes are the most suitable
for annotating in class. You should bring a printout of Appendix A of the lab manual to
the Lab Tools Tutorial.
I-5
Course Introduction
12
System Views
system1.pdf
Control Computer
Open Loop vs Closed Loop
(Other courses)
System to Control
(Other Courses)
Computer system
For performing some
(control) task
If IN1 > 0x1a07 then OUT = 0x40
System to Control
Overview
I-6
Course Introduction
13
System Components
Consider a physical system with the widest possible set of parameters.
Possible System Components
Humans: Response times milliseconds to minutes (May be referred to as human-in-theloop.)
Machines with moving parts: Response times milliseconds to multiple hours
Machines without moving parts: Response times tens of nanoseconds and up
Chemical Reactions: Response times any
Overview
I-7
Course Introduction
14
Computer
(Processor
Input
Output
plus
Interface Memory) Interface
Output
Signal
Conditioning
Input
Signal
Conditioning
Sensor
Overview
System to
be controlled
and/or
monitored
Actuator
I-8
Course Introduction
15
Possible Sensors Sensors are used to determine information about the physical plant.
In our case all sensors will produce an electrical signal (analog or digital).
Electrical:Electrical voltmeter
Chemical:Electrical pH meters
Magnetic:Electrical speedometer
Possible Actuators Possible actuators are used to affect the physical plant.
(Actuators in the broadest sense) Again: consider electrical inputs.
Overview
I - 8.1
Course Introduction
16
Interface Issues
Interface computer to the outside world
Converts signals (analog or digital) to appropriate levels and timing to permit interaction
with the processor.
Issues
Synchronization Issues
Data Flow Issues
Signal Issues
Synchronization topics occur throughout the notes, however there is a more detailed discussion
of this material (Starting on page 50 OR Generalized synchronization)
Overview
I-9
Course Introduction
17
Signal Issues
Analog (values, offset)
Digital (number of bits, meaning of the bits)
Noise
Ground reference
Current/voltage
Overview
I - 10
Course Introduction
18
Overview
I - 11
Course Introduction
19
Synchronization Issues
Relationship between/among the entities.
Active Demand Oriented (Interrupt, service required)
Passive Request Oriented (Polling)
Consider the range of possibilities:
Non-maskable interrupt
Maskable interrupt
Tight polling loop
Periodic polling loop
Blind synchronization
What are the needs of the synchronization?
Source may provide data spontaneously
Source may provide data only when stimulated by the destination
Overview
I - 12
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section II:
Embedded Systems
f2014-1.0
Embedded Systems
21
II - 0.1
Embedded Systems
22
Introduction
II - 1
Embedded Systems
23
1960
2000
Mechanics
Electronics
Mechanics
Electronics
and Informatics
and Informatics
Car
90%
10%
50%
50%
Calculator
100%
0%
10%
90%
Camera
100%
0%
30%
70%
From: R. Siegwart, Grasping the Interdisciplinarity of Mechatronics, IEEE Robotics and Automation Magazine Vol. 8, No. 2, June 2001, p 27-34.
Introduction
II - 2
Embedded Systems
24
Introduction
II - 3
Embedded Systems
25
Introduction
II - 4
Embedded Systems
26
Terminology Issues
Hardware/Software:
From the Canadian Oxford Dictionary:
Hardware: 3. the mechanical or electronic components of a computer etc.
Software: 1. the programs or other operating information used by a computer. 2. storage media
such as video cassettes, audio tapes, etc. requiring playback on electronic equipment
What is a book?
is it the object?
is it the content?
Technology means that any model shifts with time.
Into this we bring a need for some terminology.
Terminology
II - 5
Embedded Systems
27
Terminology
II - 6
Embedded Systems
28
Terminology
II - 7
Embedded Systems
29
System-On-a-Chip (SOC)
System-On-a-Chip(SOC): A complete fully-functional system is implemented on a single integrated circuit. This may include processing, memory, input and output interfaces as well as any
other digital logic.
Typically, a System-On-a-Chip (SOC) incorporates the following hardware components (depending on the application):
functionality similar to the microprocessor or a microcontroller defined previously. The
implementation may be as either hardware or software.
Communication port(s)
Volatile storage (e.g., Random Access Memory RAM )
Non-volatile storage (e.g., Read-Only Memory ROM )
Other components could include: timers, parallel interfaces, Analog to digital converters
and Pulse width modulators.
A System-On-a-Chip (SOC) can be used to implement an embedded system or a portion of an
embedded system.
Terminology
II - 8
Embedded Systems
30
Terminology
II - 9
Embedded Systems
31
(SOPC) System-On-a-Programmable-Chip
System-On-a-Programmable-Chip (SOPC): An SOC implemented using a high-density, reconfigurable PLD it is considered to be a system on a programmable chip.
Advantages (with respect to SOC):
Flexible
Upgradable
Disadvantages (with respect to SOC):
Potentially slower
More expensive in large quantities
Terminology
II - 10
Embedded Systems
32
Terminology
II - 10.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section III:
Interfacing Software, Introduction to Synchronization, and Device
Drivers
f2014-1.0
34
III - 0.1
35
Software Development
A microprocessor system requires both hardware and software design.
Good software is written in a modular manner.
Main Program(s)
High degree of
abstraction
Functional Layer
Hardware
Abstraction Layer
Low degree of
abstraction
I/O Devices
Low
III - 1
36
Software Synchronization
swsynch
time
device needs
service
service request
received
device latency
CPU latency
device service
initiated
device receives
service
CPU
device
CPU Latency and Device Latency : is the time between a service request and when the service
is initiated. Latency can involve both hardware and software delays.
Real-Time System: is one that guarantees a worst-case latency for critical events.
Software Synchronization
III - 2
37
Requests arrive at
times Tr1,Tr2, Tr3 ...
Results produced a
times Tp1, Tp2, Tp3...
Two terms that are used in discussing system performance are Latency and Throughput.
Latency : The delay between the arrival of the request and the completion of service. One
could also consider the average latency or the maximum latency by considering more results.
(Note: on the surface this appears to be slightly different than the definition of CPU Latency
defined earlier. However, this difference can be resolved by noting that the system is viewed as
completing the request once the ISR has started.)
Throughput: is a measure of how many items can be processed per unit of time. For example, a
system could have a very high latency (5 years for UW Engineering) but still have a throughput
of 900 graduates per year.
Software Synchronization
III - 3
38
Synchronization Mechanisms
Adapted from J.W. Valvano, Embedded Microcomputer Systems: Real Time Interfacing
Blind Cycle: software waits a fixed amount of time and then acts on the data whether or
not the device is ready
Periodic Polling : device status is checked after a pre-determined amount of time and this
repeats until the device is done. This is usually implemented with a timer interrupt.
Occasional Polling : device status is checked at the convenience of the designer.
Polling Loop (Gadfly or Busy Waiting): software continuously checks the I/O status,
waiting for the device to be done. Although this is often implemented as a very tight loop
(one status register test and then loop if not yet ready), it could be implemented as a
series of tests (say test 5 I/O status registers and service any that are requesting service).
Software Synchronization
III - 4
39
Software Synchronization
III - 5
40
Software Synchronization
III - 6
41
Software Synchronization
III - 7
42
Interrupt Synchronization
1. a device notifies the CPU of an interrupt request
2. CPU completes execution of the current instruction
3. execution of the main program is suspended
4. interrupts are disabled (processor specific)
5. some internal registers are saved (including the program counter)
6. device may be acknowledged
7. interrupt service routine is selected
8. interrupt service routine is executed (more on this later)
9. registers are restored, if required, including the program counter
10. interrupts are enabled (processor specific)
11. execution of the main program resumes
Software Synchronization
III - 8
43
CPU Notification
Interrupts must be handled from multiple sources
Single interrupt request line
CPU
IRQ
Device 1
Device 2
Device 1
CPU
IRQ2
Software Synchronization
Device 2
III - 9
44
Device
interface
Device
interface
General Interrupt
Service Routine
Device
interface
Interrupt Request
Generated
Handler for
Device
Handler for
Device
Software Selects
Desired Code
Desired Code is
Executed
oneirq
Software Synchronization
III - 10
45
ISR Selection
Vectored Interrupts
requests are associated with an interrupt vector
fixed priority associated with the interrupt vector
interrupt service routine (ISR) at vector address is executed
Handler for
Device(s)
Device(s)
interfaces(s)
Handler for
Device(s)
Device(s)
interfaces(s)
Device(s)
interfaces(s)
Interrupt Request
Generated
Software Synchronization
Handler for
Device(s)
Hardware Assist
to Select ISR
Desired Code is
Executed
III - 11
46
Software Synchronization
III - 12
47
Interrupt Initialization
The following steps need to be taken when initializing a system which uses interrupts.
1. disable all interrupts
2. enable device interface interrupts by setting appropriate device interface registers
3. set interrupt mask to allow interrupts from device
4. initialize interrupt vector with address of ISR
5. enable interrupts as required
Software Synchronization
III - 13
48
Device Drivers
A device driver is the software associated with a particular device. It will include:
Data Structures
variables needed to access the device interface registers
variables associated with the state of the device
data buffers
Initialization Functions
device initialization
synchronization initialization
initialization of driver variables
I/O Functions
functions to input and/or output to the device
interrupt service routine
The NIOS system provides the data structures and some of the driver functions for its devices as
part of the custom SDK associated with each design. This information can be found in nios.h
and nios peripherals.h.
Device Drivers
III - 14
49
Device Drivers
III - 14.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section IV:
Synchronization, Data Generation and Data Transfer
f2014-1.0
51
IV - 0.1
52
Introduction
IV - 1
53
Time Zone 1
Await
new
data
Correct
Error
Await
Data
Read
Await
Cleanup
Prepare
for
new data
Signal
New
Data
Wait for
new
data valid
Data
Read
Other
Operations
Use/
operate on the
new data
Data
User
Introduction
IV - 1
54
Producer
Consumer
Event
Data
Introduction
IV - 2
55
Introduction
synchronization1
Producer
Consumer
Event
Data
IV - 3
56
Introduction
IV - 4
57
II
III
Introduction
I - Generation
of Information
II - Notification
/Initiation of transfer
II
III
Support for
Synchronizing peers
(Data Flow Issues)
IV - 5
58
Synchronization
Each level in the structure requires some form of synchronization.
Synchronization: For our purposes this refers to the interaction required to make two
entities (with different views of time) interact. For example, when do the two applications
interact?
Items included are listed below.
Active Synchronization: One of the entities is capable of forcing a change in the
operational characteristics of the other. For example, setting an interrupt signal can
force the processor to execute the interrupt service routine.
Passive Synchronization: One of the communicating entities signals a request for
service, however the entity receiving the request is not forced to respond.
Introduction
IV - 6
59
Synchronization
Relationship between/among the entities:
Number of communicating entities (two or more than two)
Is there a master/slave relationship?
Are the entities equals?
Level of service required
Active, demand oriented service. The event at one of the peers must be serviced.
This could be implemented as an interrupt.
Passive, request oriented service. The event at one of the peers may be serviced.
One side keeps testing the other to see if an event has occurred.
Introduction
IV - 7
60
Producer
Consumer
Consumer
Data
Produced
Poll
Data
Produced/
Event
Occurs
Producer
Poll
Poll
Poll
Read
Data
Write
Data
Producer
Data
Produced/
Event
Occurs
Consumer
Ready for
Data (event)
Consumer
Demand
Service
Response
Time
Optionally
Verify
Request
Read
Data
Ti m e
Consumer
Passive Notification/
Initiation and
Consumer Transfer
Introduction
Producer
Passive Notification/
Initiation and
Producer Transfer
Producer
Active Notification/
Initiation and
Consumer Transfer
IV - 8
61
Consider two situations: a printer (consumer) attached to a computer (producer) and a keyboard (producer) attached to a
computer (consumer).
The data is the value of the character to be printed or the key pressed. From the keyboards perspective the user provides
spontaneous input. On a higher level, the user is simply responding to a request from the application program.
The events would be the preparation of a character (or string) for printing and the typing of a key on the keyboard.
Synchronization, in the case of the keyboard could be by polling or by interrupt, in either case, the signal indicating new
data (the event) to be consumed would be from the producer to the consumer.
Synchronization, in the case of the printer, the event may provide an indication that a new character may be printed. (I.e.,
from the consumer to the producer.)
Missing from the figure is any form of flow control. This is considered later this term.
Introduction
IV - 8.1
62
I Generation
The Generation of the data requires action by the producer, however the cause of the creation
of the data can be at either the producer or the consumer.
Spontaneous Sources: Data is produced in the device independent of the actions of the
consumer accepting the data.
Consumer Sensitive Sources: Data is produced by the device only after the previous data
has been consumed by the consumer. (more implicit.)
Consumer Responsive Sources: Data is produced by the device only after requested by the
consumer. (more explicit.)
Introduction
IV - 9
63
Data
Data
Consumed
Introduction
Event
Data
Available
Producer
Consumer
Producer
Data
Consumer Responsive
Data
Available
Data
Producer
Event
Data
Available
Consumer
Event
Consumer Sensitive
Consumer
Spontaneous
Data
Request
IV - 10
64
Introduction
IV - 11
65
Introduction
IV - 12
66
Introduction
IV - 13
67
synch1
System 2
System 1
Data
producerconsumertimenotime
Producer
Clock
Producer
Data
Data 1
Data 2
Data 3
Consumer
Clock
Sample
Every (local)
Falling Edge
IV - 14
68
Synchronous Transfer
(Common View of Time)
Data
System 1
System 2
producerconsumertimecommon
Global
Clock
Producer
Data
Sample
Every
Rising Edge
Data 1
Data 2
Data 3
Since the data is known correct at the rising edge, sample then
IV - 15
69
Time
System 2
Data
producerconsumertimesharetime
Producer
Clock
Producer
Data
Data 1
Data 2
Data 3
Sample
When time
signal received Transfer (read) data only when told to by producer (correct time provided)
IV - 16
70
IV - 17
71
IV - 18
72
IV - 18.1
73
I - Impact of Generation
progcontrol0
Device and
Interface
Time
Consumer
Sensitive
Spontaneous
Consumer
Responsive
tinterdata
Data Available
ttransfer d
repeat if
multiple
transfers
required
READ Operation
Device Centric
IV - 19
74
consumer :
the time the processor needs to transfer one data unit. This may be
> ttransf er
consumer
prod
producer ).
tsynch: is the execution time of the processor to synchronize with the availability of the
data. (I.e., the time that the processor is not available for other activity.)
Note:
tsynchpoll : Polling synchronization uses processor time until just after the data is
ready.
tsynchintr : Interrupt synchronization only starts to use CPU time after the data has
become available.
tinterdata: is the time between consecutive data blocks. Although this time could vary
between blocks, for these purposes it has been assumed to be a constant.
Generalized I/O Operations
IV - 20
75
progcontrol1
Polling
(n = 1)
tinterdata
tsynch-poll
repeat if
multiple transfers
required
Periodic
Polling
Producer
Device and
Time
Interface
(Polling synch
time shown)
Data Available
Occasional
Polling
White space
Other CPU
Activity
tsynch-intr
Note: if
IRQ used,
a diffferent
device
timing is
needed
Read Operation,
Consumer
Sensitive
I/O Device
One Transfer per
Synchronization
IV - 21
76
progcontrol3
CPU Activity
Interrupt
(n = 2)
Polling
(n = 2)
tinterdata
tsynch-poll
Device and
Time
Interface
(Polling synch
time shown)
Data Available
tsynch-intr
ttransfer producer
ttransfer consumer
Note: if
IRQ used,
a diffferent
device
timing is
needed
repeat if
Read Operation,
multiple transfers
Consumer
required
Sensitive
I/O Device
Two Transfers per
Synchronization
IV - 22
77
tsynch refers to the time for the appropriate synchronization technique (polling (tsynchpoll ) or
interrupts (tsynchinter )).
and
twait =
tsynchpoll
polling busy wait-loop
tsynchintr + tinterdata interrupt
IV - 23
78
Items per
synch.
1
n
256
t
+
256
t
d
synch
transf
er
n
n e twait + 256 ttransf er
tsynch + 256 ttransf er
twait + 256 ttransf er
Note that the assumption that tinterdata is fixed regardless of the size of the block is unusual.
IV - 24
79
IV - 24.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section V:
Computer Structure
f2014-1.0
Computer Structure
81
V - 0.1
Computer Structure
82
Computer Organization
ROM
RAM
Interface
Device
Interface
Device
gene121
CPU
RAM
Clock
Background
V-1
Computer Structure
83
Background
V-2
Computer Structure
84
CPU
I/O Interface
Device
Register
Memory
Background
CPU
Register
Device
V-3
Computer Structure
85
Memory
Stores instructions or data (indistinguishable except by context of read/write).
Stored memory values are accessed using their address
Memory is connected to CPU using one (or more) buses.
ROM (Read Only Memory): usually contains the sequence of instructions necessary to
place the processor in a known start-up state. This may be the final state (if a monitor
is used as in the lab) or this state may be just the starting point for a more functional
operating system.
RAM (Random Access Memory) used to store values and programs that may change.
There is no distinction between ROM and RAM addresses (other than they tend to be in
groups).
Background
V-4
Computer Structure
86
CPU
Central Processing Unit composed of:
Arithmetic and Logic Unit(s): to perform operations required by the instruction
sequence
Registers:
Data Registers: to provide internal storage for intermediate results. (Also referred
to as General Purpose Registers.)
Special Purpose Registers (contents listed):
Program Counter (PC): address of the next instruction to be read.
Instruction Register (IR): current instruction (NOT its address)
Program Status Register (PSW): Current status of execution (flags etc.)
Stack Pointer (SP): In CPUs that support stack-oriented operations (push,
pull, jump to subroutine, return from subroutine ... ) the SP points to the
top of the stack.
Memory Address Register (MAR) and Memory Data Register (MDR). Although not accessible to a programmer, these are the registers used to send
and receive data over the system bus.
Memory Address Register (MAR) and Memory Data Register (MDR): registers
used to permit access to memory.
Background
V-5
Computer Structure
87
Background
V-5
Computer Structure
88
Control Signals
Many operations are triggered by a control signal.
An active high control signal indicates a certain condition when it has a value of 1.
An active low control signal indicates a certain condition when it has a value of 0.
A rising-edge occurs when a signal changes from a low voltage to a higher voltage.
A falling-edge occurs when a signal changes from a high voltage to a lower voltage
signals.
Rising Edge
Falling Edge
Active High RD Signal
RD
/RD
Active Low RD Signal
Inactive
Background
RD Active
Inactive
V-6
Computer Structure
89
Clock
In general terms a clock provides synchronization among two or more units.
In general terms a clock may be implemented as an active edge (rising and/or falling) on
a given signal. A clock may have any duty cycle, and may even be specified by multiple
signals.
In the case of a processor, such as those discussed this term, the (processor) clock signal
is a source of regular, periodic rising and falling edges.
The processor clock can also be used as a measure of the time required to execute a given
instruction.
Changes in output signals occur in a predictable relationship with the system clock.
Input signals are sampled at a predictable time with respect to the system clock.
Background
V-7
Computer Structure
90
Clock (cont.)
clocks.
Background
V-8
Computer Structure
91
File:222rev.
Read Write
IR
Control
Rn
MFC
Processor
Control
Unit
R1
...
PC MAR MDR
To Memory
M UX
Const 4
ALU
Select
V-9
Computer Structure
92
Action
PCout, MARin,READ, Select Const 4, Add, Zin
Zout, PCin, WMFC
MDRout, IRin
R3out,MARin, READ
R1out, Yin, WMFC
MDRout, Select Y, Add, Zin
Zout, R1in, END
V - 10
Computer Structure
93
V - 11
Computer Structure
94
Mux
READ/MDRin
Clock:
MDRIn or
MFC
To/From
External
(system)
Bus
To/From
CPU Internal
Bus
Write
MDROut
Abstracted view of MDR Structure
V - 12
Computer Structure
95
Where are:
MAR?
MDR?
READ?
WMFC?
File:222read1.
Address
Control
MDR
CPU
Clock Rate: 100MHz
Period: 10 ns
MAR
Memory
Access Time:
50 ns
(+/- 5 nsec)
Data
V - 13
Computer Structure
96
Read Operation
Address
Data
Address 1
?
Data 1
Address 2
?
Data 2
V - 14
Computer Structure
97
File:222read4.
CPU CLK
Sync Pulse
Address
Valid Address
Data
Valid Data
1 Memory Cycle
V - 15
Computer Structure
98
CPU CLK
(Not used by
1
Memory)
Processor
Sync Pulse
Address
Memory Sync
Signal
Valid Address
(From Memory View)
Data
Valid Data
File:222read5.
Processor now waits until the memory has produced the requested value.
CPU-Memory Interface (Memory Version)
V - 16
Computer Structure
99
Memory
10 ns
(+/-1 ns)
CPU
Clock Rate
100 MHz
(10 ns)
Address
Data
Memory
50 ns
(+/- 5 ns)
File:222read2.
V - 17
Computer Structure
100
V - 18
Computer Structure
101
Multiple Drivers
Consider the simplified case shown below.
File:223a.
Multiple Drivers
V - 19
Computer Structure
102
Multiple Drivers
At the transistor level (For our purposes consider the following transistor model ... See ECE 231
and 332 for more precise models)
VCC
Cuttoff
Gnd
File:223d.
Multiple Drivers
V - 20
Computer Structure
103
Low
(for 224/325 a 0)
1.5 V
Multiple Drivers
Noise Margin
signallevels
High
(for 224/235 a 1)
2.5 V
Voltage
V - 20.1
Computer Structure
104
Multiple Drivers
Consider a standard AND Gate (With a totem-pole output driver)
+VCC
1
0
VCC-0.1V
{Or digital value 1}
0.1V
{Or digital value 0}
0
1
Gnd
File:223c.
Multiple Drivers
V - 21
Computer Structure
105
Output 0
(Low impedence
to low voltage)
Sinking current
(to lower voltage at load(s)
current is flowing to ground level)
Output a 1
Sourcing current
(to raise voltage at load(s))
Multiple Drivers
V - 21.1
Computer Structure
106
+5 V (or 0V)
1k
1k
1k
1k
I
+
1k
Multiple Drivers
V
-
Develop IV Characteristics
+
V
-
1k
V - 21.2
Computer Structure
107
Develop IV Characteristics
+
V
I (ma)
1k
3
2
1
V (Volts)
Multiple Drivers
V - 21.3
Computer Structure
108
Output = 0\0
I
V
Output = 1
Multiple Drivers
Input Impedance
V - 21.4
Computer Structure
109
Interpret as
a 0 (low)
Interpret as
a 1 (high)
I
V
Output = 1
V
Output = 0
Input Impedance
Multiple Drivers
V - 21.5
Computer Structure
110
VCC
Memory 2
(From AND gate)
Memory 1
(From AND gate)
Bus Line
(shared)
MDR
Gnd
File:223b.
Multiple Drivers
V - 22
Computer Structure
111
VCC
0
V2
V1
0
Based on Q3 and Q4
V1 would be (VCC - 0.1 V)
Based on Q1 and Q2
V1 would be 0.1 V
Gnd
File:223bcur.
Multiple Drivers
V - 23
Computer Structure
112
Alternatives
Must prevent two (opposite direction) transistors from being active at the same time.
Eliminate two of the transistors
Permanently passive pull-up or pull-down, (e.g., open-collector (BJT) or opendrain (MOS/CMOS) are passive pull-up and open-emitter (BJT) or open-source
(MOS/CMOS) are passive pull-down)
Temporarily (Tri-State)
Multiple Drivers
V - 24
Computer Structure
113
VCC
Gnd
VCC
I= ((VCC-0.1)/R) A
I=0A
0.1 V
ON
OFF
(no Current
Flow)
File:223e.
Multiple Drivers
V - 25
Computer Structure
114
VCC
VCC
ON, VCE=0.1 V
OFF
M1
ON, VCE=0.1 V
M2
M2=1, M1=0
VBUS=0.1V
ON, VCE=0.1
M1
M2
N1
Gnd
N2
M2=M1=0
VBUS=0.1V
Gnd
File:223f.
Multiple Drivers
V - 26
Computer Structure
115
Note: Terminology
In different situations the terms Wired-And and Wired-Or are used to describe behaviours associated with passive pull-up and
pull-down structures.
In the previous figure, a passive pull-up structure, B may be considered as a function of M1 and M2 or as a function of N1 and N2.
Input
Output
Input
M1
M2
N1
N2
In this case, the bus line is an AND of the two memory lines, and a NOR of the intermediate signals N1 and N2.
Multiple Drivers
V - 26.1
Computer Structure
116
File:223g
Enable
Signal Value
Q1
Tri-state
Output
Q2
Enable
Signal Value
Output
Multiple Drivers
V - 27
Computer Structure
117
Synchronization
signals
Enable 2
MDR
M2
Q3
Q1
Q4
Q2
Tri-State
Output
File:223h
Multiple Drivers
V - 28
Computer Structure
118
Differences - Timing
Consider the following:
Enable
Transistor
on resistance = r
r << R
Signal Value
Q1
Q1
C
Q2
Tri-state
Output
223eg.
Multiple Drivers
V - 29
Computer Structure
119
Differences - Timing
Passive pull-up means that the parasitic capacitance (C) of the bus wire is charged through
the resistor R.
If R is too small, then very large (slow) transistors are needed
If R is too large, then capacitor charges very slowly
t=RC
t=rC
t=rC
t=rC
File:223i.
Multiple Drivers
V - 30
Computer Structure
120
Differences - Errors
Impact of Multiple Drivers (with different values) enabled on the same signal line.
Impact at the Receiver (Reliability - of the transfer)
Passive pull-up: the value read will be low in all cases. (I,e., if one is pulling down
the value is down.)
Active pull-up and pull-down (I.e. totem-pole). The value read will be indeterminate.
If you have a passive pull-down then since one will be pulling up the value read will
correspond to a high value.
Impact at the Drivers (Reliability - of the device(s))
Passive pull-up drivers, or passive pull-down drivers could tolerate multiple active
drivers.
Active pull-up and pull-down systems may have short or long term problems with
conflicting values.
As a result, in most cases, one must select or enable at most one driver per line
at a time.
Multiple Drivers
V - 31
Computer Structure
121
Device Selection
In the event that one or more signal lines has more than one possible driver, there must be
some technique to select the current driver (or it must be possible to have more than one driver
enabled at one time.)
Explicit Selection
Passive Selection
Bus signals:
may permit multiple drivers on at
Data transfer signals includthe same time.
ing
decision not based on an explicit
address, therefore based on other
Address signals
criteria.
Data lines
Direction control
time (Eg. every 10 ms a dif Timing control
ferent device starts to drive
Bus arbitration signals (later)
the shared line.)
Special purpose signals.
external events (IRQ lines)
tends to be used in special applications, examples presented as
needed in the term.
Device Selection
V - 32
Computer Structure
122
Memory 2
Memory 1
Bus Line
(shared)
Decoded Address
=0 except when
Address of M1
is detected
Q2
Enable 1
Decoded Address
=0 except when
address of M2 is
detected
Q4
Enable 2
Device Selection
V - 33
Computer Structure
123
Address Lines
Enable 2
MDR
M2
Q1
Q3
Q4
Q2
Tri-State
Output
Device Selection
Synchronization
signals
V - 34
Computer Structure
124
V - 35
Computer Structure
125
Addr
(CPU)
Valid Address
R/W
Read
Data
(Mem)
Valid
Data
A
B C
File:223j.
Time A the CPU (the bus master ) drives the address value and the R/W signal onto the
appropriate bus lines.
Time B, the bus slave assumes that the bus signals are correct
Time C (at some time later) the bus slave drives the data lines with the requested value.
Overview of Device Selection with Synchronous Bus
V - 36
Computer Structure
126
V - 37
Computer Structure
127
Address
and
Timing
Decoder
(Centralized ATD)
A0-Ae-1
R/W
(Chip) Select
or
Device Enable
Am-1
A4 A3 A2 A1 A0
Register
Select
Decentralized
ATD
Register
Select
Ae-Ae+m-1
Address
Lines
CPU/Bus Master
Address bits
Device
Interface
Device
Clock
Data Lines
V - 38
Computer Structure
128
Aliasing vs No Aliasing
No aliasing - the address decoder deals with Aliasing - the address decoder deals with only
all of the address lines except those allocated a subset of the address lines except those alto Register/Internal decode.
located to Register/Internal decode.
A15
A15
A11
A11
Select:
1000 xx00 0010 xxxx
let e=4 and m=12
A9
A8
Select 0x842X;
let e=4 and m=12
A8
A4
A4
Time Information
(more later)
Time information
(more later)
noalias.
alias.
V - 39
Computer Structure
129
Clock
Addr
(CPU)
R/W
Data
A
File:223k.
At time A the bus master drives the address, R/W and data lines
At time B the bus slave assumes that the bus signals are correct
At time C the data is clocked into (stored) the appropriate device interface register. (This
is a bis of a simplification that we will address later in the term.)
Overview of Device Selection with Synchronous Bus
V - 40
Computer Structure
130
Metastability
Unfortunately, reality is seldom as simple as we would like
Consider the following scenarios.
Ck
D
hold
setup
File:meta1.
Ck
Ck
Q
Valid timing
new value stored
Violates Setup
Time
Ck
Ck
Possible Metastable
signals
Valid Timing
old value kept
Reality Check
Violates Hold
Time
V - 41
Computer Structure
131
V - 42
Computer Structure
132
whyabus.
Processor
Disk
Interface
Serial
Interface
Interconnection Mechanism
Memory
Analog
Interface
V - 42
Computer Structure
133
Connections Alternatives
File:busringstar.
Daisy Chain
Wiring structures play a role
in the bus arbitration scheme
alternatives
Star
Bus
V - 43
Computer Structure
134
synchronous0.
I/F Clock
Processor Clock
Processor
(Master
only 1 in this
case)
Bus
Clock
Source
Interface1
Memory 2
Memory1
Address
Decode
Address
Decode
Address
Decode
Data
Address
Clock
R/W
V - 44
Computer Structure
135
Signal Conventions
V - 45
Computer Structure
136
V - 46
Computer Structure
137
tselect.
tselectw.
(Chip) Select
m address
lines
n address
lines
Address Valid
Chip Select
tSelect
tAccess
Data Valid
Device Interface
With 2n addressable
locations
READ
Data
Bus Terminology
Address
Decoder
Address
Decoder
Address Valid
Chip Select
(Chip) Select
m address
lines
n address
lines
Device Interface
With 2n addressable
locations
Data
Address (at least m+n address lines)
Data Valid
tSelect
tStore
(Any change
in data after
the end of
tStore will not
WRITE
Note: No timing signals shown
(so just address decoder, no timing
decoder)
V - 47
Computer Structure
138
V - 48
Computer Structure
139
A:
Focus of
224/325
Select
tAccess
sufficiently
long that
address does not
impact output
Address
Lines
Valid Address
Select
Data
Out
Valid Data
tAccessAddress
Address
Lines
Select
Data
Out
Bus Terminology
Valid Address
sufficiently
long that
select does not
impact output
Valid Data
V - 48.1
Computer Structure
140
Skew
Bus Terminology
skew.
Skew
At Source
At Destination 1
(fastest)
At Destination 2
(slowest)
Delay
(tp)
V - 49
Computer Structure
141
Address
and
Timing
Decoder
(Centralized ATD)
A0-Ae-1
(Chip) Select
or
Device Enable
Decentralized
ATD
Register
Select
Ae-Ae+m-1
Address
Lines
CPU/Bus Master
synchreadblock.
Device
Interface
R/W
Device
Clock
Data Lines
Internal Signals
for bus
Enable
Output
Data
Bus
V - 50
Computer Structure
142
Time at
Master
CK1
Time at
Slave
Address and
t +t
Control (Clk, R/W) PA Skew
Master Edge
tmargin1
Decode address on bus and select slave
Time to access the requested data
tmargin2
tSetup
tHold
Slave Edge
tSelect
t Access
tPD+ tSkew
Time at
Slave
V - 51
Computer Structure
143
Synchronous Read Bus Transfer (Master and Slave Timing the same at the edges)
Phase 1
tPA tSkew
Valid Read Address
Address
R/W
tSelect
Address
Decoded
>0
Enable
Output
tPD+tSkew+tAccess
Valid Read Data
Design Margin
tM1
tM2
tHold
Minimum
Phase 1
Data
Master Edge
Phase 2
tSetup
Clock
Slave Edge
tSelect+tAccess+tSkew+tPD+tSetup+tM2
One Bus Cycle
synch3.
V - 52
Computer Structure
144
Address
and
Timing
Decoder
(Centralized ATD)
(Chip) Select
or
Device Enable
Decentralized
ATD
Register
Select
Ae-Ae+m-1
Address
Lines
CPU/Bus Master
A0-Ae-1
Device
Device
Interface
R/W
Clock
Data Lines
Data in
Register
Q
Reg
Clock
synchwriteblock.
V - 53
Computer Structure
145
Address, data
and control
CK1
tp+ tSkew
tmargin1
Time to decode address on bus
Time to store the data
tSelect
t Store
tmargin2
tSetup
tHold
V - 54
Computer Structure
146
Slave Edge
Phase 2
Master Edge
t
tPA Skew
Valid Write Address
Address
tSelect
R/W
Address
Decoded
tStore+
tMargin2
TSetup
tHold
Data
tPD+tSkew
Reg Clock
synch4.
V - 55
Computer Structure
147
R/W
Clock
Clock 1
Clock 2
clockderived.
V - 56
Computer Structure
148
Questions of Interest:
1.
Consider the two signalling scheme shown below: the one on the left is as shown in the previous notes, the one on the right
could be used. Compare and contrast the characteristics of the two schemes.
rwvsrw.
Read Cycle
Write Cycle
R/W
Option 1
Clock
/RD
/WT
Option 2
Questions
V - 56.1
Computer Structure
149
Questions
V - 56.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section VI:
Parallel Interfacing
f2014-1.0
Parallel Interfacing
151
VI - 0.1
Parallel Interfacing
152
General structure
Data
Parallel
I/O
Port
I/O Lines
Control/Sync Lines
Device Side
File:basic.
VI - 1
Parallel Interfacing
153
(Optional)
Memory
Interface
Memory
Processor
Partial Address
Decoding
Electro/Mechanical
Device
Processing Domain
Device Domain
File:structure2.
VI - 2
Parallel Interfacing
154
Ae-Ae+m-1
(Chip) Select
or
Device Enable
Address
and
Timing
Decoder
(Centralized ATD)
Decentralized
ATD
Register
Select
Address
Lines
CPU/Bus Master
A0-Ae-1
Device
Device
Interface
R/W
Clock
Data Lines
Device Interface
Register
Data Available
in Device Interface
Q
Q
Enable
Output
Reg
Clock
Data
Bus
synchreadwriteblock.
VI - 3
Parallel Interfacing
155
STD
Data Lines
Control
Register
STI
SFD
Status
(Register)
SFI
Data Out
Register
Subset of
Address Signals
SFD
Device Side
STD
Data In
(Register?)
Register
Select
(may or may not
include
Address decode)
Address Decode
Not Shown and
Intended for general
Discussion only
parellelStructure.
VI - 4
Parallel Interfacing
156
Property
Signal Levels
Timing
Signals
Delays
Device Side
Device Standards
Any
Any
Device Dependent
VI - 5
Parallel Interfacing
157
Bus Lines
Address,
Data, and
Control
Signal Lines
Device/Interface
Device
CPU
Parallel
Interface
Synchronous or
Asynchronous
Bus Signals
Persistent Data
(until Taken)
or
Transient Data
(Limited Time)
VI - 6
Parallel Interfacing
158
VI - 7
Parallel Interfacing
159
Read
Write
Clock
R/W
Address
Valid Address
Valid Address
ChipSelect
Data
Invalid
Device Data
Processor Data
VI - 8
Parallel Interfacing
160
Device-Side Alternatives
VI - 9
Parallel Interfacing
161
Driver Alternatives
Control Input
(if required)
Control Input
(if required)
Pull-Up
Switch
Pull-Down
Switch
File:drivers.
Totem-Pole Driver : Both switches are active. A logic-1 is applied to the shared signal line by
closing the pull-up switch and opening the pull-up switch. In this driver one of the two switches
is always closed and as a result it is not useful on a shared signal line.
Passive Pull-up Driver : (often implemented and called open collector) Replaces the pull-up
switch with a resistor (a passive component with no control input). In this way the line can be
pulled low (for a logic-0) but a logic-1 results if no driver pulls it low.
Passive Pull-down Driver : The passive pull-down driver (open emitter) is the dual to the passive
pull-down where the Pull-down switch is replaced with a resistor.
Tri-state Driver : Both switches are active, however the logic driving the control inputs has been
modified to permit both switches to be off at the same time. When both are off the output
floats and this driver is in the hi-impedance state (sometimes called Hi-Z).
Device-Side Alternatives
VI - 10
Parallel Interfacing
162
Control Signals
Address Bus
D0 D1
Unidirection (Input)
Tri-State Drivers
Tri-State Enable =
F(A15, A14, ... A1,
A0, RD/W, Ck)
Device Signals
Ck
Address
R/W
Address
and
timing
decoder
(ATD)
Enable
Data
File:para-uni.
File:para-uic.
Device-Side Alternatives
VI - 11
Parallel Interfacing
163
Control Signals
Address Bus
Unidirectional (Input)
D0 D1
(Registered)
Tri-State
Discuss
Clock Source
Drivers
Tri-State Enable =
F(A15, A14, ... A1,
A0, RD/W, Ck)
Device Signals
Ck
Address
R/W
Enable
Data
Data Transfer Phase
Address
and
timing
decoder
(ATD)
File:para-uni-reg.
Device-Side Alternatives
Data
From
Device
One
version
of Event
( possible
Data
Clock)
File:para-uic-reg.
VI - 12
Parallel Interfacing
164
Ck
D0 D1
Q
Clock
Control Signals
Address Bus
Device Signals
Unidirection (Output)
Clock = F(A15, ..
A0, R/W, Ck)
Address
and
timing
decoder
(ATD)
Device-Side Alternatives
Address
Data
R/W
Clock 1
Clock 2
Clock Data into
I/F Register
VI - 13
Parallel Interfacing
165
D0 D1
Data Direction Register
D
D
Tri-State Drivers
Address Bus
Control Signals
Device Signals
Address
and
timing
decoder
(ATD)
File:para-exp.
Device-Side Alternatives
VI - 14
Parallel Interfacing
166
D0 D1
Data Direction Register
D
Add Transient
Data
Tri-State Drivers
Address Bus
Control Signals
Tri-State Drivers
Device Signals
Data
Available
Read Data = FIN(A15, A14, ... A1,
A0, R/W, Ck)
Address
and
timing
decoder
(ATD)
File:para-exp-transient.
Device-Side Alternatives
VI - 15
Parallel Interfacing
167
D0 D1
Data Direction Register
D
D
Tri-State Drivers
Address Bus
Control Signals
Device Signals
Address
and
timing
decoder
(ATD)
File:para-exp.
Device-Side Alternatives
VI - 16
Parallel Interfacing
168
D0 D1
Passive
Pull-up
Drivers
Address Bus
Control Signals
Device Signals
Address
and
timing
decoder
(ATD)
File:para-implicit.
Device-Side Alternatives
VI - 17
Parallel Interfacing
169
File:opencoll.
X
Data
D0
Output
Input
Write DDR
(FDDR )
Device
I/O line
Write Data
(FOUT)
Read Data
(FIN)
A0
A1
CS
R/W
Clock
Device-Side Alternatives
VI - 18
Parallel Interfacing
170
(NO DDR)
One Bit of
Data Bus
File:pseudob1.
D
DOWN
/DATA
IO line
Device-Side Alternatives
VI - 19
Parallel Interfacing
171
Data Characteristics
Whenever two systems communicate there is a question as to how data can be passed from one
domain to the other. This transfer may include:
Signal Translation (light electrical, or 5 V 3 V, or 5 V 10 mA)
Synchronization. When is the data to be read or written?
Consider the following dimensions to the problem.
Data may be
Persistent I.e. it will remain/must remain valid until the customer explicitly accepts
the data. As described in the synchronization section of these notes. (starting on
page 66)
Transient: I.e. the data will vanish if not read at the appropriate time.
The source of the data may either inform or not inform the receiver that the data is
present.
The receiver may (or may not) request new data when it is ready for the data.
Data Characteristics
VI - 20
Parallel Interfacing
172
Control Signalling
There are two general techniques to pass control information between two entities.
In-Band : Some (or all) of the control information is passed in the same way that
the data is transferred. For example, a control-C in a text string looks like data,
but in some cases may be interpreted as a control character with a special operation
characteristic.
Out-of-Band : The control signalling is done using techniques that cannot be confused
with data. For example, there may be signals at a frequency not found in the data,
or there may be values on the data lines that cannot ever be data, or there may be
extra signal lines to indicate some control information.
Data Characteristics
VI - 21
Parallel Interfacing
173
Data Characteristics
VI - 22
Parallel Interfacing
174
Persistence of Data
Consider the persistence from the perspective of the receiver of the data.
Persistent data may be accepted at the convenience of the receiver. Once the change has
been detected, then after the data has been accepted the source is informed that the value
is no longer needed.
Transient data must be accepted within a time specified by the source after its presence
is signalled. This could be done with a latch at the receiver.
Time
Persistent data
Transient Data
Valid Data
Valid Data
Known
(specified)
time
File:datatype.
Data Characteristics
VI - 23
Parallel Interfacing
175
Valid
Accept
CR
SR
Accept
Parallel Interface
(CPU as the
Customer)
Valid
Timer
Data
Counter
Data
Device Registers
Data Characteristics
VI - 24
Parallel Interfacing
176
Control
Data
Edge
Detect
Register
Data
Available
Data Characteristics
Data
VI - 25
Parallel Interfacing
177
It may also
be
noisy
(bounce)
The SPDT
solution
assumes
that
the
switch will
not bounce
from one
throw
to
the other.
It bounces
on
and
off of one
throw at a
time.
File:switchdebounce.
SPST (Single Pole Single Throw) SPDT (Single Pole Double Throw)
Q
B
Milliseconds
A
B
C
Switch Starts to change state
Q
Data Characteristics
VI - 26
Parallel Interfacing
178
De-bounce Options
Software: unknown duration of bounce (assume limit, act After stable)
Hardware: counter or shift register (clock to sample etc.) or more expensive switch and
RS latch.
Data Characteristics
VI - 27
Parallel Interfacing
179
VI - 28
Parallel Interfacing
180
Event Characteristics
VI - 28
Parallel Interfacing
181
Transient Events
Persistent Events
E3
E1
E3Ack
E2
Event
Occurs
Event
Used/Consumed
Event
Occurs
Event
Used/
Consumed
E3 signals even happens and E3Ack indicates
Event has been consumed.
Event Characteristics
VI - 29
Parallel Interfacing
182
Event
Ck
Occured
(rising edge) Asynchronous
Clear
Event Characteristics
Stable value
indicating that
the event has
happened
Event
Consumed
To Event Consumer
VI - 30
Parallel Interfacing
183
Event Characteristics
VI - 31
Parallel Interfacing
184
Event
Ck
Occured
(rising edge) Asynchronous
Clear
Explicit Clear
Stable value
indicating that
the event has
happened
Event
Consumed
To Event Consumer
Implicit Clear
Event Characteristics
VI - 32
Parallel Interfacing
185
SW0
dataonlyinput.
Processor
I/O Bus
SW7
Event Characteristics
VI - 32.1
Parallel Interfacing
186
dataonlyoutput.
LED Display
Q
Processor
I/O Bus
Q1
Data Only Transfer (Output)
(Storage at Interface)
Event Characteristics
VI - 32.2
Parallel Interfacing
187
eventonlycpu.
Control Register's
Address Detected and
Write Time
Clock
Status Register's
Address Detected and
Read Time
Processor
newEVENT
Data Bus
Event Characteristics
VI - 32.3
Parallel Interfacing
188
Note: Data and Event Transfers, Transient Data, implicit status bit clearing
dataeventinputtransientTimingDiagram.
Data
Data 1
Data 2
Event
Event
(Data Available)
In this case the figure illustrates implicit clearing of the status bit when the data is read. This
could also be implemented as an explicit clearing.
NewData
Processor
I/O Bus
OverRun
Reset Implicitly
(automatically) when
datais read
Asynchronous
Reset
1
D
Q
Clock
Status bit
indicating fresh
data is available
(could be used
for polling or
interrupt)
Event Characteristics
VI - 32.4
Parallel Interfacing
189
dataeventinputtransientfirst.
Enable when DataRegister's
Address detected and correct
Read Time
D a ta from s e ns or
Event
(Data Available)
In this case there is consideration for what happens when a second event occurs before the first
event (data) has been processed.
There are various options available to the designer such as:
always keep the first event (as shown) or
always keep the newest event (not
shown)
Processor
I/O Bus
Once the first value is loaded,
later clock pulses are ignored
until the status bit is cleared
Reset either by CPU or
Automatically when
Asynchronous
data is read
Reset
READ
1
Status
D
Q
Clock
Clock
NewData status
bit indicating fresh
data is available
(could be used for
polling or IRQ)
READ
Status
Q
OverRun status
bit indicating that
new event occured
while previous event not
consumed
Event Characteristics
VI - 32.5
Parallel Interfacing
190
dataeventinputpersistent.
Processor
I/O Bus
Event
(Data Available)
D
Q
Clock
Data Accepted
Status bit
indicating fresh
data is available
(could be used
for polling or
interrupt)
Event Characteristics
VI - 32.6
Parallel Interfacing
191
Terms that have been defined (not an exhaustive list) include: buffering time and level, implicit data direction control, explicit
data direction control, static and dynamic bidirectional port operation, data direction register, persistent and transient data,
in-band and out-of-band signalling, and input and output synchronization. You may be asked to define or explain these terms
or compare and contrast similar (or dis-similar) terms.
2.
For the switches shown in the figure below, show how to interface each of them to a parallel port and how you would read
SPST
the switch (pseudo code). Consider how to handle bounces in the hardware and the software in each case.
3.
SPDT
For the LED shown below, indicate how to attach it to an implicit (passive pull-up) parallel port. (Again, show code, including
5V
R
initialization.)
VI - 32.1
Parallel Interfacing
192
Consider the choice between implicit and explicit data direction control. (when would each be appropriate?) Your answer
should include the following issues.
A summary of how a user would use this in a hardware sense. You should be able to provide sample drawings of
various attached devices.
A summary of how a user would use this in a software sense. You should be able to provide sample pseudo-code to
operate various attached devices.
One (preferably more) insightful comments, supported by your previous answers and example applications.
2.
Consider the choice between an implementation with persistent or transient data. (Same points should be in your answer.)
3.
Consider the choice between in-band and out-of-band signalling. (Similar points,)
VI - 32.2
Parallel Interfacing
193
VI - 32.3
Parallel Interfacing
194
5V
R
VI - 32.4
Parallel Interfacing
195
VI - 32.7
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section VII:
Error Detection and Correction
f2014-1.0
197
VII - 0.1
198
Resources
VII - 1
199
VII - 2
200
Communication Structure
channel.
Data
Source
Data Transfer
(with noise?)
Data
Destination
VII - 3
201
VII - 4
202
OV ERHEAD =
C
B+C
VII - 5
203
Communication Structure
Consider a system with B bits of data and C check bits for correction.
Correct
Data word
(B Bits)
Data
Channel
CRec
Det/Cor
Channel
Data
Out
B Bits
CCalc
Compare
Data In (B Bits)
Code word
(B+C Bits)
Error
Detected
C Check Bits
F is the function to calculate the C check bits.
general.
VII - 6
204
VII - 7
205
VII - 8
206
Parity
The most common first level of defense. (C = 1)
Add 1 bit per B bits so that the B + 1 bits always have
an even number of bits set to a 1 value (even parity)
an odd number of bits set to a 1 value (odd parity).
Detects single bit errors.
The minimum distance between valid code words is 2.
Distance: The minimum number of bits that must change to go from one code word
to another code word
.
Note: to detect single bit errors requires a distance of at least 2.
Parity
VII - 9
207
Parity
Consider a 3-bit data word (plus 1 bit of parity) (bbbc){Assume Even Parity in this case}
1000
0001
1001
0010
1010
0011
1011
0100
1100
0101
1101
0110
1110
0111
1111
Parity
0001
0000
0100
1001
1000
1011
1010
1110
1111
0011
0010
0110
0111
1100
0101
1101
distance2.
VII - 10
208
Distance and EC vs ED
distance3.
Correct Code
Word
Word with
Error
Effect of 1 bit
error (distance 1)
VII - 11
209
Distance and EC vs ED
distance3a.
EC-ED
ED Only
0-1 1
1-1
1-2
2-2
VII - 12
210
Hamming Code
(See Wakerly)
Consider the case of B = 4.
Consider the example on the next two pages.
There are 3 sets (P, Q, and R).
Each set includes 1 check bit (thus there are 3 check bits for 4 bits of data in this case)
Each check bit is set so that the combination of the data and check bits in the set has an
even number of 1s (i.e. each set has even parity).
For any received/read value each set could have either Even or Odd parity.
Thus there are 23 1 code words that indicate a single bit error and
Only 1 correct code word. (P, Q, and R all have even parity at the receiver).
Hamming Code
VII - 13
211
Hamming Code
Set P
Set Q (2 bits
1
1 1 0
Data Word = 1110
Set R
venn1.
Hamming Code
VII - 14
212
each check bit is in exactly one set. (C0 is in set R C1 is in set Q and C2 is in set P)
the data bits are in two or three sets. ( D0 is in sets Q and R, D1 is in sets P and Q, D2 is in sets P and R, and D3
is in sets P and Q and R)
Hamming Code
VII - 14.1
213
Set Q
Set P
CP
1
D1
1
D
1 3 0
D2
D0
CQ
CR
Set R
venn0.
If the 7 bits shown in the figure above were to be transmitted, and we assume that there
is (at most) 1 bit with an erroneous value, the table on the next page lists the parity for
the 3 sets of values at the receiver.
Hamming Code
VII - 15
214
Received Parity
Bit In Error Set P Set Q Set R
CP
Odd
Even
Even
CQ
Even
Odd
Even
CR
Even
Even
Odd
D0
Even
Odd
Odd
D1
Odd
Odd
Even
D2
Odd
Even
Odd
D3
Odd
Odd
Odd
None
Even
Even
Even
Hamming Code
VII - 16
215
Set P
Set Q
Set R
CP
CQ
CR
D0
Set P
Set Q
Set R
None
CR
CQ
D1
D0
D2
CP
D3
D2
None
D1
D3
Hamming Code
VII - 16.1
216
Example: An Error in D2
As Received
As Corrected
Set Q
Set P
1
1
Odd
0
Data Word = 1110
0
Even
Even
0
Odd
Set Q
Set P
Set R
Parity errors in
Set P and R
(only 1 bit in common)
--- Correct it
venn2received.
Hamming Code
Even
0
Set R
Data = 1110
Check = 100
venn2corrected.
VII - 17
217
Hamming Code
VII - 18
218
2036
2000
1500
1013
1000
502
500
11
26
57
120
247
10
11
Hamming Code
VII - 19
219
C + B 2C 1
3 + B 23 1
4 + B 15
5 + B 31
6 + B 63
7 + B 127
Hamming Code
B
4
8
16
32
64
Overhead for B
43 % (3/7)
33 % (4/12)
24 % (5/21)
16 % (6/38)
10 % (7/71)
VII - 20
220
NOTE the 1.
CCalc
B data bits
CRec
ceiling(log2(B+C+1))
bits indicating the
location of the error
syndrom1.
VII - 21
221
CiCalc
Si =
for 1 i C
If S = 0 (i.e., the syndrome has zero 1s)
then the code is correct (CiRec = CiCalci)
If S has only one 1 then the error is in a
check bit
If S has more than one 1 then the number
represented is the bit in error.
One way to accomplish this is the following:
place the check bits at positions:
20, 21, 22, ...2C1
and data bits everywhere else.
then associate
Remark
All the bits
with
20 = 1 in numerical rep.
2, 3, 6, 7..
21 = 1 in numerical rep.
4, 5, 6, 7, 12.. 22 = 1 in numerical rep.
8..15, 24..31, ... 23 = 1 in numerical rep.
See
Ques- 2j = 1 in nutions (start- merical rep.
ing on page
227)
VII - 22
222
CPT ransmitted
CPT ransmitted
CQT ransmitted
CQT ransmitted
CRT ransmitted
CRT ransmitted
=
=
=
=
=
=
D1 D2 D3
111=1
D0 D1 D3
011=0
D0 D2 D3
011=0
Set Q
Set P
CP
1
D1
1
D
1 3 0
D2
D0
CQ
CR
Set R
venn0.
VII - 23
223
CPRec
CPRec
CQRec
CPRec
CRRec
CPRec
=
=
=
=
=
=
CPT ransmitted
1
CQT ransmitted
0
CRT ransmitted
0
CPCalc
CPCalc
CQCalc
CQCalc
CRCalc
CRCalc
=
=
=
=
=
=
D1 D2 D3
101=0
D0 D1 D3
011=0
D0 D2 D3
001=1
VII - 24
224
Data Check
C0
C1
D0
C2
D1
D2
D3
C3
D4
D5
D6
D7
C0
C1
C2
C3
=
=
=
=
D0 D1 D3 D4 D6
D0 D2 D3 D5 D6
D1 D2 D3 D7
D4 D5 D6 D7
VII - 25
225
Example
Data in (D7...D0) = 0 0 1 1 1 0 0 1
Check Bits (C3,C2,C1,C0) = 0 1 1 1
Bit
D7
D6
D5
D4
Data Out
Check Out
C3
D3
D2
D1
C2
D0
C1
C0
1
1
Sent
Received
VII - 26
226
C0Rec C0Calc
1 D0 D1 D3 D4 D6
110110
0
C1Rec C1Calc
1 D0 D2 D3 D5 D6
111110
1
C2Rec C2Calc
1 D1 D2 D3 D7
10110
1
C3Rec C3Calc
0 D4 D5 D6 D7
01100
0
VII - 27
227
Terms used in this section: Hard Failures, Soft Failures, Overhead, Error Detection, Error Correction, Data Word, Code
Word, Distance and Syndrome.
Specific examples of Hamming coding would be worth considering. Possible examples include:
Given a number of bits in a data word, how many check bits would be needed?
For a given data word and coding scheme what are the values for the check bits?
For a given received pattern if there is an error, which bits are in error?
For the entry in the table for the code bit positions (starting on page 221) for the check bits, derive an expression
for code bits to be included in the calculations for Check bit C j .
Engineering Questions (See questions at the end of the parallel port section for the types of points to include in your
consideration.)
When are additional check bits justified? Eg., given x data bits when is it reasonable to add check bits? When is it
unreasonable?
How might you determine how many blocks to split x bits into for transmission. (Use material from your probability
course.)
VII - 27.1
228
VII - 27.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section VIII:
Serial Interfacing
f2014-1.0
Serial Interfacing
230
VIII - 0.1
Serial Interfacing
231
VIII - 1
Serial Interfacing
232
Computer
Computer
Channel
I/F
I/F
VIII - 2
Serial Interfacing
233
Communication Context
context
Context
Information (Variable size: perhaps a file)
Analog Signals
VIII - 3
Serial Interfacing
234
Channels
Simplex: unidirectional as shown below
Half Duplex: bidirectional, one-way at a time, as shown below
Full Duplex: simultaneous bidirectional, as shown below
duplexing.
Tx
(Transmitter)
Rx
(Receiver)
Channel
(implementation
unspecified)
Simplex
Terminology
Tx
Rx
Distributed
Direction
Control
Channel
(implementation
unspecified)
Half Duplex
Rx
Tx
Tx
Rx
Rx
Channel
(implementation
Tx
unspecified)
Full Duplex
VIII - 4
Serial Interfacing
235
Classes of Synchronization
Bit Synchronization: How long is each bit? and Where do bits start (or stop)?
These two components may be considered separately.
Bit Rate Synchronization: The time that elapses between the start of one bit and
the start of the next bit.
Phase Synchronization: Given that the rate is known, how is the mid-point (or start)
of each (or any) bit found. This amounts to determining the phase relationship
between the local clock and the clock used to transmit the data originally.
Byte Synchronization: Where do bytes start and stop?
Block Synchronization: Where do blocks start and stop?
Terminology
VIII - 5
Serial Interfacing
236
Bit Synchronization
Given an input signal as shown below:
Time
synch1.
Terminology
VIII - 6
Serial Interfacing
237
Data
synch2.
Terminology
VIII - 7
Serial Interfacing
238
Data
synch3.
Terminology
VIII - 8
Serial Interfacing
239
Byte Synchronization
Given an input signal and a clock as shown below: The clock provides one way to get the
bit timing, if we assume rising edge then bit synchronization has been attained and the bits
can be reliably interpreted. 16, 0110111001101010 Further assume that by convention
synchronization information permits bytes to be detected 0xB9, 0xA9
16-bits of interest
Byte
Clock
Bit
Clock
Data
VIII - 9
Serial Interfacing
240
Terminology
Bit per second (Bit Rate) vs Baud (or Baud Rate).
Bit Rate: The number of bits that can be transferred per second over a channel.
Baud Rate: The maximum number of symbols that can be transferred per second over a channel.
Consider the following figure
Clock
Bit
Data
Bit
Read
4 Value
Data
Value
Read
bitbaud
Terminology
VIII - 10
Serial Interfacing
241
serial13.
1
On/Off
NRZ
Bipolar
RZ (Return to Zero)
(Split Phase) Manchester
Min. 1 edge per bit (middle)
Clock Recovery easy
Differential Encoding
Edge means 0
No edge means 1
Data can be interpreted
even if it is inverted
Terminology
VIII - 11
Serial Interfacing
242
CS
Address
Decoder (ATD)
A0, A1
Address Lines
Address and
Synchronization
Signals
R/W
CS Chip Select
RCV Receive Register
XMIT Transmit Register
SR Shift Register
Int Req Interrupt Request
System Bus
Data Bus
Int REQ
Interface
Register
Selection
8
8
e.g.,
TXReady
STATUS
CONTROL
RCV
XMIT
SRin
SRout
Local
Osc.
May Jumper to
one or both
clocks
Serial Data in
Rx Clock
Serial Data Out
Tx Clock
serial1.
Shift registers are used to convert between serial and parallel data streams.
Character-Oriented Serial Interfaces
VIII - 12
Serial Interfacing
243
When SRout (I.e. the Output Shift Register) is idle, data is transferred from XMIT to SRout (in parallel)
In the figures below, two alternatives for the transmit clock are shown.
CS
Synchronous
serial1ta.
serial1tb.
R/W
A0, A1
Address Lines
Address and
Synchronization
Signals
System Bus
Data Bus
Int REQ
CS
Interface
Register
Selection
RCV
System Bus
Data Bus
XMIT
SRin
SRout
Int REQ
Interface
Local
Osc.
Address and
Synchronization
Signals
R/W
Register
Selection
CONTROL
STATUS
Address
Decoder (ATD)
Asynchronous
Address
Decoder (ATD)
A0, A1
Address Lines
Serial Data in
Rx Clock
Serial Data Out
Tx Clock
8
8
STATUS
Local
Osc.
CONTROL
RCV
XMIT
Serial Data in
Rx Clock
SRin
SRout
Tx Clock
VIII - 12.1
Serial Interfacing
244
CS
Address
Decoder (ATD)
A0, A1
Address Lines
Address and
Synchronization
Signals
R/W
CS Chip Select
RCV Receive Register
XMIT Transmit Register
SR Shift Register
Int Req Interrupt Request
System Bus
Data Bus
Int REQ
Interface
Register
Selection
8
8
e.g.,
TXReady
STATUS
CONTROL
RCV
XMIT
SRin
SRout
Local
Osc.
May Jumper to
one or both
clocks
Serial Data in
Rx Clock
Serial Data Out
Tx Clock
serial1.
VIII - 13
Serial Interfacing
245
when SRin is full data is transferred into the RCV (Receive) register (in parallel)
In the figures below, two alternatives for the receive clock are shown.
CS
Synchronous
serial1ra.
serial1rb.
R/W
A0, A1
Address Lines
Address and
Synchronization
Signals
System Bus
Data Bus
Int REQ
CS
8
8
STATUS
XMIT
R/W
System Bus
Data Bus
Register
Selection
Local
Osc.
CONTROL
RCV
Address and
Synchronization
Signals
Int REQ
Interface
Interface
Register
Selection
Address
Decoder (ATD)
Asynchronous
Address
Decoder (ATD)
A0, A1
Address Lines
SRin
SRout
Serial Data in
Rx Clock
Serial Data Out
Tx Clock
STATUS
Local
Osc.
CONTROL
RCV
XMIT
Serial Data in
Rx Clock
SRin
SRout
Tx Clock
VIII - 13.1
Serial Interfacing
246
Address Lines
(A1 and A0)
Address Lines
(A15..A2)
System Bus
Data Lines
on interface
R/W
Address
Decoder (ATD)
Chip Select
Bus Clock
Enable
Register
Selection
(Address
Decoder
for the
lower bits)
Transmit Register
Address and Write
Timing Information
the Communication
part of the
serial interface
Control
Register
Decoded Control
Serial Out
Register
Interrupt Enable
Address and
Write Timing
information
Serial Interface
(example)
Transmit
Register
Decoded Receive
Register
Address and
Read Timing
Receive Information
Register
Serial Data
Serial In
Out Ready
Interrupt Enable
Decoded Status
Register
Address and
Read Timing
Information
Status
Register
Serial Data
In Ready
Open Collector
Gates
VCC
/IRQ
VIII - 14
Serial Interfacing
247
Reality Checks
There are a number of issues to resolve.
Time:
How does the receiver really recognize bits, bytes (or later blocks)?
Given a clock how do you send/receive the data (next)?
How do you get the clock (later)?
In the case of serial communication, slightly different meanings of Synchronous and
Asynchronous:
Synchronous: Both Rx and Tx use the same clock (frequency and phase).
Asynchronous: Rx and Tx have independent clocks that have the same (or similar)
frequencies.
Errors:
Corrupted data received due to noise on the channel.
Erroneous data caused by timing problems (e.g., slow reading, clocking differences)
VIII - 15
Serial Interfacing
248
Clocks/Time
System A
System B
Nominal Data RateLeft
clocks.
VIII - 16
Serial Interfacing
249
Serial Data In
Rx Clock
Rx Clock
serclock.
VIII - 17
Serial Interfacing
250
VIII - 18
Serial Interfacing
251
Bit
Time
Bit
Time
Byte Time
RCV Register
8-bits to
CPU
Shift register
1-bit at a time
bitbyte
VIII - 18
Serial Interfacing
252
VIII - 19
Serial Interfacing
253
VIII - 20
Serial Interfacing
254
Address
Decoder (ATD)
A0, A1
Address Lines
Serial Protocols
Clock Connection:
Synchronous?
Asynchronous?
Address and
Synchronization
Signals
System Bus
R/W
Data Bus
CS
Register
Selection
Int REQ
Local
Osc.
STATUS
8
CONTROL
8
SRin
RCV
8
XMIT
May Jumper to
one or both
clocks
Data Connected
SRout
Serial Data in
Channel
Interface
Rx Clock
Serial Data Out
Tx Clock
synchasynch.
VIII - 21
Serial Interfacing
255
CS
Address
Decoder (ATD)
A0, A1
Address Lines
Asynchronous Protocols
Clock Connection:
Asynchronous Clocks Passed By Convention
Address and
Synchronization
Signals
R/W
System Bus
Data Bus
Channel
Int REQ
Interface
Register
Selection
8
8
STATUS
Local
Osc.
CONTROL
RCV
XMIT
May Jumper to
one or both
clocks
Data Connected
Serial Data in
8
SRin
SRout
Rx Clock
Serial Data Out
Tx Clock
asynchclock.
Assume both ends of the channel know the correct (nominal) data rate.
(Standard) Baud Rates: 110, 134.5, 150, 300, 600, 1200, 2400, 4800, 9600, 19.2K
... .
Must convey the phase of the tx clock to the receiver.
This is an asynchronous data frame
showing one byte of data.
serial2a.
LSB
b0 b1
Idle
Start
Bit
Early
Asynchronous Protocols
MSB
b7
Data Bits
Time
Late
VIII - 22
Serial Interfacing
256
Bit Synchronization
Issues
The data cannot be clocked into the receiver using the same clock as used for
transmission. That is, there is no wire connecting the clocks.
The designer (and user) of the receiver has only a nominal transmission frequency
specification.
There is no (direct) phase synchronization between the transmit and receive clocks.
The clock generators in the source and destinations do not necessarily have the same
drift coefficients. (Time or Temperature)
Design principle: The structure is designed assuming that the receiver has a reasonable
estimate of where the bit should start (phase synchronization), and the goal is to sample
the bit in the middle. Why?
To sample in the middle of the bit the following design characteristics are required.
A reasonably accurate specification for the nominal frequency (eg. (10000 5%) Hz.)
used to find the next bit given the current bit.
A way to extract the phase of the clock. (described later)
Asynchronous Protocols
VIII - 23
Serial Interfacing
257
Bit Synchronization
Detailed clock design example
The figure assumes correct frequencies but Rx1, Rx2 and Rx3 differ in phase synchronization with the transmitter.
If we have multiples of the transmitter frequency available at the receiver, then we
can more accurately estimate the middle of the bit. (16 or 32 are multiples often
used)
Asynchronous Protocols
VIII - 24
Serial Interfacing
258
Bit Synchronization
Asynchronous Protocols
sixteen.
One Bit Tx
Transmit Clock (At Rx)
Rx1
Rx2
Rx3
2*Rx1
2*Rx2
2*Rx3
Two Times Tx Clock
4*Rx1
4*Rx2
4*Rx3
VIII - 25
Serial Interfacing
259
Idle
LSB
b0 b1
Start
Bit
MSB
b7
Data Bits
Early
Start bit
for next
frame
1
Time
Late
serial2.
Bit -1 (Start Bit). Must have a value of 0 and indicates that a data byte is to start.
Bit 0-7 Data bit values
Bit 7 may also be a parity bit (Space (Parity Bit = 0), Mark (Parity Bit = 1), Even,
or Odd)
Bit 8 (and perhaps 9) Stop bit:
Must have a value 1 to indicate end of data
Value of 1 assures that start bit will have a falling edge at the start of it.
Between characters. The protocol leaves the line as a 1 when there is no data to transmit.
Asynchronous Protocols
VIII - 26
Serial Interfacing
260
Bit Sampling
Possible to implement an asynchronous protocol at the receiver with a free-running local
oscillator n times the data rate. (Assume n=16, 8-bits of data, and no parity for this
example.)
Step
1
2
3
4
5
6
8
9
10
11
Counter
0x0
0..7
8
0x9..0x18
0xi9..0x(i + 1)8
0x79..0x88
0x89..0x98
0x98
0x99..0xA8
(If reqd)
0x0
Operation
Wait for start of start bit (falling edge)
Wait for 0.5 bit times (8 clock periods)
Verify that serial data line is still 0.
Wait 16 clock times (1 bit time) and sample the first bit
Wait 16 clock times (1 bit time) and sample the ith bit
Wait 16 clock times (1 bit time) and sample the last bit (bit
b7)
Wait 16 clock times (1 bit time)
If data = 0 then framing error (stop bit has wrong value).
If there are to be 2 stop bits repeat steps 8 and 9 one more
time.
Indicate that the byte has been received go to step 1.
Asynchronous Protocols
VIII - 27
Serial Interfacing
261
S1
S2 S3 S4
Idle
b0
LSB
0x98
S0
0x88
88
0x78
0x58
72
0x68
0x48
40 56
0x28
24
0x18
0x08
0x38
Bit Sampling
16 times clock
(HEX Notation)
104
120
136
152
16 times clock
S5 S6
S7
S8 S9
Sample Points
b1
b7
MSB
1
Start Bit
serial3.
Asynchronous Protocols
VIII - 28
Serial Interfacing
262
Start
Bit
Data Bits
Stop
Bit
Correct Clock
Clock too slow
Line-up in
the middle of
start bit
slowclocks.
Asynchronous Protocols
VIII - 29
Serial Interfacing
263
Clock Shift
Let fT x and fRx be the actual clock rates for the transmitter and the receiver respectively. Also
assume that the number of bits to be transferred without error is B (B includes the start and
stop bits).
1/fTx
Tx Clock
DT
Rx Clock
Tx
1
1
fRx f
If B T > 12 f 1 then the shift at
Tx
the end of B bits is larger than 0.5 bits.
T =
1/fRx
clockshift.
Asynchronous Protocols
VIII - 30
Serial Interfacing
264
Idle
LSB
b0 b1
Start
Bit
MSB
b7
Data Bits
Early
Start bit
for next
frame
1
Time
Late
serial2.
Asynchronous Protocols
VIII - 31
Serial Interfacing
265
Some Errors
Framing Error : An incorrect frame has been detected. In the case of one-byte asynchronous transfers, the indication of a framing problem is that the stop bit is incorrect
(possible baud rate error)
.
Overrun Error : In a serial communication system, the data at the transmitter and receiver
is transferred at a time convenient to the controlling processor. As a result it may be that
the serial data will arrive too quickly for the receiver to process the data. It is also possible
that the transmitter will be sending data faster than the serial channel can transfer the
data. In either case, some data may be overrun by the data following it in the channel.
This is an overrun error.
There are two special cases.
Receive Overrun Error : At the receiver, incoming data has overwritten data in SRin
or RCV register.
Transmit Overrun Error : Resulting from the CPU or the device writing to the transmit
buffer before the current content of the transmit buffer has been transmitted.
Parity Error : The parity of the received data and the value of the parity bit do not match
Start Bit Error : when the line is sampled one half of a bit time after the edge of the start
bit is detected, the value is not zero. This probably indicates that a false start bit has
been detected, alternatively there may be some error in the assumed bit rate.
Asynchronous Protocols
VIII - 32
Serial Interfacing
266
Asynchronous Protocols
Parity Bit
Stop Bit
delete.
Start Bit
Bit 0
Even Parity ~
Odd Parity ~
VIII - 33
Serial Interfacing
267
Special Character
Break (and long break) ... Forces a framing error.
A normal break is usually a fixed duration in a given system. In some cases (with
slow data rates) this break may appear to be some form of data that starts with a
number of zeros. A long break often stays asserted as long as the user presses the
break key, this assures that it will be a framing error.
An example of out-of-band signalling.
Stop
Start
break.
Break
Asynchronous Protocols
VIII - 34
Serial Interfacing
268
simplex1a.
Tx
(Transmitter)
Source
Assume
SBTx stop bits
Rx
(Receiver)
Channel
(implementation
unspecified)
Sink
Assume
SBRx stop bits
Asynchronous Protocols
VIII - 34.1
Serial Interfacing
269
Synchronization
Technique
Comments
Bit Synchronization:
Bit Rate by agreement May also be done by software detection.
Bit Synchronization:
Phase start/stop bits The receiver detects falling edge to determine
where the first bit starts.
Byte Synchronization start/stop bits Since only 1 byte per frame, once bit 0 has
been detected, the byte is also known.
Block Synchronization
N/A
Some of the techniques described in later sections could be used to provide Block Synchronization.
Asynchronous Protocols
VIII - 35
Serial Interfacing
270
Synchronous Protocols
Require a common clock at source and destination.
this is the only difference between synchronous and asynchronous.
separate lines for clock and data. (limited distances and data rates.)
or
encode clock and data on same signal line (typically done with a signalling structure
similar to Manchester encoding).
Advantages:
reduced overhead no Start/Stop bits
higher speeds possible (no need to worry about relative accuracies of the two clocks).
asynchronous RS-232 max. 19,200 bps; Synchronous can be used beyond 10Mbps.
Synchronous Protocols
VIII - 36
Serial Interfacing
271
To CPU
To Output Device
Data
in
Data
out 8-bit shift register
Clock in
From CPU
Global
Clock
Note:
Clock and wire length. If the distances are too large, then the clock may not arrive at
each input at the correct time. (Discussed in detail later in the term.)
Synchronous Protocols
VIII - 37
Serial Interfacing
272
Address
Decoder (ATD)
A0, A1
Address Lines
synchclock.
R/W
System Bus
Channel
Int REQ
Data Bus
CS
Clock Connection:
Synchronous
Address and
Synchronization
Signals
Interface
Register
Selection
STATUS
Data Connected
Local
Osc.
CONTROL
8
8
SRin
XMIT
Serial Data in
RCV
Rx Clock
SRout
Tx Clock
CS
Address
Decoder (ATD)
A0, A1
Address Lines
synchclock2.
Clock Connection:
Synchronous encoded
data and clock on one signal
Address and
Synchronization
Signals
R/W
System Bus
Data Bus
Int REQ
Interface
Register
Selection
8
8
STATUS
CONTROL
RCV
XMIT
Tx Clock
Local
Osc.
Serial Data in
8
SRin
Rx Clock
Channel
Data Connected
8
8
SRout
Decode signal
to extract clock
and data.
Synchronous Protocols
VIII - 38
Serial Interfacing
273
Address
Decoder (ATD)
CS
R/W
Register
Select
In Sync
(Status Bit)
Int REQ
Data Bus
Clock
Extraction
STATUS
CONTROL
Serial Data in
Sync Detect
RCV
QUEUE
SRin
XMIT
SRout
QUEUE
serial14.
VIII - 39
Serial Interfacing
274
VIII - 40
Serial Interfacing
275
Serial Data
transmit Clock
Error
manchester1.
VIII - 41
Serial Interfacing
276
VIII - 42
Serial Interfacing
277
BISYNC Protocol
Based on special ASCII characters: SYNC (0x16), SOH, STX, ETX, ETB, and DLE.
(SYNC - Synchronize, SOH Start of Header, STX Start of Text, ETX End of Text, ETB
End of Transmission Block, DLE Date Link Escape) A complete listing of the ASCII table
is available in most texts or on the Internet (at www.asciitable.com).
A long string of SYNC characters can eventually be recognized and are used to establish
synchronization during initialization.
SYNC characters are ignored (except for their synchronization characteristic).
VIII - 43
Serial Interfacing
278
ETX 1 Byte
STX 1 Byte
Header 3 Bytes
SOH 1 Byte
seria15a.
SYNC >= 1 Byte
BISYNC Frame
Data: contains data being transferred (but not STX or ETX characters).
send these characters (and all special characters) with a Data Link Escape (DLE). A
DLE character indicates that the next character is to be interpreted as a normal (not
special) character.
For example:
DLE | STX would be used to send an STX in the data stream and
DLE | DLE would be used to send a DLE in the data stream
When the source buffer empties, SYNCs are inserted by the source and ignored by the
destination, as long as the character prior to the first SYNC is not a DLE.
VIII - 44
Serial Interfacing
279
VIII - 45
Serial Interfacing
280
Flag
Check
Data
Control (1-2)
Addr
Flag
seria15b.
VIII - 46
Serial Interfacing
281
01111110 Address
Flag
Minimum Frame 3 Fields
-- Address (8)
-- Control (8)
-- Checksum (16)
>= 0
Control
Data
16
Checksum 01111110
Flag
Frame Types
Control Field
i) Information
0 Seq
ii) Supervisory
1 0 type next
iii) Unnumbered
1 1 type mod
next
p/f
VIII - 47
Serial Interfacing
282
Frame Types
Control Field
i) Information
p
/
f
0 Seq
next
VIII - 48
Serial Interfacing
283
Frame Types
Control Frame
ii) Supervisory
1 0 type next
Type 0: Used as an Acknowledgment (ACK) only. Useful when there is no reverse traffic
on which to carry the acknowledgments.
Type 1: Negative Acknowledgment (NACK). The Next field indicates the number of the
first frame that must be retransmitted.
Type 2: Similar to type 0. ACK all messages up to Next-1 but causes the sender to stop
transmission. When ready Next will be either ACKed or NACKed.
Type 3: Selective Reject. Resend just the named frame.
VIII - 49
Serial Interfacing
284
Frame Types
iii) Unnumbered
Control Frame
1 1 type mod
VIII - 50
Serial Interfacing
285
Time
Sender
Receiver
1
0
3
1
4
2
5
3
VIII - 51
Serial Interfacing
286
seria17c.
4
NACK
D D D D
E Error no packet received
D Discard
E
seria17d.
VIII - 52
Serial Interfacing
287
1
1
4
1
2
5
6
2
4
0
Acked
B
B->A
A->B
2
1
1
3
2
4
3
5
7
Acked
6
0
seria18a.
VIII - 53
Serial Interfacing
288
3/0
3/1
3/2
3/3
3/4
3/5
3/6
3/7
4/0
4/0
4/1
4/2
4/3
4/4
4/5
4/6
4/7
5/0
Now the right side has been told that the 2nd
0 packet has been received.
seria18c.
VIII - 54
Serial Interfacing
289
3/0
3/1
3/2
3/3
3/4
3/5
3/6
4/7
4/7
4/0
4/1
Assume all are lost
4/2
4/3
4/4
4/5
5/7
Now the next field of 7 has 1 meaning to both sides
seria18d.
VIII - 55
Serial Interfacing
290
0
ACK 6
NACK 2
seria18b.
VIII - 56
Serial Interfacing
291
Timeout
3/2
3/3
3/4
3/5
3/6
4/7
Lost
Old
3/0
3/1
3/2
Window 7, 0-5
3/3
3/4
3/5
3/6
Now forward 7, old 0- old5 to host
serial19.
Thus the new window and the old window cannot overlap ... max window size is n2 .
Synchronous Serial Communication
VIII - 57
Serial Interfacing
292
Byte
Block
Global
Single Line
Clock
for Data and Clock
Technique
Technique
Comments
Dedicated clock signal Hardware detection
May require agreement to
an approximate rate
Dedicated clock signal Derived from serial Although often part of
data stream
clock extraction, the phase
can be detected by observing the edges and shifting
edges until mid bit always
found. (Assuming Manchester encoding.)
Flag, bit, bit-pattern Flag or bit pattern
or global reset
Byte synchronization Bit or byte synchronization
VIII - 58
Serial Interfacing
293
Asynchronous
Often slower
Synchronous
Alternatives available
(e.g., BISYNC and HDLC)
VIII - 59
Serial Interfacing
294
VIII - 60
Serial Interfacing
295
USB Resource
The most complete source is the USB specification, available from the USB web site
http://www.usb.org/developers/docs/
There are also a number of good reference books on the subject available including:
Anderson and Dzatko, Universal Serial Bus System Architecture, Mindshare Inc, NJ, 2001.
VIII - 61
Serial Interfacing
296
VIII - 62
Serial Interfacing
297
Introduction - Structure
Links transferring
LS and FS information
Device
Device
Device
Device
Hub (1.x)
Hub (1.x)
Hub (1.x)
Device
Device
usb1.
VIII - 63
Serial Interfacing
298
VIII - 64
Serial Interfacing
299
VIII - 65
Serial Interfacing
300
USB Signalling
usbsignal1
Low Speed
Devices
(only)
Full Speed
Devices
(only)
Downstream Port
(device or hub)
D+
D90 Cable
15 k
SE0: Single-ended 0
VIII - 66
Serial Interfacing
301
Low-Level Synchronization
Data rate is specified by the presence of one of the resistors pulling up either D- (Low
Speed) or D+ (Full Speed). This is detected when the device is plugged into the hub
Non-Return-to-Zero-Inverted (NRZI) signal encoding. (Zeros cause transitions and ones
do not cause transitions)
Bit stuffing is used to maintain enough clock edges to keep the clock synchronized. (Stuff
after 6 consecutive ones in this case.)
(Block Synchronization 1) Start of Packet is transmitted as 00000001 to synchronize
clock (lots of edges with the 0s for bit/clock synchronization and then one 1 for byte
synchronization.) Of note, line goes idle between packets and clock re-synchronization is
required for each packet.
(Block Synchronization 2) Out-of-band signalling for end of packet. (Both D+ and Dare held at 0 for 2 bit times using the SE0 signal to force a violation of differential output
values.)
VIII - 67
Serial Interfacing
302
NRZI Signalling
usbsignals
D+
DSynchronization Pattern
start of the
packet
VIII - 68
Serial Interfacing
303
VIII - 69
Serial Interfacing
304
Packet ID
(PID)
8-bits
CRC
EOP
Synchronization
Sequence
usbpackets1
0000001
USB PID: There are 16 PID values. Each value is specified as 4-bits followed by the same
four bits, complemented. For example: ID 0101 (Start of Frame) is a PID of A5.
Other values are: Setup (0xD, or 0x2D), Input (0x1 or 0x1E) and Output (0x9 or 0x96).
VIII - 70
Serial Interfacing
305
VIII - 71
Serial Interfacing
306
VIII - 72
Serial Interfacing
307
VIII - 73
Serial Interfacing
308
USB Setup
usbsoftware
User Application
requests 1024 byte
bulk transfer (Out)
User
Request
Audio
1 sample per ms
Other
System S/W
Other
System S/W
Host
Driver
USB
Driver
16
Add to
Each Frame
Frame 1
VIII - 74
Serial Interfacing
309
VIII - 75
Serial Interfacing
310
22
20
8
7
6
5
4
3
Ring Indicator
Data Terminal Ready
Carrier Detect
signal gnd
1
shield ground
VIII - 76
Serial Interfacing
311
VIII - 77
Serial Interfacing
312
DTE
RS-232
DCE
Comm. Line
serial7.
Signal
Function
TRANSMIT
Data from DTE to DCE
RECEIVE
Data from DCE to DTE
RTS (Request to Used by the DTE to indicate that
Send)
it has a character to send (Half duplex)
CTS (Clear to Used by the DCE to indicate that
Send)
the character (indicated by RTS)
may now be sent
DSR (Data Set Used to inform DTE and DCE that
Ready) and DTR the other is operational (Power on
(Data Terminal etc.)
Ready)
CD (Carrier De- The communications line is now actect)
tive
RI (Ring Indica- There is a request from the commutor)
nications line (and hence the DCE)
to contact the DTE
VIII - 78
Serial Interfacing
313
RS-232 Links
Communications
System
Printer
Processor
Connection as envisioned by standard writers
RS-232 Links
A Null Communications
system
(usually referred to as
a Null Modem
Processor
Connection used by
computer users
Printer
VIII - 79
Serial Interfacing
314
DTE
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
DTE
What connections
go in here to
make it work
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
Null Modem
VIII - 80
Serial Interfacing
315
DTE
DTE
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
VIII - 81
Serial Interfacing
316
DTE
DTE
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
RI
DTR
CD
Signal GND
DSR
CTS
RTS
RECEIVE
TRANSMIT
Shield GND
To be continued
VIII - 82
Serial Interfacing
317
Terms discussed in this section of the notes: Simplex, Half-Duplex, Full-Duplex, Bit Synchronization, Bit Rate Synchronization, Phase Synchronization, Byte Synchronization, Block Synchronization, Bit Rate, Baud Rate and Overhead.
Various specific bit patterns and overheads for the different types of communication alternatives
Given 1024 bits to transmit. Compare the overhead bits required to send the data as:
asynchronous frame, with 2 stop bits, 8 bits of data and 1 parity bit
asynchronous frame, with 2 stop bits, 8 bits of data, and sufficient check bits (using Hamming coding) to correct
single bit errors.
as synchronous frame, 256 byte blocks, sufficient checking for single error bit corrections (no other control information)
comment on the relative merits of each technique and when it would be reasonable to use that technique.
VIII - 82.1
Serial Interfacing
318
A group of 224 students entered their radio-shack/source store to by a cable that implemented a null-modem (as well as
connecting two DTEs). However on closer examination, they determined that there were actually 8-wires. Using their
knowledge from class, they knew what the first six wires were ... what two additional wires could have been cross-connected?
Why do you think this? One enterprising student borrowed a connectivity meter and determined that this particular cable
connected CTS on one end to RTS on the other end. This leads to the following questions.
How would the interfacing software change with the addition of CTS and RTS? (Your answer should consider both
options: could their be no change? and what changes would be required to use any extra functionality provided by
this connection?)
Engineering Questions
since a 3 wire null-modem requires fewer signals than a 5-wire null modem, it should be used.
VIII - 82.2
Serial Interfacing
319
VIII - 82.1
Serial Interfacing
320
Terms:
VIII - 82.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section IX:
Analog Interfaces
f2014-1.0
Analog Interfaces
322
IX - 0.1
Analog Interfaces
323
Resources
Texas Instruments Data Sheets:
Current Feedback Amplifiers: Review, Stability Analysis and Applications provides background
material on the introductory section of these notes.
Current Feedback Amplifiers ...
http://www-s.ti.com/sc/psheets/sboa081/sboa081.pdf
Understanding Data Converters. This document provides good coverage of the error in Analogto-Digital and Digital-to-Analog converters. It also material in excess of our coverage in sampling
topics.
TI Application Note: Understanding Data Converters
http://www-s.ti.com/sc/psheets/slaa013/slaa013.pdf
The following application note may be of interest to those wishing to pursue material beyond the
scope of this course. It focuses on some of the material we cover, but also examines performance
issues in more detail.
Principles of Data Acquisition and Conversion
http://www-s.ti.com/sc/psheets/sbaa051/sbaa051.pdf
Resources
IX - 1
Analog Interfaces
324
Analog Introduction
Digital-to-Analog
Conversion and Interface
(1)
User System
Processing system
Analog-to-Digital
Conversion and Interface
(2)
Signals treated as
Continuous Values
analogOverview
Resources
IX - 2
Analog Interfaces
325
Op-Amp Review
VVin= (V+-V-)
V+
Vin
AVol
Vout
opamp1.
IX - 3
Analog Interfaces
326
Non-Ideal Op-Amps
ideal, but finite gain
rails.
Vout
Vs
V-
Vs
Vout
V+
Vs-
Vin= 0
Vin
Vs-
Op-Amp Review
IX - 4
Analog Interfaces
327
Use of an Op-Amp
two modes:
Comparator : An op-amp connected without feedback can be configured to be a
comparator. In this case the output values are close to either VS or V+S
With feedback
Negative feedback
Positive feedback (not this term)
Op-Amp Review
IX - 5
Analog Interfaces
328
VVin= V+-VV+
Vs
Vout
+
VsOp-Amp View
V
VV+
Vout
+
V
s-
Logic Output (1 or 0)
User's View
compare1a.
Op-Amp Review
IX - 6
Analog Interfaces
329
Vs
Vout
+
VsVs
V-=VC
V+=VRef
Positive-Logic Comparator
Implements VC>VRef
Vs-
VRef
Negative-Logic Comparator
Vout
Vout
Vs
VC
Vout
Implements VC<VRef
VsVs-
Op-Amp Review
VRef
VC
compare1b.
IX - 7
Analog Interfaces
330
dac1.
Rf
V-
Rin
Vin
V+
Vout
Rin
+ Vin
V = ( Vout Vin)
(Rin + Rf )
(1)
Vout = (V+ V) AVol
But
V+ = 0
Therefore
Vout = VAVol
Vout
V =
AVol
(2)
Inverting Amplifier : An op-amp configured with a resistor feedback element such that an increase
in the input voltage results in a decrease in the output voltage
Op-Amp Review
IX - 8
Analog Interfaces
331
Vout-Vin
Rf
Vin
VRin + Vin
( Vout Vin )
But
V+ = 0
Vout
V+
Rin
+ Vin
(Rin + Rf )
V-
Rin
Therefore
dac1a.
Op-Amp Review
Vout
V AVol
Vout
AVol
IX - 8.1
Analog Interfaces
332
Vol
Rf
Vin
Rin
(3)
IX - 9
Analog Interfaces
333
= (
Op-Amp Review
Rf
Rin
Vin Vin )
+ Vin
Rin
(Rin + Rf )
Rin + Rf
Rin
)(
)Vin + Vin = 0
Rin
(Rin + Rf )
IX - 9.1
Analog Interfaces
334
I1 + I2 = 0; I1 = I2
Vout
Vin
; and I2 =
Rin
Rf
Therefore
I1 =
I2
I1
Rin
Vout
Vin
=
Rin
Rf
Vout
Rf
=
Vin
Rin
Assume AV = infinity
ol
Rf
Rin
VV+
Vin
I1
Rf
0V
I2
Vout
if AVol :
virtual short
0 = V+V = Vin
V+ = V
dac2.
Op-Amp Review
IX - 10
Analog Interfaces
335
I1
V1
R1
If =
0v
Rf
If
I2
V2
Rf
R2
VIn
Vn
Vout
Vout
V+
Vout
Rf
Rf
Rf
Rf
= ( V1 +
V2 + ... +
Vn )
R1
R2
Rn
Rn
dacsumm.
Vo
Op-Amp Review
Rf X
= ( Vi )
R i
IX - 11
Analog Interfaces
336
I2
I1
Rin
I1 = I2
Rf
V+
Vout
I1 =
I2 =
Vin
Vin
Rin
Vout Vin
Rf
Vin
Rin
Vout Vin
Rf
Vout
Vin
Rf +Rin
Rin
dac3.
Non-Inverting Amplifier : An op-amp configured with a resistor feedback element such that an
increase in the input voltage results in an increase in the output voltage
Op-Amp Review
IX - 12
Analog Interfaces
337
Non-Inverting Buffer
Non-Inverting Buffer : A special case non-inverting amplifier Rf = 0; Rin =
Vout = Vin
High impedance input
Low impedance output
Rf = 0
VVout
Vin
dacbuff.
Op-Amp Review
IX - 13
Analog Interfaces
338
Expected Output
Actual Output
Vin
+/- 10%
of final
value
X
10%
Delay
Slew
Ring
Settling Time
step response when viewed at an analog level (i.e., this is true for all signals)
delay
slew
ring
dynamic1
IX - 14
Analog Interfaces
339
F SAR
2n 1 ,
where F SAR is the full-scale analog range and n is the number of bits used by the digital
representation.
Analog Digital
continuous discrete
real integers
IX - 15
Analog Interfaces
340
Positive
Voltage
scaling1s.
Unipolar (0 to VMax)
Negative
Voltage
Sign-Magnitude
2's Complement
0 1 2 3 4 5 6 7 8 9 A B C D E F
Digital Value
Analog Interfaces
341
Given 4 bits (16 values) there has been an assumption that the goal for all three converters shown, is to convert (either to
or from analog) the same maximum positive value. Of course other assumptions would have lead to different figures.
In the case of twos-complement arithmetic, to change from 0 to -1, requires that ALL bits change (from 0000 to 1111).
note the impact of not allowing for this in your software. If you accidentally send a -ve 1 (1111) to a D/A converter expecting
unipolar values wide voltage swings may result. If you read a value and assume the wrong type of converter your control
algorithm will behave very oddly.
Although not related to the number system in use, it is worth noting the impact of switching from 3-bits to 4-bits to represent
the positive values.
IX - 16.1
Analog Interfaces
342
Digital-to-Analog Converters
System Bus
CS
D/A Interface
j-Bit Register
Address Decoder
Digital-to-Analog Converters
Reference In
Vref
i bits (j >= i )
n bits
Connection to D/A
may (or may not) be
a fully parallel connection
Analog Out
D/A Converter
x = kVrefB
dacover.
IX - 17
Analog Interfaces
343
Digital-to-Analog Converters
Ideal Relationship
Analog Output(x)
Volts
LSB
3.75
2.50
1.25
x = 0.25 * 5 * B
0.0
For example,
Let Vref=5 Volts,
No Error Points
00
000
001
010
011
01
10
11
Digital Input(B)
dacrange2.
dacrange.
Digital-to-Analog Converters
IX - 18
Analog Interfaces
344
If
B3
B2
0.5R
1R
B1
2R
B0
4R
8R
Vout
weighted.
If =
Vout
0.5R
2Vout
R
ref
= ( 8R
B0 +
Vref
4R B1
Digital-to-Analog Converters
Vref
2R B2
Vref
R B3 )
IX - 19
Analog Interfaces
345
If =
2Vout =
2Vout =
Vout =
Vout =
M ax
Vout
=
Vout
0.5R
2Vout
R
ref
= ( 8R
B0 +
Vref
4R B1
B0 B1 B2 B3
+
+ ) Vref
( +
8
4
2
1
Vref
(8B3 + 4B2 {z+ 2B1 + B0)}
8 |
3
Vref X
Bi2i
16 i=0
Vref n1
X
n
Bi2i
2 i=0
2n 1
Vref n = F SAR
2
Digital-to-Analog Converters
Vref
2R B2
Vref
R B3 )
IX - 20
Analog Interfaces
346
B3 0
1
B2 0
1
B1 0
1
0
B0
1
0.5R
Vout
weighta.
Constant current load from the Vref source. However, this current load is now the same
as the maximum current load in the previous version.
Digital-to-Analog Converters
IX - 21
Analog Interfaces
347
5
4
3
Vref
R
2
1
0
B3
0
1
2R B2 0
1
4R B1 0
1
8R B0 0
1
0.5R
Vout
weighta1.
The register could either be the one associated with the parallel port, or could be the register from some form of serial interface (I.e.
SPI).
Digital-to-Analog Converters
IX - 21.1
Analog Interfaces
348
Nominal Case 1
Bit
Resistor Resistor
7
20 R 10 k
6
21 R 20 k
0
2n1 R 1.28 M
Op-Amp Characteristics
Parameter
Case 1
Vref
10 V
IB7
1mA
IB0
4 A
Case 2
Resistor
100
200
12.8 k
Case 2
10 V
100 mA
400 A
Digital-to-Analog Converters
Analog Interfaces
349
II R 2R Ladders
Vref
I
R
I1
2R
R
I2
2R
R
I3
2R
I4
2R
2R
r2ra.
Vref
R
I1 =
I
2
I2 =
I1
2
I
4
etc.
Digital-to-Analog Converters
IX - 23
Analog Interfaces
350
Vref
I
R
I1
2R
R
I2
2R
R
I3
2R
I4
2R
2R
r2ra2.
Digital-to-Analog Converters
IX - 23.1
Analog Interfaces
351
II R 2R Ladders
r2r1.
Vref
Vo = IT R = RIT
2R
B3 1
2R
B2 1
R 2R
B1 1
R 2R
2R
B0 1
IT
I
= R(B0 16
+ B1 I8 + B2 I4 + B3 I2 )
Vo
ref
ref
ref
ref
= R(B0 16R
+ B1 8R
+ B2 4R
+ B3 2R
)
Vref
16 (B0
V
ref
Vo = 16
1
k = 16
P3
i=0 Bi 2
or, (x = kVref B)
Digital-to-Analog Converters
IX - 24
Analog Interfaces
352
R 2R Characteristics
Easy to fabricate 2 resistors of fixed ratios.
Exact value not critical.
Consider an n-bit D/A Vo =
Vref
2n
Pn1
i=0
Bi2i
1
2n
2n 1
2 = Vref ( n )
i=0
2
n1
X
i
(n-bit converter), |Vo| < |Vref | Note: even if all of the bits of B are set
2n 1
Vref 2n
IX - 25
Analog Interfaces
353
Vin
(Vref)
Vout = K B Vin
M-DAC
B0
Bn
mdac2.
Thus, the M-DAC implements a programmable-gain amplifier for the analog input voltage.
If you attach an analog signal to Vin, then you control the gain with the digital signal (B).
Digital-to-Analog Converters
IX - 26
Analog Interfaces
354
Digital-to-Analog Converters
IX - 27
Analog Interfaces
355
IX - 28
Analog Interfaces
356
Output
Sometimes specified as a percentage of the
range.
offset
100%
range
An offset error may be caused by leakage
currents in the switches or by some bias current at the input to the op-amp.
The offset error may also have a temperature coefficient.
Calibration can reduce the impact of these
errors.
Ideal
Actual
Input
FF
00
dacerr1.
Digital-to-Analog Converters
IX - 29
Analog Interfaces
357
Ideal
Actual
Input
dacerr2.
Digital-to-Analog Converters
IX - 30
Analog Interfaces
358
but there may be an offset error of VOf f set and the result would be:
Of f estError
VOut
= VIdeal + VOf f set
we could cancel this with calibration by subtracting the offset at 0 output (let VZeroCode be the voltage that is produced,
before calibration, when the code for 0 V is applied to the input.)
Of f setCalibrated
VOut
= VIdeal + VOf f set VZeroCode
we can calibrate this out as well. If we determine the ratio of the actual maximum output voltage (VMActual
ax ) and then alter
the gain as follows:.
Of f setCalibrated
GainCalibrated
VOut
= VOut
GainError
Digital-to-Analog Converters
F SAR
VMActual
ax
IX - 30.1
Analog Interfaces
359
High
Actual
Expected
Value
1 LSB
Differential Non-Linearity
Low
Actual
Digital Value In
i+1
Digital Value
DNL < 1LSB
Expected Output
Digital-to-Analog Converters
IX - 31
Analog Interfaces
360
Monotonicity Error
Low
Actual
i+1
Digital Value
DNL < 1LSB
(no monotonicity error)
Expected
Value
1 LSB
Expected
Value
High
Actual
High
Actual
1 LSB
Monotonicity Error : If, for any two consecutive digital values, increasing from i to i + 1
results in a decrease in output (analog) values, there is a monotonicity error. This can
occur if DNL > 1LSB.
Low
Actual
i+1
Digital Value
DNL >= 1LSB
(possible monotonicity error)
monotonicity.
Digital-to-Analog Converters
IX - 32
Analog Interfaces
361
Differential
non-linearity
Analog Out
Analog Out
Analog Out
Integral Linearity : The maximum deviation between the true output and a straight line
representing the ideal output. This calculation/measurement is based on the assumption
that all of the linear errors have been eliminated (compensated).
Digital In
Monotonicity Digital In
error
Expected Output
Integral Digital In
linearity error
Actual Output
dacerr32011.
Digital-to-Analog Converters
IX - 33
Analog Interfaces
362
0V
0V
NA
0.5 V
0.4 V
0.1 V
0.1 V
1.0 V
0.8 V
0.2 V
0.1 V
1.5 V
1.2 V
0.3 V
0.1 V
2.0 V
1.8 V
0.2 V
0.1 V
2.5 V
2.8 V
0.3 V
0.5 V
3.0 V
3.3 V
0.3 V
0V
7
3.5 V
3.5 V
0V
0.3 V
DNL Column Entry = ||AOi AOi1 | 0.5|
Result: Worst case INL is 0.3 V (or 0.6 LSB) and worst case
DNL is 0.5 V or 1 LSB.
Actual Output
Analog Out (Volts)
Expected Output
0
0
4
5
6
Digital Input (Digital)
Digital-to-Analog Converters
IX - 33.1
Analog Interfaces
363
IX - 34
Analog Interfaces
364
+- 1/2 LSB
Vout
Undershoot
Ringing
Slew
Rate
Overshoot
time
t1
t2
settling time = t2 - t1
dacerr4.
Manufacturers often leave amplifier off of D/A and provide only a current source.
This simple change (make the DAC cheaper AND faster) is a good deal for the sellers.
(You will see this in an example shortly.)
Digital-to-Analog Converters
IX - 35
Analog Interfaces
365
In this case, it may be that the switch for the current associated with 8 (I.e., b3) turns off
slower than the ones (I.e., b0, b1, b2) associated with 7 turn on. Thus there is a temporary
increase above either value.
Digital-to-Analog Converters
IX - 36
Analog Interfaces
366
Digital-to-Analog Converters
IX - 37
Analog Interfaces
367
Digital-to-Analog Converters
IX - 38
Analog Interfaces
368
-VRef
DAC
Switch
X2
Analog
Out
Vo
Range
8
Latch
CODE
Latch
tvl5621.
Digital-to-Analog Converters
IX - 39
Analog Interfaces
369
Range = 0/1
Output source current 1 ma (code = 255)
Output sink current 5 A (DAC-A) and 20A Others
Ref. Current 10A
Output Slew Rate (DAC-A)
V
Rising 0.8 s
V
Falling 0.5 s
V
Output Slew rate (Others) 1 s
IX - 40
Analog Interfaces
370
Digital-to-Analog Converters
IX - 41
Analog Interfaces
371
MAX 529
This DAC has the following characteristics.
8 analog output signals
serial interface to processing system (SPI Compliant)
single (5 Volt) or dual ( 5-20 Volt) supply
each pair of outputs can be placed in to one of the following modes of operation
unbuffered: attach directly to the output point of the R2R Ladder.
buffered: a built in buffer is provided with +5 mA (-2 mA) drive (sink) capability
half-buffered: lower power than fully buffered, but limited to unipolar output operation.
Digital-to-Analog Converters
IX - 42
Analog Interfaces
372
Symbol
Relative
Accuracy
Differential
Nonlinearity
Full-Scale
Error
Gain Error
Gain Error
Zero-Code
Error
Zero-Code
Tempco
VDD Rejection
VSS Rejection
RLE
Conditions
Unbuffered Mode
Min Typ Max
0.3 1.0
0.3
DNL
Guaranteed
monotonic
FSE
RLOAD = open
1.0
Full-Buffered Mode
Min Typ
Max
0.3 1.0
0.3
1/2
5
5
DAC
0x55
DAC
0x55
LSB
LSB
LSB
0.2
1.3
RLOAD = open
RLOAD = 5 k
PSRR
VDD
PSRR
VSS
1.0
Units
2.5
60
%
%
mV
V/C
100
code
0.1
1.0
0.3
2.0
mV/V
code
0.1
1.0
0.8
5.0
mV/V
Digital-to-Analog Converters
IX - 43
Analog Interfaces
373
Digital-to-Analog Converters
IX - 44
Analog Interfaces
374
Analog-to-Digital Converters
(A/D Converters or ADCs)
System Bus
Address
and
Timing
Decoder
(ATD)
Control
Status
Data
Conversion Complete
Start Conversion
A/D Converter
VRef
Analog In
Analog Section
adcover.
Analog-to-Digital Converters
IX - 45
Analog Interfaces
375
Analog-to-Digital Converters
adc1.
Id
R ea
el l
at
io
ns
hi
p
Digital
Representation
011
010
001
000
Analog Input
1
LSBs
Transition Point
Midpoint of the interval is the
analog voltage rep. by the code
+1/2 LSB
Quantization Error
+/- 0.5 LSB
-1/2 LSB
Analog-to-Digital Converters
IX - 46
Analog Interfaces
376
sh
ip
Id
R ea
el l
at
io
n
Digital
Representation
011
010
001
000
Analog Input
1
LSBs
Transition Point
Midpoint of the interval is the
analog voltage rep. by the code
+1/2 LSB
-1/2 LSB
adc1a
Analog-to-Digital Converters
IX - 47
Analog Interfaces
377
Ideal Relationship
Digital Representation
011
010
001
000
Analog Input
1
Transition Point
Biased, digital output changes when voltage passes the value.
+1/2 LSB
-1/2 LSB
Quantization Error
0/-1 LSB
Note: if the digital value of 010 is read, then the applied (Analog) voltage is 2.0 LSBs
VAnalog < 3.0 LSBs.
Analog-to-Digital Converters
IX - 48
Analog Interfaces
378
Analog-to-Digital Converters
IX - 49
Analog Interfaces
379
Analog Section
A
-
Analog In
VAnalog
B+
Vref
DAC
(n-bit)
to parallel port
DV
Clock
Control
1 Flip-Flip
Comparator
Q
D
C
CLK
Q
CLR
B<A B>A
n bits
n-bit Counter
enable
Reset
Start of Conversion
Conversion
complete
adc2.
Analog-to-Digital Converters
IX - 50
Analog Interfaces
380
Analog-to-Digital Converters
IX - 51
Analog Interfaces
381
1
A
-
Analog In
VAnalog
Comparator
C
Q
D
CLK _ Control
Flip-Flop
B<A B>A CLR Q
B+
Vref
DAC
(n-bit)
to parallel port
DV
Clock
n bits
enable
n-bit Counter
Reset
Start of Conversion
Conversion
complete
adc2a.
Analog-to-Digital Converters
IX - 51.1
Analog Interfaces
382
1.0
0.857
0.714
0.571
0.429
0.286
0.143
0.0
Binrary Code
(Counter Value)
Voltage
(DAC Output)
adc5a.
DV
111
110
101
100
011
010
001
000
1 LSB = 0.143V
RAMP ADC
0.6V
Analog-to-Digital Converters
IX - 52
Analog Interfaces
383
adc3.
Parallel Port In
S
+
Vref
1-bit
n-bits
DAC
(n-bit)
Analog in
VAnalog
Analog-to-Digital Converters
IX - 53
Analog Interfaces
384
IX - 54
Analog Interfaces
385
Analog-to-Digital Converters
IX - 55
Analog Interfaces
386
Analog Section
VAnalog
to Parallel Port
Vref
B
V-
DAC
(n-bit)
DV
n-bits
SAR
Clock
V+
C = A>B
(C is a 1 if DAC
output higher
than VAnalog)
Control
Control signals include:
Set/Clear Bit i
Start of Conversion
Conversion Complete
Note: SAR:Successive Approximation Register
Analog-to-Digital Converters
IX - 56
Analog Interfaces
387
Analog-to-Digital Converters
IX - 57
Analog Interfaces
388
1.0
0.857
0.714
0.571
0.429
0.286
0.143
0.0
111
110
101
100
011
010
001
000
0.6V
Analog-to-Digital Converters
IX - 58
Analog Interfaces
389
DV
0.6V
Bit 0
111
110
101
100
011
010
001
000
Bit 2
Bit 1
1.0
0.857
0.714
0.571
0.429
0.286
0.143
0.0
Analog-to-Digital Converters
IX - 59
Analog Interfaces
390
adc3.
Parallel Port In
S
+
Vref
1-bit
n-bits
DAC
(n-bit)
Analog in
VAnalog
Analog-to-Digital Converters
IX - 60
Analog Interfaces
391
Analog-to-Digital Converters
IX - 61
Analog Interfaces
392
Analog-to-Digital Converters
IX - 62
Analog Interfaces
393
VAnalog
R
R
Encoder
R
R
R
DV
n-bits to
the parallel port
R
R
R
(2n) -1 comparators
Etc.
Note: the comparators have a 1 output
if VAnalog>voltage from the resistor chain
adc6a.
Analog-to-Digital Converters
IX - 63
Analog Interfaces
394
VAnalog
Encoder
R
R
R
2
1
Encoder Example:
Input 00000000000111
Output 0100
DV
n-bits to
the parallel port
R
R
R
(2n) -1 comparators
Etc.
Note: the comparators have a 1 output
if VAnalog>voltage
from the resistor chain
adc6a1.
Analog-to-Digital Converters
IX - 64
Analog Interfaces
395
Encoder Output
DV
11
Y
10
X
01
VRef
00
VAnalog
1/4 1/2 3/4
times VRef
Example, n=2, => 3 comparators
adc6b.
Z Y X
1 1 1
0 1 1
0 0 1
0 0 0
Comments
VAnalog > 34 Vref
1
3
V
>
V
>
ref
Analog
4
2 Vref
1
1
V
>
V
>
ref
Analog
2
4 Vref
1
4 Vref > VAnalog
Analog-to-Digital Converters
Encoder
1
1
0
0
Output
1
0
1
0
IX - 65
Analog Interfaces
396
Analog-to-Digital Converters
IX - 66
Analog Interfaces
397
Indirect Techniques
Previous schemes were based on voltage comparisons
(Indirect) Integrating ADCs
Operation:
Converts voltage to time then
Converts time to a number by use of a counter
Versions:
Single slope and dual slope.
Analog-to-Digital Converters
IX - 67
Analog Interfaces
398
dt
=
dt
in
t0
t0
RC
dt
T
t0
adc7.
C
Vin R
If
-
Iin
Vout
Iin = - If
Iin = Vin/R
If = C dVout/dt
1
Vin dt = Vout(T ) Vout(t0)
RC
Analog-to-Digital Converters
IX - 68
Analog Interfaces
399
Z
1
T
At time T , (T t0)
Vin Z T
Vout(T ) =
t0 dt + Vout (t0 )
RC
=
Analog-to-Digital Converters
Vin
(T t0) + Vout(t0)
RC
IX - 69
Analog Interfaces
400
Vout
If Vin less than 0 the
slope will change to +ve.
Vout(t0)
Vin/RC
Vout(T)
Vout(T)=Vout(t0)-(T-t0)Vin/RC
t
t0
T
-Vin/RC
adc7a.
Analog-to-Digital Converters
IX - 70
Analog Interfaces
401
VAnalog
Counter Stopped
VRef/RC
Time
adc9.
Analog-to-Digital Converters
IX - 71
Analog Interfaces
402
adc8.
- VRef R
Start
DV
Vout
Out
n-bit Counter
VAnalog +
Reset
Control
Logic
Conversion Done
Start of Conversion
Analog-to-Digital Converters
IX - 72
Analog Interfaces
403
DV
f
T
RC Vref
Vref
RCf DV
VAnalog RCf
Vref
Analog-to-Digital Converters
IX - 73
Analog Interfaces
404
Analog-to-Digital Converters
IX - 74
Analog Interfaces
405
VAnalog =
T
RC Vref
Vref
RCf DV
Analog-to-Digital Converters
IX - 75
Analog Interfaces
406
VAnalog
C
R
Vo
-Vref
Reverse
+
+
Switch Control
Control
Logic
Terminal Count
Counter
Clock of Freq f
Register(DV)
DV (this version may be made
persistent)
Load DV register
at appropriate time
When is the
appropriate time?
To Parallel Port
Analog-to-Digital Converters
IX - 76
Analog Interfaces
407
adc11.
Vo
DV
T
VAnalog/RC
-Vref/RC
V0(T)
N
(usually
VAnalog
n
=2
cycles) DV=
2n Cycles
Vref
Variable Slope,
Fixed Slope,
Fixed Time
Variable Time
Analog-to-Digital Converters
IX - 77
Analog Interfaces
408
t3
t2
t1
DV
t
V1,0(T)
V2,0(T)
V3,0(T)
adc11a.
Analog-to-Digital Converters
IX - 78
Analog Interfaces
409
N
f)
Vref
RC
Analog-to-Digital Converters
R T +
(Vref ) dt + Vo(T )
VAnalog
RC T
=0
IX - 79
Analog Interfaces
410
Vref
RC
VAnalog
RC T
or
DV
f
, and T =
2n
f
therefore
VAnalog
Vref
= n DV
2
M ax
VAnalog
2n 1
= Vref n
2
IX - 80
Analog Interfaces
411
VAnalog
Vref
long to complete its path to 0V (2n < Completion Time 2n+1 clock periods)
The number of clock cycles doubles with each 1-bit increase in resolution.
Popular at low-speed low-cost applications.
Analog-to-Digital Converters
IX - 81
Analog Interfaces
412
4V 0V
210 1
4.0 V
3.9062 mV
or
IX - 82
Analog Interfaces
413
Time
ADC Aperture Time
1/fSample
1/fSample
adcaperture1.
IX - 83
Analog Interfaces
414
IX - 84
Analog Interfaces
415
1
VPeak
0.5
Max
Slope
0.5
1.5
SineWave.
IX - 85
Analog Interfaces
416
1
4 LSB
Thus there can be at most 0.6mV change in 10s (at the steepest slope).
V
= 2fM axVP eak
t M ax
0.6 103
= 2fM axVP eak
6
10 10
Time Varying Signals
IX - 86
Analog Interfaces
417
fM ax =
0.6
2 5 10 103
0.6
101
2 Hz
For this system, without a sample-and-hold circuit we are limited to 2 Hz, despite a 100 kHz
converter!
IX - 87
Analog Interfaces
418
Sample-and-Hold Overview
shover.
Sample
Time Varying
Signal
Sample
and Hold
Sampled
Signal
A/D
Converter
Binary
Value
IX - 88
Analog Interfaces
419
Sample-and-Hold Overview
Sample
Time Varying
Signal
Sample
and Hold
shover2.
Start of Conversion
CC
Sampled
Signal
A/D
Converter
Binary
Value
Sout
Time Varying
Signal
Sample
Sout
Start of Conversion
IX - 89
Analog Interfaces
420
Sample/
Hold
A/D
Converter
CC
Digital
Value
Sampled
Analog
Signal
Analog
Signal
shover3.
Parallel
Port
Soc (or other)
Sample
CPU
Memory
Sample
Period
SoC
Sample
CC
IX - 90
Analog Interfaces
421
IX - 91
Analog Interfaces
422
(From Circuit)
adc12.
Vin
Buffer 1
Vc
C
Sample
Vout
Buffer 2
To A/D Converter's
VAnalog
A sample-and-hold circuit is used to hold the input voltage constant during conversion
(ideally).
IX - 92
Analog Interfaces
423
Error Band
Vin
Droop Rate
Vout
4
t_acq
Ck
t_hs
Hold
Sample
sample1.
IX - 93
Analog Interfaces
424
1. During Sampling
Errors (in the input buffer)
offset the output for a zero input may not be exactly zero. ( 12 LSB for a given
temperature.)
non-linearity
non-unity gain.
IX - 94
Analog Interfaces
425
Performance Issues
The settling time is the time to attain a good estimate for the final value given a full
scale step at the input to within a specified error. In this case it is the time to couple the
voltage across the capacitor (through the two buffers) to the A/D input.
Vin
Vout
Bounds
Settling Time
adc13.
IX - 95
Analog Interfaces
426
Sample-and-hold
Aperture Time
Toff
Toff
Sample
Hold
apertur.
IX - 96
Analog Interfaces
427
IX - 97
Analog Interfaces
428
1
4
= 2f VP eak
= 21045
uncertainty
uncertainty
0.6 103
=
105
2 109 = 2 ns
IX - 98
Analog Interfaces
429
Sample/Hold
adc14.
IX - 99
Analog Interfaces
430
IX - 100
Analog Interfaces
431
For each of the converters examined this term, summarize if they result in biased high, biased low or unbiased results.
2.
For each of the Analog-to-Digital converter types examined this term, describe the impact of applying an input VAnalog larger
than the reference voltage.
3.
For each of the Digital-to-Analog converter types examined this term, describe the impact of an error of 10% in one of the
resistors in the design.
4.
The dual slope converter shows a register (DV) and indicates that depending on how it is clocked, the data will be either
transient or persistent. Assume that the converter itself runs continuously. Give the clock circuit for the DV register so that
it will provide persistent data, using a consumer sensitive model of synchronization.
IX - 100.1
Analog Interfaces
432
IX - 100.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section X:
Buses - Data Transfer
f2014-1.0
434
X - 0.1
435
Buses Resources
Vranesic and Zaky Section 6.2 (Synchronous Bus, Stone 3.2, Hamacher Vranesic and Zaky
Section 4.5),
V&Z Section 6.8 (Asynchronous Bus Example, Stone 3.2, 3.4, HV&Z Section 4.5 5th
edition),
V&Z Section 6.10 (Semi-Synchronous example 68000), HV&Z Section 4.5 5th edition,
V&Z Section 11.1 (Introduction)
V&Z Section Bus Arbitration (Stone 3.3, 3.7), HV&Z Section 4.4 5th edition
V&Z Section 11.2, 11.4 and 11.5 (Examples, Stone 3.6),
Mano (Digital Design) Asynchronous Sequential Logic, The chapter number varies with
edition. This reference is for the ECE 224 only.
Resources
X-1
436
Introduction
Bus Operations
Bus Signal Groups
Data transfer (Section X) (starting
Data transfer
on page 433)
address and data (information)
Bus arbitration (Section XI)
control: synchronization (time)
(starting on page 476)
and direction (There may be other
Direct Memory Access DMA
issues to control)
Section XII (starting on page 545)
Arbitration (select master)
Other signals (interrupt)
Special Topics
Timing of sets of signals (propagation delay, skew time, address decoding
time)
Transmission line effects (later in the
course)
What Makes a Wire Part of a Bus?
Where are buses found in Digital Systems?
Introduction
X-2
437
Introduction
X-3
438
Introduction
X - 3.1
439
Introduction
X-4
440
Address
and
Timing
Decoder
(Centralized ATD)
A0-Ae-1
(Chip) Select
or
Device Enable
Decentralized
ATD
Register
Select
Address
Lines
Ae-Ae+m-1
synchreadblock.
CPU/Bus Master
Device
Interface
R/W
Device
Clock
Data Lines
Internal Signals
for bus
Enable
Output
Data
Bus
X-5
441
Time at
Master
CK1
Time at
Slave
Address and
t +t
Control (Clk, R/W) PA Skew
Master Edge
tmargin1
Decode address on bus and select slave
Time to access the requested data
tmargin2
tSetup
tHold
Slave Edge
tSelect
t Access
tPD+ tSkew
Time at
Slave
X-6
442
Synchronous Read Bus Transfer (Master and Slave Timing the same at the edges)
Phase 1
tPA tSkew
Valid Read Address
Address
R/W
tSelect
Address
Decoded
>0
Enable
Output
tPD+tSkew+tAccess
Valid Read Data
Design Margin
tM1
tM2
tHold
Minimum
Phase 1
Data
Master Edge
Phase 2
tSetup
Clock
Slave Edge
tSelect+tAccess+tSkew+tPD+tSetup+tM2
One Bus Cycle
synch3.
X-7
443
Read
= tP A + tSkew
Read
X-8
444
Read
= tP A + tSkew + tHold
These expressions can be used to derive a minimum time for a synchronous read bus cycle.
Assume: a single cycle clock and that the access time for the slowest interface permitted on the
ax
bus is tM
Access
Optimized,
Tbus
cycle
Synchronous, Read
= tminimum,
phase1
Read
+ tminimum,
phase2
Read
ax
= tSetup + tSelect + 2tSkew + tHold + tP A + tP D + tM
Access
X-9
445
2 Phase Clock
2phasesynchronous ladder2
X - 10
446
Address and
Control
Time to Decode address on bus
t
Select
Time to access the requested data
tmargin2
Time for
arbitration
see next
section
tSetup
tHold
tPA+ tSkew
t
margin1a
tAccess
tmargin1b
tPD+ tSkew
CK2
CK1
synch3 ladder2
X - 11
447
Address
and
Timing
Decoder
(Centralized ATD)
(Chip) Select
or
Device Enable
Decentralized
ATD
Register
Select
Ae-Ae+m-1
Address
Lines
CPU/Bus Master
A0-Ae-1
Device
Device
Interface
R/W
Clock
Data Lines
Data in
Register
Q
Reg
Clock
synchwriteblock.
X - 12
448
Address, data
and control
CK1
tp+ tSkew
tmargin1
Time to decode address on bus
Time to store the data
tSelect
t Store
tmargin2
tSetup
tHold
X - 13
449
Slave Edge
Phase 2
Master Edge
t
tPA Skew
Valid Write Address
Address
tSelect
R/W
Address
Decoded
tStore+
tMargin2
TSetup
tHold
Data
tPD+tSkew
Reg Clock
synch4.
X - 14
450
R/W
Clock
Clock 1
Clock 2
clockderived.
X - 15
451
CK2
address, data
and control
Time to decode address on bus
CK1
tp+ tSkew
tmargin1
tSelect
tStore
tmargin2
tSetup
tHold
X - 16
452
Synchronous, Read
(starting
on page 444) .
X - 17
453
Asynchronous Buses
Synchronous buses must run at the speed of the slowest interface/device.
Asynchronous schemes permit the speed of the bus to be compatible with a wide variety
of device/interface speeds.
X - 18
454
A0-Ae-1
R/W
(Chip) Select
or
Device Enable
Decentrailized
ATD
Register
Select
Ae-Ae+m-1
Address
and
timing
Decoder
(ATD)
Address
Lines
CPU/Bus Master
Device
Interface
Master
Device
Slave
Data Lines
Internal Signals
for bus
Enable
Output
Data
Bus
asynchreadblock.
X - 19
455
At Master
Place Address and
Control sig. on bus
tSkew+
tmargin
Assert Master
At Slave
Time A
Time
Time B
Act on address
tSelect
tAccess
tSkew+
tmargin
Clock Data in
Time C
Time D
Time E
Deassert Master
Deassert Address
and R/W
Deassert Slave
X - 20
456
If there are
few
possible
masters, then it
would also be
reasonable
to
allow for tSkew
in the masters.
It would be
possible to place
the
responsibility for tSkew
in master and
slave as shown.
If the responsibility for tSkew
were
to
be
placed at the
slave, it would
likely increase
the complexity
of the slave.
asynchtimeslave.
At Master
Place Address and
Control sig. on bus
tSkew+
tmargin
Assert Master
At Slave
Time A
Time
Time B
Enable data
Act on address
tSelect
tAccess
tSkew+tmargin
Assert Slave
Clock Data in
Deassert Master
Time C
Time D
Time E
Deassert Slave
Start next cycle
Time F
X - 20.1
457
Skew,
and margin
Select time +
READ time (access time)
+ 2 Propagation
Delays
Valid Data
READ
D
2 more
Prop. Del.
asynch1.
X - 21
458
asynch2.
Slave
Data
Valid Data
Access Starts
Master signal is
driven by the master
interface. The master allows for all bus
skew!!
Slave signal is driven
by the slave interface. A much simpler signal, as it does
not use the bus characteristics to constrain the timing of
its signals.
tSelect +
t Access+
tmargin
Access must be complete and the data enabled to the bus lines
before Slave asserted.
X - 22
459
Master
Slave
Skew and
margin time
A
B
2 more
Prop. Del.
E
F
asynch3.
X - 23
460
asynch4.
Master
T
T
Store+ Setup
One version of
RegClock
Slave
TSelect+
TMargin
Optimistic
Slave
Conservative
Slave
X - 24
461
X - 25
462
F ullyinterlocked, Read
T ransf er
Asynchronous, Read
T ime Averaged
(An average value for Tbus
could
be
derived
from
t
)
Access
cycle, Average
Recall that the optimized synchronous read cycle was:
Optimized,
Tbus
cycle
Synchronous, Read
= 2 tSkew + 2 tp
aximum
+tSelect + tSetup + tHold + tM
Access
X - 26
463
X - 27
464
partial
Address
and
Control
tSkew +
tmargin
tSelect+tAccess+
2*tp
Master
tDelay(+ tmargin)
(> tSetup+tSkew
+tHold)
tSetup+
tSkew+ tHold+
tmargin tmargin
Slave
Data
Fixed
Duration
X - 28
465
F ullyinterlocked, Read
= 2 tSkew + 4 tp
+tSelect + tSetup + tCurrent
Access
T ransf er
as compared to the partially interlocked cycle time (also based on the actual transfer time).
Asynchronous,
Tbus
cycle
P artiallyinterlocked, Read
T ransf er
X - 29
466
0.5 52.5
106
0.6
62
115
133.5
99 109 119
0.7 71.5
125
133.5
0.8
81
134
133.5
0.9 90.5
144
133.5
153
133.5
100
80
60
40
0
90 100
96
10
133.5
43
.5
0.4
90
91
81
81
.5
133.5 70.5
71
80
62
81
.5
71
52
61
77
43
133.5
24
100
.5
0.2
120
33
72
Synchronous
Partial(20)
140
24
62
160
.5
Partial(30)
133.5 51.5
Asynchronous
Partial(10)
Partial(30)
14
Partial(20)
Partial(10)
Synchronous
Average
as
Fraction
of Max
Avg Access
tAccess
tSetup
tHold
tSelect
tp
tSkew
tDelay
Asynchronous
Min AverageMax
5
100
1
0.5
2
10
5
10 20 30
X - 30
467
X - 31
468
address and
control
Time to Decode address on bus
tPD+ tSkew
tPA+ tSkew
tmargin1
tSelect
tAccess
tmargin2
tHold
CK1
tSetup
X - 32
469
Phase 1
Clock
Slave Edge
Phase 2
Master Edge
Slave Edge
Phase 2
Master Edge
Phase 1
Slave Edge
Phase 2
Master Edge
tPA tSkew
Address
R/W
tSkew
Address
Decoded
Data
Enabled
Valid Data
Data
X - 33
470
tPD+ tSkew
tPA+ tSkew
tmargin1
tSelect
tStore
tmargin2
tHold
CK1
tSetup
X - 34
471
X - 35
472
Processor
Processor
Memory
Memory
split.
Memory
Memory
X - 36
473
CK
tp+ tSkew
tmargin1a
tSelect
t
margin1b
tAccess
tp+ tSkew
tmargin2
tSetup
tHold
split ladder
X - 37
474
Terms and times discussed in this section include: Synchronous Data Transfer, Asynchronous Data Transfer, Semi-synchronous
Data Transfer, Split-cycle Data Transfer, Address propagation delay, Data propagation delay, Bus propagation delay, Setup
Time, Hold Time, Select Time, Margin Time, Access Time, Store Time and Skew Time.
Engineering Questions.
Select any two of the bus structures and determine under which circumstances each of them would be preferred.
Either the Master or the Slave in a fully interlocked asynchronous bus could be responsible for de-skewing, that is
allowing for the skew time. Give circumstances when the slave should also be responsible for dealing with skew. Give
circumstances when it should be only the responsibility for the bus master.
Draw a timing diagram for a semi-synchronous bus write transaction and label all timing constraints.
(or) In the notes it was mentioned that a split-cycle bus can be constructed from: Synchronous, Asynchronous or SemiSynchronous buses. Why is an implementation based on synchronous synchronization the most reasonable?
X - 37.1
475
X - 37.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XI:
Buses - Arbitration
f2014-1.0
Buses - Arbitration
477
XI - 0.1
Buses - Arbitration
478
Resources
XI - 1
Buses - Arbitration
479
Introduction
Previous discussions have assumed 1 Master and 1 (active) Slave.
Bus Arbitration: A process that seeks to select exactly 1 Master from one or more devices
requesting to be the bus master.
Examine:
distributed, daisy chain-based, 2-Wire,
distributed, daisy chain-based, 3-Wire
distributed, daisy chain-based, 4-Wire and
decentralized, parallel.
Introduction
XI - 2
Buses - Arbitration
480
Daisy Chain
Wiring structures play a role
in the bus arbitration scheme
alternatives
Star
busringstar.
Introduction
Bus
XI - 3
Buses - Arbitration
481
Purpose of Arbitration
Goal Unique Selection.
possible (not necessarily consistent) sub-goals
fair (round robin, rotating priority, first come first serve)
cheap
unfair (fixed priority)
Non-pre-emptive arbitration: Once a master has started using the bus it will continue
to use the bus until completion. Specific bus structures may place limits on the
maximum number of cycles or the maximum time that a master may keep control of
the bus.
This term we will not consider preemptive arbitration.
Introduction
XI - 4
Buses - Arbitration
482
Introduction
XI - 5
Buses - Arbitration
483
CA
DA
Previous
Discussion
Not able to
become bus
master
DA
Device Interface
CPU
Device
Note 1: Several other techniques are to be examined this term, this is one
example to demonstrate the relationship of the arbitration circuitry to the
rest of the interface.
Introduction
XI - 6
Buses - Arbitration
484
Request_1
Grant_1
and the rest
of the
Interface
Bus_Request_2
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
Request_2
No
Request
Bus_Grant_2
Bus_Grant_0
Central
Arbiter
Bus_Request_1
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Request_0
Grant_2
arbcct1.
XI - 7
Buses - Arbitration
485
XI - 8
Buses - Arbitration
486
XI - 9
Buses - Arbitration
487
Bus_Request_1
Request_1
Grant_1
and the rest
of the
Interface
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
Request_2
Bus_Request_2
Bus_Grant_2
Central
Arbiter
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Grant_0
Bus_Request_0
Grant_2
arbcct1b
XI - 10
Buses - Arbitration
488
Device1
Distributed
Arbiter1
Central
Arbiter
1
2
Device2
Distributed
Arbiter2
assert
Request1
assert
Bus_Request0
Request_1
Bus Reserved
for use by
Device1
assert
Bus_Grant0
Bus_Request_1
assert
Grant1
Interface1 uses
the bus
deassert
Request1
deassert
Bus_Request0
deassert
Grant1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
deassert
Bus_Grant0
Grant_1
2wire4 1.
arbit2wireCaseB.pdf
Buses - Arbitration
489
Request_1
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_1
2wire4 1a.
XI - 12
Buses - Arbitration
490
Bus_Grant_0
Bus_Request_1
2
5
Request_1
Grant_1
and the rest
of the
Interface
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
1
Request_2
Bus_Request_2
Bus_Grant_2
Central
Arbiter
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Request_0
arbcct1c
Grant_2
XI - 13
Buses - Arbitration
491
Distributed
2-Wire Bus Arbiter
2
ArbiterDevice
2
(Only Device 2 Active)
1
Device1
Case C
Request2
2
Distributed
assert
Arbiter1
Bus_Request1
assert
Central 3
Bus_Request0
Arbiter
assert
Interface 1 detects
bus reserved
Bus Reserved
assert
Bus_Grant0
assert
5
assert
Grant2
Bus_Grant1
6
Interface2 uses
the bus
Bus_Request1
deassert
deassert
Grant2
deassert
Bus_Request0
Deassert could
happen at any time
deassert
Bus_Grant0
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
4
5
Grant_2
deassert
Bus_Grant1
arbit2wireCaseC.pdf
6
2wire4 2.
XI - 14
Buses - Arbitration
492
Bus Usage
by I/F 2 as
seen at I/F 1
Request_2
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_2
Case C with relationships
2wire4 2a.
XI - 15
Buses - Arbitration
493
Bus_Request_1
Request_1
Grant_1
and the rest
of the
Interface
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
5
Request_2
Bus_Request_2
Bus_Grant_2
Central
Arbiter
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Grant_0
Bus_Request_0
Grant_2
arbcct1d
XI - 16
Buses - Arbitration
494
Device1
Distributed
Arbiter1
Central
Arbiter
1
2
assert
Bus_Request0
Distributed
Device2
Arbiter2
3
assert
assert
Bus_Grant0 Grant1
4
Bus Reserved
Request_1
assert
Bus_Grant_1
Interface1 uses
the bus
5
assert
Request2
6
Interface 2 asserts
Bus_Request1
deassert
Grant1
7
assert
Grant2
Interface2 uses
the bus
deassert
Request2
deassert
Bus_Request1
deassert
Grant2
Request_2
Bus_Request_1
Bus_Request_0
Bus_Grant_0
3
7
Bus_Grant_1
Grant_1
Grant_2
2wire4 3.8
arbit2wireCaseD1.pdf
XI - 17
Buses - Arbitration
495
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_1
Grant_2
I/F 1
I/F 2
2wire4 3a.
XI - 18
Buses - Arbitration
496
Bus_Request_1
Request_1
Grant_1
and the rest
of the
Interface
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
5
Request_2
Bus_Request_2
Bus_Grant_2
Central
Arbiter
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Grant_0
Bus_Request_0
Grant_2
arbcct1d2
XI - 19
Buses - Arbitration
497
Case D2: Request During Use (Re-arbitrate) Ladder and Timing Diagram
Arbiter1
Bus Reserved
Central
Arbiter
Device2
Distributed
Arbiter2
Request_1
assert
1
Request1
2
assert
Bus_Request0
3
assert
Bus_Grant0
assert
Grant1
4
Request_2
Interface1 uses
the bus
Bus_Request_1
Bus_Request_0
assert
5 Request2
6
assert
deassert Bus_Request1
deassert
Request1
Bus_Request0
deassert
Grant1
deassert
Bus_Grant0
Bus_Grant_0
Bus_Grant_1
Grant_1
Grant_2
Reassert
Bus_Request0
to get bus for
Device 2
(Now a Case C).
arbit2wireCaseD2.pdf
2wire4 4.
XI - 20
Buses - Arbitration
498
Case D2
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_1
Grant_2
I/F 1
I/F 2
2wire4 4a.
XI - 21
Buses - Arbitration
499
Gin
Request 1
Gout
Bus Request 1
Rout
Rin
Unit 1
Bus Grant 1
Bus
Arbiter
(Central Unit)
Bus Grant 0
Bus Request 0
What happens when Unit 1 requests bus, after Unit 2 has requested the bus?
Unit 2
Grant 1
Rest of
Interface
Data
Address
Control
2wire3.
XI - 22
Buses - Arbitration
500
XI - 23
Buses - Arbitration
501
Bus_Request_1
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
Request_1
deassert
Grant_1
Request_2
Grant1
Grant_2
Device1
Distributed
Arbiter2
1
Central
Arbiter
Now same
as Case D
Device2
assert
Request2
2
assert
Bus_Request1
assert
3
Bus_Request0
Bus Reserved
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Request_2
Bus_Grant_2
Bus_Grant_0
Central
Arbiter
deassert
Bus_Request0
Bus_Grant_1
Bus_Request_0
Case E1
5
assert
Bus_Grant0
assert
4 Request1
Interface1 uses
the bus
6
assert
Grant1
deassert
Request1
arbit2wireCaseE1.
Reassert
arbcct1e
Bus_Request0
to get bus for
Device 2
(Now a Case C).
XI - 24
Buses - Arbitration
502
Request_2
Request_2
Request_1
Request_1
Bus_Request_1
Bus_Request_1
Bus_Request_0
Bus_Request_0
Bus_Grant_0
Bus_Grant_0
Bus_Grant_1
Bus_Grant_1
Grant_1
Grant_1
Grant_2
Grant_2
I/F 1
I/F 2
2wire5 1.
I/F 1
I/F 2
2wire5 1p.
XI - 25
Buses - Arbitration
503
Request_1
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_1
Grant_2
I/F 1
I/F 2
2wire5 1a.
XI - 26
Buses - Arbitration
504
arbcct1e2
arbit2wireCaseE2a.
Bus_Request_1
Request_1
Grant_1
and the rest
of the
Interface
Request_2
Grant_2
Device1
Distributed
Arbiter2
Arbiter1
Decision Point
lower device
finished
re-arbitrate?
Central
Arbiter
Bus Reserved
Rout
Unit 2 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Request_2
Bus_Grant_2
Bus_Grant_0
Central
Arbiter
Rout
Unit 1 Rin
Distrib.
Arbiter
Gin
Gout
Bus_Grant_1
Bus_Request_0
Case E2
Device2
assert
Request2
assert
Bus_Request1
3
assert
Bus_Request0
assert
4
assert
Bus_Grant1
Bus_Grant0 5
6
assert
Request1
deassert
Bus_Request1
assert
Grant2
Interface2
uses
the bus
deassert
Request2
XI - 27
Buses - Arbitration
505
No Re-arbitration
With Re-arbitration
Request_1
Request_1
6
Bus_Request_1
Bus_Request_1
Bus_Request_0
Bus_Grant_0
Bus_Request_0
Bus_Grant_0
Bus_Grant_1
Grant_1
Grant_2
Bus_Grant_1
7
Grant_1
2wire5 2.
Grant_2
2wire5 3.
XI - 28
Buses - Arbitration
506
Some Alternatives
Re-Arbitrate for every use of the bus. (Option B would require the local unit to ignore all
bus grants except if there were a rising edge on the BusGranti1 signal ... as shown in
E2B and E1B above)
As above (E2A), permit the local arbiter unit to claim bus if all devices to the right (lower
priority?) have no bus request pending. Question: What happens if the local device
changes its mind? It releases BusRequesti1, but before BusGranti1 is removed it
reasserts BusRequesti1 there could be 2 bus masters.
XI - 29
Buses - Arbitration
507
Combinational
Circuitry
Input
Signals
fundamental1
Output Signals
XI - 30
Buses - Arbitration
508
XI - 31
Buses - Arbitration
509
d LRreq
b100 e Lgnt
e101
f Rgnt
g LRreqG
h other
a000 b-00 h000
i LgntRreq
e101
j RgntLreq
h100
Gin, Request)
010
110
f1-0
h-0h- -0 f110
h100
h000 h000
h100
f110
111
g10i101
j110
g101
h000
i101
j110
101
d100
d100
d100
d-00
100
c-00
c100
c100
c-00
-
Note: the entries in the table represent the next state followed by the output values (Rout, Gout,
Grant)
XI - 32
Buses - Arbitration
510
The system is in state b during a local request (Request) when there is no remote request (Rin ). (I.e., no other request
pending or active.)
The system is in state c during a remote (only) request. (I.e., no local request is pending.)
The system is in state d while awaiting a Gin signal. It remains here until the Gin signal is received. Note: if the request
(local (Request) or remote (Rin )) disappears, although unusual, an error could be avoided.
The system is in state e once a Gin has been received to service a local request
State e Grant for local use received. Note, in the event of a second request (Rin ) the next state is the i state.
The system is in state f once a grant for remote use received. Note if a local request (Request) is received while in state f
the next system state is the j state.
The system is in state g when there are two requests pending, The local request wins when grant is detected. In this state
when going from state g to state h, the output has been specified as h100 to force Grant to be turned off first. We should
change only 1 output at a time.
XI - 32.1
Buses - Arbitration
511
The system is in state h for all cases when the arbiter must wait for grant to fall after Rout has been lowered. The use of
state h, rather than separate lines for all the possible ways to get here is one of the places the primitive flow table has been
simplified.
The system is in state i when the local device interface is the bus master, and there is a request received from some arbiter
further down the daisy chain (Rin ). If the remote request (Ri n) disappears before a grant for it is received (a second Gin )
then return to state e. In this state when going from state i to state h, the output has been specified as h100 to force Grant
to be turned off first.
The system is in state j when a local Request arrives while a remote interface is using the bus. In this state, it is assumed
that on the transition from state j to state h that h100 is reasonable as it turns the Grant off before Gin has been received.
(This is subtly different from the version shown in the timing diagrams.)
XI - 32.2
Buses - Arbitration
512
XI - 33
Buses - Arbitration
513
Mnemonic
111
101
100
Idle
a000
b-00
c-00
Lreq
b100
e10-
d100
Rreq
f1-0
d100
c100
LRreq
b100
g10-
d100
c100
Lgnt
e101
h-0-
i101
Rgnt
h- -0
f110
j110
LRreqG
h100
g101
other
a000
b-00
h000
h000
h000
h000
d-00
c-00
LgntRreq
e101
h100
i101
RgntLreq
h100
f110
j110
XI - 33.1
Buses - Arbitration
514
merger.
merger1.
b
c
d
e
f
g
h
i
j
a b
d e
f g
XI - 33.2
Buses - Arbitration
515
merger2.
merger3a.
h
Continuing from previous foil
d
f
XI - 33.3
Buses - Arbitration
516
g
d
f
e
merger4a.
XI - 33.4
Buses - Arbitration
517
State j is now D
This results in the following reduced state table, ignoring the merging of error states () and foolishly assuming that they wont
happen.
111
101
100
A000
A100
B1- -
C- -0
A110
D110
B100
A100
A100
B101
C-0-
C100
B101
B100
A100
A000
A000
C000
C000
C000
C000
B100
A100
C100
- - -0
A110
D110
B100
Note: Table entries specified as: Next State Rout Gout Grant
XI - 33.5
Buses - Arbitration
518
Then one must allocate state vars etc. and finish the design. Note that only 4 states seem to be needed
You must also determine if the values in the blank boxes can remain as dont cares, or if there is some race condition that
requires a value to be specified.
XI - 33.6
Buses - Arbitration
519
BusRequest
Central
Bus
Arbiter
(CA)
BusGrant0
Distributed
Bus
Arbiter
1
Distributed
Bus
Arbiter
2
Distributed
Bus
Arbiter
3
Request1
Grant1
Rest of
Interface
3wire1.
XI - 34
Buses - Arbitration
520
XI - 35
Buses - Arbitration
521
XI - 36
Buses - Arbitration
522
Distributed
Arbiter
(DA)
BusGrant1
Central
Arbiter
(CA)
BusGrant0
BusBusy
BusRequest
Distributed
Arbiter
Decreasing
Priority
Request2
Request1
Grant2
Grant1
XI - 37
Buses - Arbitration
523
Central
Assume Bus Arbiter
Idle to start
Device
Interface1
Distributed
Arbiter1
assert
Request1
assert
/BusRequest Bus
Arbitration
at CA
Bus Reserved
Note /BusBusy
and
/BusRequest
change at
similar times
Device
Interface2
Distributed
Arbiter2
arbit3wireCaseB.
Arbitration
assert
BusGrant0
assert
Assert
Grant1
/BusBusy
Deassert
/BusRequest
Deassert
BusGrant0
Deassert
/BusBusy
Device1 uses
the bus
Deassert
Request1
deassert
Grant1
XI - 38
Buses - Arbitration
524
BusRequest
BusBusy
BusGrant0
BusGrant1
Grant1
Grant2
At DA1
At DA2
At the CA
Arbitration(1)
Bus Use(1)
Arbitration(2)
Arbitration(1)
Bus Reserved(1)
Bus Use(2)
XI - 39
Buses - Arbitration
525
3wire3 1.
Arbitration
Bus Use
Request1
Request2
Request3
BusRequest
BusBusy
BusGrant0
BusGrant1
BusGrant2
Grant1
Grant2
Grant3
XI - 39.1
Buses - Arbitration
526
Three devices
Initially used by interface for
device 2
Requests by interface for device 3 then interface for device 1
Use by interface for device 1
then interface for device 2
3wire3 2.
Request1
Request2
Request3
BusRequest
BusBusy
BusGrant0
BusGrant1
BusGrant2
Grant1
Grant2
Grant3
3 Wire Arbitration
Bus Busy,
Note Priority
XI - 39.2
Buses - Arbitration
527
BusBusy
BusRequest
BusGrant1
BusGrant0
BusAck
Request1
Request2
Grant1
Grant2
4wire1 1.
XI - 40
Buses - Arbitration
528
Request1
Request2
Either Order
BusRequest
BusAck
BusGrant0
BusGrant1
BusBusy
Grant1
Grant2
DA1
Arbitration
(1)
DA2
Bus
Use (1)
Arbitration
(2)
Bus
Use (2)
XI - 41
Buses - Arbitration
529
Central
Arbiter
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
Central
Arbiter
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
Distributed
Arbiter
(DA)
XI - 42
Buses - Arbitration
530
bus idle )
2-wire: (t2wire
arbitration,
bus idle )
3-wire: (t3wire
arbitration,
bus idle )
n links in the daisy chain plus the time through the CA, plus the time to assert
BusBusy. The time to drive Grant is part of the n delays in the distributed arbiter
chain. 4wire
4-wire: (tarbitration, bus idle) delay to drive BusRequest, delay through n links in the
daisy chain, the delay through the CA, delay to drive BusAck, and finally the delay
to assert BusBusy
for the 3-wire and 4-wire the BusGrants are deasserted during bus usage and the time
associated with that activity is ignored here.
Summary of the Operational Characteristics of Daisy-Chained Bus Arbitration
XI - 43
Buses - Arbitration
531
XI - 43.1
532
Buses - Arbitration
XI - 44
Buses - Arbitration
533
Distributed Arbiter
for one interface (q)
2-wire: t2wire
uncertainty = (n i) tdistributed
arbiter delay
3-wire: t3wire
uncertainty = (n i) tdistributed
arbiter delay
4-wire: t4wire
uncertainty = (n i) tdistributed
arbiter delay
requests
from n and i.
n-i
i
XI - 45
Buses - Arbitration
534
Consider the ladder digram for a 2-wire daisy chained bus arbiter
shown.
Assume that the bus is idle, and has been idle for sufficient
time to stabilize. (I.e., there are no signal changes propagating through any of the distributed arbiters.)
Assume that the nth interface makes a bus request at time
trequest n .
Interface i can make a request at any time.
if the request is prior to the time marked as CT in
the figure then interface i will get the bus.
if the request arrives after CT, then interface n will
become the bus master.
it is important to note that when the request
from device i arrives the bus is idle,
it is also of note that i is the highest priority
interface requesting the use of the bus.
despite this, n gets the bus.
this is the uncertainty time, i.e., the time during
which the natural daisy chain priority may be
violated.
Simultaneous requests
from n and i.
n-i
i
CA
tRequest n
tRequest i1
Critical Time CT
tRequest i2
XI - 45.1
Buses - Arbitration
535
XI - 46
Buses - Arbitration
536
Distributed Arbiter
for interface (c)
currently using bus
busy1.
Central
Arbiter
n>c
Remove Request
2-Wire
Re-Arbit.
(n>c)
Re-assert Request
Detect Rising Grant
Central
Arbiter
n<c
c
2-Wire
Re-Arbit.
(n<c)
3c+n
n
n
n
c
Remove Request
c+3n
XI - 47
Buses - Arbitration
537
bus busy )
3-wire: (t3wire
arbitration,
bus busy )
through n links in the daisy chain including the delay to assert Granti and then to
assert BusBusy. (delay to deassert the BusRequest and BusGrant signals is
within the bus usage time and can be ignored here.)
4-wire: Assume request is greater than t4wire
arbitration,
bus idle
idle so that arbitration selection process is complete before the previous user has
finished using the bus. Thus t4wire
arbitration,
bus busy
BusBusy
XI - 48
Buses - Arbitration
538
arbiter delay
3-wire: t3wire
uncertainty = (n i) tdistributed
arbiter delay
4-wire: t4wire
uncertainty = (n i) tdistributed
arbiter delay
+ tcurrent
usage
user
XI - 49
Buses - Arbitration
539
Bus Status
Parameter
2-wire
3-wire
4-wire
Bus Idle
Bus Busy
tDA The time for a signal to propagate through one DA. This is assumed to be the
time from any input to any output.
tCA The time for Grant0 to be produced following the arrival of the last signal to
permit a grant to be issued.
tBL The time for a bus line to be driven and arrive at its destination.
n the ID of the (first) new request.
i in the case of non-simultaneous requests, i is the ID of the second DA to request
the bus. It requests the bus after n requests the bus but before the bus is granted
to n. Assume: n > i.
Summary of the Operational Characteristics of Daisy-Chained Bus Arbitration
XI - 50
Buses - Arbitration
540
Data Transfer
2-wire
chain
Arbitration Structure
Daisy- 3-wire Daisy- 4-wire Daisy- Decentralized
chain
chain
Synchronous
FullyInterlocked
Asynchronous
PartiallyInterlocked
Asynchronous
SemiSynchronous
Split-cycle
XI - 51
Buses - Arbitration
541
nondai2.
DMA3
DMA2
DMA1
DMA0
ID3
ID3
ID2
ID2
ID1
ID1
ID0
ID0
Interface 1
Interface 2
XI - 52
Buses - Arbitration
542
nondai1.
DMA3
DMA2
DMA1
DMA0
RequestBus
ID3
ID2
HighPriority
when a device interface wishes to become the bus master, it asserts its ID
on lines ID0 .. ID3. If the device does
not wish to use the bus it applies and
ID value of 0000.
The device with the highest ID that is
seeking to be the bus master becomes
the bus master during the next arbitration cycle.
ID1
ID0
The start of a bus arbitration cycle is signaled by lines not shown in the figure.
The names of the signals (DMA0, DMA1, DMA2, and DMA3) are the same names used
in the standard bus.
No daisy chain, no special bus slots
Faster no O(n) step there is no delay that is linear in the number of device interfaces.
XI - 53
Buses - Arbitration
543
Terms discussed in this section include: Bus Arbitration and Non-pre-emptive arbitration
what is the key feature of daisy chained arbitration techniques? How is this feature replaced in the non-daisy-chained
structure?
Assume that the delay through a DA is 9 ns and that there is a system with 5 devices that may be bus master. Compare
and contrast the tuncertainty among the various arbiters for various bus conditions.
Engineering Questions.
a two-wire arbitration scheme requires the fewest connections and is the best for all uses.
since 4-wire bus arbiters use more of the available bus time, they are the preferred solution.
the non-daisy-chained bus arbiter is faster than the 3-wire bus arbiter.
XI - 53.1
Buses - Arbitration
544
XI - 53.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XII:
Direct Memory Access(DMA)
f2014-1.0
546
XII - 0.1
547
Resources
XII - 1
548
progcntl.
CPU
Reg
IReg
Interface
MLoc
Memory
Device
XII - 2
549
XII - 3
550
progControl2a
High
Address
Bits
Decoder
Bus Clock
R/W
Address Bus
Chip
Select
2 Address
Bits
Data Bus
IRQ
Data Reg
00
01
10
11
2-Bit
Register
Select
ATD
Address Manipulation
Reset
Data Pending
When Data
Read
Control Reg.
Int.
Enable Status Reg.
Data Pending
O/C
Device is assumed to be
unidirectional and only
provide data.
Data is applied by the external device, and then
clocked by that device.
When data is clocked the
flip-flop is set to 1, and
this 1 can be read by the
bus master when the status register is queried.
When the data is read,
the
status
register
(ready-bit) is cleared.
D
Ck
D=1
Asynch
reset
Data Available
(rising edge)
XII - 4
551
Dev Data
Data Available
Data Pending
Address Bus
Status
Data
Register Address Register Address
Bus Clock (Ck)
Unrelated bus activity
XII - 5
552
Terminology Recall
Recall from Section IV of the notes:
CPU Activity
Device and
Interface
(Polling synch
time shown)
tinterdata
Data Available
Interrupt
(n = 2)
Polling
(n = 2)
tsynch-poll
Time
tsynch-intr
ttransfer producer
ttransfer consumer
Note: if
IRQ used,
a diffferent
device
timing is
needed
repeat if
Read Operation,
multiple transfers
Consumer
required
Sensitive
I/O Device
Two Transfers per
Synchronization
progcontrol3.
XII - 6
553
Note:
Number of items transferred is 256.
The
number of tests at
location
teststatus
is unknown, but the
time required is known
(tsynchpoll ). It can be
calculated if you know
the delay between data
(tinterdata).
XII - 7
554
XII - 8
555
XII - 9
556
IR
Read Write
Rn
Control
...
R1
Processor
Control
Unit
MFC
PC MAR MDR
To Memory
M UX
Const 4
ALU
Select
XII - 10
557
XII - 11
558
Motivating Example
Many details and choices to come, but first one specific example with specific design decisions
including the items listed below.
Integrated DMA controller (DMAC) and device interface
One DMA enabled interface
Terminology
Basic DMA cycle
DMA control software
Complete DMA cycle
DMA performance comparison
DMA controller issues
DMA Example
XII - 12
559
Status/Control Register
CPU
Memory
Mode
R/W
Up / Down
Start
Interrupt Enable
Busy
MAR
Byte Count
Register (BCR)
Status/Control
Integrated
DMA Controler
and
Device
Interface
Device
Interface
Interrupt Request
Read-Only Status Bits
Read/Write Control Bits
Device
dmacntl3.
DMA Example
dmareg.
XII - 13
560
Logical Interface
Memory Address Register(MAR): pointer to the next byte in memory to be transferred.
Byte Count Register(BCR): Number of bytes yet to be transferred in the block.
Status/Control Register:
Mode number of transfers per bus mastership
R/W direction
Up/Down how to change the MAR (I.e., increment or decrement.)
Start start the transfer
Interrupt Enable enable/disable interrupt
Busy synchronization bit for processing one block of data
Interrupt Request interrupt pending asserted at the conclusion of processing one block
of data
DMA Example
XII - 14
561
DMA Example
XII - 15
562
DMA Example
XII - 16
563
DMA Example
XII - 17
564
simpdma1a.
High
Address
Bits
Decoder
Clock
R/W
Address Bus
Chip
Select
2 Address
Bits
Data Bus
IRQ
Data Reg
00
01
10
Control Reg.
Reset
Data Pending
When Data
Read
Int.
Enable Status Reg.
Data Pending
Q
D
Ck
D=1 Data
Available
DMA Example
O/C
DMA Enable
Asynch
reset
DMARequest
ATD
11
2-Bit
Register
Select
XII - 18
565
DMA Example
XII - 19
566
...
LOOP:
[4]
[4]
[4]
[4]
[2]
DMA Example
XII - 20
567
XII - 21
568
XII - 22
569
sequence1.
CPU
DMAC
Interface
Global
initialization
Set up DMAC
Set up Interface
(and device)
Set up processor
(interrupts)
Normal CPU
activity
Block
initialization
Normal CPU
Activity, except
some bus cycles
used by DMA
transfer
Device
DMAC requests
bus mastership
DMAC bus master
causes exchange
between interface
and memory
Inform CPU
transfer complete
Block
synchronization
(interrupt/polling)
Repeat until
all transfers
specified to
DMAC are
complete
Block
synchronization
XII - 23
570
Polling Comparison
CPU
DMAC
Interface
Device
Set up Interface
(and device)
Set up processor
CPU sends
commands
to device
Normal CPU
activity
Polling until
device/interface
ready
Transfer
data
Interface requests
service (set bit)
Repeat until
all transfers
are complete
Block
synchronization
XII - 24
571
Interrupt Comparison
CPU
DMAC
Interface
Device
Set up Interface
(and device)
Set up processor
(interrupts)
CPU sends commands
to interface
Normal CPU
activity
Normal CPU
activity
Normal CPU
activity, except
some cycles
used by interrupt
service routine
execution
First
request
Interface requests
interrupt
Repeat until
all transfers
are complete
Block
synchronization
XII - 25
572
XII - 26
573
Note: A DMAC is just an interface with a number of control, status and data
registers!
In the examples that follow, detached vs integrated is presented for single bus structures only.
XII - 26
574
Detached
Integrated
Synchronization Signal
CPU
DMA
Controller
CPU
System
Bus
System
Bus
DMA /
Interface
Interface
Memory
Memory
Device
dmacntl2.
Device
dmacntl1.
XII - 27
575
Note: Each DMA cycle requires 2 bus cycles. A read and a write. The same cycles
as required for the data transfer portion of
the program controlled I/O. Of course there
is still the saving from the reduced synchronization bus traffic.
progcntl.
CPU
Reg
IReg
Interface
MLoc
Memory
Device
XII - 28
576
3
6
3
Bus
Arbitration
Arbitration
Address
5
Data
6
Control
Bus
Interface
1
Detached
DMAC
(dual address,
single bus,
single channel)
Buffer
DIAR
MAR
BCR
Control
DIAR is the
Device Interface
Address Register
4. Memory places
value onto bus
7. Device Interface
reads the value
from the bus
The Buffer
holds the value
between cycles
Request
SingleDualA.
XII - 29
577
XII - 30
578
CPU
Memory
DMA
Controller
I/O
Interface 1
Ack
Ack
Implicit address only
Master only
Slave only
Master and slave
operation modes
Req
I/O
Interface 2
Req
detach.
XII - 31
579
B Signal flow between the DMAC and Interface - Detached Bus Drivers
CPU
Memory
DMA
Controller
I/O
Interface 1
Ack
I/O
Interface 2
Req
Req
Ack
detachCPU.
XII - 32
580
CPU
Memory
DMA
Controller
Ack
Arbitration
Arbitration
Address
Address
Control
Control
Data
Data
I/O
Interface 1
Ack
dashed lines only required
for implicit adressing
detachDMAMasterSpecific.
I/O
Interface 2
CPU
Memory
DMA
Controller
I/O
Interface 1
Ack
Req
Req
Ack
Req
I/O
Interface 2
Req
XII - 32.1
581
Arbitration
Address
Data
Control
Bus
Arbitration
Bus
Interface
Detached
1
DMA
controller
(implicit address,
single bus,
single channel)
MAR
BCR
Control
Req
4. Memory places data on bus
5. Interface copies data from bus
Ack
4.5
SingleImplicit.
XII - 33
582
XII - 34
583
(14
Address Bits)
R/Wbus
Device Interface
(connected as before)
Ck
R/WInterface
IRQ
00
01
10
Chip Selectinterface
11
I/O Interface
(simpdma
shown previously)
Acknowledge
(Ack. from DMAC)
DEVICE
Request (Req. To
DMAC)
Note: Figure excludes Hold, Master and other bus synchronization signals
implicita.
XII - 35
584
Separate
Bus
DMAC
CPU
I/O Bus
I/O -1
I/O -2
Notes:
Where would DMA controller fit?
Although logically separate buses,
most/all of the wires could be shared.
(If the same physical wires are used,
then the DMAC would require local
storage.)
Single bus implies memory mapped
I/O, while separated Memory and
I/O buses implies non-memory mapped
I/O.
separat.
C Bus Structure
XII - 36
585
C Bus Structure
XII - 37
586
Enable (CS)
(A31, A30)
A31, A30, A7 .. A2
Enable (CS)
(A31 ... A5)
Memory Subsystem
Requires 30 address
bits and 1 chip select.
The memory can
respond at the speed of
the semi-synchronous bus
Complex
I/O device.
Requires 5
address lines
(and a chip select) it
cannot run at bus speed
C Bus Structure
I/O interface
Requires 4
address
lines
(can run at
bus speed)
Addr
Decode
Hold
Bus Master
Bus Master
Addr
30 bits Decode
Enable (CS)
(A31, A30)
Enable (CS)
(A7 ... A5)
Hold
Memory Subsystem
Requires 30 address
bits and 1 chip select.
The memory can
respond at the speed of
the semi-synchronous bus
Complex
I/O device.
Requires 5
address lines
(and a chip select) it
cannot run at bus speed
I/O interface
Requires 4
address
lines
(can run at
bus speed)
XII - 38
587
control1.
Arbitration
Address
Data
Control
Bus
Arbitration
Bus
Interface
Control
Status
DMA Controller
Internal Bus
Channel 0
Channel 1
Channel 2
Channel 3
MAR
MAR
MAR
MAR
BCR
BCR
BCR
BCR
Control
Control
Control
Control
Req0 Ack0
Specialized Topics
XII - 39
588
Memory
512
1K
512
chain1.
Specialized Topics
XII - 40
589
Continuation Registers
(as in the 6844 described in V&Z, section 7.8.1)
Continuation Registers: are registers, within the DMAC that contain an image of the next
values for MAR, BCR and Control Registers. When the current transfer is complete, these values
are copied in to the active channel. Often the continuation registers are implemented using an
unused channels control registers.
continue2.
Arbitration
Address
Data
Control
Bus
Arbitration
Bus
Interface
Control
Status
DMA Controller
Internal Bus
Channel 0
2000
512
Control
Channel 1
Channel 2
MAR
Content Copied when
Byte = 0
Byte Count
Control
Channel 3
1000
MAR
512
Byte
Control
Control
Req2
Ack2
To/From Device Interfaces
Specialized Topics
XII - 41
590
Data Chaining
Data Chaining : In this model, two channels registers are used. One, the data channel, points
to the data that is being read or written. The second channel, the chaining channel, points to a
list of future DMA transfers (setup in memory by the processor). When the byte count register
of the data channel reaches 0, the next values pointed to by the chaining channel registers are
transferred from memory to the data channel registers.
chain2.
Arbitration
Address
Data
Control
Bus
Arbitration
DMA Controller
Internal Bus
Channel 0
Channel 1
Channel 2
Channel 3
3000
MAR
1000
MAR
15
Byte
512
Byte
Control
Control
Control
Control
Req2 Ack2
To/From Device Interfaces
Specialized Topics
XII - 42
591
I/O Performance
Optional
DMAC
Interface
Processor
Device
Memory
Performance Summary
XII - 43
592
Performance Summary
XII - 44
593
Performance Summary
XII - 45
594
Performance Summary
XII - 46
595
Performance Summary
XII - 47
596
I/O Performance
If we assume that 3-wire is used, and that bus arbitration is comparable to a memory bus-cycle
(it will be faster in many cases) and as a result 1bc = 1bac. The following comparison results.
Synchronization
Polling
Periodic Polling
Interrupt
DMA (Dual)
DMA (Implicit)
Processor Time
10 seconds
(400,000,080 bc)
Bus Time
10 seconds
(400,000,080 bc)
25,080 bc
85 bc
85 bc
25,080 bc
4085 bc (2085 bc + 2000 bac)
3085 bc (1085 bc + 2000 bac)
Performance Summary
XII - 48
597
Performance Summary
XII - 49
598
Performance Summary
XII - 50
599
Terms and times discussed in this section include: Burst, Cycle Stealing and Transparent.
Signal connections: Which unit drives which signals? Which units use which signals?
for each of the DMAC structures in the DMAC architecture subsection (starting on page 572) consider the impact of
switching from a one bus to a separate memory and I/O bus structure. Also consider the impact on the performance of the
systems.
How could you structure DMA to permit more than one memory address to (receive) the data from the interface?
How could you structure DMA to permit transfers from device interface to device interface. (For example, could you use
DMA to transfer data from one serial interface to another?)
How could you use DMA if you did not know the size of the block to transfer? (For example, the size of a block of data
coming from the internet may not be known until the first few bytes of the block are received.)
Engineering Questions.
Performance Summary
XII - 50.1
600
Performance Summary
XII - 50.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XIII:
Grounding, Shielding and Transmission Line Issues
f2014-1.0
602
XIII - 0.1
603
Introduction
Resources:
Vranesic and Zaky section 10.2, 10.3 and 11.4.1.
Stone: 2.1, and 2.2
Transmission Lines only:
National Semiconductor Application Note AN-806
(http://www.national.com/an/AN/AN-806.pdf). This provides an introduction to transmission line characteristics.
National Semiconductor Application Note AN-807
(http://www.national.com/an/AN/AN-807.pdf). This provides an introduction to transmission line effects (reflections).
In fact the National Semiconductor Application Note site contains many
interesting notes:
http://www.national.com/appnotes/apnotes all 1.html)
XIII - 1
604
Introduction
XIII - 2
605
Grounds
Ground has been used in this course (and others) to refer to several different concepts. In this
section it is necessary to separate this term into a number of different ideas.
Signal Ground: A point in a circuit used to reference all signal values. This point is often
considered the zero voltage point.
It is possible to separate the AC component of a signal from the DC component of a signal.
Hence there could be separate reference points for each component. It is also possible to
separate analog signals from digital signals and use different reference points.
DC Ground : The reference point for all DC signals in a given circuit block.
AC Ground : The reference point for all AC signals in a given circuit block.
Digital Ground : The reference point for all digital signals in a given circuit block.
Analog Ground : The reference point for all analog signals in a given circuit block.
Shield Ground : It is often important to shield a circuit (or a cable). As described later,
one requirement for this is a shield ground.
Building Ground : The point in a building where the power lines are attached to earth
ground.
Earth Ground : The common point used to reference building grounds.
Grounding
XIII - 3
606
Connecting Grounds
Although it is convenient to consider the different grounds as distinct, they are all connected.
The figure below illustrates the floor-level connections.
rooms1.
Power
Panel
On each floor there will be a power panel that will provide ground
to the various outlets on that floor. Note: some grounds are common
in the same room as the equipment, while other grounds do not get to
a common point until the power panel.
Grounding
XIII - 4
607
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Grounding
XIII - 5
608
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Power
Panel
Appropriate number
size and spacing of
ground rods.
The ground connection in each power panel is routed to a common
panel (not shown) and then to an outside ground. In this case
ground rods are used.
Grounding
XIII - 6
609
VGA = I1*R1
(WRT Building Ground)
VGB = I2*R2
(WRT Building Ground)
I2
Resistance in
R1 the Ground R2
Connection
I1
+
VGB
-
Building Ground
Grounding
XIII - 7
610
Grounding
XIII - 8
611
VGA = I1*R1
(WRT Building Ground'
V'Gnd)
VGB = I2*R2
(WRT Building Ground''
V''Gnd)
Significant
Distance
(CPH and DC)
I2
I1
R1
VGnd = V'
Gnd-V''Gnd -
VGA
Building Ground'
V'Gnd
(at CPH)
DC
+
VGB
Building Ground''
V''Gnd
(at DC)
Earth Ground
(real?)
Grounding
XIII - 9
612
= I1 R1 + VGnd I2 R2
The voltage differential may be several volts, and the ground loop current IGL quite large.
(possibility of severe damage).
This leaves several problems:
if we pass signals between buildings as a value (voltage) then we must also share
grounds (leading to ground current).
if we need to shield the signals from external interference then the shield must be
attached to ground.
Grounding
XIII - 10
613
Shielding - Sources
Some circuits need protection from electromagnetic interference.
Sources:
computers and other digital systems 1 MHz - 3000 MHz
AM radios 455 kHz
FM radios 10.7 MHz
AC power lines 60 Hz
Most common protection is a shield:
enclose circuit in a metallic conductive cage,
enclosure remains at the same potential, and
external radiation raises or lowers the cage potential
but, the details are beyond scope of the course.
The remainder of this subsection of the notes considers the impact of adding shielding
to digital circuits.
Shielding
XIII - 11
614
Shielding - Floating
shield1.
Equivalent Circuit
C3
C3
C1
Vout
Note
Feedback
Vout
C1
C2
V
C2
Shield
Shielding
XIII - 12
615
Equivalent Circuit
C3
C3
C1
C2
Shield
C1
No Feedback Path
Shield Rule #1. The shield of an electronic circuit must be connected to the
signal ground (the zero reference point) of that circuit in order to reduce or
eliminate the feedback effects induced by the shield.
Shielding
XIII - 13
616
Chassis
Shield
Signal Zero
Ref. Point to
Ground
AC Ground
Rule 1: Shield
to Zero Ref. Point
shield3aintro.
Shielding
XIII - 14
617
Shield
Chassis
Noise Current
in signal line
Noise Source
shield3a.
Ground loop current changes the zero ref. point. erroneous voltage levels. The AC
component of the ground current can be treated as a noise source.
Should attempt to minimize current flow in zero ref. line.
Shielding
XIII - 15
618
Shielding
shield4a.
Noise Current
in shield
Noise Source
XIII - 16
619
Shielding
XIII - 17
620
Noise Source
shield5a.
Shielding
XIII - 18
621
Noise Source
shield6a.
Shielding
XIII - 19
622
balanced receiver
two inputs
comparator
(Output = V + > V )
High input impedance
balanc1.
Balanced Transmitter
+
Balanced Receiver
Interference raises and lowers both signal lines and thus if the receiver compares the two
values it may be unaffected by the interference.
Common Mode Rejection Ratio: The ability of the receiver to ignore the changes common
to both input lines is indicated by the receivers common mode rejection ratio.
Shielding
XIII - 20
623
balanc2a.
Noise Source
Shielding
XIII - 21
624
balanc2a.
Noise Source
Shielding
XIII - 22
625
Noise Source
balanc3a.
Shielding
XIII - 23
626
V+
Balanced
VS
Single Ended VS
Shielding
At the Receiver
0-Level
1-Level
Noise Margin
V (V + V ) V + V (V + V )
VS
2VS
VS VS
2VS
2VS
0
VS
VS
0
VS
VS
XIII - 24
627
trans1.
+
V1
-
RS
RL
Waterloo
Toronto
Transmission Lines
XIII - 25
628
c
f
where c is the speed of light (3 108 m/s) and f is the frequency of the wave.
is about one (very large) hand span if we take f to be 1 GHz (109). = 0.3
meters.
recall that a square wave is composed of a number of higher frequency odd harmonics.
Thus circuits of 1 to 3 cm may have transmission line effects if they are expected to
operate at 1 GHz.
Transmission Lines
XIII - 26
629
trans2.
v
Iin
+
Vin
Transmission Lines
XIII - 27
630
trans3a.
dV
Iin
R
dI
C
Vin
dx
Transmission Lines
XIII - 28
631
trans3.
dV
Iin
+
Vin
RI
L
- +
jLI
jCV
dI
GV
dx
Note: jLI is the incremental voltage drop across the inductor
and jCV is the incremental change in the current caused by
the capacitor
Transmission Lines
XIII - 29
632
dV
dx
= (R + jL)I (1)
dI
dx
= (G + jC)V (2)
Transmission Lines
XIII - 30
633
Overview of Derivation of Z0
Differentiate (1) w.r.t. x
d2 V
dx2
dI
= (R + jL) dx
, but we know
Substituting for
d2 V
dx2
dI
dx
dI
dx
from (2)
results in (2)
= (R + jL)(G + jC)V or
d2 V
dx2
= 2V (3)
XIII - 31
634
Overview of Derivation of Z0
Differentiating (4) and substituting for I leads to
dV
= V 0ex + V 00ex (= (1))
dx
= (R + jL)I (replace I with (5) )
= (R + jL)(I 0ex + I 00ex)
= (R + jL)I 0ex (R + jL)I 00ex
Now by equating similar exponents. Note similarity with V = RI.
For ex V 0 = (R + jL)I 0
(6)
XIII - 32
635
Overview of Derivation of Z0
(R + jL)
(R + jL)(G + jC)
v
u
u
u R + jL
u
= u
t
(G + jC)
= Z0
(I.e. Z0 is the ratio of voltage to current!)
or the Characteristic Impedance of the
transmission line.
r
Transmission Lines
or
Z0 =
Similarly
V 00
I 00
v
u
u
u
u
u
t
R + jL
G + jC
= Z0.
XIII - 33
636
Zs= x * (R+jwL)
R
Zp=1/(x*(G+jwC))
Zp
Length x
Transmission Lines
XIII - 33.1
637
trans3b
Zs
Vin
Zp
length x
Assume
impedence= Z0
Repeated
to infinity
Zs
Zs
Zp
length x
Transmission Lines
Zin
=
=
Zs + Parallel(Zp , Z0 )
Z0 Zp
Zs +
Z0 + Zp
Zp
length x
XIII - 33.2
638
Z0
Zs +
(Z0 Zs )(Z0 + Zp )
Z0 Zp
Z02 Z0 Zs Zs Zp
Z0 Zp
Z0 + Zp
Zs
x(R + jL)
Zp
1
1
G + jC x
Results in the following (if we assume that length shrinks to very small) and the only term remaining (the lengths have cancelled) is
Z0 =
Transmission Lines
v
u
uR
t
+ jL
G + jC
XIII - 33.3
639
L
C.
1
LC
If L is measured in henrys per meter and C is measured in farads per meter then s
will be in meters per second and Z0 in ohms.
Transmission Lines
XIII - 34
640
Z0 =
v
u
uR
t
+ jL
G + jC
As increases, the impact of R and G decreases. When the frequency increases, the terms multiplied by start to dominate.
(Conversely if is small the R and G terms may increase in importance.)
For frequencies above 100 kHz ( > 628 krad/s) it is reasonable to assume that transmission line effects have started to
set in.
Transmission Lines
XIII - 34.1
641
Z0 =
s=
0.4106
701012
= 76 and
1
0.4701018
Transmission Lines
XIII - 35
642
I=C
dv
dt
(Assuming time is in seconds, voltage in volts and capacitance in farads, the result will be current in amperes).
If we assume a voltage step, and long lines, the current appears to grow linearly with length. In the case of cables, C is specified per
meter. However, the transmission line model provides an alternative view: the initial current is constrained by Z0 . (I = ZV0 )
Transmission Lines
XIII - 35.1
643
3V
12 pF
At low slew rates (1 ms rise time) I = C dv
[ m ]100 m 0.001
dt constrains the current. For example, at 100 m I = 7010
s =
2.1 105 A.
At high slew rates (1 ns rise time) the transmission line effect will limit the current and the estimate of the current based on
Z0 is better for all of the lengths of the transmission lines shown. For example, I =
on the next page.
3V
76
Between these extremes note that as the length increases, the slew rate necessary for the transmission line effect to constrain
the initial current flow decreases. (And vice-versa.)
The remainder of the notes on transmission line effects assume that the slew rate is fast enough that Z0 is the correct way
to estimate initial current flow.
Transmission Lines
XIII - 35.2
644
1 ns
1.00E+04
1.00E+03
1.00E+02
1.00E+01
1.00E+00
1.00E-01
1.00E-02
1 ms
1.00E-03
1.00E-04
1 ms
100 microS
10 microS
1 MicroS
100 nS
10 nS
1 nS
Char Imp.
70 pF/meter Capacitance
0.4 microH/meter Inductance
Line length in Meters
1.00E-05
1.00E-06
10
100
1000
10000
100000
Transmission Lines
XIII - 35.3
645
Transmission Lines
XIII - 36
646
Ir
Ii
VS
Load ZL
trans4.
Transmission Lines
XIII - 37
647
Transmission Lines
trans4a.
Ir
+
Ii
RS
VS
IL
Z0
Voltage Across Z0 = Z0 * I
and I = VS/(RS+Z0)
Therefore Vi = VS*Z0/(Z0+RS)
VL
-
Load ZL
XIII - 38
648
trans4b.
Ii
Vr
Ir
V
i
I =V /Z
L L L
RS
V =V +Vr
L i
I=Ii-Ir
Ir=Vr/Z0
Transmission Lines
Load ZL
XIII - 39
649
Currents:
IL = Ii Ir (Note direction of current flow
shown in figure)
Ii = ZV0i (Magnitude of current wave)
Ir = ZVr0 (Magnitude of current wave)
Transmission Lines
=
=
=
=
=
=
=
VL IL + Vr Ir
Vr2
VL (Ii Ir ) +
Z0
V L Vi VL Vr
Z0
Z0
VL (Vi Vr )
VL (Vi Vr )
VL
Vi + Vr
XIII - 39.1
650
rho1.
VReflected
r=
VIncident
VIncident
VReflected
Impedance
Z
Transmission Line (Z0)
Reflection Coefficient : The reflection coefficient specifies the ratio of the reflected voltage
(current) to the incident voltage (current). It is useful as an abstraction only in systems where
the various loads and sources can be modelled as linear components. In some literature the
reflection coefficient is referred to as .
Reflections in a Linear System
XIII - 40
651
Reflection Coefficient
These expressions can be manipulated to eliminate the I terms.
Vi + Vr = (Ii Ir ) Z
Vi
Vr
= ( )Z
Z0 Z0
Z0Vi + Z0Vr = ViZ Vr Z
Vi (Z0 Z) = Vr (Z0 + Z)
(Z Z0)
Vr
=
=
(Z0 + Z)
Vi
Similarly, is the reflection coefficient for current
Ir
Ii .
XIII - 41
652
Ir
Ii
ZS
VS
Load ZL
trans4c.
In this figure
The voltage reflection coefficient at the and the voltage reflection coefficient at the
source is
load is
ZS Z0
S =
Z0 + ZS
ZL Z0
L =
Z0 + ZL
XIII - 42
653
XIII - 43
654
trans5.
Ir
Load ZL=inf
r =1
L
VS
At Source
VS
VS*Z0/(Z0+ZS)
=0.99*VS
1
At Sink
Time
(Propagation
Delays)
V=0.99Vs + 0.99Vs
1.98Vs
Vs
Time
(Propagation
Delays)
XIII - 44
655
Reflected Voltage
Source
Sink
0
0
0
LVS1 = VS1
S (LVS1)
0
Time
Source
Sink
0
VS1
0
1
VS1
VS1 + L VS1 = 2VS1
2
VS1 + L VS1 + S (LVS1)
2VS1
(2 0.98)VS1
3
(2 0.98)VS1
2VS1 + S (LVS1)
0
L(S (LVS1))
+L(S (LVS1))
2VS1 1.96VS1
0.04VS1
To keep the table less cluttered, VS1 = 0.99 VS . That is the initial voltage applied to
the transmission line at time 0: VS1 =
Z0
(Z0 +ZS )
VS =
1
1.01
VS .
For example, in time step 2 (propagation delays) the voltage at the source is the sum
of: The original voltage (VS1), the incident voltage (LVS1) and the reflected voltage
(S (LVS1)).
Reflections in a Linear System
XIII - 45
656
trans7.
Ir
Ii
ZS=Z0
Load ZL=inf
r =1
L
VS
At Source
S = 0; L = 1.
one round trip delay for the signal to
reach terminal value.
VS
2 is the initial value,
note impact on performance as a function of threshold.
Vs
Range of VThreshold
Vs/2
At Sink
Vs
Range of VThreshold
XIII - 46
657
trans6.
Ir
Ii
ZS<<Z0
Load ZL=Z0
r =0
L
VS
At Source
VSZ0/(Z0+ZS)
At Sink
VSZ0/(Z0+ZS)
XIII - 47
658
Ir
Ii
ZS
Load ZL!=Z0
VS
trans8.
S =
ZS Z0
Z0 +ZS
6= 0; and L =
After settling: VL =
ZL Z0
Z0 +ZL
L
VS Z Z+Z
L
S
6= 0
Note: multiple receivers/loads is the norm! Each tap may be considered as a separate
transmission line.
XIII - 48
659
XIII - 49
660
trans9.
Ir
Transmission line (Z0=93)
ZS=25 Ohms
VS=1V
Load ZL=inf
V
Ii
XIII - 50
661
trans9a.
Ir
Transmission line (Z0=93)
ZS=25 Ohms
Load ZL=inf
VS=1V
Ii
r =1
L
r = -0.58
S
0.0V
1*(93/(93
+25)) = 0
.79V
0.0 + 0.79
0.79
0.79+0.79-0.46
= 1.12
(Note
0.46= -.58*0.79)
0.79+0.79
= 1.58
-0.46
1.58-0.46-0.46
= 0.66
-0.46
1.12-0.46+0.26
=0.92
0.26
0.26
0.66+.26+.26
=1.18
0.88
XIII - 51
662
Ir
Transmission line (Z0=93)
ZS=25 Ohms
Load ZL=inf
VS=1V
Ii
1/Z0
40 ma
40 mA
40 mA
-1/Z0
-1/ZS
1/Z0
0
1
1V
1V
Slope -1/Z0
1V
Slope -1/Z0
XIII - 52
663
1
ZS
as shown running
1
Z0 )
XIII - 53
664
1
Z0
1
Z0
1
Z0
passing
through 2 etc.
XIII - 54
665
Ir
Transmission line (Z0=93 W)
ZS=25 W
Load ZL= 10 W
VS=1V
Ii
40 ma
1/Z0
40 mA
1/ZL
40 mA
-1/Z0
5
-1/ZS
3
1
1/Z0
1
Slope -1/Z0
1V
1V
4
2
0
V
1V
XIII - 55
666
XIII - 56
667
30mA
Output (High)
20mA
10mA
-2V
-1V
1V
2V
3V
4V
5V
-10mA
-20mA
-30mA
Output (Low)
Input
iv1.
XIII - 57
668
Example 50 Cable
30mA
Output (High)
20mA
10mA
-2V
-1V
1V
2V
3V
4V
5V
-10mA
-20mA
-30mA
Output (Low)
Input
iv1 50.
XIII - 58
669
30mA
Output (High)
20mA
10mA
-2V
1V
-1V
2V
3V
4V
5V
-10mA
-20mA
-30mA
Output (Low)
Input
iv1 100.
XIII - 59
670
30mA
Output (High)
20mA
10mA
-2V
-1V
1V
2V
3V
4V
5V
-10mA
-20mA
-30mA
Output (Low)
Input
iv1 200.
XIII - 60
671
30mA
Output (High)
20mA
10mA
-2V
-1V
1V
2V
3V
4V
5V
-10mA
-20mA
-30mA
Output (Low)
Input
iv1.
XIII - 61
672
Make sure you understand the terms listed on the next page of the notes.
Using your results from above, a (linear) source impedance, a (linear) load impedance and a transmission line of given length,
calculate the reflection coefficients and the wave form at each end of the transmission line assuming that there has been a
0 V to 10 V step at time 0. (repeat for a 10 V to 0 V step at time 0.)
Compare and contrast source and load matching. Consider any impact on the designer, builder and user of these schemes.
How would the use of an unmatched transmission line affect the operation of your system?
Why might a designer separate the analog and digital grounds in a system?
XIII - 61.1
673
XIII - 61.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XIV:
Examples (Signalling and Buses)
f2014-1.0
675
XIV - 0.1
676
SCSI (Small Computer System Interface) Bus (starting on page 715) The SCSI bus is used to interconnect relatively complex devices.
The coverage emphasizes: the unique scheduling and data transfer structures (there are no address lines used during normal transfers,
and the T arget (somewhat like the slave) controls the transfer), and the use of one-hot addressing.
IEEE-488 (starting on page 732) The IEEE-488 bus structure is intended to be used to interconnect lab instruments. The structure
provides for multicast transfers (where one source can send to multiple receivers in a single transfer) that are fully-interlocked. In
this case there are also no address lines used during the transfer.
Peripheral Component Interconnect (PCI) (starting on page 742) PCI is used in many PC systems to connect complex device
interfaces. It is a bus structured for block transfers. The arbitration is based on a star connection.
XIV - 0.1
677
Resources
HV&Z, Section 4.7 (PCI, SCSI, and USB) (5th Edition)
V&Z Section 11.2 (VME Bus IEEE-1014)
V&Z Section 11.4 (Interface standards RS-232 etc. The higher level issues were discussed
in the serial interfacing section of the course notes.)
V&Z Section 11.5 (Peripheral Buses)
V&Z Section 11.5.1 Small Computer System Interface (SCSI)
V&Z Section 11.5.2 IEEE-488 Instrumentation Bus
B&B Electronics RS-422 and RS-485 Application Note
http://www.bb-elec.com/bb-elec/literature/tech/485appnote.pdf
A comparison of 422 and 485 can also be found in National Semiconductor Application
Note: AN-216 http://www.national.com/an/AN/AN-216.pdf
An application note that illustrates the transmission line effects related to termination
in an RS-485 system is provided by Maxim at
http://www.maxim-ic.com/appnotes.cfm/appnote number/763/ln/en
Other resources listed in the specific section.
Resources
XIV - 1
678
XIV - 2
679
Introduction
XIV - 3
680
Introduction
XIV - 4
681
By using current as the value, the problems described in the grounding section (starting on page 605) can be handled easily.
Each of these items is addressed while considering one implementation of a 20 mA current loop communication structure.
20 mA Current Loop
XIV - 4.1
682
20 mA Current Loop
Transmitter
Receiver
Serial Link
Current
Detector
XIV - 5
683
Rs
Receiver
R0
R1
Opto-Isolator
Receiver Circuit
Transmitter
Serial Connection
serial51.
Component Selection
One option is to use an opto-isolator
Assume the transmitter provides: 20 mA with at least 4 V will be delivered to the receiver
and the voltage at the load will not exceed 12 V.
Assume the LED requires 10 mA to provide sufficient light to saturate the photo transistor.
There is 0.8 V drop across the diode when 10 mA are flowing through the LED.
Select R0 and R1 to limit LED current and voltage.
20 mA Current Loop
XIV - 6
684
20 mA Current Loop
XIV - 7
685
MC 1488
+12V
TTL
-12V
MC 1489
+5V
TTL
Signal Ground
Shield Ground
serial9.
XIV - 8
686
Parasitic Capacitance
capacitor.
XIV - 9
687
seria12a.
Change the slew rate of the signal (by modifying the drivers) and thus lower the power in
the high frequency harmonics.
RS-232 permits a slew rate 30 V/s (max)
For example: -15 V to +15 V in 1 s or -3 V to +3 V in 200 ns.
XIV - 10
688
Receiver
Current
Limit
seria12b.
XIV - 11
689
RS-422/423 Standards
(HV&Z Section 11.4.2)
Other standards define standard drivers and receivers just as in the RS-232 case.
RS-422 a double-ended (balanced) interface
MC 3487
MC 3486
+3V/-3V
-3V/+3V
seria10a.
MC 3486
(RS-422)
3V/-3V
0V/0V
seria10b.
XIV - 12
690
serial10c.
Logic 1
serial10d.
Logic 1
Logic 0
+3
Logic 0
+3
-3
RS-422 Signalling
-3
RS-232 and RS-423 Signalling
XIV - 13
691
transmit data
rcv data
transmit common
Ground
signal ground
DTE - "Terminal"
DCE "Modem"
receive data
receive common
transmit data
shield ground
no connection
100 Ohm resistors optional
RS-449 connection standard showing the connection
of an RS-423 unbalanced link
XIV - 14
692
XIV - 15
693
RS-485 Structure
485Structure
DataIn
Enable
DataOut
termination resistors
(120 W each)
at two ends only
2-Wire RS-485
Structure
XIV - 16
694
485Termination
VA
Floats to a valid
value when signal
is undriven
VB
XIV - 17
695
485FourWire.
Device B
4-Wire RS-485
Structure
Device A
Device D
Master Link
Device E
Device C
Device B
Device D
Slave Link
Device E
Device A
Device C
XIV - 18
696
RS - 422
Multiple
Single
10 Mbps
1200 m
10 V
2.0 V
150 mA
7 V
RS - 485
Multiple
Sequentially single (Up to
32 drivers supported)
10 Mbps
1200 m
6V
1.5 V
250 mA
7 V to +12 V
XIV - 19
697
RS-232-C
RS-423-A
RS-422-A
RS-485
ITU
V.28
V.10/X.26
V.11/X.27
Data Rate
20kbps
300kbps
10Mbps
10Mbps
Maximum Distance
15m
1200m
1200m
1200m
Number of Drivers
32
Number of Receivers
10
10
32
Driver Voltages
15 V
6 V
5 V
5 V
Number of conductors
per signal (plus one
ground if needed)
Notes:
XIV - 19.1
698
XIV - 20
699
SPI Concepts
data is loaded asynchronously at master and slave and then serially shifted synchronously
SS
SPDR Write
enable
SS
MISO
data
MISO
MOSI
data
MOSI
SPDR Read
master
SPDR Write
SPDR Read
SCK
clock
SCK
slave
XIV - 21
700
Serial Shifting
n bit data registers (SPDR) are linked to form a distributed 2n bit register
when data transfer is performed, the 2n bit register is serially shifted by n bits
data may be shifted MSB or LSB first (MSB-first as shown in the figure)
Motorola standard defines n = 8, Nios processor SPI allows 1 16 bits
Before
MOSI
1 1 0 1 0 1 0 0
MISO
MISO
0 0 1 1 0 1 1 0
SPDR
SPDR
master
slave
MOSI
After
MOSI
0 0 1 1 0 1 1 0
MISO
MISO
1 1 0 1 0 1 0 0
SPDR
SPDR
master
slave
MOSI
XIV - 22
701
XIV - 23
702
XIV - 24
703
XIV - 25
704
SPI Operation
SCK
SS
MOSI
MSB
LSB
MSB
MISO
MSB
LSB
MSB
XIV - 26
705
SS
MISO
SS n
Decoder
MOSI
SCK
slave 1
MISO
MOSI
master
SCK
slave 2
SCK
MOSI
MISO
SS
XIV - 27
706
Avalon Bus
Question: When is a bus not really a bus? or Can you build a bus with neither tri-state nor
passive pull-up drivers?
The
The
resources that cover this material can be found in the Altera distribution material.
following manuals are available:
Avalon Interface Specifications
QSys Interconnect
XIV - 28
707
Multiplexer
Master
M1
Request
Logic
Multiplexer
Request
Logic
Master
M2
Master Ports
Multiplexer
Arbiter
Logic
Arbitration
to select
Mux control
Multiplexer
Arbiter
Logic
Slave Ports
Slave S1
Slave S2
Slave S3
XIV - 29
708
XIV - 30
709
VME Bus
The VME bus (IEEE-1014) is intended as a backplane bus
V&Z is quite clear on the various details, this year we will examine only two of its characteristics
bus termination
multiple interrupt sources and sinks
VME Bus
XIV - 31
710
Bus Termination
Since this is a backplane bus it may be longer, and driven by a wider variety of devices.
Each line is terminated as shown below (there is one termination on each end of the wire).
+5 V
+5 V
330 W
330 W
Bus Line
470 W
470 W
vme1.
470
800
5 V) with a termination
VME Bus
XIV - 32
711
Bus Termination
4.5 V
To get a zero on the bus (I.e. a voltage no larger than 0.5 V) there must be 165
= 27.2 mA
and the rest (25.1 mA) flowing into the driving gate ignoring any current into
the load!!!
VME Bus
XIV - 33
712
Interface
Computer
Interface
Memory
Computer
Computer
Computer
Memory
Interface
Memory
Computer
Computer
Interface
Interface
Computer
However when there is the possibility of having several possible recipients of a given
interrupt how can it be structured? (For example, two processors and 1 serial port, some
times the port may wish to interrupt processor 1 and at other times processor 2.)
vme2.
VME Bus
XIV - 34
713
vme982.
VME Bus
vme981.
XIV - 35
714
VME Bus
XIV - 36
715
XIV - 37
716
Peak
transfer
rate
(MBps)
Bus
Width
(bits)
Cable
Type
Maximum
Distance
(m)
Maximum
Devices
SCSI-1
SE
HVD
25
10
SE
HVD
25
20
16
SE
HVD
25
16
20
SE
HVD
1.5
25
40
16
SE
HVD
25
Ultra 2 SCSI
40
LVD
HVD
12
25
80
16
LVD
HVD
12
25
16
Ultra 3 SCSI
160
16
LVD
12
16
320
16
LVD
12
16
640
16
LVD
12
16
16
XIV - 37.1
717
scsi1.
Micro
Processor
Initiator
SCSI
Controller
Target
Tape
Drive
Micro
Processor
Tape
Controller
SCSI
Controller
Initiator or
Target
Input link
output link
termination
resistors
Target
Disk
Controller
Disk
Drive
Target
Printer
Controller
Printer
XIV - 38
718
XIV - 39
719
T arget
Requests
the
bus (if suspended) (Referred to as
Re-selection)
Reactivates the
connection
Sends control
or data information to the
Initiator.
(Optionally)
suspends
the
use of the bus.
Signal
DATA
Phase
Information
Type
Direction
Handshake
(Async)
Other
XIV - 40
720
Event Name
Activity
Arbitration
Selection
Message
T arget requests an Identif y message containing the logical unit number to be used and the
communication capabilities required. T arget rejects transfer if capabilities are not supported.
Command
Data
Status
Message
XIV - 40.1
721
XIV - 41
722
Arbitration
Selection
Information
Transfer
0/1
0/1
0/0
1/0
Select 1 device and it
then selects another
scsi2.
Note that the BSY/SEL values are reused during the sequence
Also note that it is the BSY/SEL signals that control when the next phase is entered
XIV - 42
723
XIV - 43
724
XIV - 44
725
-DB2
<800
-DB5
>1200
6
-DB6
-BSY
>800
2,6
>2200
6 only
>80
>400
<200
6 (6 wins)
-SEL
Bus
Idle
Selection
Arbitration
Time Shown in ns
Numbers show the addresses
driving a line.
scsi3.
XIV - 45
726
XIV - 46
727
XIV - 47
728
XIV - 48
729
SCSI - Reselection
Reselection: After some or none of the data that has been requested by the Initiator has been
transferred, the T arget releases the bus to await data to become available. Once the data is
available the T arget arbitrates for the bus and becomes a bus master (as the T arget). The
process is reselection.
-DB5
T 5
-DB6
-BSY
T5
I 6
T 5
I and T
5, 6
T5
T5
-SEL
Arbitration
Initiator Examines
ID
scsi4.
XIV - 49
730
SCSI - Reselection
1. Start with bus idle (BSY and SEL idle)
2. The T arget that wishes to re-establish the connection (and others) go through arbitration
until one is selected (assume that it is the T arget in question)
3. The T arget asserts the Initiators address (which it has saved during the initial arbitration cycle)
4. Sometime later the T arget releases the BSY line
5. When the Initiator detects its address and observes the de-assertion of BSY, it asserts
BSY
note this is similar to previous case, except the Initiator is asserting BSY not the
T arget as required for data transfer
6. When the T arget detects that the Initiator has asserted BSY, it too asserts BSY, and
then releases SEL
7. Once SEL is released, the Initiator releases BSY and we are back to the same state as
at the end of selection
XIV - 50
731
SCSI - Reselection
Comments
The T arget is responsible for the transfers
The T arget is a complex interface
commands such as seek etc. can be included in complex commands such as READ
sector xxxx (No seek, Interrupt, read DMA)
XIV - 51
732
IEEE-488
IEEE-488 a standardized version of HPIB (Hewlett-Packard Instrumentation Bus). The
IEEE-488 bus is also referred to as the GPIB (or General Purpose Instrumentation Bus).
Intended for connecting instruments (smart instruments by 1980 standards)
Also useful for some peripherals, but not for disks
4MBytes/sec to 8MBytes/sec.
Bus oriented (not like serial point to point)
Byte-wide transfers
16 signals plus 8 grounds (24 pins)
IEEE-488
XIV - 52
733
Function
(8-bit Data)
Stop transfer and listen for commands
These signals JOINTLY perform the function of the Slave signal
in a master slave transfer oriented bus)
(similar to a master signal it indicates that there is data to be
read on the bus
Indicate to the controller that service is being requested
Force bus devices into a known state.
Disconnect device from panel and place under the control of the
instrument bus
Used for parallel polling
IEEE-488
XIV - 53
734
IEEE-488
XIV - 54
735
Data (T)
DAV(T)
RFD(L)
DAC(L)
IEEE-488
XIV - 55
736
Data(T)
DAV(T)
RFD(All L)
All Ready
DAC(All L)
All have
accepted
IEEE-488
XIV - 56
737
IEEE-488 Structure
Controller
1
ieee4883.
IEEE-488
XIV - 57
738
IEEE-488
XIV - 58
739
IEEE-488
XIV - 59
740
IEEE-488
XIV - 60
741
IEEE-488
Polling
Serial poll: Select each device in turn as a talker and the controller as the listener, release
ATTENTION and wait for a status byte from the talker. (Up to 31 devices to poll.)
Fast Poll: Each device is assigned one data line (at setup).
each requesting device asserts its line.
if the set up has more than one device assigned to a given line, then serial polling
can be used to differentiate between these devices (the maximum number of serial
polls is 4).
IEEE-488
XIV - 61
742
PCI
pci1a.
Processor
and
Cache(s)
Memory
Bus
System Bus
AGP
Bus
PCI developed, by
Intel, to replace local
bus architectures for
personal computers.
PCI extends the PC
hierarchy.
Additional reference:
T. Shanley and
D. Anderson PCI
System
Architecture, 4th Edition,
Mindshare, 1999.
Accelerated
Graphics
Port
North
Bridge
Video
Card
Memory
PCI Bus
USB
PCI
1
PCI
2
PCI
n
South
Bridge
ATA Bus
n<8
SCSI Bus
ISA or
EIA BUS
ISA
1
ISA
2
ISA
i
XIV - 62
743
PCI Introduction
A PCI bus interconnects relatively complex systems, in a relatively confined area.
Overview
Synchronous
Support for burst traffic. (split cycle-like, with one address phase and (potentially)
several data phases.
Expectation of many possible masters competing.
XIV - 63
744
PCI CLK
FRAME#
C/BE#
6
H
G
Data 1
Addr
Da 2
Data 3
C
CMD Byte Enable Byte Enable Byte Enable
I
IRDY#
TRDY#
DEVSEL#
GNT#
7
J
AD
4
H
D
F
L
K
K
pcitime.
XIV - 64
745
XIV - 65
746
XIV - 66
747
PCI Arbitration
Since PCI is very constrained, it can use a complex central arbiter and a star connection.
Daisy Chain
Bus Oriented
Star (PCI)
pciintr1.
XIV - 67
748
pciarb2.
XIV - 68
749
XIV - 69
750
Assume that you have been asked to interface an opto-isolator to a 20 mA current source. The course has a power supply of
15 V and a source resistance (RS ) of 50. Assume that the opto-isolator that you are to you requires between 6 and 15 ma
to produce a reliable output (i.e., to turn the photo transistor on in saturation). Select components and draw the circuit
required for your receiver.
Consider the use of a standard RS-232 driver and 20 mA current loop to drive a transmission line with a characteristic
impedance of 93. How would you implement termination in each case (justify choice). In each case estimate (for your
assumptions) the power consumed by the termination resistor(s).
What is the peak data throughput for a 32-bit, 33 MHz PCI bus?
What is the peak data throughput for a 64-bit, 66 MHz PCI bus?
XIV - 69.1
751
XIV - 69.1
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XV:
List of Contents
f2014-1.0
List of Contents
753
Section Titles
XV - 0.2
List of Contents
754
Section Titles
XV - 0.3
List of Contents
755
Section Titles
XV - 0.4
List of Contents
756
Section Titles
XV - 0.5
List of Contents
757
Section Titles
XV - 0.6
List of Contents
758
Section Titles
XV - 0.7
List of Contents
759
Section Titles
XV - 0.8
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XVI:
Summary of Contents
f2014-1.0
Summary of Contents
761
XVI - 0.9
Summary of Contents
762
A comparison of the abstraction layers for software development. (starting on page 35)
XVI - 0.9
Summary of Contents
763
(spontaneous, consumer responsive and consumer sensitive) are described. These models permit a more complete
discussion of latency.
Computer Structure (starting on page 80) Processor Structure. A summary of how the processor executes an instruction and how
external interfaces can detect requests by the processor.
CPU-Memory Interface (CPU Version) (starting on page 91)
The single bus CPU model is used to motivate the needs for the system bus from the CPUs perspective.
CPU-Memory Interface (Memory Version) (starting on page 95)
The needs for communication from the memorys perspective are described. This includes the potential for synchronous and asynchronous communication alternatives.
Multiple Drivers (starting on page 101)
How to attach more than one device that can drive a value onto a line. This discussion centers around the electrical
alternatives for these connections. Tri-state, passive pull-up and passive pull-down alternatives are described and
compared.
Device Selection (starting on page 121)
Explicit and passive selection techniques are examined.
Overview of Device Selection with Synchronous Bus (starting on page 124)
Requirements for attaching to a basic synchronous bus described. Both read and write operations are shown.
Reality Check (starting on page 130)
XVI - 0.9
Summary of Contents
764
Although most previous courses have assumed that the timing of signals was appropriate. Metastability may occur
if the setup or hold time is violated.
Synchronous Bus Introduction (starting on page 131)
Definitions of the terms and times used in this section of the notes including skew time, propagation delay, select
time and access time. There is also a discussion of the features common to all bus structures. This material is
covered in more detail later in the course.
Synchronous Bus Transfer (starting on page 141)
The synchronous bus is used as the basis for the discussion of bus data transfer structures. The timing and
interconnections required to support a basic synchronous bus are described here with the more complex discussions
left for detailed coverage later in the term.
Questions (starting on page 148)
Parallel Interfacing (starting on page 150) Examines the role of the interface to match the bus timing and signalling characteristics
with a devices timing and signalling characteristics.
Function of Parallel Interfaces (starting on page 152)
The main function of the parallel interface is to provide a method to permit the processor, or other bus master,
to read (or write) data from(to) the interface in the time scale of the bus. The interface may also provide signal
conditioning and other features described in later in this section of the notes.
System Bus Side (starting on page 158)
Introduces basic synchronous bus communication structure to motivate how to attach a parallel interface to a
processor.
XVI - 0.9
Summary of Contents
765
XVI - 0.9
Summary of Contents
766
The most basic (and common) of the error detection techniques parity sends one additional bit per data word to
permit single bit errors to be detected.
EC, ED and Distance (starting on page 208)
The relationship between error detection (ED) and error correction (EC) is examined. The distance between words
is defined and used as a measure to compare error correction and detection needs.
Hamming Code (starting on page 210)
One of the standard single bit error correction techniques, Hamming code, is introduced through a small example.
The constraints and costs associated with Hamming code is examined and the effects on efficiency when longer code
words are used is also considered.
Hamming Code Implementation (starting on page 220)
The issues associated with implementation for larger words is also examined.
Serial Interfacing (starting on page 229) Introduction to serial communication interfacing; asynchronous communication techniques,
synchronous techniques; and serial device interfacing techniques.
Serial Interfacing Introduction (starting on page 231)
The issues associated with serial interfacing such as the types of synchronization, are introduced.
Terminology (starting on page 234)
Link types (simplex, half-duplex and full duplex), types of synchronization (bit, byte and clock) are described, bit-rate
and baud-rate, and types of coding schemes.
XVI - 0.9
Summary of Contents
767
XVI - 0.9
Summary of Contents
768
XVI - 0.9
Summary of Contents
769
XVI - 0.9
Summary of Contents
770
master and the slave. The asynchronous bus is the first situation that considers, in detail, the fact that signals have
different values at different places on the bus at the same instant.
Partially Interlocked Asynchronous Buses (starting on page 464)
The fully-interlocked asynchronous bus of the previous section is extended to reduce the number of bus interactions
required to synchronize a transfer.
Semi-Synchronous Bus Transfer (starting on page 467)
Buses based on a semi-synchronous bus data transfer technique are very common in microprocessor systems. The
semi-synchronous bus provides a technique to permit interaction with slower interfaces. This technique has only
limited impact on the faster transfers.
Split Cycle Protocols (starting on page 471)
The split cycle protocol provides improved performance in environments where there are multiple bus masters. Each
bus master can make a request of the slave, release the bus, and then receive the response from the slave at some
later time. This leaves the bus available for use by other interfaces during the slave access time.
Buses - Arbitration (starting on page 476) Examination of operation and characteristics of daisy chained and non-daisy chained bus
arbitration techniques.
Introduction (starting on page 479)
The general needs of arbitration are examined. The terminology for devices and interfaces and arbitration is defined.
2-Wire Daisy Chain (starting on page 484)
The first of the daisy-chained arbitration techniques is examined in more detail than the other techniques. This sub-
XVI - 0.9
Summary of Contents
771
section includes the detailed consideration of distributed digital systems. Of particular note is the limited information
that is available at each part of the distributed arbitration system to make the arbitration decisions. This section
considers a design example translating the needs of the arbitration system to the specification of a fundamental
mode (asynchronous) circuit.
3-Wire Daisy Chain (starting on page 519)
The 3-wire arbiter structure presentation does not provide design details to the same level as the 2-wire material.
The material describes a system that permits global knowledge of the state of the shared resource (the bus), while
permitting a distributed arbitration system design. The coverage includes several detailed timing examples.
4-Wire Daisy Chain (starting on page 527)
The 4-wire distributed arbitration technique is a modification of the 3-wire technique. It permits the bus arbitration
and the bus usage to be overlapped. The presentation emphasizes the differences between the 3-wire and 4-wire
and examines a small number of cases.
Summary of the Operational Characteristics of Daisy-Chained Bus Arbitration (starting on page 529)
The characteristics of the various daisy-chained arbitration techniques are summarized. In addition there is a more
formal examination of the priority provided by the various schemes. One of the key points is that there exists a
window of time in which the arbiter with requests pending from two devices will select the one furthest from the
central arbiter to be the next bus master. The size of this window can be used to compare the techniques.
Non-Daisy-Chained Bus Arbitration (starting on page 541)
The non-daisy-chained arbiter is presented to illustrate that it is not a requirement to have daisy-chained wiring to
make a unique arbitration decision.
Direct Memory Access(DMA) (starting on page 545) Examination of DMA operation (software, hardware and bus needs), DMA
XVI - 0.9
Summary of Contents
772
characteristics.
Block Oriented Program Controlled I/O (starting on page 548)
Block oriented program controlled I/O operation and requirements including sample hardware, C-interface software,
assembly language interface software and special purpose instruction software (and hardware) alternatives.
DMA Example (starting on page 558)
Examines the fundamental needs of DMA without considering all of the background and interacting issues. It
presents a complete DMA example which, as will be seen later, is based on one set of alternatives.
Complete DMA Cycle (starting on page 567)
Considers the DMA cycle from the perspectives of the controller, the interface, and the device. Provides significantly
more structure to the needs of a block oriented transfer using DMA. It also provides ladder diagrams to compare
the timing for program controlled I/O and DMA.
DMA Controller Architecture (starting on page 572)
The next three subsections examine DMA controller related issues that are, to a large extent, independent design
alternatives.
A Intimacy Between DMAC and Interface - Detached vs Integrated (starting on page 574)
Compares DMA controllers that are general in nature, designed for use with different and varied interfaces, with
those that are part of the interface for which they are providing service.
B Addressing Structure Implicit Addresses vs Dual Addresses (starting on page 575)
XVI - 0.9
Summary of Contents
773
Implicit addressing provides a bus cycle that transfers data directly between interface and memory. This subsection
examines the cost in using interfaces that are not designed for DMA in a DMA environment.
C Bus Structure (starting on page 584)
Considers the impact of one and two bus structures on the connectivity of the DMA controller.
Specialized Topics (starting on page 587)
Multiple channel controllers are examined. The specialized needs for transferring data in long blocks are examined.
Performance Summary (starting on page 591)
Comparison of performance of DMA and non-DMA systems. General discussion of the meaning of performance with
respect to I/O systems.
Grounding, Shielding and Transmission Line Issues (starting on page 601) Examination of some of the real-world considerations at
the wiring level for digital circuits.
Introduction and Resources (starting on page 603)
This section of the notes covers a number of realities in digital circuit design. This subsection provides some structure
to the remaining notes in the section.
Grounding (starting on page 605)
Considers issues associated with grounding. Of particular note is the impact of different paths to ground on the
interpretation of the resulting signal levels.
Shielding (starting on page 613)
XVI - 0.9
Summary of Contents
774
Considers the needs to shield some circuits from outside influences. Various shielding requirements are examined.
Techniques to transfer signals from one shielded environment to another are also examined. The techniques considered are optical fibre, balanced, single-ended, opto isolators.
Transmission Lines (starting on page 627)
Transmission lines could be a complete course. The differences between lumped and distributed circuit models are
introduced and situations when transmission line effects are significant to the digital designer are presented. The
characteristic impedance expression (Z0 ) is derived and its meaning examined.
Reflections in a Linear System (starting on page 650)
Reflections in linear systems, source and load matching, and the linear reflection coefficient (Labelled as in some
literature.). Analytical and graphical solution techniques are shown.
Reflections in a Non-Linear System (starting on page 662)
Although analytical solutions to non-linear load and source impedances are beyond the scope of this course, a
graphical technique is described that can be used to estimate the amount of time required for a given transition to
settle to a final value.
Examples (Signalling and Buses) (starting on page 674) Aspects of existing systems that demonstrate some of the course concepts.
Introduction (starting on page 678)
The examples can be thought of as in two groups: signalling examples, showing variations and extensions to the
electrical signalling examples used earlier in the notes; and bus examples, illustrating and extending the earlier
material in the course. These examples also show systems that combine various sections of the course into a single
structure.
XVI - 0.9
Summary of Contents
775
XVI - 0.9
Summary of Contents
776
The Avalon Bus is an unconventional bus structure. It is based on non-shared communication paths with multiplexers
to select interconnections between masters and slaves.
VME Bus (starting on page 709)
The VME bus example is used to show the use of termination resistors to provide load balancing. It also shows the
use of a daisy-chain wiring technique to facilitate multiple interrupt service providers.
SCSI (Small Computer System Interface) Bus (starting on page 715)
The SCSI bus is used to interconnect relatively complex devices. The coverage emphasizes: the unique scheduling
and data transfer structures (there are no address lines used during normal transfers, and the T arget (somewhat
like the slave) controls the transfer), and the use of one-hot addressing.
IEEE-488 (starting on page 732)
The IEEE-488 bus structure is intended to be used to interconnect lab instruments. The structure provides for
multicast transfers (where one source can send to multiple receivers in a single transfer) that are fully-interlocked.
In this case there are also no address lines used during the transfer.
Peripheral Component Interconnect (PCI) (starting on page 742)
PCI is used in many PC systems to connect complex device interfaces. It is a bus structured for block transfers.
The arbitration is based on a star connection.
Section Titles (starting on page 753)
XVI - 0.9
UNIVERSITY OF WATERLOO
Department of Electrical and Computer Engineering
Section XVII:
Glossary
f2014-1.0
Glossary
778
Note: Glossary
I:Course Introduction
II:Embedded Systems
embedded system: a special-purpose computer system designed to perform a task without the users knowledge of its existence.
The user may provide input to the embedded system via controls and sensors but the user need not be aware of the presence of the
embedded system. ( 22 )
Hardware: 3. the mechanical or electronic components of a computer etc. ( 26 )
Software: 1. the programs or other operating information used by a computer. 2. storage media such as video cassettes, audio
tapes, etc. requiring playback on electronic equipment ( 26 )
Microprocessors: A microprocessor consists of a processor only (no main memory and no I/O devices). ( 27 )
Microcontroller : A complete computer including a processor, memory and some input/output devices. These devices are usually
specified in a fairly general manner to permit reuse of the same microcontroller component in many applications. ( 28 )
System-On-a-Chip(SOC): A complete fully-functional system is implemented on a single integrated circuit. This may include processing, memory, input and output interfaces as well as any other digital logic. ( 29 )
Programmable Logic Device: A digital logic IC that permits configuration and interconnection of internal logic blocks. Often this
term refers to a computer chip that can be rewired to implement a custom digital circuit using primitive building blocks. ( 30 )
System-On-a-Programmable-Chip (SOPC): An SOC implemented using a high-density, reconfigurable PLD it is considered to be a
system on a programmable chip. ( 31 )
III:Interfacing Software, Introduction to Synchronization, and Device Drivers
CPU Latency and Device Latency : is the time between a service request and when the service is initiated. Latency can involve both
hardware and software delays. ( 36 )
XVII - 0.10
Glossary
779
Real-Time System: is one that guarantees a worst-case latency for critical events. ( 36 )
Latency : The delay between the arrival of the request and the completion of service. One could also consider the average latency or
the maximum latency by considering more results. (Note: on the surface this appears to be slightly different than the definition of
CPU Latency defined earlier. However, this difference can be resolved by noting that the system is viewed as completing the request
once the ISR has started.) ( 37 )
Throughput: is a measure of how many items can be processed per unit of time. For example, a system could have a very high
latency (5 years for UW Engineering) but still have a throughput of 900 graduates per year. ( 37 )
Blind Cycle: software waits a fixed amount of time and then acts on the data whether or not the device is ready ( 38 )
Periodic Polling : device status is checked after a pre-determined amount of time and this repeats until the device is done. This is
usually implemented with a timer interrupt. ( 38 )
Occasional Polling : device status is checked at the convenience of the designer. ( 38 )
Polling Loop (Gadfly or Busy Waiting): software continuously checks the I/O status, waiting for the device to be done. Although
this is often implemented as a very tight loop (one status register test and then loop if not yet ready), it could be implemented as a
series of tests (say test 5 I/O status registers and service any that are requesting service). ( 38 )
IV:Synchronization, Data Generation and Data Transfer
Producer : Either a software or a hardware component responsible for producing data (or events) for the consumer. ( 54 )
Consumer : Either a software or a hardware component responsible for consuming data (or using events) that have been produced
by the producer. ( 54 )
Data: The value (or values) that are transferred from the producer to the consumer. ( 54 )
Event: represents the occurrence of some activity that is communicated to the consumer. ( 54 )
Data Generation: How is the data creation controlled (if it is controlled). How is it started? stopped? Is this done by the Producer
or the Consumer? ( 56 )
XVII - 0.10
Glossary
780
Data Notification/Initiation of transfer : Once the producer has the data, how does the producer notify the consumer that it is ready
for the data to be consumed? Or, alternatively how does the consumer request the data? ( 56 )
Data Transfer : Once the producer has the data and the Consumer is ready for the Data, how it the timing (synchronization) of the
transfer handled? ( 56 )
Synchronization: For our purposes this refers to the interaction required to make two entities (with different views of time) interact.
For example, when do the two applications interact? ( 58 )
Active Synchronization: One of the entities is capable of forcing a change in the operational characteristics of the other. For
example, setting an interrupt signal can force the processor to execute the interrupt service routine. ( 58 )
Passive Synchronization: One of the communicating entities signals a request for service, however the entity receiving the request is
not forced to respond. ( 58 )
Spontaneous Sources: Data is produced in the device independent of the actions of the consumer accepting the data. ( 62 )
Consumer Sensitive Sources: Data is produced by the device only after the previous data has been consumed by the consumer. (more
implicit.) ( 62 )
Consumer Responsive Sources: Data is produced by the device only after requested by the consumer. (more explicit.) ( 62 )
Data Transfer : Refers to all aspects of a transfer between two entities that have (potentially) different views of time. For example,
how do the two systems interact. ( 65 )
Data Persistence: How long data is valid for transfer between the communicating entities. ( 65 )
Time Synchronization and Clocking : How signals, representing any data, are specified and enabled to make the transfer happen. (
65 )
Control Signalling : How any control information is exchanged between the communicating entities. ( 65 )
Persistent: Information remains valid until consumer signals that the data has been collected (processed). ( 66 )
XVII - 0.10
Glossary
781
Transient: Information is made available to the consumer and remains valid for a period of time and then may change. In most cases
the minimum period of time is known by the designer. ( 66 )
Global Initialization: setting processor and I/O interface parameters necessary for the overall operation on the system. (Eg., set
interrupt tables, specify unchanging bidirectional ports to input/output) Executed once. ( 70 )
Transfer Initialization: setting processor and I/O interface to facilitate a specific process. (Eg., set the memory location to accept
(provide) the data for the transfer, set the block and track number for a disk transfer.) Executed once per transfer. Later in these
notes, in the specific case of multiple transfers this step is referred to as Block Initialization ( 70 )
ttransf er producer : is the time for the device and interface combination to transfer one data unit. This determines the maximum rate
at which data could be available to the processor. ( 74 )
ttransf er
consumer :
the time the processor needs to transfer one data unit. This may be longer or shorter than ttransf er
but ( 74 )
tsynch : is the execution time of the processor to synchronize with the availability of the data. (I.e., the time that the processor is not
available for other activity.) ( 74 )
tsynchpoll : Polling synchronization uses processor time until just after the data is ready. ( 74 )
tsynchintr : Interrupt synchronization only starts to use CPU time after the data has become available. ( 74 )
tinterdata : is the time between consecutive data blocks. Although this time could vary between blocks, for these purposes it has been
assumed to be a constant. ( 74 )
V:Computer Structure
Address propagation delay (tP A ): The time for the address to propagate from the bus master to all of the potential slaves. ( 136 )
Data propagation delay (tP D ):
136 )
The time for the data to propagate from the data source to all of the potential data receivers. (
Bus Propagation delay : The maximum of the separate (Data and Address) propagation delays. ( 136 )
Setup Time (tSetup ): The minimum time that a signal has to be available at the input to the buffer before the active clock signal
XVII - 0.10
Glossary
782
(edge) arrives. (At the slave for a write and at the master for a read.) ( 136 )
Hold Time (tHold ): The minimum time that data has to be held stable after the clock edge that triggers the transfer. (At the slave
during a write and at the master during a read.) ( 136 )
Select Time (tS or tSelect ): The time required for a device (or interface) attached to a shared communication media (a bus) to detect
that the current transfer involves the device (or interface). This time does not include any of the time required by the device (or
interface) to perform any internal address decoding. ( 137 )
Access Time (tAccess ): The time required for the interface to access the information for the bus after the device or interface has
been selected and the address is correct. The exact order that the select is correct and the address is correct may vary depending on
implementation details. The access time is the time following the last of these two events. ( 138 )
Store Time (tStore ): The time required for the interface to enable the correct location and to write the appropriate value into that
location after the device (or interface) has been selected and the address is correct. ( 138 )
Skew Time (tSkew ) (partial): For our purposes here the skew time is the difference (largest or worst case) in signal propagation
times. Although various sets of signals could have different values of skew time (E.g., the address lines or the data lines), one value,
the largest, is used in this presentation. A more general definition would be the magnitude of the difference between two events that
ideally would occur simultaneously. (This definition was taken from the JEDEC dictionary.) Of course this definition does allow for
skew on a single signal (discuss this with your instructor.) ( 138 )
Margin Time: In the figures in this section tM 1 (or tmargin1 ) and tM 2 (or tmargin2 ) are the times where there may be some design
flexibility. More generally, the margin time is the overdesign that a designer includes for safety to assure successful operation. ( 138
)
VI:Parallel Interfacing
Totem-Pole Driver : Both switches are active. A logic-1 is applied to the shared signal line by closing the pull-up switch and opening
the pull-up switch. In this driver one of the two switches is always closed and as a result it is not useful on a shared signal line. (
161 )
Passive Pull-up Driver : (often implemented and called open collector) Replaces the pull-up switch with a resistor (a passive component
XVII - 0.10
Glossary
783
with no control input). In this way the line can be pulled low (for a logic-0) but a logic-1 results if no driver pulls it low. ( 161 )
Passive Pull-down Driver : The passive pull-down driver (open emitter) is the dual to the passive pull-down where the Pull-down
switch is replaced with a resistor. ( 161 )
Tri-state Driver : Both switches are active, however the logic driving the control inputs has been modified to permit both switches to
be off at the same time. When both are off the output floats and this driver is in the hi-impedance state (sometimes called Hi-Z).
( 161 )
In-Band: Some (or all) of the control information is passed in the same way that the data is transferred. For example, a control-C
in a text string looks like data, but in some cases may be interpreted as a control character with a special operation characteristic. (
172 )
Out-of-Band: The control signalling is done using techniques that cannot be confused with data. For example, there may be signals
at a frequency not found in the data, or there may be values on the data lines that cannot ever be data, or there may be extra signal
lines to indicate some control information. ( 172 )
VII:Error Detection and Correction
Hard Errors: permanent error (Eg. a memory bit stuck at some value) ( 199 )
Soft Errors: transient errors (Eg. the 4th bit of a transmission failed ... the error may not repeat) ( 199 )
Error Detection(ED): Given information to be transferred, sufficient (redundant) information is added (at the data source) to make
it possible to determine (at the data destination) that the received data is not the same as the original information. ( 200 )
Error Correction(EC): Given information to be transferred, sufficient (redundant) information is added (at the data source) to make
it possible to recover (at the data destination) the original information. ( 200 )
Error Rate: The rate of errors on the channel. This may be specified as a probability. For example, 106 indicates that, on average,
one bit in a million is in error. The errors may (or may not) be correlated. (I.e., the occurrence of an error may increase the likelihood
that the next bit will be in error.) ( 201 )
Overhead: For our purposes we define overhead as the number of non-data bits divided by the total number of bits transferred. (
XVII - 0.10
Glossary
784
201 )
Data Word: The information bits that are to be transferred over a channel. In this case the data word has B bits of data. The data
word is the smallest unit for error correction or detection. ( 202 )
Code Word: The combination of the B bits of data and the C bits of error handling bits. ( 202 )
Distance: The minimum number of bits that must change to go from one code word to another code word ( 206 )
Syndrome: Combine the values of C Calc and C Rec to indicate the presence of and the location of an error in a received code word (
221 )
VIII:Serial Interfacing
Simplex: unidirectional as shown below ( 234 )
Half Duplex: bidirectional, one-way at a time, as shown below ( 234 )
Full Duplex: simultaneous bidirectional, as shown below ( 234 )
Bit Synchronization: How long is each bit? and Where do bits start (or stop)? ( 235 )
Bit Rate Synchronization: The time that elapses between the start of one bit and the start of the next bit. ( 235 )
Phase Synchronization: Given that the rate is known, how is the mid-point (or start) of each (or any) bit found. This amounts to
determining the phase relationship between the local clock and the clock used to transmit the data originally. ( 235 )
Byte Synchronization: Where do bytes start and stop? ( 235 )
Block Synchronization: Where do blocks start and stop? ( 235 )
Bit Rate: The number of bits that can be transferred per second over a channel. ( 240 )
Baud Rate: The maximum number of symbols that can be transferred per second over a channel. ( 240 )
XVII - 0.10
Glossary
785
Communication Protocol: A set of rules for making connections and transferring information. ( 252 )
Overhead: (to be consistent with the previous definition) is
( 264 )
Framing Error : An incorrect frame has been detected. In the case of one-byte asynchronous transfers, the indication of a framing
problem is that the stop bit is incorrect (possible baud rate error) ( 265 )
Overrun Error : In a serial communication system, the data at the transmitter and receiver is transferred at a time convenient to the
controlling processor. As a result it may be that the serial data will arrive too quickly for the receiver to process the data. It is also
possible that the transmitter will be sending data faster than the serial channel can transfer the data. In either case, some data may
be overrun by the data following it in the channel. This is an overrun error. ( 265 )
Receive Overrun Error : At the receiver, incoming data has overwritten data in SRin or RCV register. ( 265 )
Transmit Overrun Error : Resulting from the CPU or the device writing to the transmit buffer before the current content of the
transmit buffer has been transmitted. ( 265 )
Parity Error : The parity of the received data and the value of the parity bit do not match ( 265 )
Start Bit Error : when the line is sampled one half of a bit time after the edge of the start bit is detected, the value is not zero. This
probably indicates that a false start bit has been detected, alternatively there may be some error in the assumed bit rate. ( 265 )
BISYNC Protocol: Modify the sequence of characters using hardware or software to provide block synchronization. (Byte synchronization is used to derive block synchronization.) ( 276 )
HDLC Protocol: Modify the sequence of bits so that synchronization can be maintained. (Bit synchronization is used to derived
block synchronization.) ( 276 )
USB Token Packet: Selects the slave for the communication. The slave includes: T arget device (7-bits), endpoint number (the I/O
register in the device (4-bits)), and the direction of transfer (in or out). ( 303 )
USB Data Packet: Payload information for the transfer up to 1023 bytes in isochronous case, and 64 bytes for other (full-speed)
XVII - 0.10
Glossary
786
transfers. ( 303 )
USB Handshake Packet: When required, this is used to confirm to the data source that the data has been received (and accepted)
by the data destination. This is not required for isochronous transfers. ( 303 )
USB PID: There are 16 PID values. Each value is specified as 4-bits followed by the same four bits, complemented. For example:
ID 0101 (Start of Frame) is a PID of A5. ( 304 )
USB SOF Token Packet: In USB, a frame is used to provide some synchronization and to facilitate data transfer. In most cases,
the SOF packet will be sent once per millisecond to indicate a new cycle has started. The SOF token packet provides a number to
indicate that this is the start of the nth frame. Please note, the concept of frame used in USB (a sequence of activities that repeat
every 1 ms) is quite different from the concept used in the serial communication section of the notes. ( 305 )
USB IN Token Packet: The IN packet can be used for Interrupt, Bulk, Control and Isosynchronous transfers (more later). The IN
packet provides the address of the device and the I/O register (endpoint) to provide the data for the IN transfer. ( 305 )
USB OUT Token Packet: The same as IN except the communication channel being established is in the opposite direction. ( 305 )
USB SETUP Token Packet: Used to setup the remote device or hub. ( 305 )
USB ACK Packet: Error free receipt of data packet. ( 306 )
USB NACK Packet: Unable to accept or return data. Also used during polling to indicate that no new data is available. ( 306 )
USB STALL Packet: T arget unable to complete transfer and software intervention is required. ( 306 )
USB Interrupt Transfer : Traditional small volume transfers. There is no interrupt facility on the USB, so each device must be polled
at a regular interval to see if a new value has been entered for action. During the interval between polling, a device could lose data,
but every piece of data must be delivered, therefore there is a time critical component. ( 307 )
USB Bulk Transfer : Used by block transfer devices. Once the transfer has been started, there is no particular time constraint. Every
piece of data must be delivered. ( 307 )
USB Isochronous Transfer : Typically real-time data. The data must be read/written with a given rate. If one item is missed it can
XVII - 0.10
Glossary
787
be ignored and processing continues. Every piece of data need not be delivered. ( 307 )
USB Control Transfer : Used to setup devices. ( 307 )
IX:Analog Interfaces
Comparator : An op-amp connected without feedback can be configured to be a comparator. In this case the output values are close
to either VS or V+S ( 327 )
Inverting Amplifier : An op-amp configured with a resistor feedback element such that an increase in the input voltage results in a
decrease in the output voltage ( 330 )
Non-Inverting Amplifier : An op-amp configured with a resistor feedback element such that an increase in the input voltage results
in an increase in the output voltage ( 336 )
Non-Inverting Buffer : A special case non-inverting amplifier Rf = 0; Rin = ( 337 )
settling time: the time for the output to settle within a specified range of the final value for a given input. ( 338 )
slew rate: the rate at which signals change from one value to another. ( 338 )
Quantization: When an analog signal is reduced from a continuous signal to a set of digital values, a range of analog signals must
be assigned a single digital value (quantity). The act of this transformation is quantization. ( 339 )
LSB: On the analog side, one LSB is the change in the analog signal that corresponds to a change of one digital LSB (one bit). A
more mathematical specification is that 1LSB =
F SAR
2n 1 ,
where F SAR is the full-scale analog range and n is the number of bits used
XVII - 0.10
Glossary
788
XVII - 0.10
Glossary
789
Missing Code: It may be that some digital values can never be generated due to some errors in the ADC. If this is the case, the
missing values are referred to as missing codes. ( 412 )
Converter Aperture Time: The (maximum) time that the converter output (result) is sensitive to changes in the analog signal. (
413 )
Nyquist Sampling Rate: If a time varying signal contains components of significant amplitude only below f Hz, then a sample
frequency of greater than ( 414 )
Sample and Hold Aperture Time: the time required for Q to turn off once the hold signal is asserted. (Tof f ). ( 426 )
(Sample and Hold) Aperture Uncertainty : the change in time between the command to turn Q off and the actual time Q turns off.
(Jitter in the figure) Changes in Tof f ( 427 )
Droop: A drop in the signal out of the sample and hold circuit. It is caused by discharge of C due to: ( 429 )
Acquisition Time: The time required before the capacitor voltage is within a specified percentage of the final value (as distinct from
the settling time which worries about the voltage into the A/D converter, as opposed to the voltage across the capacitor.) ( 430 )
X:Buses - Data Transfer
Synchronous Data Transfer : The transfer of data between communicating entities with a common view of time. In this case there
is a global clock and data is transferred at a specific point in the clock period. Also all transfers are of fixed duration (one clock
period. There is no feedback from the consumer to the producer of the data to alter the rate of transfer or to alter the duration that
the data is valid. ( 437 )
Asynchronous Data Transfer : The transfer of data between communicating entities with different views of time. In this case there
is no global clock, and there is a mechanism to permit variable transfer times. This mechanism may be either fully or partially
interlocked. ( 437 )
Semi-synchronous Data Transfer : The transfer of data between communicating entities which have a common view of time (a
global clock), however permit variable transfer times. The transfer times are an integral number of clock cycles in length where The
actual number of clock cycles is somewhat under the control of the slave. ( 437 )
XVII - 0.10
Glossary
790
Split-cycle Data Transfer : The transfer of data between communicating entities which only permits a transfer from the producer to
the consumer. As a result, read transfers are accomplished in two cycles each of fixed duration, one in each direction. Write transfers
are accomplished in a single transfer. ( 437 )
XI:Buses - Arbitration
Bus Arbitration: A process that seeks to select exactly 1 Master from one or more devices requesting to be the bus master. ( 479 )
Non-pre-emptive arbitration: Once a master has started using the bus it will continue to use the bus until completion. Specific bus
structures may place limits on the maximum number of cycles or the maximum time that a master may keep control of the bus. (
481 )
Central Arbiter (CA): The portion of the arbitration system responsible for detecting that there is a bus request and causing a grant
to be issued, if appropriate. ( 482 )
Distributed Arbiter (DA): The portion of the arbitration system that is repeated in each device interface that has a requirement to
become a bus master at some time. ( 482 )
Fundamental Mode Assumptions:
(1) inputs only change one at a time. That is, the probability of two signals changing simultaneously is 0 and
(2) the output (state) signals stabilize before the next input change is received. ( 507 )
XII:Direct Memory Access(DMA)
Cycle Stealing : Transfer only 1 byte (word) per bus mastership ( 561 )
Transparent: If the processor makes idle cycles known, then it is possible to structure the system so that DMA controllers only claim
the bus when the processor does not need it. ( 561 )
Burst: Multiple transfers are permitted per bus mastership. This would permit the transfer of (up to) the entire block in one bus
mastership. ( 561 )
Integrated DMA Controller : The DMA control functions (Byte Count Register, MAR, Control Register and Status register functions)
XVII - 0.10
Glossary
791
are part of the device interface that is using the DMA functionality. ( 572 )
Detached DMA Controller : The DMA control functions are implemented as an interface separate from both the processor and the
interface(s) that use the DMA functionality. ( 572 )
Dual Address Protocol: In this DMA protocol two address cycles are used per transfer, one to read the data from the source and
one to write the data to the destination. ( 572 )
Implicit Address Protocol: In this DMA protocol only one address cycle is used per transfer. The controller causes the source to
place the data on the bus and the destination to copy the data from the bus at the appropriate time. ( 572 )
Continuation Registers: are registers, within the DMAC that contain an image of the next values for MAR, BCR and Control
Registers. When the current transfer is complete, these values are copied in to the active channel. Often the continuation registers
are implemented using an unused channels control registers. ( 589 )
Data Chaining : In this model, two channels registers are used. One, the data channel, points to the data that is being read or written.
The second channel, the chaining channel, points to a list of future DMA transfers (setup in memory by the processor). When the
byte count register of the data channel reaches 0, the next values pointed to by the chaining channel registers are transferred from
memory to the data channel registers. ( 590 )
XIII:Grounding, Shielding and Transmission Line Issues
Signal Ground: A point in a circuit used to reference all signal values. This point is often considered the zero voltage point. ( 605 )
DC Ground: The reference point for all DC signals in a given circuit block. ( 605 )
AC Ground: The reference point for all AC signals in a given circuit block. ( 605 )
Digital Ground: The reference point for all digital signals in a given circuit block. ( 605 )
Analog Ground: The reference point for all analog signals in a given circuit block. ( 605 )
Shield Ground: It is often important to shield a circuit (or a cable). As described later, one requirement for this is a shield ground.
( 605 )
XVII - 0.10
Glossary
792
Building Ground: The point in a building where the power lines are attached to earth ground. ( 605 )
Earth Ground: The common point used to reference building grounds. ( 605 )
Ground Loop: The current flow in the ground circuit. (As distinct from the current flow in the neutral signal.) ( 610 )
Common Mode Rejection Ratio: The ability of the receiver to ignore the changes common to both input lines is indicated by the
receivers common mode rejection ratio. ( 622 )
Characteristic Impedance (Z0 ): The ratio of the propagated voltage to the propagated current at every point on the line. Z0 is the
characteristic impedance of the line. ( 639 )
Reflection Coefficient : The reflection coefficient specifies the ratio of the reflected voltage (current) to the incident voltage
(current). It is useful as an abstraction only in systems where the various loads and sources can be modelled as linear components.
In some literature the reflection coefficient is referred to as . ( 650 )
XIV:Examples (Signalling and Buses)
Reselection: After some or none of the data that has been requested by the Initiator has been transferred, the T arget releases the
bus to await data to become available. Once the data is available the T arget arbitrates for the bus and becomes a bus master (as
the T arget). The process is reselection. ( 729 )
XV:List of Contents
XVI:Summary of Contents
XVII - 0.10