Hazards in Digital Logic and Switching
Hazards in Digital Logic and Switching
Hazards in Digital Logic and Switching
o A
hazard
is
a
momentary
unwanted
switching
transient
at
a
logic
func?on s
output
(i.e.,
a
glitch).
o Hazards/glitches
occur
due
to
unequal
propaga?on
delays
along
different
paths
in
a
combina?onal
circuit.
o Can
take
steps
to
try
and
eliminate
hazards.
o For
asynchronous
circuits
in
par,cular,
hazards
can
cause
problems
in
addi,on
to
other
issues
like
races
and
non-‐fundamental
mode
opera,on!
n Momentary
false
logic
func2on
values
in
an
asynchronous
circuit
can
cause
a
transi2on
to
an
incorrect
stable
state!
n Occurs
when
output
is
0
and
should
remain
at
0,
but
temporarily
switches
to
a
1
due
to
a
change
in
an
input.
o Sta?c-‐1 Hazard:
n Occurs
when
output
is
1
and
should
remain
at
1,
but
temporarily
switches
to
a
0
due
to
a
change
in
an
input.
1 1
0 0
static-0 hazard (0->0) static-1 hazard (1->1)
n Occurs
when
an
input
changes,
and
a
circuit
output
should
change
0
-‐>
1
or
1
-‐>
0,
but
temporarily
flips
between
values.
1 1
0 0
dynamic hazard (0->1) dynamic hazard (1->0)
AND2
OUTPUT GLITCH!!!
bc
00 01 11 10
a
0 0 1 0 0
1 0 1 1 1
f=ab+b'c
o Observe
that
when
input
b
changes
from
1-‐>0
(as
in
the
previous
?ming
diagram),
that
we
jump
from
one
product
term
to
another
product
term.
n If
adjacent
minterms
are
not
covered
by
the
same
product
term,
then
a
HAZARD
EXISTS!!!
bc
00 01 11 10
a
0 0 1 0 0
1 0 1 1 1
f=ab+b'c + ac
o The
extra
product
term
does
not
include
the
changing
input
variable,
and
therefore
serves
to
prevent
possible
momentary
output
glitches
due
to
this
variable.
1 a AND1
b
1->0
AND3
1->1
o If
we
work
with
Product-‐Of-‐Sums,
we
might
find
sta?c-‐0
hazards
when
moving
from
one
sum
term
to
another
sum
term.
We
can
remove
these
hazards
by
adding
redundant
sum-‐terms.
o We
can
draw
the
transi?on
table,
and
see
that
there
is
the
poten?al
to
end
up
in
an
incorrect
stable
state.
1 a curr
1->0 next state output
b state
1->0 Y=ab+b'y
ab=00 01 11 10
y Y Y Y Y
y 0 0 0 1 0 0
1 1 0 1 1 1
o 2-‐level circuits are easy to deal with and hazards can be removed…
o The
situa?on
is
harder
with
mul?-‐level
circuits
in
which
there
are
mul?ple
paths
from
an
input
to
an
output:
0->1 x
a 1
w 1->0->1
1 1 f
1b y
1->0 1 0->1 0->1->0->1
1c 1->0
1
1d z
o Hazards
like
this
are
hard
to
fix.
We
could
always
find
a
2-‐level
circuit
of
the
previous
circuit
and
get
something
hazard
free…
R (reset) Q S (set) Q
S (set) !Q R (reset) !Q
o Consider our original circuit with a sta?c-‐1 hazard (temporary 0 at output):
1 a bc
b 00 01 11 10
1->0 a
f=ab+b'c 0 0 1 0 0
1 0 1 1 1
1 c f=ab+b'c
o Since
we
are
trying
to
fix
sta?c-‐1
hazards
we
need
to
be
able
to
tolerate
momentary
0s
at
latch
inputs
=>
Use
a
SR
Latch
(NOR
Latch).
o To
get
the
func?on
f
from
the
latch
output,
we
need
equa?ons
for
S
and
R
of
the
latch
(so
that
the
latch
gets
SET
when
f
should
be
one,
otherwise
RESET).
bc bc
00 01 11 10 00 01 11 10
a a
0 0 1 0 0 0 1 0 1 1
1 0 1 1 1 1 1 0 0 0
Equation for S Equation for R
1 a 0->0
b
1->0 R
0->0 f
1->1
1 c 0->0
1->0
S
0->0
1->1
1->0->1
0->1
o Note: we always have output values assigned for stable states!
o We
should
think
about
the
what
happens
with
the
unspecified
output
values…
n They
are,
in
effect,
don t
cares
that
we
can
exploit
during
minimiza?on
of
the
output
logic
equa?ons.
n But,
we
might
temporarily
pass
through
these
values
while
transi?oning
from
one
stable
state
to
another
stable
state.
o Depending
on
the
output
equa?ons
that
we
derive
(due
to
minimiza?on
of
the
output
equa?ons),
we
might
end
up
having
glitches
at
our
circuit
outputs.
n Glitches
are
bad;
they
could
get
fed
into
another
circuit
causing
problems.
They
also
waste
power.
o Consider
a
transi?on
between
two
stable
states
due
to
a
change
in
an
input
value
and
how
it
might
be
best
to
assign
the
don t
care
value
in
an
unstable
intermediate
state:
n If
both
stable
states
produce
a
0
output,
make
output
0
instead
of
a
don t
care.
n If
both
stable
states
produce
a
1
output,
make
output
1
instead
of
a
don t
care.
n If
stable
states
produce
different
outputs,
the
output
can
remain
a
don t
care
and
be
used
to
find
a
smaller
output
circuit.
o This
will
enable
us
to
avoid
output
glitches
when
passing
through
unstable
temporary
states.
o The
above
changes
will
avoid
temporary
glitches
at
the
outputs
during
transi?ons
where
the
output
should
not
change.