Professional Documents
Culture Documents
^v
^N
H
r^
Zissos
Subsidiary
of
I fare our!:
Brace Jov
Francisco
Published
>iOCK
.
D.
ZISSOS
Canada
with contributions by
J.
C.
BATHORY,
1978
ACADEMIC PRESS
London
A
New York
San Francisco
London
LTD.
Road
NW1
ACADEMIC PRESS
INC.
Avenue
Hew Vork, New York 10003
[
ACCESSION
No.
Fifth
175406
/^LASS
A
OCTI980
.s
y/
1978 by
C jpyright
INC. (LONDON) LTD.
ACADEMIC PRESS
S
ISBN: 0-12-781750-6
Printed in Great Britain by
Willmer Brothers Limited, Birkenhead
Foreword
There
Board for Universities and Research Councils which authorises and monitors
all major items of computing equipment in Universities has a significant
therefore commissioned a
my
It
intention to
of the community.
The first and perhaps most important point is a consequence of the equal
importance of both hardware and software in the computing environment,
and this book properly emphasizes both. The dramatic fall in the costs of
power, main storage, and some secondary storage devices, has been paralleled
with escalating software and service costs. Even today the recurrent costs
arising from software provision and user services far outweigh any hardware
FOREWORD
vi
costs.
Indeed when
all
life
of a
medium
or large
affected?
It is
important to
new technology
will
permeate society
in
two ways the high volume/low cost and low volume/high cost categories.
The former type will be produced in millions and will be very cheap indeed.
They will often be single chips dedicated to one application and, as such, will
not even be recognizable as computers. Such chips will be found in everyday
equipment such as cars, washing machines and TV sets. They will have no
peripheral equipment (apart from signal converters) and will probably not
even be maintained in the conventional computer sense. High sales volumes
will be required to keep production costs down. Indeed expansion into new
areas will be essential to the success of the
new microprocessor
industry
earlier.
Higher
will
keep prices relatively high. The new technology will however enable special
purpose devices such as Distributed Array Processors, or Data Base Engines
to be constructed with superior performance compared with existing devices.
In the future a whole range of systems will be available from small personal
computers costing a few hundred pounds, to large systems with a power in
excess of 50 Mips for, say, 2 million. Thus from a hardware standpoint the
new technology will widen the range of facilities available at reduced costs.
alone.
The software
new technology
will also
in the single
fault free,
FOREWORD
vii
will
It will
simply have to
mean
will
demand
maintenance which will raise prices even further. Thus the end user will see
falling hardware prices but at best stable and probably rising software prices.
Whilst the overall effect might be one of falling costs the era of really cheap
computing predicted by so many, will simply not arrive.
new
Some
buy
cheap hardware and write their own software. At the present time such
an approach is particularly hazardous because of the rapid changes taking
users will be tempted to
really
The software
available
expensive because
it is
initial
system
is
6-bit
amount of
is
effort involved,
inevitable, but
FOREWORD
viii
It is
power and
filestore resides in
how much
new technology
will
user
when he
is
perplexed.
hope that in this foreword I have drawn your attention to some of the
wider issues which result from the applications of the technology which is
described and explained in Professor Zissos's excellent book. Let us now
concern ourselves with presenting a better computer image to the new users by
I
we
August 1978
place.
J-
L.
ALTY
Preface
but
however, have access to formal step-by-step procedures and this book has
been written in order that all those who wish to do so can design and
implement systems using microprocessors. It aims to save microprocessors
from the fate of computer technology in the 1950s and 1960s when great
emphasis was placed on software design and minimum attention was paid to
the formalization of hardware design. The result was a technology which,
while affecting the lives of millions, was accessible to very few. Computers
minutes.
It is
It will
be published by
Prentice-Hall in 1979.
The research upon which this book is based has been supported by a grant
from the National Research Council of Canada.
Calgary
August 1978
d.Z.
Contents
Foreword by
Preface
1.
J.
L. Alty
v
ix
LOGIC DESIGN
1.1
Introduction
1.2
1.5
Optimal Design
Boolean Algebra
Gates
Race-Hazards
1.6
Unused
1.7
State Reduction
1.3
1.4
2
2
11
13
States
14
14
Sequential Equations
Event-Driven Sequential Circuits
1.10 Clock-Driven Sequential Circuits
1.11 References
1.8
15
1.9
20
25
31
THE MICROPROCESSOR
2.3
The Microprocessor.
Wait States
M.P.U. Signals
2.4
2.5
2.7
Semiconductor Memories
I/O Ports
Address Decoders
2.8
Interfaces
2.9
Design Philosophy
2.1
2.2
2.6
References
38
42
44
47
50
52
32
50
53
53
54
CONTENTS
WAIT/GO SYSTEMS
3.1
Introduction
55
3.2
56
3.5
3.6
References
3.3
3.4
4.
Introduction
4.2
Test-and-Skip Systems
92
4.3
Clock Stretching
Problems and Solutions
93
94
INTERRUPT SYSTEMS
5.1
Introduction
109
5.2
Interrupt Systems
110
5.3
113
5.4
Intel
5.5
5.8
5.9
References
5.7
D.M.A.
120
124
125
127
127
148
SYSTEMS
149
6.1
Introduction
6.2
6.4
D.M.A. Systems
D.M.A. Interfaces
The Two-Wire Interface
6.5
Cycle-Steal Logic
158
6.6
6.3
7.
91
4.1
5.6
6.
73
90
TEST-AND-SKIP SYSTEMS
4.4
5.
57
62
D.D.T.
150
151
156
160
SYSTEMS
167
7.1
Introduction
7.2
7.4
D.D.T. Systems
D.D.T. Interfaces
Problems and Solutions
7.5
References
175
7.3
169
169
175
CONTENTS
APPENDIX
1.
A 1.1
A 1.2
A 1.3
APPENDIX
Action/Status Devices
Action/Status Devices
Front-End Logic
References
2.
The
Intel
181
184
8085
A2.1 General
A2.2
A2.3
A2.4
A2.5
181
185
Wait/Go Systems
187
Test-and-Skip Systems
196
Interrupt Systems
196-
Reference
200
INDEX
Index.
201
Logic Design
In this chapter the basic concepts necessary to help the reader acquire a
working knowledge of logic design are outlined. This knowledge is essential for
the design and implementation of the hardware component of systems.
The design steps outlined are based on the use of sequential equations
developed in 1969 by the author. All circuits implemented using these
1.1
Logic design
implement
is
33^% maximum
INTRODUCTION
realistically
logic
circuits
given
their
I/O
(input /output)
which the input signals are applied. Sequential circuits are sometimes said to
possess a sense of history. An everyday example of a combinational circuit is a
domestic lighting circuit controlled by an ordinary tumbler switch. If the
switch is down the light is on, and if the switch is up the light is off. A lighting
circuit controlled by a cord-pull, on the other hand, is sequential, for the effect
of pulling the cord depends on the current state of the circuit. If the light is on a
pull turns it off, and if the light is off a pull turns it on.
Sequential circuits in turn are classified as unclocked (asynchronous) or
clocked (synchronous).t Unclocked circuits are event-driven circuits, in
contrast to clocked circuits (also known as clock-driven circuits), whose
f A third category of sequential circuits, referred to as pulse-driven circuits is discussed in the 2nd
edition of 'Problems and Solutions in Logic Design', by D. Zissos, Oxford University Press, 1978.
Up
when
to 1969,
little
attention to engineering
constraints until, in
most
cases, the
1.2
OPTIMAL DESIGN
1.3
The necessary
BOOLEAN ALGEBRA
Boolean algebra.
In Boolean algebra, as
in conventional algebra,
is
a working knowledge of
values only,
or
1.
true
if
either
',
or 'u' or 'OR'. A
A or B or both
are true,
and
'
false otherwise.
'.
Thus,
1.
LOGIC DESIGN
+ =
0+1 =
1 + 1 =
1+0=
or x Often it
denoted by single letters (the same rule
as in ordinary algebra). Sometimes it is written as A or 'n' or 'AND'. 'A '
may be read 'A and B\ or "A times B\ "A -F is true if A and B are both true, and
false otherwise. Thus,
is
omitted when
its
is
written as
'
'
'
'.
'
',
0x0 =
0x1=0
1x1 =
1x0 =
The inversion (or complementing or negation) operator is written as a bar
its argument or as a
in front of it. Sometimes it is written as 'NOT'.
Thus the inverse of A is A, or A, or 'NOT' A.
over
Boolean Theorems[1, 2]
we need only
is
to design
three theorems.
Theorem
Redundancy theorem
A+AB = A
Proof
A+AB = A(1+B)
= A-\
=A
AB+AC = AB + AC + BC
AB + AC + BC =
=
=
=
Proof
AB + AC + (A + A)BC
AB + AC + ABC + ABC
AB([+C) + AC(1+B)
AB+AC
A and A
in the expression
is
optional so long as
its
parent products (AB and AC) remain in the expression. Should, however, one
of its parent products be eliminated (by applying theorem 1), then such a
product is no longer optional, and cannot be removed from the expression. We
shall
demonstrate
this
Example 1
In the Boolean expression
/= A+AB,
we
2,
AB
B, thus
f=A+AB + (B)
1, product AB is redundant, because it contains all the factors
simply B) of product B. Since AB, one of the parent products of B,
Now, by theorem
(in this case,
is
not
now
is
no longer
optional.
f=A+AB
result.
Example 2
AB
f= AB + AC + BCD + (BC)
Now, by theorem
1,
the product
BCD
is
redundant, since
it
contains
all
the
BC. Therefore,
f= AB + AC + (BC)
A
affect the
value
LOGIC DESIGN
1.
Now, because the parent products of BC, namely AB and AC, are still present in
the expression, the term
BC is
it
can be eliminated,
leaving
f=AB + AC
Diagrammatically, we show these steps as follows
f=AB + AC + BCD
result.
Example 3
Consider the Boolean expression/ = A +AB +BC. The optional product B,
first two products A and AB, replaces its parent product AB
this
process as follows
f=A+AB+BC
\J
the
In
result.
products, and/or
(ii)
(i)
to eliminate non-parent
De Morgan's theorem
the
complement of P
is
F = A-{B + C)
and the expression resulting from
its complement is Q, we have to
is
P by
prove that
Q=
P. This will be so
if
and only
p-Q =
and
P,
P+Q =
p-p
if
P+P=l
Suppose
(i)
Q =A =
is
simply a constant (0 or
P. Further,
if
P=A
1)
or a variable, say
P=
A.
Then
q=A=A=P
(ii)
Suppose
is
sum
of two terms A,
(which
may well
be expressions).
Then
P=
A+B
Q=AB
Therefore,
P+Q =
A+B+AB = A+B+AB+B
(Theorem
(Theorem
=A+B+B
2)
1)
=A+l
=1
Therefore
(iii)
Q=
P.
Suppose
is
(which
may
well be
expressions).
Then
P = AB
Q = A+B
Therefore,
PQ =AB(A+B)
= + =
and
P+Q
Therefore
Q=
=AB+A+B = AB+A+B+B =
P.
all
it
is
Example
P = A +BC.
Suggested procedure
Given
Minimize
P = A+BC
P = A+BC
1.
Bracket
all
LOGIC DESIGN
P = A + (BC)
P = A-(B+C)
P = A -(B+C).
products
Invert
Remove redundant
brackets
Example 2
Derive the complement
of/= A(BC+BC+BCD).
Suggested procedure
f=A(BC+BC + BCD)
f=A(BC + BC)
Given
Minimize
Bracket
all
products
/ = A + [(B +C)
Invert
Remove redundant
f=A + (B + C)
brackets
(B
Q]
(B+C).
(1) Alice
and only
(2)
Betty gossips
(3)
if
all
if
Alice
is
present,
conditions even
when
alone,
SOLUTION
G=
that there
is
no gossip. Let A
is
gossip in the
G = AB + C+AD
(the terms are respectively the given conditions (2), (3), (4); condition (1)
To
derive
is 0).
Given
Minimize
Bracket
all
products
Invert
Remove redundant
G
G
G
G
G
= AB+C+AD
= AB+C + AD
= (AS) +C + (AD)
= (A + B)C(A + D)
= AC+BCD.
Therefore there
Clarice
brackets
Betty,
all
Example
Derive the complement of
P = A +BC+AD
Suggested procedure
P=
P=
P=
Given
Reduce
Bracket
all
products
(A)
+ (BC)
P = (A)-(B + C)
P = A'(B + C) the
Invert
Remove redundant
A+BC + AD
A+BC
brackets
required result.
Boolean Reduction
Boolean function
is
not
affect the
is
if it
contains no
in
A+AB
is
A+AB = A+B.
since
follows
Step
Multiply out
into
its
two-level sum-of-products
form by multiplying out. Products that contain both a variable and its
complement as factors are eliminated, using the identity A -A = 0. The
repetition of a variable in a product is eliminated using the identity A-A = A.
The products are finally re-arranged in ascending order of size from left to
right.
Example
Consider the Boolean function/ =
BC + (AB +D)D+A.
obtain
Applying step
1,
we
1.
LOGIC DESIGN
be to
its right.
is
from the
left,
all
is
eliminated.
Example
In step
first
1,
we
derived / =
A +BC + ABD. We
We
in/= A +BC.
start step 2
by considering the
no products
to the right of
step.
2.
In practice,
we
find
that experience will enable us to take short cuts in the process described below.
is
a computer program.
in
left
to
we proceed as follows.
(1) The first variable in the first product is selected, and the remainder of the
right,
expression
is
selected variable.
2. If
we
insert the
Step 3
is
We
(2)
repeated until
repeat step
all first-level
3,
it is
3. If the
discarded.
We
Example 1
Reduce f=A+AB+ BDC + ABD.
SOLUTION
Step
No
Multiply-out
change
No
change
shall
10
f=A+AB+BCD+ABD
B
non-parent product
AB
BCD
and eliminates
A+B+ABD
BD replaces
= A+B+BD
parent product
= A +B+D
the required
ABD
BD
result.
Example 2
Reduce f=(A+ C)(A + B) + DE[B + C]
+ ABC
SOLUTION
Step
Multiply-out
BC eliminates non-parent
= AB+AC+BDE + CDE
product
BC
DE
= AB + AC+DE
the
result.
1.
LOGIC DESIGN
1
NAND
.4
11
GATES
Gates
Although logic
circuits
AND, OR,
NAND
used.
A NAND
example,
if
B and C
signals A,
+B+Csee
Figure
OR
NAND gate,
its
output
is
F or
ABC =
1.1(a).
3n>
A+B+C
(a)
AB+CD
*=Dst
A (B +
C)
+ DE
^S>-
izD
-A(B+ CD)+E(F+G)
F+G
(d)
Figure
NAND
1.1
The output of a
circuit can be expressed as a Boolean sum-ofproducts expression, one product for each gate driving the output gate. The
factors of each are the input signals to the corresponding gate. For example the
12
is
AB+CD.
04
That
this is so
02*03
= 02+03
Now,
#2
= A+B,
and
=C+D
=A+B+C+D
Therefore,
= AB+CD
The inexperienced reader
is
The same
functions with
1.
3.
4.
1.1(d).
implement Boolean
+A(B+D), we proceed
2.
and
as follows.
BC+AlB + D]
e=
Figure
1.3.
1.
LOGIC DESIGN
13
Tristates
Tristates were developed in
University.
shown
in
Figure
1.3.
When
input,
behaves
like
an open
circuit.
1.5
RACE HAZARDS
[3]
Race hazards are unwanted transient signals (signal spikes) which, under
and with certain relationships of circuit
delays, appear in a logic circuit. Figure 1 .4 shows an example in which 'spikes'
occur during a change of input signal A from 1 to when B = C = 1. The cause
of race hazards is that immediately following a change in a signal A, A = A
= either or 1 It follows that if the Boolean expression of a signal in a circuit
reduces to either of the two forms A +A or A -A, a race hazard exists at the
is
hazard-free.
AB + AC
AB = A-l
AC
= A-\
Output of
gate 4
Figure
when B = C =
1,
1.4,
1.4.
4.
its
-A.
14
This
is
readily achieved
by means of theorem
2,
namely
AB + AC = AB + AC + BC
or
(A+B)(A+C) = (A+B)(A+C)(B + C)
The introduction of the third term prevents the first expression from being
reduced to A +A, since when B = C = 1, AB + AC+BC reduces to A +A + 1
= 1 Similarly when B = C = 0, the second expression reduces to (A + 0)
.
(A
+ 0)(0 + 0) = A-A-0 =
0.
property
is
1.6
the
2"~ J
If
number
1.9
UNUSED STATES
is JV,
where
<N < 2", there will be 2" N unused states. The reader is strongly advised
is
because in
The designer must therefore take such a possibility into account at the design
level and specify the desired action. This means that all state diagrams must
have 2" states before they are implemented.
1.7
STATE REDUCTION
The
states
destination, that
is,
represented by the
column heading.!
when
it is
in a state
by the
f In the case of clocked circuits, we omit the clock signals from our state tables since
been specified that circuit changes can only be initiated by clock pulses.
it
has already
1.
LOGIC DESIGN
15
assumed under certain conditions, he can leave the entry in the corresponding
square blank. As in the case of state diagrams, in each square we must specify
the circuit outputs, unless
is
same
the
as
convention to
it is
Two
2.
When
is
stable
if
in such cases
it is
the
its
is
made
in
accordance
rules.
rows may be merged if the state numbers and the circuit outputs
appearing in corresponding columns of each row are alike, or if the entry in
combine into
Note
f 5J
state only.
by S mn
C%j
now
When a row S m is merged with a row S n we shall denote the new row
examples see
[1].
1.8
SEQUENTIAL EQUATIONS
(1.1)
A=
(1.2)
is
meaning
as follows.
is
when
16
equal to
1).
1,
is
to
By analogy,
Turn-offset of a secondary signal
equal to
is
set of
1,
0).
We
refer to these
Equation
gates
NAND
gates, but
can be extended to
all
electromechanical relays, fluidic gates and so on. In Figures 1.5(a) and 1.5(b)
we show
A and
Note
that
sets of a
'push-to-break' switch
if
r its
NOR
s
NAND
and
sequential
turn-off
set.
secondary signal are present at the same time, in the case of the
NAND
NOR equation. This property may be used when designing fail-safe systems.
The turn-on and
the state diagram.
A = Be
turn-off set of
A = Be
turn-on set of
B = Ac
turn-off set of
B Ac
equations.
1.6(a)f
1.1
from
we obtain
we obtain
the circuit's
NAND
They are
A =Bc+A(B + c)
(1.3)
B = Ac+B(A + c)
(1.4)
Z=
S2 + S3
=AB + AB = A
and
signal substitution.
is
TFF
(T
flip-flop).
1.
LOGIC DESIGN
17
1'
-1L
Relay
(a)
Jf
Relay
(b)
Figure
50
Z=
Z=
AB =
00
Z=
51
01
''c
,,
10
53
1.5.
11
(a)
Z=
52
18
signal delays.
For
this
reason
we
shall
is
referred to [2].
Inverted Signal
That the outputs of gates 4 and 8 in Figure 1.6 are A and B can be proved as
is a secondary
follows. Let us denote by s the turn-on sets of M, where
of
Then
sets
M.
signal, and by r the D turn-off
M = s + M'r
Its
NAND implementation
is
shown
in Figure 1.7.
EG>
Figure
To
obtain
1.7.
Adding
equation,
-M and s-r
we obtain
M = sM + sr + (sM) +
hand
side of the
(sr)
= M(s + s) + r(s + s)
= M+r
=
Product
1.7.
Similarly, s
Signal Delays[5]
Signal delays in logic circuits can be derived by reference to the circuit
diagram or
below.
We
directly
use
from the
circuit's
to denote the
LOGIC DESIGN
1.
19
When
time for
to turn
on
3t
time for
to turn off
4t
time for
to turn
on
2t
time for
to turn off
3t
we obtain
(b),
gates 2 and
gates 4 and
gates 6 and 7
gates and
3
1,
1, 5,
9, 8
7.
For ease of
reference
we repeat
we proceed
as follows.
A =Bc+A\B + c\
B = Ac+B\_A + c~]
on when its turn-on set, Be, becomes 1 that is when B = 1 and
The time interval between the change in c and the change in A is
Signal A turns
c
changes to
3t
s.
and
This
is
finally
inverted, then
is first
ORed
causes
time for
to turn off
time for
to turn
time for
to turn off
it
ANDed with B
to change to
1.
Similarly,
2t AND, OR
on =
3t
AND
is,
pmax= t g(l+ x l
t
It
sm in
= ^ g (l-x)
Therefore in primitive
misoperation
circuits,
(l+x)<2t g (l-x)
1
and
+ x < 2 2x
x<
^3
is
avoided
if
20
That
is,
maximum
all
33^%.
maximum.
This figure
is
the theoretical
In practice
it
can be increased by
allowing for the probability of the slowest gate in a circuit racing in a critical
race the two fastest gates. The figure can be further increased if the filtering
effect of gates is
The reader's attention is drawn to the fact that algebraic manipulation of the
sequential equations must be avoided, unless account is taken of the fact that
each algebraic manipulation affects the relative delays of the primary and
signals. If circuit minimality is necessary or desirable the designer
should apply the steps of merging and signal substitution [2].
secondary
1.9
we
In this section
sequential circuits.
Design Factors
Our
design process
is
accomplished
in four steps,
design factors.
1.
and
reliably.
3.
Gate minimality. Generally speaking not all our circuits will be minimal.
Gate speed tolerance. Variations of + 33|% in the response times of gates are
4.
Circuit maintainability.
5.
Design
6.
Documentation.
7.
The design
2.
automatically met.
effort.
electronics
8.
This
Our
minimal.
No
steps.
is
is
necessary.
Design Steps
The sequence
in
is
given below.
1.
Step
LOGIC DESIGN
21
I/O characteristics
In this step we draw a block diagram to show the available input signals and
We
circuit
sets of
signals.
states.
This step
is
2, if
The
merge
means
such a reduction
is
rows.
number
reduce
of states to
five states
be used for
this
purpose.
Having coded the internal states we proceed to derive the Boolean equations
for the state variables and the output signals. Although initially blank entries
can
exist in
the designer
a state table, clearly after the circuit equations have been derived
must fill in the blank squares. He does so according to the use he
entries
Design Problem
must
An
alarm circuit
SYSTEM DESIGN WITH MICROPROCESSORS
22
010
00
01
"?
110
/ /f
000 f-
t\
-H
>ioo
-*
10
001 A-^
h-
11
Oil
0100
0000
-A
/>101
111
noo
_^\
1000
f-
0010
A^-
-\
ono>
01114
ooii
-jfioio
fino
Ami
;\
x
fV-4x
\^Aion
0001
oioi 4
I
Figure
1001
Alioi
I
1.8.
a red light on. The operator turns off the bell by pressing an acknowledge
switch a. When the fault clears itself, the red light turns off, the green light turns
SOLUTION
Step
I/O characteristics
The I/O
signals are
specified interplay
the state
1.
LOGIC DESIGN
23
50
51
No-fault
Fault
state
-^-0
green
*=1
light
=
b =
detected
g =
r=
b=
An
d
alarm
circuit
-^:rlight
a,
Fault
ItJ
buzzer
Fault
cleared
acknowledged
g=l
=
=
2=
r=
b
53
(a)
=
52
(b)
Figure
1.9.
diagram in
Because the circuit outputs are
two lights and one buzzer, which would not respond to narrow signal spikes at
their input, the designer has the option of defining them either as s or I s during
Figure
1.9(b).
first
This
is
shown
is
in Figure 1.10(a).
Next we apply the state reduction steps outlined in section 1.8. Rows SO, SI
and S2, S3 merge into rows SOI and S23 respectively, reducing our four-row
table to the two-row table shown in Figure 1.10(b). The corresponding state
diagram is shown in Figure 1.1 1(a). Using the entries in our two-state table as
optional products,
we obtain
In state S01,
aj+qf+(af) =/,
that
is
af+(af) =/,
that
is r
af+(af) =f,
that
is
= af+ (af) = f,
that
is
= af+af+ (af) = f,
that
is r
= af+ (af) = J,
that
is
in
square
3.
in
square
3.
in
square
3.
In state S23,
1
square
8.
in square
8.
in
in square 8.
24
sflf
50
01
00
g,r,
0,0,0
1,0,0
52
0,0,0
53
52
51
= 1,0,0
50
51
10
11
0,0,0
0,1,1
0,0,0
0,1,0
0,1,0
50
52
53
0,0,0
0,0,0
1,0,1
(a)
\o/
00
01
501
g,/-,
= 1,0,0
10
11
523
0,1,1 0,0,0=0,1,1
1,0,0
8
(523)
523
0,1,0
1,0,1
501
(523)
(b)
Figure
1.10.
523
501
g=f
r=f
b=f
b=f
A=0
A =
(a)
1.
LOGIC DESIGN
25
By
we obtain
set of
A =
a-f
turn-off set of
A =
a-J
turn-on
Therefore
A = af+A(a+f)
g
r
The corresponding
1.10
= S0l'J+S23>J=Aj+Aj = f
= S01-f+S23-f=Af+Af = f
=:
S01-/+ S23-J =
NAND circuit
is
Af+ AJ
shown
in
Figure 1.11(b).
(b)
their operation is
These are bistable elements in which the change of the output signal A is
coincident with either the leading or the trailing edge of a pulse signal,
commonly referred to as the clock pulse. Throughout this book, unless we
specify otherwise, it will be assumed that a change in the output signal, A, takes
place on the trailing edge of the clock pulse.
flops.
(iv)
flip-flops
flip-flops
flip-flops,
namely
(DFFs)
(TFFs)
SR flip-flops (SRFFs), and
JK flip-flops (JKFFs).
26
DFF
TFF
SRFF
JKFF
Figure 1.12.
following exceptions.
The
by
flip-flop equations, in
The
flip-flop
are
(a)
(b)
which the
flip-flop
output remains
static at
1,
and
A total state is a state which is defined by a unique combination of input and secondary signals.
1.
(c )
LOGIC DESIGN
27
which the
flip-flop
output remains
static at 0.
SO-J
RA =
Sl-K
= A-K
SA
The corresponding
we obtain
circuit
is
shown
A-
in Figure 1.13(c).
For further
[2].
A>n
JL
J-
AND S
A=Q
A =
'JL
AND R
K-\
A
(b)
(a)
(c)
Figure 1.13
Design Problem
4-5-6 Detector
Design a circuit that will stop the paper-tape reader shown in Figure 1.14 (by
m off) and turn on a buzzer when the character sequence 4-5-6 is
turning signal
detected.
synchronizing pulse
character
is
output.
is
28
2
2
Tape
reader
Decoding
2
.
4-5-6
Sequence
logic
detector
-Ma
Buzzer
m
Figure 1.14.
SOLUTION
Step
As
I/O characteristics
stated.
diagram
looks for a
'4'
When
sees a
it
change
state,
'5' it
moves to
'5',
state S2. If a
'4' is
is
is
'6' it
is
moves
by
to
A '4' initiates
The corresponding
rows
is
state table
is
shown
in
Figure 1.15(b).
No
merging of
possible.
order to accommodate
we
shall
not
make
the reader
shown
in Figure 1.15(a). In
Algebra,
implementation.
By
SA
diagram
in
Figure 1.15(a),
we obtain
Sl-5
= A B -5,
therefore J.
= B -5
LOGIC DESIGN
1.
AB =
29
00
01
'4'
Look
detected
'4'
for a
Look
for a
'5'
51
so
m=
m=
*A
'4, 5, 6'
'4, 5'
detected
Stop tape
detected
Look
for a
'6'
52
S3
m=
*A
6=
(a)
10
input
w=l
=
52
50
/w=l
m=l
50
51
S3
51
m=l
6
m=l
6
50
52
AW=1
6 =
m=
6
50
51
52
/n=l
6 =
m=
6
6=
50
53
@ m=0
=
50
OT=1 w=l
6 =
6 =
53 OT=0 OT=0
6 = 1 6 = 1
w=0
6
m=l w=
50
50
50
OT=1
6 =
53
m= m=l
51
S2
4-5-6
4-5-6
6=
SI
11
input
SI
so
m=
6
m=0
6=1
(c)
(b)
Figure 1.15.
RA =
S2-4 + S2>4-6
S2-4 + S2-6
S2
=A
SB
-6,
-B
since
-6,
S2
-4 is
a subset of S2
-6
therefore
X^ = B -6
= 50 -4
=
/4
-B
-4,
therefore
JR
=A
-4
30
RB =
Sl -4-5
+ S2-4-6 + S2-6
SI
-4 -5
+ S2
-4,
since S2 -6
is
= fl-4-5-M-B-4,
m=
b
S3
a subset of S2
therefore
= S3=
to
in all
blank
circuit response
AB.
achieving this
is
by
left
is
strongly advised
be
K R = 4-5 +.4-4
=A+B
-4
unspecified.
direct reference
below.
product
-B,
that
is
jA
=b-5 =
K A = B -6 jB
=A
-4
K B = 4 -5 +,4-4 = 4 -5 + 4 = 4.
^-^>
HI>
Figure 1.16.
-6
1.
LOGIC DESIGN
fail
31
to turn the
motor
JKFFA locks into its set state (J A = K A = 0) and JKFFB locks into its reset
state, since J B = 0. Therefore,, we enter S3 in the blank squares, as shown in
Figure 1.15(a). The corresponding circuit
1.11
1.
Zissos, D. 'Problems
is
shown
in Figure 1.16.
REFERENCES
and Solutions
in
Press, 1976.
2.
Zissos, D. 'Logic
3.
Zissos,
4.
5.
6.
Caldwell,
Duncan,
S.
F.
2,
February 1972.
The Microprocessor
In this chapter
we
microprocessor systems.
We
which
is
2.1
Definition.
THE MICROPROCESSOR
microprocessor
is
circuit, f
(i)
to execute programs^,
(ii)
in
The program
stores,
such as
Before
is
typically,
semiconductor
These are discussed later.
microprocessors, it should be pointed out
though not
necessarily, stored in
we have a
closer look at
m.p.u. chip will contain registers, arithmetic logic units, decoders, condition
difference is that the rapid development in recent
technology has allowed more and more circuits to be
accommodated in less and less space. This has created a major problem in l.s.i.
flags,
years of
MOS
with the
t Clocked sequential circuits are multistate logic circuits whose operation is synchronized
application of clock pulses, between which no circuit transitions take place.
% A program is a sequence of valid instructions used by the microprocessor to execute a given task.
2.
THE MICROPROCESSOR
33
34
shall
omit
The four
1.
2.
registers
shown
in this
(p. 36).
diagram are
3.
An
4.
The
addressing register
instruction register
IR
PC This is a register which contains the address of the next instruction to be executed.
AC From our point of view this is the register concerned with data transfers in and out
r
IR
of the microprocessor.
This is an addressing register, that is a register whose contents can be used as an
address in a fetch or a store operation.
This is the register which receives each instruction in turn, and holds it during
execution.
minimum number
of registers
registers,
1)
Instruction-fetch
(Machine cycle
2)
Address-fetch
Figure
machine
may
2.2.
(Machine cycle
cycles,
be executed
M3
Ml
Ml
(Machine cycle
in three
cycle 2
3)
Instruction-execute
THE MICROPROCESSOR
2.
the byte
twice
if
cycle
Ml
shown
states, as
If
is,
say, 8 bits
we assume
35
states,
in Figure 2.4.
that the
it
helpful to
Machine cycle
During
this
make
is
2.4).
machine
is
transferred from
memory (ROM
or
RAM)
we denote by A m
cycle will be
Am
state Ml-
in
T\
memory
the location in
as stated
in
state the
no information and
d, carries
is
therefore tristated.
On the next clock pulse our microprocessor moves to state Ml -T2. Nothing
changes
the a bus
the
is
tristated.
see in the next section, is to provide the user with the opportunity of delaying
entry of the microprocessor into state Ml -T3 in Figure 2.4, before the memory,
or whatever
down
of the microprocessor.
When
M1-T3
is
connected to
the instruction register (IR) through a set of tristates within the m.p.u. chip.
is
now
shown
in Figure 2. 3. This
means
that
The next clock pulse moves the microprocessor to state Ml* TA in Figure 2.4.
In this state the contents of the instruction register (that
is
the instruction)
is
36
A/2.
73
Address
decoder
\>
- d
+
/
rr,
+
I/O device
I/O
#6
in
#6
A6
Interface
Figure
is
2.3.
shown
Ml
is
in Figure 2.4.
Machine cycle 2
This cycle is also referred to as address fetch cycle, because this is the cycle
used to transfer the address of the I/O device from memory into the m.p.u. The
mechanics of transfer are identical to those used to move the instructions from
memory
Throughout
is
When our microprocessor enters state Ml- T3, the data bus is connected to
THE MICROPROCESSOR
2.
Ml
71
71
PC
a to
PC
,JL
PC
</
,
ato
d tristated
tristated
i
Jl
.JL
PC
73
Jl
T2
PC
Jl
-JL
PC
d tristated
|Jl
a to
a to
d tristated
d tristated
73
71
a to
d tristated
T2
Mr3
Ml
a to
37
Jl
73
a to
a to
ato
d to IR
rfto r
d to
AC
[Peripheral linked
[Address loaded]
[Instruction loaded]
to,4C]
Jl
a to
PC:=PC +
PC
d to IR
[Instruction decoded]
PC:=PC +
Figure
(r)
through a
2.4.
set of tristates
program to the data bus, thus establishing a direct link between the
memory and the addressing register (r), as shown in Figure 2.3. This means
that the I/O address is now available at the input of the addressing register. A
pulse is next generated within the m.p.u. which loads the I/O address into the
addressing register, the program counter (PC) is incremented and machine
cycle M3 is entered on the seventh clock pulse, as shown in Figure 2.4.
the
Machine cycle 3
This cycle
is
specified
is
38
In states M3- 71
andM3*T2,
made
is
tristated.
and
in state
M3-T2
is
is
provided with the opportunity to delay the entry of the microprocessor into
state
M3- T3
since, as we
the peripheral
is
ready.
The mechanics
for
explained in the next section. For the sake of simplicity at this stage
we
shall
we connect
Figure
2.3.
WAIT STATES
2.2
Memory
Synchronization
is
usually the
memory
access time.
synchronization,
frequency.
if
step-by-step explanation
is
therefore
It is
mechanics of
maximum
memory
allowable clock
given below.
memory
to
respond before
it
later,
memory
in state
Ml* 71. In
state
2.4,
memory
our
chip
is
is
two clock
had time to respond. Therefore, in our case the maximum clock frequency ,/max
must be so chosen that two clock periods are always greater or equal to the
access time of the memory chips, denoted by variable t.
2.
THE MICROPROCESSOR
39
we obtain
r~
J
max
l
^\
f ma *<-
or
Note
memory
that
synchronization
is
designer usually faces, because in practice the m.p.u., the clock and the
memory chips are selected from the same family of components, with the
maximum clock frequency specified by the manufacturer. If the designer
wishes, for
some reason or
other, to
to the
I/O Synchronization
means that we must prevent it from entering state 3-T3 in Figure 2.4 until the
new character is ready to be read. We can achieve this by activating the reader
when the microprocessor enters state M3-T2, that is immediately after the
reader's address is output on the address bus, and then prevent it from moving
to its next state, M3-T3, until the new character is available. As we shall explain
in Chapter 3, the most straightforward method of achieving this would be to
turn off the microprocessor clock during the time that the peripheral in
question is responding. With the exception of a small number of
microprocessors, such as the Signetics 2650 and the RCA 1800 series, it is not
turn off the clock of present-day microprocessors without
destroying the electrical state of the m.p.u. To overcome this constraint,
microprocessors are provided with a synchronization feature which allows
possible to
them to enter a wait state in which the microprocessor idles without turning off
the clock.
When
state
from moving
Figure 2.5
to state
40
Machine cycle 3
Machine
A/3-71
cycle 3
A/3 -71
rto a
rto a
M3-T2
rto a
A/3 -72
rto a
A/3-7W
Wait state ^
Activate
peripheral
rto
as
A/3-73
to
Peripheral
Peripheral
AC
to^C
rto a
J]
rto a
(peripheral
A/3-7W
Wait state^
responded)
Activate
penpneral
^ rto a
A
(a)
and remains
changes back to
responded)
(b)
Figure
changes to
(peripheral
2.5.
transition of signal r to
M3-T3
operation, that
its
is
the tape
is
microprocessor to assume
it
its
normal
starts to execute
next cycle.
If
to
M3-T3,
as
shown
is
read, that
is
Wait stateN
(Wait stateA
(Wait
state\
,
,
'
Instruction
fetch
Address
I/O
fetch
execute
Figure
2.6.
_ /Wait state\
2.
As
when
before,
peripheral.
which
is
THE MICROPROCESSOR
41
indicated by
its
ready signal
changing from
to
we
activate the
We keep it in the wait state until the peripheral has fully responded
to resume
its
1.
On
2.4,
leaving the
which allows
normal operation.
Reference to our paper tape reader shows that two types of I/O synchronization are needed. One in which the peripheral is first activated and then
accessed by the microprocessor {advance and read in our example) and another
which the peripheral is first accessed and then activated (read and advance in
our example). We shall refer to these two types as
in
(i)
activate
(ii)
access
with provisions for entering a wait state during any machine cycle or at the end
of an I/O instruction. This allows for memory as well as for both types of I/O
synchronization.
Not
2.6.
'
A/1
Instruction Fetch
A/2
Address fetch
A/3
I/O Execute
71
WAIT =
"J1
n*J
J kREADY
j[READY\WAn
T2
J tREADY
WAIT =
Jl^^^ATT?)
73
WAIT =
JkREADY
Jltfk:ady
Next instruction
Figure
2.7.
<f>
42
example
(its
READY line)
it
'1'
Next
Interrupt
routine
(6800
halted^
Circuit transitions take place
Figure
2.3 M.P.U.
Like
all
SIGNALS
all
<f>
2.8.
instruction
command
it
and
it
responds, as in the
signals.
To
allow the
The designer must ensure that he has interpreted correctly the status
of a microprocessor, before using jt. Although this applies to
uses in a system,
is
because, as
it is
if
were used.
all
signals
equipment one
we have explained
and address
components of the
by
several
signals in
to
as
m.p.u.
microprocessor to microprocessor.
The m.p.u.
signals
vary
widely
from
MOTOROLA
y a (address bus)
-<
(23)
READY A
<
INT
(14)
OLD
(13)
RESET
(12)
INTEL
WAIT.
(24)
8080
HLDA
DBIN
(17)
WR
(18)
SYNC
(19)
and
puts
fin in the
Tw of each
T
T
T
Minimum
INTE
(16)
(21)
d (data bus)
is
'1'
AT
NOTE.
This signal goes high within a specified delay of the leading edge of 01. The
address and data buses are floated within a brief delay after the rising edge of the next
02 clock pulse.
STATUS
WORD CHART
Type of machine
cycle
N STATUS
WORD
Figure 2.9
44
BA
-MBA
>a
- d (data bus)
->-e
HALT
<
(2)
(address bus)
0'
puts
M6800
T gets
it
end of the
state.
__
IRQ
(4)
on
NMI
this input.
(6)
S^
<
(39)
is
and FFFD.
0.
DBE
(36)
RESET
(40)
<
BA
(7)
VMA
(5)
'0'
on
-AT
-AT
indicates
M6800
indicates to
address on a bus
(34)
UR/W
-*
d bus.
is
in wait state.
memory and
valid.
T for read.
BA
Figure 2.10.
2.4
From
2.
3.
4.
5.
6.
The
The
The
The
The
The
listed
below.
Internal
Mode
Wait/Go Mode
Mode
Mode
D.M.A. Mode
Test-and-Skip
Interrupt
D.D.T. Mode.
internal
mode,
all
the
2.
The
Internal
45
Mode
mode
In this
THE MICROPROCESSOR
RAMS. As no
and data
the instructions
we
not discuss
shall
mode
ROMS
this
and
mode
of
the interested
referred to[l].
is
As we
mode
1.
2.
3.
4.
5.
shall see in
is
responding
in a wait state
Chapter
3,
(see
Figure
(idle)
3.3).
The
the
main
features of this
are
The disadvantage
of this mode, in
that the microprocessor idles during the time that the peripheral being
accessed
is
responding. In
some
applications this
may
be either undesirable
and/or intolerable.
Functionally, this
exception.
The
Interrupt
Mode
two wires
46
external source.
resumed
As we
although
system throughput.
is fast
is
is
established
the system, as
between them. This mode is particularly suitable when we wish to transfer large
blocks of data between a peripheral and memory. Although initiated by the
programmer, the transfer of data takes place autonomously, that is without
programmer
intervention. Usually,
though not
necessarily, at the
end of the
Contrary to
common
belief,
is
straightforward, as
transfers of data
how
slow
between
it is.
is
is
analogous
mode would be
to obtain a hard
7.3).
to
move data
in
number
of
instructions to be executed,
it is
clearly wasteful
2.
In
required.
situations
THE MICROPROCESSOR
like
a direct link
this
47
be established between
peripherals.
The formalization
2.5
1.
SEMICONDUCTOR MEMORIES
in the
form of integrated
is
circuits in
described as
address
lines,
4096 x
describes a
memory
chip of 4096
bits,
How
with 12
memory module
more
chips
in a system.
and
PROMS and
RAMS. A
ROMS
This
is
it during manufacture.
cannot be erased and replaced by new
information. Therefore the information which is stored in ROMS is limited to
specialist uses, such as storing standard programs, code-conversion (look-up)
tables, etc. Unlike RAMS, ROMS retain their information when power is
Such information
switched
is
permanent and
it
off.
The main advantages of ROMS are large bit-capacity, low power, fast access
time and their non-volatile nature, while their disadvantages are their limited
t
byte
is
number
48
use and the fact that, because the information cannot be changed, a single error
can be costly.
ROM
is
shown
The
in Figure 2.11.
is
must be applied
release of the
tristate
output
tristates.
after the
signals. In practice
Address
decode
Address
'
signals
Tristate
ROM
buffers
Output
Enabling
Chipselect
signals
Timing
signal
Chip
select
signal
Figure 2.11.
EPROMS
This
is
memories.
the
When
abbreviated
it is
form
of
erasable-programmable-read-only-
ROM. The significant difference between a ROM and an EPROM is that the
can be removed from the system and 'reprogrammed'. This means that
it can be erased and replaced by new information. The
reprogramming process requires specially-designed apparatus, typically an
latter
the information in
himself.
PROMS
Programmable read only memories. When
installed in a system,
PROMS
2.
like
THE MICROPROCESSOR
49
EPROMS,
current
circuit.
They
EPROMS,
and
industrial applications.
RAMS
Random-access-memories. Information can be both written and read from it
under program control. The block diagram of a
is shown in Figure 2.12.
RAM
As
in the case of
ROMS
and chip
memory module
Two
RAM,
it
which it belongs).
control signals are normally required by a RAM
to
(i)
(ii)
as in the case of
ROMS,
transfer.
The information
is
turned
off.
stored in
Some RAMS,
is, it is
lost
its
information.
RAMS can be either static or dynamic. In a static RAM, as long as the power
is
written into
it
will
be
lost
Address
Address
signals
is
RAM,
decode
RAM
Chip
Memory
select
control
Tristate
buffers
Chipselect
j
signals
Timing
signal
R/W
Figure 2.12.
Input/
output
Enabling signal
it is
50
refreshed. This
is
is
'0'.
RAMS have lower capacity and are slower than dynamic RAMS, but.
found to be not as
RAMS.
reliable as static
STACKS
which
is
is
after
be accessed
an up/down counter,
memory
locations
is
dedicated to
stacking operations. If not done automatically, the user must initialize the
stack pointer to the
first
stack location.
2.6 I/O
A block
output ports
is
shown
tristate
PORTS
arrangements implementing input and
When
enabling signal e x
the
terminals of the input port are connected to the address bus, allowing a source
to write data onto
it.
Similarly when e 2
(When an
open circuited). Clearly while digital
information travels from one source to one or more acceptors, all other sources
that are tied to the bus must be disabled.
The tristate arrangement connecting to the bus a device that can act both as
a source and as an acceptor is shown in Figure 2.13 (b). When e x = 1 and e 2
= the device can read data from the data bus, when e t = and e 2 = 1 it can
it is disconnected from the bus.
write data on the bus, and when e x = e 2
The use of I/O ports in microprocessor systems is shown in Figure 2.1.
Note that our device has one set of lines only, which are used both for
reading and writing. These lines are called bidirectional lines.
connected to
it,
2.7
ADDRESS DECODERS
AND
we have used
local
2.
when
THE MICROPROCESSOR
51
For example a
address, consists of two inverters
and an
AND
6,
gate, as
assuming a four-bit
shown
Input port
data bus
(a)
Output port
data bus
(b)
Figure 2.13.
A commonly-used
one that decodes three address lines to eight
addresses see Figure 2.14 (b). A larger number of address lines can be
decoded by suitably interconnecting i.e. chips, using the methods described in
Chapter 1.
In practice
i.e.
i.e.
is
52
-l
-l
AND
i?
2
(a)
^0
A2
A3 A4 AS
A6
Al
Address decoder
"~
(2)
(2
(2^)
(b)
Figure 2.14.
2.8
The
function of an interface
is
is
INTERFACES
to
monitor the
to be transferred
and
state of
to issue the
command
signals for
Acceptor
Source
Command
signals
Status
signals
Command
signals
Interface
External control
Figure 2.15.
'
Status
signals
Formally an interface
2.
THE MICROPROCESSOR
is
53
DESIGN PHILOSOPHY
2.9
is
the specialist with the tools to improve his technique in dealing with more
sophisticated assemblies.
As
is
we considered
the following as
important.
1.
System
2.
Circuit maintainability.
reliability. All
to maintain.
3.
Design
4.
5.
Design
effort.
6.
steps.
knowledge
is
specialist
necessary.
Modifications.
easily modifiable to
meet new
2.10
is
DESIGN STEPS[1]
accomplished in
below
(see also
Figure
2.16).
Step
Aim
of the design
The system
specification
is
is
This stage
is
and the user. Failure at this stage is usually the cause of system misoperation
which then produces the need for subsequent design modifications.
Step 2 Device characteristics
In this step the designer studies the terminal characteristics of the devices to
be used.
avoided.
Any
54
chart.
The fourth
step
is
provisional,
and
next step.
its
It is
may
results
On
machine code
was designed
is
in step 4.
fact,
steps 4
and
5 should be regarded as
is
obtained.
Start
1
Consult user
,
Device characteristics
Figure 2.16.
2.11
1.
2.
3
4.
REFERENCES
Zissos, D.
Press, 1976.
5.
Duncan,
F.
Prentice-Hall, 1979.
Wait/Go Systems
In this chapter we explain the wait/go concept and use it to design
microprocessor systems. The design of wait/go systems requires no specialist
knowledge of electronics or of microprocessors and, therefore, can be
undertaken by the user with no expertise in these areas. The design philosophy
3.1
in sections 9
and 10 of Chapter
2.
INTRODUCTION
For example,
every
microseconds,
ten
if
microseconds to print a byte, clearly nine out often bytes will be lost, unless the
is slowed down. We must therefore ensure that in any design
the microprocessor does not attempt to drive a peripheral faster than it can go.
Synchronization between a microprocessor and a peripheral under these
microprocessor
peripherals, thus eliminating the need for synchronization signals. This allows
microprocessor systems to be implemented simply and reliably. Furthermore,
56
because the
'wait'
and
'go' are
we
concepts that
who may
all
The main
From
1.
2.
and so on.
3.
4. Its
5.
The software
is
'test-and-skip'
mode.
reduced.
From
1.
2.
3.
systems.
4.
5.
It
6.
3.2
When
is
we saw
on the wait
line
all
in
Chapter
changes from
to
see Figure
Wait line
-
fin
Go line
Figure
t Action/status devices are discussed in
2,
is
3.1.
Appendix
1.
3.1.
state, signal
3.
state
is
passed on to the go
WAIT/GO SYSTEMS
line, g.
In our case a
to
57
signal transition
on
line g
3.3
WAIT/GO SYSTEMS
The block diagram of a wait/go system is shown in Figure 3.2. Its operation is
as follows. When an I/O (input/output) instruction is detected the
microprocessor enters automatically a wait state and the peripheral is
activated. The microprocessor remains in the wait state until the peripheral
has
fully
Figure
it
assumes
its
normal
cycle, as illustrated in
3.3.
-^^d
Peripheral
fin
Command
Status
(
signals
m,p.u. signals
Interface
Figure
3.2.
irn goes
Peripheral waits
Peripheral
fully
responded
fin waits
Peripheral goes
Figure
3.3.
'
signals
58
It
has been shown that in the case of action/status devices (see Appendix 1 ),
We shall reproduce the
proof below.
w, g, a
and
have
that
the
Signal w:
'1'
on
wait
line)
state.
this
terminal
Signal g:
(the
to
on
indicates
Signal a:
to
on
into action.
Signal
r:
0.
^- d
'
Acceptor
f.m
-
-r
a-
'
Interface
-^
Figure
suitable internal-state
interface
is
shown in Figure
Figure
By
3.4.
3.5.
3.6(b).
we obtain
the following
equations
wr + wr + (wr) = w
g wr + wr + (wr) = r
fThe
Chapter
(1)
(2)
1.
WAIT/GO SYSTEMS
3.
59
responded
fin goes
Peripheral waits
Peripheral goes
fin waits
a =
a =
o =
*=1
Figure
00
So
3.5.
01
11
Si
a,g
g =
Peripheral
activated
fin in
wait state
10
0,1
0,1
0,1
1,1
s2
So
Si
1,0
Si
s2
1,0
1,0
(a)
00
01
1*012
0,0 =
0,0
^012
a,g=
10
5 012|
0,1
1,1
1*012
1,0
(b)
Figure
3.6.
- rf
Acceptor
fin
Figure
3.7.
is
the
and an action/status
60
cycle, as
shown
is
In the first case, illustrated in Figure 3.8 (a), an I/O input operation is
implemented by first activating the device and then reading. For example
'advance tape and read', whereas in the second case shown in Figure 3.8 (b) the
opposite is true; that is, the data is first read and the device then activated. For
I/O execute
Address fetch
Instruction fetch
(w =
tape'.
0=0)
0)
e =
w =
=
w =
=
w =
read
(b)
Read =
Figure
By
read
w=
(a),
is
read into
AC J
3.8.
we obtain
+ (wait), and
wait + (read).
Therefore,
e
See Figure
3.9(a).
= wait + read
=w
3(a)
3.
Similarly,
WAIT/GO SYSTEMS
by reference to Figure
3.8 (b),
61
we obtain
= read + (wait)
= read
w = wait
e
3(b)
This indicates that in addition to the two wires, when the microprocessor
enters a wait state at the end of an instruction, as
is
(1,
to
accommodate n
shown below.
devices
2 and 3) to those
am
= A m' W
=A
-r
+A
-r 1
...
+A H _
-rH _
we modify
the above
62
Their implementation
is
shown
we show a
slots.
Address
decoder
#0
#1
#n-
'n-\
H%
Demux
w
73
c
at
Wait/go
*l
Mux
logic
Demux
Address
bus
Figure 3.10.
3.4
WAIT/GO LOGIC
WAIT/GO SYSTEMS
3.
63
#-
#1
|
a..,--
--/,
Figure 3.11.
/in
m.p.u. signals
Wait/go
logic
Figure 3.12.
The main
difficulty likely to
shall
is
INTEL
3.13(a).
straightforward and
Example 1 Wait/go
is
We
logic
a suitable circuit
The normal
is
shown
is
is
active
2.9, is
The
shown
state
in Figure
diagram of
microprocessor
8080
from Figure
and
all
is
is
This state
is
mode
are
110110
64
From databus
- a
M\d1 d
(s
d5 d4 d 2 dl d
Wait/go
address
de coder
See
Part (b)
INTEL
,,
,,
,,
,,
|i
l'I/0'
8080
MI
WAIT
DBIN
AND
Wait/go
logic
-KZ
READY
A/1- I/O
(b)
(a)
Figure 3.13.
A/1
A/2
A/3
A/1
Instruction fetch
Address fetch
Instruction execute
Instruction
71
T2
T3
T4
T2
73
71
7w
72
73
71
72
'
//
//
INP
//
i
>
//
DBIN
1
Y,
WAIT
w( = e)
/f
tl
Data into A c
(read)
Figure 3.14.
WAIT/ GO SYSTEMS
3.
65
.JL
*0
Look for
I/O
instruction
instruction
detected
DBIN
Look
A/H/qJ~[_
*3
8080 enters
Peripheral
wait state
responding
READY
AB
WAIT-gj L
Peripheral
^in waits
activated
READY =
w=
e =
Vjl/>zw
INP-DBIN
DBIN
for
wait/go
address
READY =1
>v
52
*1
I/O
READY =
w = WAIT
= w
e =
w = WAIT
= w
e =
<j>
00
01
<f>
1C
11
Figure 3.15.
1 1 or 'OUT' 1 1010
1 1) on the data bus on its way to the m.p.u.. For this
purpose we use the AND gate in Figure 3.13(b),which generates a
output
when an I/O instruction is detected. We use the output of the AND gate to
move
to state
S^
microprocessor
State
is
S2
in state
is
T3
in
Figure
2.7.
later,
that
In this state (S 2 )
is when
we pull
the
the
READY line in Figure 3.13 low. This causes the microprocessor to enter wait
state M Tw three clock pulses later, making WAIT and w signals in Figure
-
3.13(a) equal to
1.
Now,
signal
w becoming
whose
signal
r,
moves
to state
clock pulse after the peripheral activity is completed, that is after the peripheral
has
fully
state
$A
Sl'A w
A-B-A W
R A = S 3 -g + (S
SB
A-B-g
B-g,
therefore
JA
B-A
+ {A-B)
therefore
K A = B-
= B-MH/O,
therefore
JB
= Ml -I/O
66
RB =
S 2 'WMT' + S -A w + {S 3 )
l
W AIT-
=A
c
tj
+ A-B -A w
+ S yDBIN + (S 2 + S 3
(S
= A-DBIN + A-<l)
READY =
therefore
+S
K B = AWAlT-g + A-A w
)'<l> 1
= A-B + A'B
=A
Because the INTEL 8080 enters
the instructions, as
we
Now,
for the
its
INTEL
3.4,
= wait + read
=w
8080,
wait
read
= INP-DBIN
(S 2
+ S 3 )-WAIT=
A- WAIT, and
we obtain
e
= A-WAIT+INP-DBIN
=w
READY
WAIT
DBIN
Figure 3.16
3.
WAIT/GO SYSTEMS
67
is
required to
INTEL
8080.
in the
reproduced in
This provides one with the opportunity of determining I/O cycles by looking
monitor the data bus during an address fetch cycle. | Therefore the second
choice was adopted, namely monitoring the address bus during the last cycle of
an instruction. The signals we used are shown in Figure 3.17 they appear on
page 4.14 of the M6800 Microprocessor Applications Manual, 1975.
Reference to this diagram indicates that the signals on the address bus during
the last cycle
pulse
4>\-
in practice
show two
circuit
Circuit
1.
The set of the m.p.u. signals we used to implement our first wait/go circuit is
shown in Figure 3.18. Their timing diagram is displayed in Figure 3.17. The
state diagram of a suitable circuit is shown in Figure 3.19. Its operation is as
follows.
Its
'normal' state
active
and
all
is
This state
is
wait/go address
is
mode
are inactive.
a
detected on the address bus during the last cycle of the
during
4> 2
is
When
<f>
Note that
In this state
we
M6800
to enter
When
it
its
Figure 2.10)
enters
its
halt state
WAIT/GO SYSTEMS
3.
69
*-
Wait/go
address
decoder
aw
M6800
VMA
5
BA
Wait/go
*'.
logic
HALT
Figure3.18.
signal,
becomes
signal, w, in
question.
shown
as
1,
in Figures 2.8
When
1,
which
and
its
ready signal
r,
and
and therefore
signal g in
changing to 1.
The steps we use to implement our state diagram have been explained in
section 9 of Chapter 1. Applying these steps and referring to our state diagram
Figure
3.7,
in Figure 3.19,
SA
we
obtain}:
= S r g-'BA'
= A'B-g- BA\
i
therefore J K
= A-B-g + A-B
= A-g + A-B,
SB
B-g
therefore
= SyVMAA w
= A'B-VMAA W
therefore
JB
'BA'
K A = g+B
= A'VMAA
Rb = S 2 'd
A-B-g,
therefore
KB = A
HALT =S + S 3
= AB + AB = B
w=
S_
BA + S 2
= A-B- BA + A-B
= B- BA +A-B
i
We
Aw
R/W lines
are tristated
when
the microprocessor
is
halted.
70
So
Look
Wait /go
for
wait/go
address
HALT=
detected
VMA-A W
jf
s3
Unused
peripheral
state
goes
HALT -
w =
s2
6800 waits;
*l
AB
==
00
HALT =
/4ir = o
w-
w = BA
0]
10
1]
Jl*
Figure 3.19.
MOTOROLA
read
6800,
= VMA-A;^ 2'R/W
The corresponding
System
circuit is
reset
B
BA
on page
= read
= VMA'A w
shown
NAND
'(j)
61,
we obtain
'RW
in Figure 3.20.
ro
ID>
VMA
R/W
Figure 3.20.
w =
+ HALT
3.
Circuit
WAIT/GO SYSTEMS
71
2.
for the
M6800
is
circuit
1.
directly
from the
A = B''BA'
'&4 +
A = B 'BA
2 J^.B +
$2
turn-on set of B = A'"VMA"'A ' 1
turn offset of B = A -yJ^A+g
turn-on set of
turn-off set of
'
-</>
'
V)
A =B- BA + A-(B+'BA + $ 2
i
B=
HALT = S +S 3
A'
VMA'-A w
'(t>
+B(A+g)
-g
= A-B + A-B-g
= A'B+B-g
w = S2 + S3
= A-B + A-B
=A
As
e
for circuit
= read
= VMA'A w
>(f) 2
-R/W
'BA'-fa
Look
for
Wait /go
wait/go
address
HALT =
detected
VMA.J W
1
w=
AB =
'BA'
<t>2
HALT =
R>
00
M6800
M6800 waits
enters wait
Peripheral
state
goes
HALT=0
w =
01
Figure 3.21.
HALT=g
11
10
72
clarity of
design
Reference to Figure 2.10 shows that a certain interplay exists between the
'bus available' signal
when TSC
1.
BA and
is
TSCBA
signal,
if
is
forced low
TSC
ANDing
the
pin 39
States
TSC
input with S 2
+ S3
That
= S 2 + S 3 -TSC
= (A-B + A-B)TSC
= A-TSC
S 2 and S 3 appear
is
applied
in
Figure 3.21.
:^>H3^
AND
R/W L
Figure 3.22.
is
We do so
WAIT/GO SYSTEMS
3.
3.5
73
solutions.
MOTOROLA
INTEL
microprocessor.
Problem
Given a paper tape reader and a microprocessor, design a system that stops
and raises a flag when the character sequence 4-5-6 is detected.
Use the wait/go mode to implement your design, which is to be verified using
the INTEL 8080 and the MOTOROLA 6800.
the tape
8080
SOLUTION
Step
Aim
of the design
The main aim is to scan incoming data for specified sequences, such
threshold values,
as labels,
etc.
logic,
device.f
is
an action/status
is
solution
shown
is
With the exception of the I/O port in Figure 3.26 no other hardware is needed.
This
is
INTEL
8080
w. This
was proved
in section 3.4.
The
octal
and hexadecimal
74
Character
1 bit
8 bit
(space)
040
240
Octal code:
Character
8 bit
Character
060
260
261
262
263
6
7
061
062
063
064
065
066
067
070
071
072
073
271
075
077
100
275
277
300
301
302
303
304
305
306
307
1
"
#
$
%
&
'
(quote)
(
)
+
,
(comma)
-
line feed
carriage
rt
042
043
044
045
046
047
050
051
052
053
054
055
056
057
012
015
242
243
244
245
246
247
250
251
252
253
254
255
256
257
212
215
2
3
4
5
=
?
@
A
B
C
101
102
103
104
105
106
107
D
E
F
377
177
null
Octal code.
7 bit
1 bit
8 bit
110
310
111
311
112
133
114
115
116
117
120
312
333
314
315
316
317
320
121
321
122
123
124
322
323
324
325
326
327
330
K
L
264
265
266
267
270
M
N
O
P
Q
R
272
273
T
U
125
126
127
130
131
132
W
X
331
332
Figure 3.23.
- a
- - d
c
:
-==- ==n
1
~m
Reader
~J
\in
"
w
-^
-i
Interface
Flaire 3.2^I
3.
WAIT/GO SYSTEMS
(_
Start
75
"
,
Input
1
No
A>
>
Figure 3.25.
Reader
INTEL
8080
""""'(HO
#010
#020
it
+5V
Figure 3.26.
vi
r-
o
C
r*>
II
\0
o
Tf
V"i
N^ni3>!
o
fS
IVNOUICMOD
II
VO
trn
r*i
ci
n
m
tj-
^o
rs
r*i
r**i
<*>
dwnr iVNomaiMCO
o
~
<s
CM
q's
CS
^>
<^
X
mvi = '-u
ir>
tj-
>r>
r-
r-
mw =
r*^
Tt
*/^
r--
:|i
I</o
T*
rr
\o
V=
r^)
:y
S ? 3 3 3 3
11VD IVNOlliaNOD
J
<
^
^O
>rv
Tf
e -rj
u a
00
P-
H H U
r>
^i
CM
t.
& u.
& ^
^ "a8
d HSlld
r-
t^
m
m
"'
r-
tj-
r*>
<N
VO
ri
r-
uj
wm
fi;
vO
TJ-
a:
tCM
LAVISH*
BJ
H
O
<N
fn
\o
m
>/->
r*\
II
<-
_
Tf
OS
Hm
O"a
SO
>
Ui
(50
0-
2J
.g
Q 5
Bt
a.
fe
dOd
D
8
O
o
3
c
vo
<N
H=d
d+
I+d =
*a
r-
IT?
-^
1H=1H
5 s
Q
3
o
rs
vo
3-
3
o
3
o
nc
<s
r-
w-i
CN
<N
<N
fN
r--
r-
r^
vo
<N
Cn|
<N
(N g. fS
fS
<N
t~-
r--
r-
t^
/->
<
:i
5 a
o
o
=
s
o
"
r-
1+j
fN
aivxcnj
\-i =
(N
oJ<5
t--
IIVIO^
(N
ro
I-d=d
:d
Qr-
TJ-
TJ-
tj-
85 = 2
ii
7+
.".
^3
Qo!
3<3
:j
sC
^o
i^i
f>
*0
r-
VD
hi
^o
-<t
*o
vo
^o
<N
2 +
>
<> a
V = dw
-:S
5
o "s
a;
-l
r|
>
II
<Jw
= :V
(N
cu
Z e
rs
<N
(N
fNt
fS
(N
(N
r-*
C4
?S
<N
fS
ts
C-4
g
i
>
a."?
'V) is:
* 8 8 a
la. a.
c w n
^
Q
+
Q
o
<
Q
-
>
+
\u
Q 5 a; -j -r m
>o
c
!5=22=S8
--.o
ov-iv-jv^u-iu-iT}-
mr-Tt
r--
o o o o o o to o O CO o
Oo^OOOrHCO- ooooooooo o o o o o o o o o to
o CO Co
Coo-h^- OOOOOO OO o o o o o o to
o o o o o to o to
<
<
Co
'
o -o
& S
QoQQooooo ooooooooo o X O O O O O O O o
Q QQo- oo o ~-o o oo o X o o o o o o
Q QQo- o oo oo ooooo X o
oo oo o
ooooo oo o o
'
'in-r^r~ 1't^^r-^t^Ttt^-
o 0O 0OO 0O-i-^-H-HrHrt-,-O'-i- o o o o o o o o to
l
oooo--
'
<
-1
<
o
T
*
_.
t>
J5
?!
H<
Z
PQ
Q Z.
om
1-1
I^J3|tt
i'llll
!o2o
5.5'g
2-S.is.S:
&SSS
e-og^
SPS'S
lis
~^
^a^illl
tj-i
-~
.t;
*-
*-
13
oy
e
o
c
.EoooSaJ=
2SS2 S s S'**~o.
feeSs
6 nco.aa.g>
"|a| ^Is^S S'SJl^OOOS
i'&c'oS Ho 2.s.2.25Wai;^o x SoOOOOX ^~ I.2 13
b- ~ " &g g g
.5 " a "5E.2p,eaoooo M Su u
_ _
>>>>?B.S
IX!J=JSJ52J33S
B^oci.ftCi.c
-wj(t't;^-2+
o o o o A
o*o58- xl 1 S82S9
t5tSoo8o*
;222 2ZOOOOs;cL a oOL fcfto,a.oSoioioSDi: ^t^oio<i^o<^a<etftott^^cocoMw5oocwwoJww
3 o n
;s .*
o wn3 ,c w
83
oi)
'
>
ti
<
's;
'
2^
Qj XX
2 Z Z a. a, a. a: lo n S g 5
:?i?22ZOOOOaa.aii,a,a.a.a.a.^tt:a:D!iii a:
r-t^-^-r-Tj-r-r-^fr^
''
3 c
oi ei tc e a a e at on 5> 55
ttr^^
r^
^-^
^- imvrnvivi'j'tc^-
.
.Sf
00000f
tototo. to _,_ o O o 00
.
to Co CO.o COO o
.
Co Co Co Co o C)
,
<
o o Ci- Q
ooo- o Qo o o
o Q Q
ocd o
o
oooo
C5
<*i
o o o S-c c o. a. o
c c c c a
<% <%
2,r ,"
tc
" & u.
", .
c
u u ^
"ob'Sb'Sb
05
O *!
rx
i-E=a**u >>32
a-a-o-u-a-o-o-o-o
r-yyS-as555>-
E
-
-- ^isflssss
o o o o
=
<uuuouuu CJUUOOUOQ<<<<QOQQQQQWX
g E g E==
T3T3T3T3T3T3CCCrteartOOOO
t:
'o
f-.
2^
<Uft,fc(jN wj0
<9QDQXXXX
-.Ssss^n
o <DQQao!oi!XXXX
S uaQli
a/ai^xvv
oi;xXs|.s|.5_
53 33 33 333000000 00
mim
oaC
XXQfflOffiS?
<<<3Z:Z:!j
78
Octal
Octal
Hex
address
listing
listing
LI:
003
000
333
DB
001
010
376
264
302
000
003
08
002
003
004
005
006
007
010
L2:
on
012
013
014
015
016
017
020
023
022
023
024
025
026
027
f See
ASCII Table on
6800
SOLUTION
Step
Step 2
Step 3
Mnemonics Comments
IN
FE
JNZ
08
If
IN
CPI
Compare AC with
If
LI
333
DB
IN
010
376
266
302
002
003
08
OUT
166
76
to L2.
6.f
JNZ
12
10
jump
5,
character.
Compare AC with
02
03
D3
Read next
CPI
B6
C2
character not a
j
}
FE
to LI.
5.f
JNZ
02
03
323
jump
4,
character.
B5
C2
020
Read next
FE
character not a
LI
03
010
376
265
302
002
003
4.f
00
DB
character.
Compare AC with
CPI
54
C2
333
Read next
If
}
j
character not a
Raise
HLT
6,
jump
to L2.
flag.
Halt.
p. 74.
Same
e,
we
require an
M6800 is shown
AND gate to
see circuit
and
in Figure 3.29.
circuit 2 of
example
2.
By direct reference to
hexadecimal
listing of
programming chart
is
in Figure 3.31,
shown on
p. 79.
we obtain
the
Address
decoder
VMA M200
AND
R/W
M6800
Reader
"'4000
#2000
#4000
Figure 3.29.
LI;
L2;
Hex
Hex
address
listing
00
00
B6
01
20
00
02
03
04
05
06
07
08
09
0A
OB
0C
0D
0
OF
10
01
81
34
26
F8
B6
01
81
,4,2000
Read next
NOP
CMP A
>
FA
B6
13
01
14
15
16
17
18
19
81
36
26
40
00
3F
Compare A with
4.
character not a
LDA
4,
jump
to LI.
jump
to L2.
jump
to 12.
,4,2000
Read next
NOP
CMP A
character.
>
Compare A with
j-
If
5.
BNELl
LDA
character not a
Read next
NOP
CMP A
f
BNELl
.4,4000
If
6.
character not a
SWI
character.
Compare A with
r
>
STA
5,
,4,2000
EC
Bl
character.
BNELl
35
26
20
00
\A
\B
LDA
Comments
20
00
12
11
Mnemonics
Stop.
6,
8-=:8
o
3
I-8 = :8
(0
1HOIH
1JIHS H1IHV
-8)XS3X
(d
= :3
1J3T 31VXOH
Q
D.D0
ft.
>
Q.
t/3 c/3
a.
ft.
II
"2
<
<
Q
S5 <<
<
a
Q-
55*
i'.T
++
N ^
ItJ
ft. ft.
!'.7
V = :V
(d-v)isai
3 + (J +
C
h
C
z
c
L
+ l>
IN
o<
a.
II
f
+
<mr\r
dwnr
nans
Hans
(d
II
v y)
**
.? 5?
M8
CDS
Hi
dv V = :y
d = :dS
d = :y
*ac
Qh
^J
^S
o
IC
IN
dAV =
II
'-V
>
on 3
o
|/3
Cttl
1S3I
dy= V
:
oo<
xz
cn uj
a.
->
- h^ s
R*z
OJJQ O
<
<< OuBS Hto OO
(d-XI)lS31
o
<
>
.'.7
u-
OS-UJ *0
V = :d
>lc
c
IN
a.
<> w O HC <
.J mJ
dS=d
II
ft.
<<
as
g3o
OHU
uz z
d soo
'ad
U
^ <o.p
d + y = :V
II
>
60
o
o
a=d
(d-a)isai
II
o <
W3 GO
II
os os
"J
T3 os uu os
uj
g
^oonzSs
+ d + g = :a
o Q
O +
v a) 1S31
>3<u
d+a=:a
8
O
Z
=d
XI
8 = :8
a,
OS
uj cu a:
dva = :a
d=:a
I+3 = :3
1JIHS DIOOl
o-d-a=:a
= a
d = :Xl
IHOia
Is
Q-
d.A8
SZ
IHOia 31VXOH
d-a=a
dA8=8
1J31 1JIHS
dAV = V
c
c
c
d-v = :y
l>
Xft.
So
-hQ
Q
Q
c
a
-hoo
& s
O a5 osfcQ
KXZ
Qo o
Do o
S5
xumulator and memory imstru CtKms tor th<I M otc>ro a A168 OU Mil:ro<:orjaptiter System (Reproduc ed
Microcomputer System Design Data 1976-7)
I
AOORESSING MODES
ACCUMULATOR AN ) MEMORY
EXTND
INDEX
DIRECT
IMMEO
OP
OP
9B
AB
OB
EB
INHER
MNEMONIC
OP
Add
ADDA
AOOB
8B
CB
Add Acmltrs
ABA
Add with
ADCA
89
99
A9
B9
ADCB
C9
09
E9
F9
B +
ANDA
ANDB
84
94
A4
B4
M + C->A
M + C--B
A. M--A
C4
D4
E4
F4
B.M->B
BITA
85
95
A5
B5
A. M
BITB
C5
05
E5
F5
B.M
6F
7F
00 -*M
OPERATIONS
Carry
And
Bit Test
OP
BB
FB
CLRA
CLRB
Compare
CMPA
81
91
A1
B1
CMPB
CI
01
El
F1
Compare Acmltrs
CBA
Complement, Vs
COM
63
73
Negate
NEG
2's
Decimal Adjust,
OR
B +
M-B
B-A
conUnts)
00
-A
5F
00
-B
A-M
B-M
2
A-
43
M--M
A->A
53
tWB
00 -
M
A
00 -
00 - B
DAA
19
- B
BCD
7A
DECA
4A
OECB
5A
Characters
B-
1->B
98
A8
B8
AM-A
EORB
C8
08
E8
F8
BM-B
6C
7C
4C
A+1-A
INCB
5C
B+1--B
F6
BA
EA
FA
DA
Push Oata
B+M->B
AA
CA
E6
ORAB
PS HA
06
Or, Inclusive
A + M-*A
9A
B6
C6
36
A-*Msp, SP-1-SP
PSHB
37
B-"Msp. SP-1--SP
PULA
32
33
SP + 1-SP,
M S p-B
PULB
ROL
69
79
49
ROLA
bI
M
AS LA
48
ASLB
58
ASRA
47
ASRB
57
LSRA
44
LSRB
54
76
68
ASL
67
ASR
78
77
Unc
M'
64
74
ii
"
I
"
"*
"
)-
"0
- n
bQ
b7
LSR
D 1
b7
B.
R
n-i
b7
ii
bQ
- n
C
R
STAA
97
A7
B7
A-M
STAB
D7
E7
F7
B-*M
A-M-A
SUBA
80
90
AO
BO
SUBB
CO
DO
EO
FO
B-M->B
10
TAB
16
TBA
17
Subract Acmltrs.
SBA
SBCA
82
92
A2
B2
SBCB
C2
02
E2
F2
Minus
"7
bI
Ml
56
In c
46
66
RORA
RORB
Test, Zero or
ROR
Transfer Acmltrs
59
ROLB
Subtract
M-A
M-B
A6
96
1-*M
INCA
8A
Store Acmltr.
LDAB
ORAA
88
EORA
Rotate Right
BCD Format
-M
A-1 -A
M -
->
6A
4F
86
Rotate Left
50
LDAA
Oata
70
M-"A
40
Load Acmltr
Pull
NEGB
INC
Increment
rtftr to
NEGA
DEC
Decrement
Exclusive
60
#
A
11
COMA
COMB
Complement,
OP
IB
CLR
Clear
TST
6D
70
A-B-A
A-M-C-A
B-M-C-B
A-B
B-A
M-00
TSTA
4D
A -00
TSTB
50
8-00
MNEMONIC
CPX
IMMED
OP
8C
DIRECT
OP
9C
~
4
INDEX
OP
AC
EXTND
OP
BC
INHER
OP
BOOLEAN/ARITHMETIC OPERATION
-(M/M
(X H /X L )
1)
DEX
09
X-1->X
DES
34
SP-1->SP
INX
08
X +
INS
31
SP+1-+SP
LDX
CE
DE
EE
FE
M-X H ,(M +
LDS
8E
9E
AE
BE
M-SP H
XH
Indx Reg
- Stack
Pntr
-Hndx Reg
Stack Pntr
STX
DF
EF
FF
STS
9F
AF
BF
35
TSX
30
RELATIVE
INDEX
-M, X L ^(M
EXTND
Branch Always
BRA
20
None
Branch
If
Carry Clear
BCC
24
C =
Branch
If
Carry Set
BCS
25
C=
Branch
If
Zero
BEQ
27
Z=
Zero
BGE
2C
Zero
BGT
2E
Higher
BHI
22
<
+ (NV)
+ Z=
>
>
Branch
If
Branch
If
Branch
If
Branch
If
Branch
If
Branch
If
Branch
If
Minus
Branch
If
Branch
If
Branch
Branch
OP
OP
BRANCH TEST
N*V =
+ (NV)
2F
BLS
23
<
BLT
2D
NV=
BMI
2B
BNE
26
Overflow Clear
BVC
28
If
Overflow Set
BVS
29
If
Plus
BPL
2A
8D
Zero
Branch To Subroutine
BSR
JMP
GE
7E
Jump To Subroutine
JSR
AD
BO
No Operation
NOP
01
RTI
3R
10
RTS
39
12
9
INHER
CLC
OC
CLI
OE
Clear Overflow
CLV
OA
Set Carry
SEC
OD
SEI
OF
SEV
OB
A--CCR
TAP
CCR-*AcmltrA
TPA
Clear Carry
Clear Interrupt
Set Interrupt
Mask
Mask
Set Overflow
OPERATION
4
I
OP
Number
of
MPU
0-l
o-*v
^c
-I
-*v
06
07
Number
of
Program Bytes;
Arithmetic Plus;
Half-carry
Cycles;
Interrupt
A^CCR
CCR-A
Carry from
memory
(S)-
I-
if
test
is
Test: Result =
10000000?
(Bit
Test: Result =
00000000?
(Bit C)
(Not cleared
(BitV)
if
most
V)
Test:
Operand
10000000
(BitV)
Test:
Operand
01111111
(BitV)
(Bit
(Bit
N)
(BitV)
(Bit
N)
BCD
most
prior to execution?
prior to execution?
N C
significant
(MS) byte of
result =
15=
of
1?
LS bytes?
1)
(All)
(Bit
significant
previously set.)
I)
Set
when
interrupt occurs.
If
previously
set, a
Non-Maskable Interrupt
(ALL)
bit 7
Set
Always
Complement
CCR
Transfer Into;
LS
Least Significant
Bit =
MS
Most Significant
Zero;
Reset Always
location
M;
bit 3;
bit)
of
AND;
Contents of
mask
Negative (sign
Zero (byte)
Arithmetic Minus;
Boolean
from
(Bit set
Byte = Zero;
O^C
LEGEND:
Mjp
BOOLEAN
=
(^
v3J
i
3F
3E
SWI
OP
WAI
MNEMONIC
Software Interrupt
OPERATIONS
if
t
t
=0
BLE
Jump
Acmltr
Lower Or Same
Zero
1)
INHER
it
OP
-MM
1)
MNEMONIC
OP
X- -SP
SP + - X
OPERATIONS
it
1)-X L
(M + 1)->SP L
SP H -*M, SP
L
TXS
1-X
Not Affected
Condition Code Register
82
is
3.
WAIT/GO SYSTEMS
83
is
to
MOTOROLA
8080
SOLUTION
Step
To
Aim of the
design
logic.
printer
are
action/status devices.f
The block diagram of our solution is shown in Figure 3.32. As the printer is an
is needed. The step-by-step operation of the system is flow-
is
INTEL
8080 e
w. See
no other
example
in
section 3.4.
'
'
'
Reader
Printer
fin
i
ay
e
w
I
_^
menace
Figure 3.32.
f Action/status devices are explained in
Appendix
1.
a2-
84
The
octal
and hexadecimal
Octal
003
000
016
OE
001
(n)
(n)
002
003
004
005
006
007
010
001
012
013
014
015
016
014
015
312
016
003
333
010
323
020
303
003
003
OC
OD
CA
OE
L2:
LI:
SOLUTION
Step
3.28).
MVIC
Comments
Load
with
INRC
Increment register C.
DCRC
Decrement
JZ
DB
IN
OS
OUT
n.
Sets condition
flags.
register C. J
03
>3
register
If
register
Read next
is
character.
Print character.
18
C3
03
03
76
JMP
L2
Jump
HUT
to L2.
Halt.
'
|
Step 2
Step 3
Mnemonics
a }
166
6800
Figure
Hex
listing listing
address
set in
Same
as in the
8080 solution
,1
The block diagram of our solution using the M6800 is shown in Figure 3.35.
As in the previous problem, in addition to the I/O port we require an AND
gate to generate the enable signal
and 2 of example
e,
see circuits
2 in that section.
hexadecimal
listing of
our program.
It is
shown on page
86.
is
4-5-6. Character
WAIT/ GO SYSTEMS
3.
Start
Initialize
85
count
<
Yes
Stop
Read
Decrement count
Figure 3.33.
Use the wait/go mode to implement your design, which is to be verified using
INTEL 8080 and the MOTOROLA 6800.
the
8080
SOLUTION
Step
Aim
of the design
The aim
of the design
is
to print a record.
logic.
shown
printer
are
action/status devices.!
is
of our solution
is
INTEL
8080
in Figure 3.34
w. See
example
no other hardware
1
is
in section 3.4.
The octal and hexadecimal listings for the INTEL 8080 are derived by direct
and to the programming chart in
set in
Appendix
Figure
1.
3.28).
86
Reader
INTEL
Printer
8080
w oio
^020
#010
#020
Figure 3.34.
L2:
Hex
Hex
address
listing
00
00
C6
01
02
03
04
05
06
07
08
09
QA
OB
0C
0>
0
OF
L\
10
27
0B
56
LDA
,n
01
f?
LDA
Load
register
If re S ister
B=
with
Read a
character.
NOP
STA
.4,4000
01
NOP
5A
IE
DEC B
JMP LI
Decrement
Jump
SWI
Stop.
B.
to L2.
n.
um P
,4,2000
40
00
00
02
3F
>
20
00
Bl
Comments
Mnemonics
to L1
3.
WAIT/ GO SYSTEMS
87
Address
decoder
VMA M200^
AND
R/W
M6800
Reader
Printer
"'2000
~"~ H'4000
#2000
#4000
Figure 3.35.
Start
Initialize
count
Read
No
Read
No
Read
No
Yes
Read
Decrement count
Figure 3.36.
<
^rStop
Hex
listing
listina
Mnemonics
000
333
DB
IN
001
020
376
264
302
000
003
10
FE
CPI
Compare AC
BA
CI
JNZ
Octal
address
003
L\
002
003
004
005
006
007
010
LI:
Oil
012
013
014
015
016
017
020
021
022
023
024
025
026
027
030
LA:
031
032
033
034
035
036
037
Li:
00
03
333
DB
020
10
376
265
302
002
003
333
020
376
266
302
002
003
016
(n)
014
015
312
043
003
If
LI
FE
CPI
Compare AC with
B5
C2
JNZ
If
DB
IN
Read next
FE
CPI
Compare AC with
B6
C2
JNZ
Step 3
If
L2
OE
MVICl
()
oc
OD
INRC
CA
JZ
23
03
L3
IN
333
DB
10
040
303
C3
041
042
043
030
003
18
5,
jump
to LI.
character.
03
76
character not a
Load
register
jump
to
-LI.
with
n.
If register
Read next
is
character.
Print character.
JMP
HLT
6,
OUT
LA
6.t
DCRC
"j
Same
5.f
02
03
Step 2
to LI.
10
18
character not a
LI
D3
Step
jump
4,
character.
02
03
323
SOLUTION
character not a
}
Read next
030
6800
with 4.f
IN
020
166
Comments
Jump
Halt.
to LA.
WAIT/GO SYSTEMS
3.
89
The block diagram of our solution using the M6800 is shown in Figure 3.35.
As in the previous problem, in addition to the I/O port we require an AND gate
to generate the enable signal
example 2
e,
see circuits
and 2 of
in that section.
LI:
12:
our program.
Hex
Hex
address
listing
00
00
B6
01
02
03
20
00
04
05
06
07
08
09
0A
0B
OC
0D
0
OF
10
11
12
34
26
F8
B6
LDA
/4,2000
NOP
CMP A
BNE
LDA
LI
.4,2000
NOP
CMP A
26
BNE
LDA
LI
,4,2000
C6
19
1A
27
HEQ
IB
\C
0B
IA
J56
BNEL2
LDA
LDA
B,n
,4,2000
4.
character not a
4,
jump
to LI.
jump
to L2.
jump
to L2.
character.
>
Compare A with
5.
character not a
5,
character.
Compare A with
1
If
Load
register
6.
character not a
If register
6,
B with
B=
0,
n.
jump
Read a
NOP
with
20
00
01
If
Read next
18
\E
IF
| Compare A
20
00
NOP
CMP A
character.
If
EC
Read next
01
81
35
17
15
Comments
Read next
16
14
programming chart in
we obtain the hexadecimal
to the
3.31),
Mnemonics
20
00
F4
B6
and
3.36
Figure
shown below.
01
81
36
26
13
L3:
01
81
It is
set in
character.
to L4.
90
Hex
Hex
address
listing
Comments
Mnemonics
L
20
21
22
23
24
LA:
25
26
27
28
Bl
40
00
STA
A, 4000^
}
01
NOP
5A
IE
DEC B
JMP
Decrement
L3
00
>
B.
^
>
Jump
to L3.
\A
3F
SWI
3.6
Stop.
REFERENCES
3.
4.
INTEL
5.
1.
2.
Zissos,
Press, 1976.
Mimi
1977,
November
1977.
Test-and-Skip Systems
In
chapter
this
we
outline
step-by-step
methods
for
the
design
and
4.1
The need
INTRODUCTION
an I/O
and 3. One method of
implementing I/O synchronization, the wait/go method, was described in the
previous chapter. In this chapter we shall describe the two alternative methods,
namely test-and-skip and clock stretching.
to synchronize the microprocessor with a peripheral during
mode we
In the test-and-skip
and
the
the
tests
test.
whether it has
fully
He continues to do
responded or not.
If not, the
programmer repeats
program comes out of the loop and proceeds to execute the next
shown in Figure 4.1. The design and implementation of
instruction, as
this
mode
of operation
is
section.
In a limited
slowing
down
number
of cases where
92
Read
status of device
No
Activate peripheral
Other instructions
Figure
4.2
4.1.
TEST-AND-SKIP SYSTEMS
of a test-and-skip system
is
shown
in
Figure
peripheral
is
ready, otherwise
0. Its
step-by-step operation
4.2.
=
is
Signal r
when
the
as follows.
to
II
II
II
II
I:
ll
II
\tn
Other status
Peripheral
signals
.Command
signals
I/O
signals
Interface
Figure
4.2.
Status
signals
4.
yet,
TEST-AND-SKIP SYSTEMS
test.
93
He continues to do so
1,
at
peripheral.
CLOCK STRETCHING
4.3
Let us denote
Now
if
is
is t
seconds, where
max
J min
its
>t.
If
we assume
trailing
stretching circuit.
+i
o-
\ *[
02
0-
0-
r-
fl
'
Figure
4.3.
is
straightforward and
94
should present no
of logic design.
detail in
The method
who possesses
described in Chapter
Oxford University
To
is
in
a working knowledge
of this
book and
method, we
shall
stretch
we denote by
the corresponding
internal-state diagram.
show the
we
diagram,
more
Press, 1976.
variable
in
By
obtain
JA
therefore
RA =
SB
RB =
01
S3
'S
=A
-B
'E,
-s
=A
-B
-s,
S2
=A -B,
therefore
K A = B's
therefore J B
therefore
=S O -01+ S l+ S 2+ S
=B
A-s
KB = A
</>l
(So
+ S 3)'02
= (A-B + A-B)'<j) 2
= 5-02
The corresponding
circuit
4.4
In this section
is
shown
in Figure 4.5.
,.j[?l
*'x-+i
01=1
+2''+2
0;=o
,48
= 00
s2
Si
So
JL*
4=1
<t>'
11
01
Figure
4.4.
JL'
<i>\=<f> l
+2*-*2
10
TEST-AND-SKIP SYSTEMS
^1
A
j
Figure
first
all
*i-L
f=D
95
-Z)+>
4.5.
INTEL
three steps in
microprocessor.
Problem
RAM to printer
locations in
RAM
ROM
SOLUTION
Step
Aim of the
design
The relevant I/O signals of the INTEL 8080 are shown in Figure
terminal characteristics of the printer are shown in Figure 4.6.
4.7.
The
of our solution
is
shown
in
Figure
4.8. Its
operation
is
Step
S3
> c
TJ
6 cs
-^
S
i -a
43
l>
.s
.>
<U
(U
&
43
*"
co
fe
.h
e
s
>0
Q.
eB -23
<D
55 .
<u
'ii
S3
*1
>
II
o
S ^
C'H 3
l_
O
S .*
*
7^
a*
g.3
o
TO
-1
35
60
T3
S3
$<
<u
0)
T3
S3
S3
=0
S
o 3 *"
o
60
s O S _
i)
a
>
=s
.5 .g <
S
-*
60
3 43 43
2
-
m O +'
l-i
43
^-,
as
S3
ca
>.
60 T3
<U
S3
o b
o)
60
en
>-i
43
Ch
J3
3s '
too
U 3
3
43 43 a
cu
^ 432
<*>43
5
as
is
.R 60
S3
<U
<L)
<
S3
S OO 42w
y
*-
Cd^
S3
-H
tn
<u
S3
O
S3
<u
r/l
cd
S3
S3
rt
C
O
CJ
<
&0
l-H
(/I
>
<u
T3
^H
o
<
en
43
OJ
O o
>
V3
en
(U
Ifi
T3
3
"etf
r/l
43
CM
o
U S3 o
O o
a
k.
s 'I
o .>; a
?
c
k.
>
<a
K o
? cd
II
rrl
_S3
.
E^ 43
43
S3
Pk
4.
TEST-AND-SKIP SYSTEMS
Next instruction
I/O instruction
A/1
97
Ml
A/3
A/1
Address fetch
I/O execute
Instruction fetch
rur_TL
INP
DBIN
OUT
WR
Figure
4.7.
JTTTTT
tm
Printer
Other status
signals
I/O
Status of
printer
signals
Interface
Figure
4.8.
98
w = Am-OUT-WR;
implemented
this signal is
by the
N AND gate. We open the tristate when I/O IN instruction with address
Am
being executed
is
i.e.
= IN-DBIN-Am.
This signal
is
generated by the
AND gate. Since the printer status signal x can only be monitored when w =
we make w equal
to
zero
all
when
1,
w cannot be
the arrangement we have used,
the time
when
the printer
signal
is
unready.
clarity
we
synchronize the printer operation with the microprocessor. The flow chart
shown in Figure 4.1. The mnemonics are shown below.
OUT
#
IN
LI:
AC
is
to printer.
I the printer.
ANA A
Set flags.
JZ
LI
\ ready go
If printer
not
to LI.
By direct reference to our flow chart in Figure 4.9 and either to the
programming chart in Figure 3.27 or to the instruction set in Figure 3.28, we
obtain the octal and hexadecimal listings of our program. These are shown
below (Am = A010).
Octal
Mckl ress
1
II
003
Octal
Comments
Mnemonics
Ilex
/.
000
041
21
001
002
003
(L)
(L)
(H)
(H)
016
OE
004
005
(n)
(n)
014
OC
LXl
Load immediate
the initial
{
MVIC
Load block
{
INRC
LI:
006
007
010
011
012
013
019
015
016
017
015
312
027
003
333
010
247
312
012
003
JZ
17
03
DB
LI
08
Al
ANA A
CA
OA
JZ
03
\I
IN
LI
If register
register C.
is
empty,
jump
to location LI.
Read
status
of printer.
If
Set flags.
\i
jump
to set
flags.
Decrement
HL.
length into
Increment register
DCRC
OD
CA
address
register C.
condition
L3:
RAM
to location L2.
TEST-AND-SKIP SYSTEMS
4.
Octal
address
020
021
022
023
LI:
024
025
026
027
030
031
032
Octal
Hex
Mnemonics
Comments
176
323
IE
MOVA,m
OUT
INRL
JMP
Increment
03
08
010
054
303
006
003
076
015
323
010
06
03
C
1
L3
MVI A
OUT
D3
RAM
location
L3
Move immediate
code
Print.
HLT
is
into
The contents of
Halt.
J>
initial
RAM address
Initialize
counter
Yes
Read
status of printer
No
Move
from
next character
RAM into AC
Print
Decrement counter
Figure
4.9.
<
Stop
the
AC
returned.
Start
Load
AC
are printed
76
address.
to
08
Jump
82)
166
fron
2C
C3
{
033
99
100
*~OUT
WR
Figure 4.10.
Problem 2
Reader
to
RAM
is
the
INTEL
8080.
SOLUTION
Step
Aim
of the design
The
I/O signals of the INTEL 8080 are shown in Figure 4.7. The
diagram and terminal characteristics are shown in Figure 4.6.
relevant
reader's block
4.
TEST-AND-SKIP SYSTEMS
101
e2
Xr=
ji
i,
=r
_=
J
Reader
Hn
It'
/
k-
Other status
m-
/-
signals
I/O
signals
Figure
Start
Load
4.
1 1
initial
RAM address
Initialize
counter
C
Yes
Read
_N.
status of reader
^ReadCT
readv.
Read into
Move AC
AC
into
RAM
Decrement counter
Figure 4.12.
^C
Stop
102
Because the
minimum
the
I/O pulse to
set
They
in Figure 4.13.
it
cannot drive
by using
in practice
shown
0.48 /(sees
is
can be overcome
The enable
signals of the
transition in signal
to
two
ex
= INP'DBIN-A q and
e2
= INP'DBIN'A p
/,
as
tristates are
AND
By direct reference to our programming flow chart in Figure 4.14 and either
programming chart in Figure 3.27 or to the instruction set in Figure
3.28, we obtain the octal and hexadecimal listings of our program. These are
shown below. (A p = A 020 and A q = A ()M)
to the
).
Octal
Address
Octal
Comments
Mnemonics
Hex.
003 000
001
002
003
004
005
041
21
(L)
{L)
(H)
(H)
016
OE
(n)
(n)
014
OC
LXIH
Load
RAM
initial
address into
ii
MVIC
INRC
HL register
pair.
Load block
length
{ into register C.
Increment register
to set
condition flags.
L3:
006
007
010
011
L2:
LI
012
013
014
015
016
017
020
021
022
023
024
025
026
027
015
312
027
003
333
020
247
312
012
003
333
030
167
054
303
006
003
166
DCRC
OD
CA
JZ
17
03
DB
LI
Decrement
IN
Read
status
{ of reader.
10
Al
ANA A
Set flags.
CA
OA
JZ
If
03
DB
L2
< jump
L
IN
to location L2.
Read next
character.
Move AC
contents to
18
MOV MA
INX H
77
2C
C3
06
03
76
register C.
is empty,
r
< jump to location LI.
L
If register
JMP
{
L3
HLT
Increment
(
i
Jump
I
Halt.
RAM
memory
address.
to location L3.
4.
TEST-AND-SKIP SYSTEMS
103
-"(!
Address
decoder
-Ap
Reader
IF
Ap Aq
'"fflMfl
INTEL
8080
RAM
-~~INP
--
DBIN
-*~OUT
WR
Figure 4.13.
Use
the
INTEL
8080 to
verify
your design.
SOLUTION
Step
Aim
of the design
is to design an interface between a microprocessor and two
The relevant I/O signals of the INTEL 8080 are shown in Figure 4.7.
The terminal characteristics of the printer and reader are shown in Figure
4.6.
104
Start
J>
HL =
:
initial
RAM address
~T~
C=C+1
C: =
C-
<
Yes
Stop
J>
Yes
Zero
No
Read next character
HL:
=HL+1
Figure 4.14.
process
is
repeated.
we
shown
in
our
move
the
at least
1 n
and must remove the ground before signal changes to 1 As the duration of
an I/O pulse is approximately 0.5 /xsecs it cannot be used directly. The most
sec
TEST-AND-SKIP SYSTEMS
4.
i,
II
li
II
II
105
Reader
Printer
H7l
Other status
AM-
signals
I/O
signals
Interface
Figure 4.15.
Start
Initialize
counter
Yes
Read
-^
status of
No
Read
Decrement counter
Figure 4.16.
Stop
106
straightforward
method is to use the I/O pulse to set a flip-flop, and use the
to
as
to reset
it.
an I/O address to our reader, the I/O pulse INP'DBIN-A 003 can be used
this
To
is
its 1
to
we ground
its
is
is
= INP'DBIN-A 002
terminal w when an I/O instruction
w = OUT'WR v4004. This signal is
tristate; that is e 1
executed, that
for
implemented by the NAND gate and the inverter shown in Figure 4.17. Status
signals m and x are fed into the second tristate. The output of tristate 2, when
enabled is '000 000 1 1' or '003 8 unless either or both of the devices (reader and
',
In our solution
we
shall allocate
The
to the
in
Octal
address
003 000
001
002
Octal
Comments
Mnemonics
Hex
01
016
01
(n)
(n)
014
OC
MVI
Move
1
INRC
= number
Increment register
condition
L3:
L2:
LI:
003
004
005
006
007
010
011
012
013
014
015
016
017
020
021
022
023
024
025
015
312
025
003
333
005
376
003
302
007
003
333
003
323
004
303
003
003
166
DCRC
OD
CA
LI
<
t
15
03
DB
in
FE
CPI
03
07
03
DB
If register
register C.
is
empty, jump to
location LI.
Input status.
JNZ
(12
(IN
{ Compare AC with
f
{K
If
next byte.
devices unready,
jump
to location L2.
Read a
character.
03
D3
OUT
04
C3
03
03
76
to set
05
C2
Decrement
JZ
flags.
JMP
| L3
HLT
i Jump to
X location L3.
Halt.
4.
at
T3
TEST-AND-SKIP SYSTEMS
107
QNV
<u
I'
5n
&0
II
<>^
QMV
<i>
-^SOOy
00y
<-8
eooy
108
Start
C: = w
1
C=C+1
Figure 4.18.
Interrupt
Systems
In
5.1
In this
mode
INTRODUCTION
it
wishes
it
For
reference purposes
the
first
we denote by A m
interrupted
program
the location in
resides,
because PC
is
2.4.
It
main program
As
Similarly,
we
we
110
Current program
Interrupted
program
Interrupt
1
Interrupt
routine
Return
1
Resumed
program
Figure
refer to
it
5.1.
condition flags and of the working registers must also be preserved during an
interrupt routine. Working registers are m.p.u. registers that are used by both
the interrupted
interrupt routine.
flags,
their
5.2
INTERRUPT SYSTEMS
all
5.2. It consists
of
mode, a
its
interrupt interface.
It
its
interface,
which monitors
its
Flags are defined in the next section. The interrupt circuit, which monitors all
the flags, then generates the interrupt signal, signal / in Figure 5.2, and some
We
shall refer to
it
as interrupt logic.
5.
INTERRUPT SYSTEMS
II
I,
I,
I:
111
II
Hn
INTA
Peripheral
Interrupt logic
<<
I.
II
I.
I.
Command
Other
I/O
flags
signals
/n
Status
signals
signals
Interface
Figure
5.2.
and responds
1
It
in the following
current instruction
shown
2.
its
manner.
in
Figure
it
We
by INTA, as
5.2.
8.
9.
3.
4.
5.
6.
7.
10.
is
i.
point).
and condition
INTEL
on
stack,
whereas in the
112
I
Further interrupts
disabled
'
Identify source of
interruption
*
Service request
"
Clear flag
1
Restore working
registers
'
Enable interrupts
|
'RETURN'
instruction
Re-entry point
restored
Figure
it is left
5.3.
we
presents
no
special
difficulty,
if
the
interrupt
cycle
of
the
microprocessor in question
is
and
flag sorters,
5.
5.3
INTERRUPT SYSTEMS
113
Flags
A flag
some
The block diagram of a flag
circuit with set, clear, enable and disable facilities is shown in Figure 5.4. The
function of each of the four input signals is as follows. A signal on terminal e
enables the circuit, whereas a signal on terminal d disables the circuit. Clearly
is
it
it.
enabled, a signal
signal
Flag circuit
Figure
5.4.
Flag Circuits
In
common with all logic circuits, the terminal characteristics of a flag circuit
can be implemented by
we
circuit 2.
Flag Circuit
state
shown
in Figure 5.5.
By
its
internal
turn-on set of
A = B -k
turn-off set of
A = B -k +B -d
turn-on
B = A-e+A-k
set of
turn-off set of
B=A
-d
+A
= d + Ac
i
-c
Invert
>(B
+A
+ k)(B + d)
Invert
+d-(A
we obtain
+ c)
is
14
Therefore,
NAND
50
is
= A-B-k
shown
51
in Figure 5.6
52
Flag
Flag
disabled
/=o
E=
AB =
circuit
-k
53
Flag
off
Flag
on
/=o
E=\
00
c+ d
/=0
=1
E=l
01
11
Figure
5.5.
z^y^y^
AND
io-oh
Figure
5.6.
cleared
10
5.
INTERRUPT SYSTEMS
115
Flag Circuit 2
If
facilities
flip-flop, as
shown
is
JL*
Figure
5.7.
Identification of Flags
As we mentioned
flags.
in the
processor
is
it.
Therefore,
must
when
the micro-
below.
In this
receives
an interrupt
signal,
it
sequences through the devices looking for the individual device(s) that need
servicing. When it finds such a device, it stops sequencing and calls the
corresponding service routine. If the interrupt signal is still on at the end of the
service routine, the polling of the devices continues, otherwises the
program
is
method we
main
resumed.
method
i.e.
chips.
116
Current program
Preset counter to x:
=m
Read
status of flags
</
No
,
ll
I,
|,
I:
/,
I.
Hii
OR
Jump
to service routine
"
<,
J m-' m +
(a)
No
Figure
5.8.
is
code,
we
The design and implementation of flag sorters is straightforward and should
present no difficulty to the reader who possesses a working knowledge of logic
design, outlined in Chapter 1 We shall demonstrate the steps by designing and
unless
specify otherwise.
We
shall arbitrarily
priority.
5.
INTERRUPT SYSTEMS
117
d
Current program
'/
Input
Vectoring
address
fill
PC =
:
Gump
i
i
1
to
SR)
Return
Flags
Flag sorter
Restore working
registers
(b)
(a)
Figure
A Two-Flag
Sorter
of a two-flag sorter
(input/output) relationship
5.10(b).
By
5.9.
is
shown
shown
is
in
Figure 5.10(a).
in the
we obtain
Its
I/O
in Figure
/=/o+/i
An
is
shown
in Figure 5.10(c).
Eight-Flag Sorter.
The block diagram of an eight-flag sorter is shown in Figure 5.11(a). Its I/O
relationship is shown in the form of a truth table in Figure 5.1 1(b). By direct
reference to this table,
we obtain
/
/o-
/o
Two-flag
A
-e-
sorter
A-
OR
vi(2)
(a)
(b)
Figure 5.10.
(c)
118
= fl+h+JJJz+JJj2
C=f
As eight-input
above
OUTPUTS
INPUTS
/o f\ fi
/o
/1
/2
h
h
Eight-flag
*
h*
^4(2)
sorter
S(2
2=:
C(2 2 )
f* fs
fi
00000000
xxxxxxxl
xxxxxxlO
xxxxxlOO
xxxxlOOO
x
(a)
10
C B A_
#--e--e-
1111
1110
1101
1100
1011
1010
1001
1000
(b)
Figure 5.11.
64-Flag Sorter
64-flag sorter
is
shown
in Figure 5.12.
The
flags are
flag
sorter.
The
group
selector, itself
an
The group
selector selects
interrupt signal, /,
5.
INTERRUPT SYSTEMS
119
method we used to derive a 64-flag sorter using eightcan be used to produce a system for handling up to 4012 flags
simply by using the 64-flag sorter in Figure 5.12 as the module.
Clearly the modular
flag sorters,
Group
Address bus
/o:
8-flag sorter
<
fi~
h:
*l
8-flag sorter
hi
g
f\(>~.
8-flag sorter
hi"*3
/243
8-flag sorter
fn
hi:
8-flag sorter
f39
Ao:
5
"*5
8-flag sorter
<
/47
As
6
8-flag sorter
<
fs5
h(>
8-flag sorter
<
fa
e e l e 2 e 3 e4 e S e 6 e 7
Binary to decimal
decoder
._^lFlag
jC
^ J address
D >
_
^ 1IGroup
__
Group
flags
'
Group
selector
Figure 5.12.
address
120
5.4
In this section
explained
we
earlier, in
order to design
it is
The
we shall
its
interrupt circuit we
see, is
rather unique.
INTEL 8080. As we
must understand
its
A detailed explanation
given below.
Reference to
its
INTEL 8080
[3]
if
on pin
is
</>
during the
is
last state of
~X
Location pointed by
00 000 000
Low
f^^^
00 000 000
W//////A
00 001 000
address
PC
\<-:<tt-y.v\ 00 010 000
Old
PC
y/////////< oo
PC
00 000 000
00 ddd 000
on
ooo
IR
Figure 5.13.
INTERRUPT SYSTEMS
5.
program counter
PC
are pushed
121
on
which
00 ddd 000.
As each set of eight bits in the program counter is pushed on stack, the two
words generated internally 00 000 000 and 00 ddd 000 are moved into
PC, 00 000 0000 in the portion that holds the high address and 00 ddd 000 in the
portion that holds the low address. The implication of this is that the next
instruction to be executed will be fetched from one of the eight locations listed
eight-bit
below.
00 000 000
(000 8 )
00 000 000
(000 8 )
00 000 000
(000 8 )
00 001 000
(010 8 )
00 000 000
(000 8 j
00 010 000
(020 8 )
00 000 000
(000 8 )
00 011 000
(030 8 )
00 000 000
(000 8 )
00 100 000
(040 8 )
00 000 000
(000 8 )
00 101 000
(050 8 )
00 000 000
(000 g
00 110 000
(060 8 )
00 000 000
(000 s
00 111 000
(070 8 )
As we saw
by a
ddd
in the restart
flag sorter.
we
shall see how the restart instruction can be used to interrupt the
8080 for emergency situations when interrupts are disabled. This
feature, which is analogous to the non-maskable interrupts in the Motorola
6800 chip, is essential in process control applications, in medical and other
Later
INTEL
Let us
now
exception that
(2)
(1)
An INTA
is
(3)
The
2.4,
is
with the
generated,
interrupt terminal
is
disabled.
If during the INTA -DBIN interval we disconnect the memory from the data
bus and 'jam' onto it a restart instruction, as shown in Figure 5.14, the program
will vector to one of the eight locations shown in Figure 5.13 depending on the
sorter, ddd.
122
INTA.DBIN
INTEL
INT
i:
i,
ii
I,
Flag sorter
1
II
Memory
J
Interrupt flags
Figure 5.14.
the
program
will
in
memory
with high
ROM.
RAMS (you cannot write in ROMS), the locations in ROM specified by 00 ddd
000 contain JUMP instructions to specific locations in RAM, as shown in
Figure 5.15. Unless
specify otherwise,
is
ROM
000,
000o
RAM
RAM to which
303
003 8
303
RAM
(JUMP)
First instruction of s.r.m
003
010 8
shall
we
we
(JUMP)
070.
303
"
003
(JUMP)
t
003
Figure 5.15.
5.
INTERRUPT SYSTEMS
123
RAM
003 g
ddd = 000
000 g
ddd - 001
yyyyyyyy^^y^.
ddd = 010
010 8
'yyyyyyyyyyyyyyyy^ 0208
ddd = Oil
y//////////////^: 0308
Output of 1
ddd = 100
flag sorter!
y/^/^XMZ
040 8
^//////////////^
050 8
ddd = 101
ddd = 110
ddd=
yyyyyyyyyyyy^^^
111
yyyyyyyyyyyyyy^^.
m,
Figure 5.16.
eight locations in
Any of the eight locations can be used to store the first instruction
Figure 5.16.
contains
'jump'
instruction to
--^d
INTEL
8080
INT
INTA
m
QTmrru
AND
^/^prL^^I
ibet
o-
Flag sorter
Peripheral
njjTTT
Other
flags
/n
INP
Interface
Figure 5.17.
Command
OVi
Status
signals
signals
124
return instruction.
'pop' instructions.
INTEL
Figure 5.17.
5.5
One
in
INTEL 8080
when operating
in medical,
signals are ignored during this period. This time interval can be dangerously
extended
if,
either
to carelessness or ignorance,
,-U
w_,.
Emergency
Memory
address
Figure 5.18.
Such
risks
terminal
is
disabled or not.
5.
5.6
As we
MOTOROLA
we do
understanding of
so, as
its
all
M6800 we can
microprocessors,
MOTOROLA
Reference to
with
its
125
systems. Before
The
INTERRUPT SYSTEMS
is
we must have a
6800
[4]
interrupted by a logic
clear
described next.
M6800 can
be
instruction in progress
(f)
during the
is
occurs.
Its interrupt
sequence
summarized below.
is
The current
2.
instruction is completed,
Further interrupts are disabled,
3.
The
1.
m.p.u. status
is
PC L
PC H
IRl
IR H
ACCA
ACCB
CC
4.
The program counter is next loaded with the contents of memory locations
FFFS (PC H ) and FFF9 (PC L These contents, as we have already explained,
).
The
reader's attention
is
first
drawn
To resume
the interrupted
from
program
at the
code is 2>B. Execution of this instruction restores the pre-interrupt m.p.u. status
by 'popping' from stack the m.p.u. registers in the reverse order.
Because in the case of the M6800 the source of interruption can be identified
126
Interrupt
System
In this system
we
operation
is
diagram
is
VMA
ii
ii
ii
,i
M6800
IRQ
NOR
fofi
fi
Figure 5.19.
Interrupt
System 2
In system 2
we
operation
is
diagram
is
--^d
5.
INTERRUPT SYSTEMS
Start
127
Read
Convert
to starting
address of
SR(A J
11
Jump
to
SR( A s )
''
Stop
Figure 5.21.
5.7
2.9).
5.8
In this section
although
we
use the
INTEL
first
all
it
Problem
An
event-counter
the
INTEL
(ii)
the
MOTOROLA
8080,
and
6800.
for the
INTEL
128
Required system
Print-out
Figure 5.22.
8080
SOLUTION
Step
Aim
of the design
INTEL
8080
is
shown
on
line q,
we
shall interrupt
is
is
as follows.
Count
Figure 5.23.
00
<D
> c
T3
3
T3
J3
<u
ri
<u
60
i>
ed
-a
o O
E
C
3 o
O
00
ft
c
.5?
<
ft
-Ai
as
rt-22
55 .
c3
S
O 3
tso e
-S
+"'
43
->
o
"S
S
Wh
O
o
i-i
8 a
fe0
*3
'S
>-'
3
J3X1
<
is
8.
,2 00
as
+-'
O
c
43
C O <u
o
60
cd
as
o
3
T3
as
(U
KJ
>
R O
cd
CI
i.
ft
as
<U
as
as
O
(is
x.
as
II
i$
aj
S _C
>>
SS
T3 XJ
D
U J3
<
00
o
v <u S3 o
O o
Q
C 5S <n h.
? XI > c
c
II
as
a>
t-i
.a
&0
3
a
-.5
"
"J
i-*
<u
^H
as
o
o
^ > (50
C
L?
"8
jg 43
as
S3 ->
*J
a
o
a
o
<L>
ft
'32
60X
o^
T3
<43 .
**
35
.3 =
43
C
o
o
R 8
e g
S>
as
X XI
C
>
S n
D
cd
S3
as
-^
U
<
"i
vs
_, -^
Xo
<
'
4>
J3
ai
at
<
t-
! *3
o
JS
60 ^3
d
<u
ft "S
<*-
II
43o
S M
o
l-H
XI
>_
as
-o.o
C >
o >
o
c a
=s
o o
<
22
J2
<
43
^ 2
^
<L>
t5
ra
.22
130
-^-^d
o/
li
Printer
Hn
INTA
Interrupt logic
TT
1
Other
I,
II
flags
/n"
I/O
signals
Interface
Figure 5.25.
1.
Similarly,
when
switch
m is activated, we shall
interrupt the current program and execute another service routine which
produces a print-out of the event-count and resets the counter to 0.
2.
by our
INTEL
8080 solution,
interface are
If no enable and disable facilities are required for our flag signals, they can be
implemented using flag circuit 2, described in section 5.2 of this chapter. If we
use the q pulses to set flip-flop/ in Figure 5.28, and the activation/release of
switch m to set flip-flop /,, then the equations of our interface signals are
Cn
= OUT-WR-A 003
cx
rl
w and
m,
w = OUT-WRA,
INTERRUPT SYSTEMS
5.
131
'/
Further interrupts
disabled
1
/f
^\y
Yes
No
_^
'
Print event-count
Increment event-count
Reset event-count to
zero
1
Clear/,
Clear /
'
Restore working
Restore working
registers
registers
Enable interrupts
Enable interrupts
'Return'
'Return'
instruction
instruction
1
Figure 5.26.
If we further
As we saw
is
shown
in
Figure 5.28.
The programming
INTEL
in Figure
132
INTEL
8080
INT
Flag sorter
IIIIIIH
Other
flags
"fi
fo
<<
INP
DBIN
OUT
WR
Interface
D^J
]
Figure 5.27.
= 110/,
1111
INTA
AND
DBIN
INT
,-u
I
-
Address
decoder
llll.
Printer
-/,
OR
^003
^004
/o
W
r
(Not used)
INTEL
~L
l\J
~"
UZL
~
\fo
NAND
NAND
- OUT
- WR
Figure 5.28.
5.
INTERRUPT SYSTEMS
133
5.29.f By direct reference to them and to the instruction set in Figure 3.28 (or
to the chart in Figure 3.36), we obtain the octal and hexadecimal listings shown
below.
Octal
Octal
Hex
address
listing
listing
Mnemonics
Service Routine
Comments
(Count)
//
003
010
365
Oil
012
013
004
04
323
003
D3
014
015
016
361
373
311
PUSH PSW
365
170
323
031
032
033
034
035
036
037
040
6800
flags.
clear
flag/
Restore
.
F\
POP PSW
FB
EI
AC and flags
Enable interrupts.
C9
RET
Return.
(Print)
F5
PUSH PSW
Save
78
MOV Afi
Move B
D3
OUT
I/O
AC
and
flags.
into A.
to load printer
and
3E
MVI A
Load
0D
015
L>3
OUT
041
004
076
015
323
004
006
060
042
043
044
361
373
311
F\
POP PSW
FB
El
C9
RET
Return.
04
04
06
Same
5.3.
AC
Activate printer.
MVIB
Clear register
30
clear /j.
SOLUTION
f Reference
I/O cycle to
03
Service Routine
030
Save AC and
Increment B.
INRB
OUT
(our
counter).
134
Count routine
Print routine
Start
Start
'
Save
AC
Save
AC and
condition flags
Increment count
Clear
Reset count
Restore condition
Clear /j
flags
"
"
AC
and
Restore
condition flags
E.I.
."
'Return'
E.I.
''
'Return'
Figure 5.29.
M6800
shown
it
2.
3.
Two
flag signals,
f and/
and
print routines,
5.
INTERRUPT SYSTEMS
135
Address
decoder
VMA
U AND
R/Wt~-
i,
Address
decoder
Printer
0-
w--
NOR
IRQ
--x
M6800
Other
flags
/o"
h
H
VMA
/?/>P
ii
ii
Interface
"2
Figure 5.30.
As before, we shall assume that/ and/j are the only two flags in the system.
This allows us to generate the interrupt signal and the address of the
interrupting device using a single
our two
flags,
Figure 5.31.
pulse on line
flags,
are
r
-</>
2,
and
r^VMA-R/W-Anot-fc
NAND gates
and 2
in
136
^d
^8004
VMA Lr
R/W
AND
'0'-
I,
l:
II
Address
decoder
Printer
+2
oM
IRQ
NOR
^ ^
Ji
^
(Not used)
M6800
l
0 *
i j
0 K
r,
Cl
fl
NAND
NAND
--
VMA
0,
Figure
In this system
printer
is
we can
activated
and
5.31,
the flag
is
when we
may
occur at
w=
on a 1 to
the same time, making
signal transition,
INTEL
M6800
systems.
service routine.
f Reference
was made
to Figure 5.3.
Current program
E
Further interrupts
disabled
Input
No
Yes
Print event-count
Increment event-count
Reset event-count
Clear
Clear /j
'Return' from
'Return from
interrupt'
interrupt'
instruction
instruction
Figure 5.32.
00
Hex
Hex
address
listing
50
B6
51
80
04
87
25
07
52
53
54
55
56
57
58
59
LI:
5A
5B
5C
5D
5E
LDAA
r Input address
from flag
v sorter.
<
RARA
Rotate right A
to count routine,
BCS LI
Jump
if
LDAB
Move
00
counter
FF
STAB
^ into B
C Print
\ and clear
RTI
INC
1 flag/,.
Return.
r
)
increment
\ counter
F6
Fl
80
06
3B
1C
00
5F
60
FF
61
20
00
62
63
Comments
Mnemonics
Fl
2>B
STAB
carry flag
Clear
I Aag/
RTI
Return.
is set.
138
Problem 2
INTEL
(i)
8080
SOLUTION
Step
Aim
of the design
the design
The aim of
data,
which
is
the interrupt
is
to enable the
programmer
mode, as shown
in
to transfer a block of
Figure 5.33.
The terminal
INTEL
8080
is
shown
shown
in Figure 5.24.
is
is
is
shown
as follows. At each
RAM into
From the accumulator it is output onto the data bus and the
is
transfer
is
initiated
is
initiated
flag.
The block diagram of our solution using the INTEL 8080 is shown in Figure
5.36. The two signals to be generated by the interface hardware are
1
2.
The
The
command,
interrupt flag/7
w,
and
5.
INTERRUPT SYSTEMS
139
Figure 5.33.
/in
INTA
Interrupt circuit
MMMJ
Other
I/O
flags
signals
Interface
Figure 5.34.
140
Current program
word count
Initialize
31
rteX^
Yes
End of block
\^ourit=0^>
Disable
NoJ
Decrement
byte address
1
Restore working
registers
Enable interrupts
Return instruction
Figure 5.35.
transfer
/7
INTERRUPT SYSTEMS
5.
of generating signal
141
w is to decode an I/O
instruction with one of the available I/O addresses, say 004 8 In such a case
.
If
stretch
it
= 0UT-WR>A 004
is less
than
the
when
terminal
It
is
when
its
w is grounded.
If we
is
we
explained in section 5.2 of this chapter, then the equations of its clock and reset
signals
The
become
flag flip-flop is
flip-flops, unless
we
shown
c1
rx
=w
x,
and
in Figure 5.37.
is
with a logic
0.
-d
INTA
AND
DBIN
iTTrnrf
ll
T _L_I
Address
decoder
INT
Printer
Flag sorter
INTEL
,1
I,
;>
I,
8080
fl
Other flags
INP
ii
DBIN I
OUT
WR
Interface
Figure 5.36.
142
In addition, the interface must provide the programmer with the facility to
use software for enabling and disabling the interrupt flag. Such a facility can be
supplied by a flip-flop, which can be turned on and off under program control.
If we allocate octal addresses 005 and 006 for this purpose, the relevant
equations are
c
= OUT-WR-A 006
is
shown
Figure 5.37.
in
INTA
DBIN
jmw-r
Address
decoder
Printer
Flag sorter
INT
nTTTTTT
Other
INTEL
T ^
flags
AND
-wv
fi
*r
AND
NAND
NAND
'004
Figure 5.37.
OUT
WR
5.
INTERRUPT SYSTEMS
143
Octal
address
003
060
1
2
3
4
5
6
7
070
1
2
3
4
5
6
7
100
1
2
3
LI
6
7
10
Octal
Hex
listing
listing
365
345
032
056
003
276
323
004
053
042
056
003
041
055
003
065
302
105
003
323
006
341
361
373
311
5
5
PUSH PSW
\A
IE
LHLD
PUSHH
IE
MOV A,M
D3
OUT
04
2D
DCX H
22
SHLD
2D
}
DCRM
C2
JNZ
45
03
| LI
>3
06
Same
POPH
POP PSW
C9
RET
as for the
Step 3
to Figure 5.3.
Decrement
HL
is the
address in memory where the
next byte resides.
Load HL with the address of the
location in memory where the
byte count is stored.
OUT
1
1
8
003-056/7).
Move next byte into AC.
clear flag.
IX I
03
35
HL
Move into
the address of the
next byte (contents of locations
f
J
03
21
Step
was made
SOLUTION
t Reference
}
J\
03
6800
Step 2
Comments
Mnemonics
EI
8080 solution.
If
jump
is
not zero,
to location LI.
Disable/, if byte
count is zero.
Restore working registers.
144
Start
Save A, Hags, H,
Move
Yes
End of block
Decrement
byte address
Disable
Restore A,
flags,
transfer.
7
H, L
Enable interrupts
Return
Figure 5.38.
Reference to our system block diagram in Figure 5.39 shows that the signals
to be generated
command,
1.
2.
Interrupt flag/7
If
we
w,
and
w = ^8004 VMA-R/W'(j) 2
If
is
see
less
NAND
than
5.
INTERRUPT SYSTEMS
145
- -
Address
decoder
VMA
U AND
R/wr*
,,
Address
decoder
,1
M6800
Printer
^MJ}
IRQ
Flag sorter
Other
flags
-A
VMA
"
R/W
"
"
Interface
Figure 5.39.
'stretch'
it
1.
is
If
is
when
printer,
as we explained in section 5.2 of this chapter, then the equations of its clock
reset signals
The
and
become
flip-flop is
flops, unless
and
we
shown
c1
x,
rx
w.
in Figure 5.38.
and
The reader is reminded that our flipon the trailing edge of a clock pulse
reset with a
ground, that
is
a logic
0.
7^
= A 4000 VMA-R/W-fc
146
R/w
ANDed
flip-flop is
with
to generate signal
/7
as
Address
,JJtHtIL
decoders
Printer
+2
IRQ
-o- /
Flag sorter
n
II
ii
I,
II
ii
ii
fM
Other
x t
oo
-r
flags
AND
M6800
1 /
o k
0 K
NAND
AND
fl
NAND
2
'8004
'2000
VMA
-^ R/W
-+2
Figure 5.40.
The programming
direct reference to
instruction set in
routine.
it
and
to the
5.
INTERRUPT SYSTEMS
147
Start
J>
Move
next character
into
ACC A
Print character
and
clear flag
Yes
End of block
transfer.
Disable flag
Decrement byte
address
RTI
Figure 5.41.
Hex
Ilex
address
listing
00
5F
60
B6
61
mH
62
63
64
65
66
67
68
69
6/4
6B
6C
6>
6
LI:
IDA A
STAA
80
04
1A
00
5F
27
04
1A
70
00
72
3B
location 005F.
Move
into
Print character
and
DECn
}
BEQ
LI
|
DEC m L ^
I
RTI
STAA
next character
00
62
71
\
\
"l
Bl
Comments
Store block length in
3B
Bl
40
6F
Mnemonics
AC.
clear flag/7
Decrement the
block length.
If
block length
jump
RTI
is
zero.
to LI.
Decrement pointer
to next character.
Return.
Disable
flag/7
.
Return.
148
5.9
1.
Zissos, D.
and Duncan F. G.
REFERENCES
'Digital Interface Design',
Oxford University
Press, 1973.
2.
Zissos, D. 'Problems
and Solutions
in
Press, 1976.
3.
INTEL
4.
M6800 Microprocessor
D.M.A. Systems
In this chapter
we
memory
sections 2.9
shall
and 2.10
respectively.
6.1
INTRODUCTION
methods require several instructions to be executed for the transfer of each byte.
For example, if we use the interrupt mode, we must
1.
2.
3.
4.
5.
6.
7.
8.
For
if
in chapter 5.
large blocks of data this can involve excessive amounts of m.p.u. time.
if the rate of the incoming information is greater than
the rate at
Furthermore,
which the microprocessor can write into memory, some of the information will
clearly be lost.
is
established between
memory
150
and peripheral, as shown diagrammatically in Figure 6.1(b), the abovementioned problems would be eliminated, since we should be able to transfer a
byte of information between memory and a peripheral in one memory cycle.
Contrary to common belief, the design and implementation of such systems is
straightforward. As we shall see later on in the chapter, the interface hardware
is uncomplicated and the software required to drive it minimal, approximately
a dozen instructions for each block transfer.
direct link
facility is called
abbreviated form.
Memory
Peripheral
m.p.u.
(a)
d.m.a. path
Memory
Peripheral
m.p.u.
(b)
Figure
6.2
6.1.
DMA. SYSTEMS
6.3
1.
and
is
summarized below.
The programmer
initializes
He
instructions to output to the interface the initial memory address and the
block length. The d.m.a. interface is, therefore, allocated an I/O address by
access
it.
6.
D.M.A.
SYSTEMS
151
1. Initial
Memory
memory
c> address
2.
Block length
3.
'Go*
command
Address
1
'
Interface
Figure
2.
6.2.
He next outputs a third item to the interface, a 'go' command. This signal is
used to initiate the block transfer, which is then completed autonomously,
that is without programmer intervention.
3.
When the block transfer is completed, the interface generates a flag signal, e,
4.
to inform the programmer that the block transfer has been completed.
The programmer acknowledges flag e by executing an I/O instruction,
which clears it. Signals c, t and f are defined in the next section.
6.3
DMA.
INTERFACES
1.
and
interface
see Figure
6.4.
The
basic function of
The
Interface
Its
1 is
is
described below.
block diagram
is
shown
two counters
152
Start
Load
)
memory
initial
address
Issue 'go'
command
Disable interface
Stop
Figure
1. Initial
Memory
Control
signals r><ci
nn
mp
cfc>
J
6.3.
memory
address
2.
Block length
3.
'Go'
command
-i
Peripheral
signals
Interface
.Command
(Start)
'
signals
'i
(Stop)
Interface 2
Figure
6.4.
Status
signals
6.
D.M.A.
SYSTEMS
153
connected in cascade,
five
gates
value of the block length (held in the accumulator) to be loaded into counter
1.
Load pulses
(Step-down pulse)
Hn
K
AND
E
I/O pulse
AND
Figure
6.5.
154
While a d.m.a. cycle is being executed, signal t equals 1. We use this signal to
decrement our two counters in Figure 6.5.
At the end of the block transfer counter 1 contains all zeroes, which is
indicated by a logic 1 generated at the output of the NOR gate. This signal,
denoted by variable e in Figure 6.5, is used by interface 2 to stop the block
transfer.
it is
e,
generate the
programmer
reset terminal
r,
In Figure 6.6
e.
of interface
for a microprocessor
with an eight-line data bus and a sixteen line address bus. For the sake of
clarity we do not show the peripheral in this diagram. Signals c, t and t' are
explained next.
j-HSI
Load pulse
"
''
"
'i
ii
'
a
I
AND
Hn
It,
NOR
AND
I/O pulse
AND,
Interface 2
Figure
6.6.
6.
D.M.A.
SYSTEMS
155
Interface 2
The function of
interface 2, as
make our
designs as far as
cycle-steal characteristicsf as
,
described below.
Signal
c.
to
signal
transition
on
this
terminal
tristates
the
Signal
Signal
memory
are generated.
t.
t'.
0. It is
Signal
t'
is
D.M.A.
D.M.A.
memory.
cycle requested
cycle granted
Decrement counters
and 2
*<
Raise e
St P
"^
Activate peripheral
Figure
6.7.
cycle-steal characteristics
is
156
6.4
In this section
we show
Figure
6.8.
and
t'
results.
Interface 1
Status
signals
Microprocessor
Peripheral
Interface 2
_^_
I!.
signals
Figure
Step
Command
6.8.
I/O characteristics
activity
is
Figure
6.9.
The
internal state
are explained in
t Action/status devices
Appendix
1.
SYSTEMS
D.M.A.
6.
157
End of d.m.a
cycle
/i7i
Hn
goes
Peripheral
activated
tristated
Peripheral linked
Peripheral
memory
to
ready
Figure 6.10.
causes action signal a to change from
action.
0,
our
to
1,
peripheral
is
moves
responded, signal
S 2 The
to state
responding, that
while
is
circuit
equals zero.
changes to
1,
steal
End of cycle-steal
So
Device responded
----~,
--"
r
Si
s2
Device on
Cycle-steal
c=l
a
c=
Device started to
respond
=
=
Figure 6.11.
Step 3 State reduction
In this step, as
diagram into a
we have
already explained,
we
By
Introducing
E and
e,
we obtain
t-r
+ t'r + (t'r) =
(1)
-r
(2)
-r
+ (t
-r)
we obtain
c
E'e-r
t
(3)
(4)
158
X'
51
50
c,a
51
10
11
01
00
1,0
1,0
52
50
1,0
1,1
0,1
SI
52
0,1
0,1
(a)
|5012|
|5012
|5012
10
11
01
00
5012
5012
c,a
1,0
1,1
0,1
<,<=o,o
(b)
Figure 6.12.
is,
the
d.m.a.
interface
with a d.m.a. cycle and ends with the activation of the peripheral.
6.5
CYCLE-STEAL LOGIC
not
in
characteristics
a given
6. 14(a).
microprocessor. The block diagram of such a circuit is shown in Figure
to be
likely
difficulty
main
The
The design procedure is straightforward.
pin
m.p.u.
of
the
interpretation
correct
experienced by the reader is the
we
assume that a
Figure 6.14(b). We
d.m.a. cycle extends over three clock pulses, as shown in
logic for the
cycle-steal
the
designing
by
procedure
shall demonstrate the
INTEL
8080.
The
INTEL 8080
shown
in Figure 6.14(a).
buses.
line (pin 13) disconnects the address and data
labelled
HLDA
A logic
on the hold
The response
signal
is
6.
Initial
D.M.A.
SYSTEMS
159
memory
address
2.
Block length
3.
Go command
^p-~-
I/O signals
Interface 1
P*
E
(Go)
(Stop)
Figure 6.13.
flit
m.p.u. signals
Cyclesteal
logic
(a)
Clock
uu
:ju
(b)
Figure 6.14.
INV
AND
160
high within a specified delay of the leading edge of <f> 1 in machine state T3. The
data and address buses are floated within a brief delay of the rising edge of the
next
INTEL
is
referred to the
2-12.
In Figure 6.15(b)
tristates the
we show
INTEL
8080
SA
=S =
SB
we obtain
A-B,
RA =
for
S 3 c-HLDA
-
A- B- c- ELDA,
= S 'HLDA = A-B-HLDA,
RB =
S2
A-B,
So-c
+ ^ + S;, =
=
S1
JA
therefore
K = B- c-HLDA
therefore
JB
therefore
HOLD =
=B
therefore
= A-HLDA
KB = A
A-B-c + A'B + AB
A-c + B
The corresponding
(primitive) circuit
6.6
In this section
S2
is
= A-B
shown
in Figure 6.16.
Specifically,
INTEL
all
it
first
D.M.A. Problem
Reader
to
RAM interface
the
RAM
HLDA
is
generated.
D.M.A.
6.
SYSTEMS
HOLD A
(13)
logic 1
on
161
INTEL
8080
+ HLDA
(21)
(a)
c.HLDAiJT
50
fin goes
Look
for c
HOLD
f
/'
=
=
=
51
52
fin
fin
tristated
HLDAJ\J
HOLD
t=
HOLD
f =
,45 = 00
fin
tristated for
J?
tristated
tf>
S3
t=
t'
clock pulse
Look
for c
HOLD
t
HLDA
f =
01
10
(b)
Figure 6.15.
HOLD
y~
*
i^A
HLDA
HLDA
System
reset
Figure 6.16.
SOLUTION
Step
Aim
of the design
the design
The aim of
is
to enable the
programmer
to transfer a block of
facility.
The microprocessor
is
162
a pulse on terminal
0.5 to 1.5
of
c,
as
shown
in Figure 6.14.
6.17.
databus
MoInternal
address
o.d.
(output disable)
c.e.
(chip enable)
RAM
R/W
Data
"
Address
~j)<~
o.d.
At
R/W
least
650 nsecs
At
least -
At
least
50 nsecs
150 nsecs
Figure 6.17.
1. Initial
cfc>
memory
address
2.
Block length
3.
'Go'
command
?-^r>^i
Reader
(data source)
i
Interface
Figure 6.18.
address
6.
D.M.A. SYSTEMS
No
163
'
JYes
l^V
f =
No
Yes
Read
into
RAM
No
Decrement/increment
RAM address
Decrement word count
Activate reader
No
Raise e
Stop
Figure 6.19.
'
164
*3g
i
r
o
jossaoojdojonu uiojj
r
MOijjapufi
(moi) junoo
pjo^
wi
6.
D.M.A.
SYSTEMS
165
of our solution
is
shown
is
flow-charted in
Figure 6.19.
Our starting point is the block diagram shown in Figure 6.4, showing a general
The implementation of interfaces 1 and 2 is shown in Figure 6.5
we assume that the block length is not greater than 256 words, then
corresponding system using the INTEL 8080 is shown in Figure 6.20.
d.m.a. system.
and 6.13.
the
If
RAM,
AC with
initial
RAM
address (high)
Load AC with
initial
RAM
address (low)
length
Load
is
OUT
004
Load
RAM
initial
address.
OUT
004
OUT
Load block
004
length.
OUT
Start block
005
transfer.
When
OUT
006
EI
Clear
RET
Return.
flag.
Enable interrupts.
D.M.A. problem 2
System modification
Modify the solution of the previous problem so that only valid data, indicated
by
V=
1,
RAM.
SOLUTION
The specified modification is implemented by suppressing a d.m.a. cycle and
when V-r = 1 [Introducing variable r in the equation
166
= EreV
tVr.
D.D.T. Systems
In this chapter
we
shall
7.1
INTRODUCTION
information which
1.
To
is
Figure
7.1.
it,
as
shown
in
problem
3 in
To
method
is
automatically eliminated.
shown
then print
it,
using a
on the tape, we shall need 2 x n d.m.a. cycles for the actual data transfer plus
half a dozen or so instructions to initialize the two interfaces, as we
explained in the previous chapter. The total time involved in this case,
although considerably
still
likely to
less
is
168
This figure
is
problem. Furthermore,
this
method assumes
which
d.m.a. channels.
3.
To
show diagrammatically
in
Figure
microprocessor, which
is left
7.3.
and the
printer, as
we
is
free to continue
with
its
own
activities,
thus
and
7.3
we do not show
peripherals.
Reader
Memory
-*
m.p.u.
Printer
Figure
7.1.
Reader
'
Memory
m.p.u.
Printer
Figure
7.2.
Reader
Memory
m.p.u.
Printer
Figure
7.5.
the other
7.
D.D.T.
SYSTEMS
7.2 D.D.T.
set)
is
169
SYSTEMS
is
shown
in
7.4. The
means of which
Figure
interface
it
can be
When the user wishes to establish a direct data link between a pair (or
when
one or more of the peripherals are busy, otherwise b = 0. If the devices are
found to be free (not busy) he executes an I/O instruction with the address
given to the interface.
The
by
interface responds
(i)
isolating
to
1,
is
(ii)
When the complete data block has been transferred, signal b changes to and the
bus section becomes untristated.
- a
Hn
Source
'
I/O
Acceptor
Command
Status
signals
signals
Command
'
signals
Status
'
signals
Interface
signals
Figure
7.4.
INTERFACES
7.3 D.D.T.
1]
170
Our
starting point
is
wires. 121
is
From the implementation point of view, the interface is a logic circuit with r t
and
r2
as input signals,
we show below.
Step
External characteristics
See Figure
7.5.
Source
Acceptor
#1
#2
#1
#2
a2
activated
#2 idles
#1
fully
fully
responded
responded
#1 idles
#2 activated
Interface
(b)
(a)
Figure
7.5.
is
active
and device 2
inactive.
The
corres-
ponding
state in
circuit
moves to
state
fSee Appendix
1.
7.
DDT. SYSTEMS
171
S 2 and
in state
"
Interface
(see Figure
7.5(a))
"
Figure
7.6.
s\
SO
S2
#1
#1 responding
a2 =
fl,
idles
#2 responding
#2kttes
Figure
a1
a2
=
=
7.7.
7.7
is
shown in
7.8(a).
optional values.
7.8(b),
we
obtain
"i
r x r 2
+r
r 2
+ (r
-r 2 )
r2
7(1)
r i -r 2
+r
-r 2
+ (ri
-r 2 )
rt
7(2)
7.8(b).
We shall refer to equations 7.1 and 7.2 as primitive interface equations. Their
implementation consists of two wires, as shown in Figure 7.9.
172
01
00
50
av a 2
51
1,0
1,
50
51
10
11
1,0
52
51
52
0,1
1,1
0,1
0,1
(a)
r
l'2
00
01
10
11
\co/
<lol2>
5012
= 0,0
<f>,
0,1
1,0
(b)
Figure
7.8.
'
#2
#i
-/
Figure
Go/No-go
- r
a 2"
7.9.
Control
In order that
we do not
we
specify otherwise,
we
shall start a data transmission with a read operation and end it with a write
operation, as shown in Figure 7.10. Our read and write operations are as
We
0) states of
use signal
our system
diagram, we obtain
The corresponding
ai
= G-r 2 +G-r 2 =
a2
= G-r
circuit
is
r2
shown
in
Figure 7.13.
By
1)
and the
direct reference to
7.
D.D.T.
Start
SYSTEMS
173
~)
No
*C
stop
JYes
Read
Write
Figure 7.10.
a, =
ux
-r 2
= G .^
Read
Write
Figure 7.11.
Figure 7.12.
#2
#1
-
-t 1
AND
Figure 7.13.
A
o-
'stop'
Figure 7.14.
4T
- r
174
If
the start/stop
commands
we can
are pulses,
in
Figure
Read
Inhibit
(/ 2
= 1)
operation (a 2
shown
0)
By
in Figure 7.15.
is
and
a2
= G -r
r2
-i
+G-r
-i 2
we
= G -rj,
as
obtain
'h
\.
=
a-,
a,
G.r,
Figure 7.15.
Write Inhibit
As
(/,
= G -r 2
),
as
shown
we implement
in Figure 7.16.
By
obtain
i
a2
= G -r,
r2
J
i
+G -r 2 -^
/,
=r 2
ax
=0
a 2 = G.rj
a2
a\
G.r 2
Figure 7.16.
'
01
00
al
a2 =
G./-J
a2
ax
a2
'
Figure
10
11
a 1 = G. ri
a read operation
7.17.
=0
=0
ax
=0
a2
G.r 2
we
7.
SYSTEMS
D.D.T.
175
Interface Equations
The values of the action signals for all combinations of read and write inhibit
7. 7. By direct reference to it, we obtain
We
ai
?\
'h
a2
/,
-7
'
+ 'i
r2
-G -^
'h 'G
i
-?2
'
ri
-G
7(3)
-r 2
7(4)
7.4
In this section
although we use the INTEL 8080 to implement our designs, our procedures
apply to all types of microprocessors. Specifically, it should be noted that the
first
three
steps
in
the
design
are
microprocessor.
Problem
Copy
a tape
d.d.t.
mode.
SOLUTION
Step
Aim of the
The aim
d.d.t.
design
of the design
mode.
No
is
to
processing of data
is
required.
is
solution
is
shown
and G.
and a 2 are derived
interface are: a u a 2 , b
Signals a r
directly
176
-*-a
f^Di
^-j.^
G
fin
Tape reader
e.o.t.
Tape punch
(#2)
(#1)
,
,
~r
l
a \~
a2 -
r2
'
'
r
Interface
I/O
signals
1
Figure 7.18.
ft:
I
=
Punch
'
Read
-c
=Tn
e.o.t.
b:
=
"
C_
Stop
Figure 7.19.
7.
D.D.T.
SYSTEMS
The equation
for signal b
r1
a2
= G-r
177
and
2.
r2
is
+ r 2 + e.o.t. see
Figure 7.20
Address
decoder
AND
INTEL
8080
Tape reader
#1
\K
Tape punch
#2
AND
e.o.t.
NAND
~e.o.\
-~OUT
Figure 7.20.
tape
an I/O instruction.
It resets
(e.o.t.) signal.
'go' instruction,
Clean a tape
Copy a paper
(all Is).
SOLUTION
Step
Aim of the
design
is
not be reproduced.
178
(e.o.t.) signal.
is
of our solution
is
shown
U2
AND
G
i
'
/*n
Tape reader
e.o.t
Tape punch
#1
#2
-r
a l~
- /'
'
I/O
r
Interface
signals
Fig ure 7 2 1.
The equation
is
stable.
ax
5-r t
a2
cl'G r 1
for signal b
r1
Signal G, as in problem
-r 2
+ G -r,
-d
is
+ f 2 + e.o.t.
1, is
It is
7.
DDT. SYSTEMS
Start
179
'<
Load tape
No
x^Devices^
^s^ready/^
i
Yes
b:=l
Punch
Read
No
ft:0
Stop
Figure 7.22.
set
by the I/O
(e.o.t.)
'go' instruction
and
is
signal.
'go' instruction,
180
Address
AND
decoder
T
Reader
Tape punch
d'
#1
#2
d'r
x-
AND
r 2-
OR
GINTEL
8080
r \-
AND
d'
AND
d''
AND
NAND
'l
2
e.o.t.
e.o.t.
0/T
WR
Figure 7.23.
7.5
REFERENCES
1.
2.
Zissos D.,
Press, 1976.
Duncan
F.
G. and Colin T.
J.
'Logic-free
Data Channels',
Appendix
Action/Status Devices
The concept of action/status devices
implementation is outlined.
A1.1
In 1974 Zissos,
is
ACTION/STATUS DEVICES
Duncan and
Signals a
and
Signal
A
No
Signal
a.
r.
to
and a
'
2]
status terminal, as
shown
in
Figure Al.l.
signal transition
activation
is
possible
when
0.
(r
1)
or unavailability
(r
0)
A1
.2
we
describe below.
FRONT-END LOGIC
logic
is
shown
is
monitor the status signals of the device and to generate the correct sequence
of command signals to drive the device when action signal changes from to 1
In addition it generates the status signal r. Its implementation is
straightforward and uses the procedures outlined in Chapter 1
to
182
Status
signals
Front-
Action/
end
Device
status
device
logic
Command
signals
Figure Al-1.
The main
Figure
difficulty likely to
useful, in that
it
and command
A 1-2.
is
the correct
we
it is
used to
generate the
status signals.
When
is
first
command
signal
first
command
our front-end logic generates the second command signal. The process
continues until the device has fully responded to the last command signal. At
this point the circuit assumes its initial state when a = 0. This ensures that the
signal,
front-end logic responds only to the leading edge of an action pulse, and allows
the device to free-run by connecting its ready (status) signal to its action
terminal.
Example
Design the front-end logic for a digital printer (Figure Al .3), whose terminal
characteristics are.
Terminal
w A ground on
this terminal
(w
Terminal y Grounding terminal y causes the print hammers to strike and the
paper to advance to its next line position.
Terminal z Signal z = when the print hammers are being activated and the
paper
advancing, otherwise z
a, x and
diagram of a suitable
In this example
state
is
shown
1.
and w, y and
in Figure
r are outputs.
The
APPENDIX
to this
1.
183
diagram we obtain
A = B-x
A = B -a-z l^B + a + z
of B = A -a
turn on set of
Digital
printer
w x
A 1-3.
Figure
51
50
H>=1
M>
yr=
AB-=
00
01
az,
10
LI
w=l
w=
- i
r = z
r ==
52
53
Figure
A 1-4.
A =B-x+A-(B + a + z)
B = A-a+B-(A + z)
w = S t =A'B
y
S
*^2
=A+B
+ S +S 2
1
'
-x
+ S3
"^
= S2 + x
=A+B+x
The
circuit
A 1.5).
A 1.5
184
;=D
H>
:=D>
Figure
A1.3
1.
Zissos, D.,
Duncan,
F.
A 1-5.
REFERENCES
Collin, T.
J.
Calgary, 1974.
'Logic-free
Thesis, University of
Appendix 2
GENERAL
[t]
the
INTEL
8080 as a
result of
evolutionary advances in technology, which have been taking place in the last
ten years or so,
Its
main
features
below.
(i)
Single
This feature
is
Single
System Clock.
The use
of
single-phase
clock
reduces
output on pin 37
The
cycle,
reader's
One phase
built
on the
The
internal circuit
</>.
oscillator.
is
of this clock
is
is
internally a
50% duty
made
(iii)
(iv)
M.P.U. Signals. These are shown in Figure A2.1. Generally speaking they
are clearly-defined and well-chosen, with perhaps two exceptions, (a)
INTEL
[1].
186
READ Y
(35)
a*
^>
d*
A '0' puts the 8085 in the wait state and a '1' takes
The
line is
machine
sampled during
on
cycle,
it
out,
T2 and Tw of each
$ see Figure
states
A2.5.
(6)
TRAP
(9)
RST 7.5
'0'
'1'
to
transition causes
(10)
program
RST6.5
^
^
RST 5.5
INTR
'1'
HOLD
(36)
RESET IN
tristates a, d,
Ml-
RD,
Figure A2.5.
7/1 in
cycle.
(39)
8085
interrupts
(restart) or
INTEL
to vector to
INTR
and
It
also sets
all
KSTmasks
terminal.
Sj
Software halt
(29)
(33)
^
^
I/OM*
WR*
'0'
(32)
RD*
'0'
indicates
(ID
INTA
This signal
(3D
(30)
(3)
is
">
Not
in the input
limited to 1/Os.
mode J
AT
ELDA
ALE*
Use
trailing
as
RD
(pin 32).
tristated at the
lines
to 7.
The
RESET OUT
Indicates 8085
SID
(5)
(4)
-> SOD
(37)
>
</>
Serial
halt'.
is
being
output data.
System clock.
Figure A2.1.
Tristated during 'software
d bus
Instruction fetch
instead of
>
^
an
after
(38)
Read
'1'
(34)
Write
Status information-
reset.
APPENDIX
Terminal
I/OM
THE INTEL
I/OM
signal
will
go high
is
187
8085
tristated
during a software
(logic 1)
when
the microprocessor
is
in a wait state, as
being
(v)
halted,
is
multiplexing operation
is
information. Therefore,
it
during state
d,
carries
no
pins, that
purposes. This
In
instruction-fetch
denoted
cycle,
is
by
Ml
in
Figure
it
The
A2.3.
I
trailing
'ALE'
NTEL 8085 in
edge of A LE
is
allow for set up and hold times for the address information. For
set to
timing diagrams,
if
Ml
71
PC H to^ g -^ 15
PC L to d
d latched with ALE
PC L
M1-T2
l^^L
PChIoAi-Ak
ALE-
dto I.R.
mi-t:
pc l
LATCH
PC H toA t -A ls
Latch to
A 0~ A 7
dtc I.R.
Ml-TA
i,Ml-[T2+
73]
I M1-[T2
PC H toA % -A X5
Latch to
- A7
d tristated
Instruction
Figure A2.2.
73]
05
o
o
SC
sO
r-l
-J
<1-
kj
r-
w-j
II
-<:
o,
SO
rf
>/->
""
r-
ic
*o
^t
rs
<s
<
N^aia^ ivMomaNOD
II
<N
ri
its.
r-
(N
ro
f)
csl
rsl
r-
v%
<N
^-
rj
so
(S
(N
r-l
cs)
3
(50
dwnr iVNOiiiaNOD
so
O
so
CN
SO
-Jso
cT
IMW =
fN
II
SO
p-
r-
rIN
r~
r--
so
Tt
n
II
r~
r-
>*-,
*
m
-J
"J-
u->
<S
O
r-
(^)
*
rj
Q
Z O
IN
r^
r*^
r-
r-
r-
r*^
r~-
v-t
rTt
rso
so
rNj
* Q
Dm
*-
r*^
f~-
so
D-
(Tt
a>
ftO
53
o
u-
rsi
-J
a;
f- _
Um
(X
SO
a:
II
c->
0,
.".
Li
0,
so
t/3
>;
c
'*J
(N
"o
O
o
s
r-
rrs|
X^VXSH^
ao
.o
Im
d HSIld
r~
so
r^i
hJ
:y
s so
3
11V3 IVNOUIONOD
**
ci
v=
T
r-
so
-*t
I<fo
:i->
Tf
>/->
sO
rs
t-
SO
<*i
SO
SO
mw = -v X
dOd
so
O
o
<N
^
c
SO
H=d
d + 1H =
<N
r<M
n
fS
tj-
so
CM
Cv(
(N
CS
(S
- S E s
M O J-
1H
O-
r-
m
VO
<N
r-
<N
II
'"
uvicrH
^
"3
c
I+d =
ro
5 r- '^ (u-i
sj
03
i;
^c
t
=
II
so
<n
*
so
*
fN
<N
r-
ci
/
- SO
^
v = dw 5
<N!
*
1
*
wo
II
a.
O
z
VO
5^ Sp
i
*4
a;
r-
r-
r-
t"-
v~>
<N
cs
-<t
rst
fn
rcs
r-j^-cs
w-i
12
cs
>^lr^t
f">
(N
r^O
r(N
rs
c-i
rs
^o
cm
r^
r-
(N
fS
<
*
f)
SO
so
II
d|AI
= :V
(N
s
w
2
5
_-
Q
_^_
r-
^O
Tt
TJ"
rf
-^
r^
<n
t
n
-^
rs
cn
fs|
fs
rl
r-
V">
vO
CM
(N
m
<N
(N
r-
rs
yn
cs
rs
<n
\o
cs
<N
(N
rs
rs
cs
o
m
rs
r-
in
rs
rs
rs
52
O u
^'
rs
aivioa
>n
:J
-?
sC
o
8
r~-
I--
:j
3
-
I+J =
II
vt
"-3-
|-j =
rfS
ii
..
r*l
l~d= d
:d
rsi
rs
-*t
Tt
rs
\o
rs
<s
rs
Soft,.;
o o-o > K
=58
t
<5
^-
Q
+
S
o
>^<
S
-
>
Mob
55(2
>
03
5
Q ^ S; -J
"<:
kj (J
>
THE INTEL
r~-
^r\
~ B
D
o
00
E'-3
C3
c5
o
"1
_CLJ
XI
3
o
C8
is
0)
OO
2
c
D
oo
<-
<D
IS
Q
O
on
t>
-*
a!
Q
O
00
<y>
en
en
c3
crt
3
E
in
r~
iy->
i/-i
^O
i/^
H
00
H
oo
H
00
a!
OS
aS
CO
co
_*:
2^
'
XI
r~*
D.
7J
=2
C o
JJ c
CO
189
8085
_
00
00
W
oo
^
S
r-
m
2
tJ-
s'z
c en
00
(/3
<
<U
s-c
(50
<
aj
:~r
rii i^lvelmlUi^iglJi
-i-i-i_-iSiSiSi
L_^_l
L__J
__J_ __l_^-l
T
I T T 7 7
190
Instruction Sef\
(vi)
Figure A2.4.
(vii)
Wait /Go Mode. The design and implementation of 8085 wait/go systems,
as with
all
microprocessors,
is
of wait/go logic
The design
would have
been somewhat simpler, had a wait signal been made available to us. A
Nvait' signal, as we have already explained in Chapter 3, is a signal
indicating to the system that the microprocessor has entered a wait (idle)
state.
(viii)
Interrupt Mode.
(ix)
direct
on pins
7,
and 9 and
DMA.
(x)
Mode.
No
special
INTEL
exist
features
(c)
Eight indirect
8080.
the
for
design
and
D.D. T. Mode.
As
INTEL
mode, the
8085 has no
special features.
A2.2
WAIT/GO SYSTEMS
common with
all
signal
on the
'go'
The
wait/go logic, which will allow him to initiate wait/go cycles.
63.
page
on
3.12
Figure
in
shown
is
logic
block diagram of a wait/go
point is the internal state diagram of the INTEL 8085 during
circuit, the
Our
starting
the execution of an
INTEL
M3- Tw
to be initiated
by a
instead of state
to
M3- T3.
change on the
'go'
in Figure A2.6.
fThe instruction set defines the set of operations that can be performed by a central
processor unit.
T
lip
II
II
II
ll
ll
%
Q
^
is
rr
l
ii
Itj}
6
to
OS
+
^
--Or-i
II
II
OOOJ^
o
II
II
II
3
3
ii
II
ii
>**
ilco
1=1
5!
1
^
9-ooto,
-e-H5j
^
3
II
ii
***>
IS
ii
or
ii
>x
*=!
IS
||
0|
^
^
Jl
to
T3
"S,
^+
"
^
S3
IS
c o
t~
3
'B
II
ICp
"
".
<
"
IS
ItO
+;
HOOi/l
-S-ooco
ii
ii
o
to
o
to
+
"
"B. ?f
<u
ICp
n,6
ll
II
4>
"8
-ft
00
ll
>** i ^
1
Q
^
S
Q
^
ll
is
o"
II
IS
*=!
i-H
JL
Co
g.
rii
y-
CO
^
Q
^r
lOOO
II
II
II
"^
0,
=
READY
1*
3
O/M
to
to
-OOto
II
II
II
-S-ooO
_-
IS
ii
"N
>-i <u
^c
I'
Q
S
ii
ii
;.
ll
1-5
II
Q
s
II
II
II
IS
192
"
Address
decoder
INTEL
\a w
8085
IO/M
(34)
</>
(37)
Wait/go
So
(29)
..
(33)
(35)
logic
READY
Figure A2.6.
by
by applying a logic '0' on pin 35. Since this
'0' on the
line is sampled during states T2 and Tw we need to generate a logic
READ Y line when the 8085 enters state M3- T2 and the a bus contains a wait/go
Now,
pulling
reference to Figure A2.5 shows that the 8085 enters the wait state
its
READYhne low,
that
is
The '0' signal on the READ Y line is maintained until the 'go' signal,
'0'
from
to T, at which time we must pull the READ Y line high. This
changes
g,
3- T3, at which point it resumes its
allows the microprocessor to move to state
normal operation. Reference to the m.p.u. chart in Figure A2.1 shows that
during the execute cycle of an I/O instruction a '1' is generated on pin 34. This
address, A w
is
S -S 1
that
l5
is
on page
It
+S
(S
t ).
V and
'g'
</>,
lines.
The reader
is
referred
62.
A2.7.
I/OM
I/OM, A w and
is
diagram
is
shown
in
Figure
operates as follows.
The normal state of the circuit is Q0. This state is maintained while the 8085
maintain
is active and the peripherals using the wait/go mode are inactive. To
is
looking
circuit
our
this
state
In
high.
the 8085 active we keep its READY line
bus
the
address
sample
it
must
purpose
this
For
for a wait/go address, A w
8085
when
the
Now,
Figure
A2.5.
71
in
M3state
in
when the microprocessor is
is in state M3-T1,
I/OM = 1, and
.
l/OM(S + S 1 )A w
to
move
APPENDIX
8
O
II
THE INTEL
8085
193
j
line
1 ^H
come
II
wait
II
II
8085inAf3-7w,
Peripheral
/t42Y
responding
"
[papuodsai
Xnnj |BJ3qdu3,j]
to of
II
II
state
out
high
Pull
Ot
'3
c
0.
*=!
=!
"e3
Ibc
J3
a.
c
<u
El
O
8085inM3-r>v
II
I-H
r^
II
II
from
peripheral
VV
peripheral
8085inM3-n
Activate
read
11
"
Data
01
^1
000
11
11
<
'
11
-.00
11
11
11
11
_c
lO
oo
o Ooo
00
00
OS
o
CO
*=!
IS
,0
< so
^^
J9 *
o
>
</f
^00
II
II
H OO
-e-
II
II
CO
c
-o
13
<<
00
a 00O
II
II
194
io
II
1^
loq
OS
loq
05
U
Q
<
IB
I-t;
Icq
00
oi
<
s-
60
'^Kj,,
TU
o h
to
to
It
N
160
1^
(J
l<J
03
HJ
03
I"
APPENDIX
Because
THE INTEL
in
195
8085
Ql
edge of
<j>,
our
moves
circuit
M3-T2
to state
at the
we do not move
the
to state
READY line high to allow the 8085 to come out of the wait state. It does so
on the next clock pulse. At the same time our wait/go logic moves to state Q5.
Data is read from the accumulator, if the peripheral is a source, when the 8085
is in state M3-T3. Therefore, in state Q5 enable signal e must be high.
From state Q5 we can go directly to state Q0. However, this would result in a
six-state diagram, that is in a circuit with two unused states. To avoid this
Chapter 1 (page
normal operation of our circuit.
Q6 and Ql
in the
when
the 8085
terminal
is
is
we
insert
in state
sampled only
14),
M3-T2
in states
or
M3-Tw
T2 ad
Tw
This
(see
is
because the
READY
Figure A2.1).
Because the 8085 enters the wait state during the I/O execute
can be equated to w see equation 3(a) on page 60.
cycle, signal e
To
is
shown
in Figure A2.7.
SA =
ra =
SB =
=
Q1
By
= ABC,
therefore J A
qS= ABC,
we obtain
= BC
therefore
K A = BC
therefore
JB
Q0jl/OM(S + S 1 )A w + Q 4
ABO I/OM- (S + S
)A w + ABC,
AC-l/OM(S + S
Rs = Q2g + Q6 = ABCg + ABC,
S c = Q3g = ABCg,
R C = Q1 = ABC,
therefore
therefore
therefore
)A w
+AC
K B = ACg + AC
Jc
= ABg
K c = IB
196
System
reset allows
our
and
TRAP
allows
it
emergencies.
The corresponding
circuit
is
shown
in Figure A2.8.
SYSTEMS
A2.3 TEST-AND-SKIP
is
The block diagram of a test-and-skip system using the INTEL 8085 with one
acceptor and one source is shown in A2.ll. Signal rp = 1 when the source has
data available. Similarly, rq 1 when the acceptor can accept data. Tristate
signal ep is generated by ANDing Ap, Rd and I/OM.
RD
IO/M
WR
mode.
is
on r/bus.
Figure A2.9.
A2.4 INTERRUPT
SYSTEMS
[1]
The INTEL 8085, as we have already mentioned, has five interrupt inputs.
TRAP,RST7.5,RST6.5,RST5.5andINTR see Figure A2.12. There areno time
constraints on these inputs they can occur at any time. The interrupt terminals
(pins 6, 7, 8, 9, 10 and 1 1 in Figure A2. 2) are sampled during the last clock period
;
APPENDIX
<***,,
n n
THE INTEL
A/2
A/1
T4
T\
T2
197
8085
A/3
T3
r2
73
^_TLRJLmUl^RJ
RD
I/O (IN)
1
IO/M
"1
I
I/O (OUT)
WR
Figure A2.10.
of the instruction that is being executed. They have a fixed priority relative to
each other, shown below
TRAP
highest priority
RST1.5
RST 6.5
RST 5.5
INTR
lowest priority
m
Address
decoder
An A D An
'P 'q
Other
status
signals
INTEL
Source
Acceptor
#P
#q
8085
Interface
(32)
(34)
MM'
~m
Interface
-*~RD
IO/M
(31)
Figure A2.ll.
Jf7?
198
TRAP
a non-maskable
is
emergency
RST
it
will
(restart) interrupt,
it
high.
The three direct restarts, RST 7.5, RST 6.5 and RST 5.5 can be individually
masked (disabled) under program control using the SIM instruction see
Figure A2.4. Note that RST 7.5 request can be set even though its mask is set
and the interrupts are disabled. Reference to Figure A2.1 shows that a '0' on
pin 36 sets
INTR
is
all
the
it
disables pins
is, if
7,
and 9
in
Figure A2.12.
to the interrupt
It is identical
and enter an
same as the interrupt cycle of the 8080.
is set,
is
the
This cycle is identical to an instruction fetch cycle with two exceptions. INTA
sent out instead of
INTA
is
RST
(6)
INTEL
to execute.
or a
is
<-
TRAP
is
Non-maskable
restart interrupt.
o
to
transition
RST7.5
(9)
This
'0'
to
location
8085
instruction.
RST 6.5
(8)
(7)
(10)
^
<-
RST 5.5
AT
at
INTR
instruction.
jammed on
A CALL
or
RESTART
instruction
is
Asynchronous.
(11)
INTA
>
This signal
after
is
^INTR
is
disabled by
RESET as well
is
accepted.
APPENDIX
THE INTEL
8085
199
microprocessor to push the contents of the program counter onto the stack
before jumping to a new location. If this statement is not clear, the reader is
1 in Chapter 5 (pages 109 and 1 10). Because in the case of the
8080 we have used the RST instruction (see section 5.4, page 120), we shall now
referred to section
CALL instruction.
use the
opcode
in state
M1-T3
in
it
on the data bus when INTA = 0. The program counter is not incremented
during interrupt acknowledge cycles.
During machine cycles MA and M5 the 8085 pushes the upper and then
lower bytes of the PC onto the stack and places the two bytes accessed in M2
and M3 in the lower and upper halves of the program counter. This has the
effect of jumping the execution of the program to the location specified by the
CALL
instruction.
In Figure A2.13
CALL
Initially the counter is reset by the RD
pulse
instruction during an
interrupt cycle.
pulses
on
its
reset line.
AND
INTEL
We
110
after
an
110
A B
AND
AND
rr
rr
A B
A B
8085
INTA
INTA
(11)
TFF
TFF
RD
(32)
Figure A2.13.
is
200
incremented during the trailing edge of a clock pulse, then the correct timing for
CALL instruction is
AB INTAinsert opcode 11001101
AB INTA insert byte 2 (low address)
AB INTA insert byte 3 (high address)
The counter resets with the next RD pulse.
A2.5
1.
MCS85
User's
Manual
REFERENCE
73 555
Index
Asynchronous sequentive
ASCII
circuits
115
characters, 74
Flag identification, 1 1
polling method, 1 1
vectored method, 1 1
Flag sorters (priority encoders)
Boolean algebra, 2
Theorems:
1. Redundancy,
2-flag sorter,
1 1
2.
Race-hazard, 3
3.
De Morgan's
Front-end
logic,
182
Gates, 11
I/O ports, 50
I/O signals,
stretching, 93
Clock-driven
1 1
Boolean reduction, 8
circuits,
25
Clock pulses, 25
Clocked flip-flops, 26
Combinational circuits,
circuits, 113,
Flag, definition,
Accumulator [AC], 34
Clock
Flag
for
for
1
(DFFs), 25, 26
D.D.T. mode, 46
D.D.T. problems and solutions, 175
problem 1: Copy a tape, 175
problem 2: Clean a tape, 177
D.M.A. mode, 46
D.M.A. problems and solutions, 160
problem 1: Reader to
interface, 160
problem 2: System modification, 165
Design philosopy, 53
Design steps, 53
flip-flops
RAM
EPROMS, 48
Event-driven circuits, 20
design factors, 20
design steps, 20
INTEL
INTEL
8080, 97
8085, 185 et seq.
for M6800, 68
I/O synchronization, 39
INTEL
8080,
INTEL
8085
M6800
instruction set for, 80
Interface, definition, 52
Interrupt Acknowledge,
1 1
Interrupt cycle,
INDEX
202
Problem
RAM
2:
Instruction
JK
flip-flops
sequential,
SR
EPROMS, 48
PROMS, 48
RAMS, 49
ROMS, 47
Sequential circuits,
Memories
Memory
see Semiconductor
memories
State reduction,' 14
Microprocessor,
definition, 32
modes of operation, 44
D.M.A., 46
D.D.T., 46
Terminal characteristics
the
PR40
96
printer,
a reader, 96
45
test-and-skip, 45
wait/go, 45
RAM
M.P.U. charts
8080, 43
Motorola 6800, 44
M.P.U. signals, 42
INTEL
INTEL
of,
interrupt, 45
INTEL
INTEL
synchronization, 38
internal,
96
et seq.
(JKFFs), 25, 26
Logic circuits
combinational,
characteristics,
set,
of INTEL 8080, 77
of INTEL 8085, 185
of M6800, 82
Reader terminal
Tristates, 13
Two-wire
8080, 43
8085, 185 et seq.
Motorola 6800, 44
NAND circuits,
NAND gates,
interfaces
Unused
states, 14
Wait/go
cycles,
82
concept, 56
logic,
62
for the
Program,
for the
Program
definition, 32
for the
charts,
for
INTEL
8080, 76
for
M6800,
81
PROMS,
48
Pulse-driven circuits,
for the
definitions, 13
RAMS,
49, 162
M6800
M6800
8080, 63
8085, 185 et seq.
(circuit 1),
67
(circuit 2), 71
Wait/go mode, 45
Wait/go states, 38
Wait/go systems, 55
main
Race-free diagrams, 21
Race-hazards, 13
INTEL
INTEL
properties, 56
book
about
is
how
ihose
inst
be of great interest lo
medical physics and biolechanicaJ engineering, and
will
rumen la lion.
Other hooks by D. Zissos art: Logic Design Algorithms (1972), Digital Interface
Design (1974), and Problems and Solutions in Logic Design (1976), all published by
Oxford University Press.
Printed
in
England
NSW
2113, Australia
0.12.781750,6
mm