0% found this document useful (0 votes)
696 views

Hazards in Digital Logic and Switching

Hazards occur due to unequal propagation delays in combinational circuits, causing temporary glitches at logic function outputs. There are two types of hazards: static hazards occur when an output temporarily switches values but should have remained the same, while dynamic hazards occur during intended output transitions. For asynchronous circuits, hazards can cause transitions to incorrect stable states. Hazards in two-level circuits can be eliminated by inspecting K-maps and adding redundant product or sum terms not affected by changing inputs.

Uploaded by

Ayush Mukherjee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
696 views

Hazards in Digital Logic and Switching

Hazards occur due to unequal propagation delays in combinational circuits, causing temporary glitches at logic function outputs. There are two types of hazards: static hazards occur when an output temporarily switches values but should have remained the same, while dynamic hazards occur during intended output transitions. For asynchronous circuits, hazards can cause transitions to incorrect stable states. Hazards in two-level circuits can be eliminated by inspecting K-maps and adding redundant product or sum terms not affected by changing inputs.

Uploaded by

Ayush Mukherjee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Hazards

 
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  There  are  two  types  of  hazards;  sta,c  and  dynamic.  

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!  

ECE124  Digital  Circuits  and  Systems   Page  1  


Sta?c  hazards  
o  Sta?c-­‐0  Hazard:  

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)

ECE124  Digital  Circuits  and  Systems   Page  2  


Dynamic  hazards  
o  Dynamic  Hazard:  

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)

ECE124  Digital  Circuits  and  Systems   Page  3  


Illustra?on  
o  Consider  the  following  circuit  with   1 a AND1
1
delays  where  only  one  input  (input   b 1->0
1->0
b)  changes…   10->1 1 f=ab+b'c
INV 1->???
o  Draw  a  ?ming  diagram  to  see  what   1 0->1
happens  at  output  with  delays.   1 c AND2

o  From  the  logic  expression,  we  see  


that  b  changing  should  result  in  the   b
output  remaining  at  logic  level  1…  

o  Due  to  delay,  the  output  goes  1-­‐>0-­‐ INV


>1  and  this  is  an  output  glitch;  we  
see  a  sta,c-­‐1  hazard.   AND1

AND2

OUTPUT GLITCH!!!

ECE124  Digital  Circuits  and  Systems   Page  4  


Fixing  hazards  (2-­‐level  circuits)  (1)  
o  When  circuits  are  implemented  as  2-­‐level  SOP  (2-­‐level  POS),  we  can  detect  and  
remove  hazards  by  inspec?ng  the  K-­‐Map  and  adding  redundant  product  (sum)  terms.  

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!!!  

ECE124  Digital  Circuits  and  Systems   Page  5  


Fixing  hazards  (2-­‐level  circuits)  (1)  

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.  

ECE124  Digital  Circuits  and  Systems   Page  6  


Fixing  hazards  (2-­‐level  circuits)  (3)  
o  The  redundant  product  term  is  not  influenced  by  the  changing  input.  

1 a AND1
b
1->0

INV AND2 1->1


1 c f=ab+b'c+ac

AND3
1->1

ECE124  Digital  Circuits  and  Systems   Page  7  


Fixing  hazards  (2-­‐level  circuits)  (4)  
o  For  2-­‐level  circuits,  if  we  remove  all  sta?c-­‐1  hazards  using  the  K-­‐Map  (adding  
redundant  product  terms),  we  are  guaranteed  that  there  will  be  no  sta?c-­‐0  hazards  or  
dynamic  hazards.  

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.  

ECE124  Digital  Circuits  and  Systems   Page  8  


Hazards  in  asynchronous  circuits  
o  Consider  our  first  circuit  with  a  hazard,  but  assume  it  is  not  combinatorial,  but  rather  
asynchronous.  

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

ECE124  Digital  Circuits  and  Systems   Page  9  


Hazards  in  mul?-­‐level  circuits  (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

ECE124  Digital  Circuits  and  Systems   Page  10  


Hazards  in  mul?-­‐level  circuits  (2)  

o  Timing  diagram  shows  output  changing  0-­‐>1-­‐>0-­‐>1.  

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…  

ECE124  Digital  Circuits  and  Systems   Page  11  


Fixing  hazards  with  latches  (1)  
o  Can  also  fix  hazards  using  SR  or  S R  latches.  
n  An  SR  Latch  can  tolerate  momentary  0s  appearing  at  its  inputs  (since  we  might  momentarily  move  
from  a  set  or  reset  to  a  hold  and  then  back).  
n  An  S R  Latch  can  tolerate  momentary  1s  appearing  at  its  inputs  (since  we  might  momentarily  move  
from  a  set  or  reset  to  a  hold  and  then  back):  

R (reset) Q S (set) Q

S (set) !Q R (reset) !Q

ECE124  Digital  Circuits  and  Systems   Page  12  


Fixing  hazards  with  latches  (2)  

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

ECE124  Digital  Circuits  and  Systems   Page  13  


Fixing  hazards  with  latches  (3)  
o  Consider  that  we  take  our  output  f  from  the  output  of  a  latch.      

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

ECE124  Digital  Circuits  and  Systems   Page  14  


Fixing  hazards  with  latches  (5)  
o  Draw  a  circuit  using  the  latch,  and  see  that  glitch  in  output  due  to  the  hazard  is  gone.  

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

ECE124  Digital  Circuits  and  Systems   Page  15  


Output  assignment  in  asynchronous  circuits  
o  Flow  and  transi?on  tables  might  have  unspecified  entries  for  circuit  outputs.  
n  This  might  be  a  result  of  the  fundamental  mode  assump?on.  
n  This  might  be  a  result  of  unstable  states.  

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.  

ECE124  Digital  Circuits  and  Systems   Page  16  


Avoiding  output  glitches  
o  Consider  the  following  flow  table  with  don t  cares  at  some  outputs  (circuit  has  one  
input  and  one  output):   next state output
curr
state x=0 x=1 x=0 x=1
a a b 0 -
b c b - 0
c c d 1 -
d a d - 1

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.  

ECE124  Digital  Circuits  and  Systems   Page  17  


Example  
o  If  we  consider  possible  transi?ons,  we  see  that  some  of  the  output  don t  cares  
should  be  changed  to  0  or  1  to  avoid  glitches.  

curr next state output curr next state output


state x=0 x=1 x=0 x=1 state x=0 x=1 x=0 x=1
a a b 0 - a a b 0 0
b c b - 0 b c b - 0
c c d 1 - c c d 1 1
d a d - 1 d a d - 1

o  The  above  changes  will  avoid  temporary  glitches  at  the  outputs  during  transi?ons  
where  the  output  should  not  change.  

ECE124  Digital  Circuits  and  Systems   Page  18  

You might also like