Intern ati o n a Journ a l of  Re con f igur able  and Embe dded  Sys t ems  (I JRES)  V o l.  1, N o . 3 ,  N o v e m b er  2 012 , pp . 75 ~86  I S SN : 208 9-4 8 6 4    75        Jo urn a l  h o me pa ge : h ttp ://iaesjo u r na l.com/ o n lin e/ind e x.ph p / IJRES    Queu ed-Stack Dat a flow Processi ng Element for a Cognitive  Sensor Platform   Mar k  McDer m ot t   Department o f  Electrical and Co mputer Engi n eer ing, Univ ers i t y   of  T e xa s at  Au st in       Article Info    A B STRAC T Article histo r y:  Received Aug 5, 2012  R e vi sed Oct  1,   2 0 1 2   Accepted Oct 13, 2012      This  pape r des c ribes  a Qu eued- S tack (QS )  Dat a flow P r oces s i n g  Elem en t   (DPE) that is used in a cognitiv e sens or platfor m . The queued- stack is used   for buffering in put data  to the  DPE and  for storage of variables and results.  The queuing mechan ism and d a taf l ow pr otocol provides the capability  to   com pose m u lti- node com putatio nal s y s t em s where com m unicat i on between  elements is via n on-blocking FIFO ch annels . S y s t em  com position is achiev e d   using sy n c hrono us dataflow tools such  as  SDF3  or Ptolemy .  Th e dataf l ow- proces s i ng elem ent is  im plem ented us ing single cy cle micro- co ded engine  where the rat i o  of datapath tr ansistors to control logic is op tim ized for   program m a ble e n erg y -perform an ce s e ns i tive  app l ica tions .   Keyword:  Q u eu ed -S ta c k    Dataflow Proc essor  C o m posabl e  S y st em   Syn c hro nou s D a taf l ow  Co gn itiv e Sen s o r  Platform  Copyright ©  201 2 Institut e  o f   Ad vanced  Engin eer ing and S c i e nce.  All rights re se rve d Co rresp ond i ng  Autho r Mar k  McD e r m o tt  Depa rt m e nt  of  El ect ri cal  and   C o m put er E ngi neeri n g ,   Un i v ersity of  Tex a s at  Au stin  1   U n i v er sity St atio n  C 0 803 Au stin , Tex a 7 8 7 12- 021 Em a il: mcderm ot@ece.utexas.edu       1.   INTRODUCTION  Th n e x t  step   in  th e evo l u tion   o f  i n tellig en t  sen s o r s is toward s cogn itiv sen s o r s. Cogn itiv e sen s or  p l atform s h a v e  th e cap ab ility  to  reaso n  about b o t h th eir  ex t e rn al en v i ronmen t an d  i n tern al con d ition s   an d  t o   m odi fy  t h ei r p r oces si n g   beha vi o r  a n d  co nfi g u r at i o n i n   an  o ngo ing  effo rt  to   o p tim ize th eir op erati o n relativ to  th e d e v i ce’s relev a n t  op ti mizatio n  criteria  [1 ]. Th is  req u i res i m p r ov ed  co m p u t atio n a l cap a b ility to  p e rform  th e add itio n a l  task s, with i n  th e sa m e  en erg y  bud g e t as an  in tellig en t sen s o r  syst e m . Gen e ral - pu rpo s com put i ng  pl at form s do  not  have t h e e n e r gy - p e r f o rm an ce characterist i cs neede d   fo r lo w  en erg y  sen s or  syste m s. Hard-code d  logic  would  pr ov id e th e m o st o p timal  energy-pe r form ance but at  the expens e of  re- pr o g ram m abi l i t y . The basi c archi t ect u r e of t h e sens or  pl at f o rm  i s  shown  bel o w i n  Fi g u r e  1. The p r oce ssi ng  el em ent  used  i n  t h i s  pl at f o rm  i s  im pl em ent e d usi n g  an  ene r g y  effi ci ent  st ac k- base d m i crocode d e n gi ne.       Fi gu re  1.  Se ns or  Pl at fo rm  Ar chi t ect ure   Evaluation Warning : The document was created with Spire.PDF for Python.
               I S SN :2089 -48 64    I J RES   Vo l. 1 ,  N o . 3 ,    Nov e mb er  201 75  –  86    76 A key cha r ac teristic of a  sensor  system   is that it  is prim arily a reactive syste m  where a  c h ange i n  the   v a lu e of a senso r  inpu t will au to m a tical ly f o rce recalcu l atio n  of th e v a l u es o f  o t h e v a riab les in  th e syste m The  pr ocessi n g   of se ns or  da t a  i n  a react i v e sy st em  i s  op t i m a l l y  done  u s i ng a  dat a fl o w - p r o cessi ng   el em ent  (DPE) [2]. The DPE is “fired” on ce all t h e data tokens have been received.  Upon com p let i on of the  co m p u t atio n  the d a tafl o w -processin g  elem en t is id led ,   waitin g fo r t h n e x t   tran ch o f  t o k e n s   fro m  th e chan n e l   no de.   The pa ssing of toke ns is best  accom p lished  using  a que u ing (FIFO) m echanism ,  which is insensitive   to  th v a riab le laten c y o f  t h e in pu t sensor data; th u s   elimi n atin g th n e ed  fo r th DPE  to  fetch  and  st o r e t h sens or data on the  stack (L IFO).  T h is  arc h itecture  m e rg es  a queui n g m e c h anism  into  a s t ack-based processing  ele m ent. The result is queue d-stack that  is used  to  sto r e inp u t  d a ta fro m   a sen s or ch annel as well as r e su lts  fr om  t h e com put at i on  o p erat i ons  i n  t h dat a pat h .     The m e rged  que ue d-stac ele m ent provi d es a n  ideal  mechanism  for  bu ild ing  a  syn c hr ono us  dat a fl o w  sy st em . Processi n g   of dat a  i s  t r i g gere d w h en  the correct numbers  of toke n s  are in serted  in to  the  q u e u e . Th e ab i lity to  si m u lta n e ou sly read   or write to   th e q u e u e d - stack  prev en ts u n n ecessary  stallin g  o f   t h dat a fl o w - p roce ssi ng el em ent .  The zer o- ov erhea d  nest e d -l o opi ng , repe at  funct i o n a nd t h e c o n d i t i onal   ex ecu tion  m i cro - op eration s   resu lt in  ex cellent energy-perfo rmance efficie n cy.  Thi s   pape pre s ent s  a  uni que   im pl em ent a t i o n o f  a sy nch r o n o u dat a fl ow - p r o cessi ng el e m ent  fo r u s in reactive sy ste m s. The queue d -s tack a r chitecture and m i crocode co n t ro l pro v id e op ti m a l e n erg y - p e rform a n ce for en erg y  li m i ted  in tellig en t/cogn itiv e sen s o r  p l at form s. Th to k e n - b a sed   ch ann e co mm u n i catio n   p r o t o c o l   p r ov id es th e cap a b ility to  co m p o s e co m p lex  syste m s o f   h e terog e n e ou d a t a -flow  processi ng elements.      2.   SYSTE M  CO MPO S ABILI T As m e nt i oned  abo v e t h que u e d-st ac k arc h i t ect ure  provi de s a  m echanism to easily co m pose systems   by  co nnect i ng  pr ocessi ng  n o d es  vi a cha nne l  no des. T h e c h an nel  n o d es i m pl em ent  a synch r on o u s dat a fl o w   pr ot oc ol  w h er e dat a  t oke ns  are t r ans f er re d  fr om  one no de an d co ns u m ed by  anot h e r n ode  usi n g  a no n- bl oc ki n g  F I F O  [9] .  Sy nch r on ous  dat a fl ow  t ool s s u c h  as S D F 3  [ 1 0]  and   Pt ol em y  [11]  c a n be  use d  t o   c o m pose  and sim u late the sens or syste m .   Figure  2 below s h ows a “c om posed system” consistin of a cl ust e o f  DPEs , se ns or  el em ent s  and   associ at ed c h a nnel   n odes ,  a n  o u t p ut  com m uni cat i o ns  ele m ent and a  de bug elem ent. This c o nfigura tion is   u s ed  for b a sic d a taflow pro c essin g   o f   d a ta fro m   m u ltip le  sen s ors. Th DPEs can  b e   syn t h e sized  t o  h a ve  h e tero g e n e o u s  co m p u t atio n a l  cap ab ilities b a sed   o n  th e al g o rith m i c req u irem en ts o f  the syste m . Each   DPE  can  be c o nfi g ure d  t o   ha ve  one   or  t w o i n put -QS  el em ent s   depe n d i n g  o n   h o w  m a ny  cha nnel s  ne ed t o   be   pr ocesse d a n what  t h e st ora g e re qui rem e nt s are  fo r t h e algorithm s  being  execute by the DPE.          Fi gu re  2.  Exa m pl e of a “C o m posed Sy st e m ”    The channel node s are  used  to connect a  DPE (or cl usters  of  DPEs ) to t h e sensor element(s ) . T h channel nodes  buffe r the transactions  fr om  the se nso r s a n d  fo rwa r d t h d a t a  t oken s  t o  t h e D P E. Eac h   DPE   has an i n t e gr at ed o u t p ut  cha n nel  n ode t h at  i s  used t o  co n n ect  t h e out put   of a  DPE t o  t h e i n put  o f  an ot he DPE.   Evaluation Warning : The document was created with Spire.PDF for Python.
I J RES   I S SN 208 9-4 8 6 4         Que u e d - S t a ck   Dat a f l o w  Pr oc essi ng  El eme n t  f o a C o g n i t i ve Se ns or Pl at f o rm ( McDe r m o t t )     77 3.   DAT AFLOW PROCESSING  ELEMENT   The proce ssing ele m ent used for  this platform  is  im ple m ented as a stack-base d  microcode d engine   wi t h  a dva nce  f eat ures s u c h  a s  nest e d  l o opi ng , c o n d itional  exec ution, re peat  execution  and a programmable  l o o k u p  t a bl f o r  rec o n f i g u r a b l e  f u nct i onal   ope rat i o ns.  Fi g u re  3  bel o w  s h o w s  a  bl oc di ag ram  of t h e  DP i m p l e m en ted  u s in g  thr ee Q S   ele m en ts an d  on e ou tpu t  FI FO  ch an n e l node. Th e in pu t QS ele m en ts ar u s ed  to   receive cha n ne l data from   two sources  or they can be c onfigured s u ch that one QS  element is receiving  data   whi l e  t h ot he r i s  pr ocessi ng  dat a  fr om  a previ ous t r a n sa ct i on. T h e R e s u l t - Q S  i s  use d  t o  st ore t h h i ghe preci si o n   res u l t s  o f  t h e  dat a pat h   ope rat i o ns.          Fi gu re 3.   Dat a f l ow Pr ocessi ng   El em ent      The DP E i s  im pl em ent e d usi n g a param e t e rized sy nt hesi ze d m odel  where  t h e wi dt h an d dept h of t h e   stack s,  fun c tion a l un its, an d data-p ath s  are determin ed   du ri ng  al g o ri t h m i c devel opm ent time. For systems that   are com posed  of m u ltiple DPEs, it is  feasible for each  DPE to be confi g ur e d  for a task or group  of  tasks  du ri n g  t h e sy nt hesi pr ocess  b y  sel ect i ng t h e   opt i m al  param e t e rs.   The m i crocode  st ora g e i s  im pl em ent e d usi n g  a st andar d  si n g l e  p o rt  R O M   or  WC S ( w ri t e abl e  co nt rol   st ore )  m e m o ry com p i l e r. T h W C S  co nfi g urat i o n i s   us efu l  fo r system s  wh er e th e m i croc ode  needs  to  be   up dat e d  f r om  an e x t e r n al  so u r ce suc h  as  flas h m e m o ry [3].      4.   QUEUE D - S T A C K  AR CHI TECTURE   The Que u ed-Stack (QS) is im ple m ented as a circular  buffer that has two circular  poi nters, one to  t r ack t h e L I F O  (st a c k dat a  and t h ot he r  one t o  t r a c k t h e FI FO  (q ue ue)  dat a . A t h ree- deep  QS i s  sho w n   bel o w i n  Fi g u r e 4. T h e FI FO  poi nt er t r ac ks  dat a  “i nsert e d  in to  th e qu eu e fro m  e ith er the ch ann e l d a ta  o r  th resu lt  d a ta  from  th e d a tap a th op eration s . Th e LIFO  po in t e r i s   use d  t o  t r ack  p u she s  a n po ps  f r om  t h e st ack.   Th QS can  insert d a ta in t o  t h e qu eu wh il e si m u ltan e o u sly p u s h i ng  or  p opp ing   d a ta on /off t h e stack. Th is  allo ws ch an n e l  d a ta to b e  asy n chro nou sly inserted  i n to  t h q u e u e  elem en t wh ile th e co mp u t ation a l en g i n e  is  pr ocessi ng  dat a  fr om  a pre v i o us t r a n sact i o n.     PUS H   PO P / I N S E R T   PU S H   TOS   BO S   TO S   BOS   OUT P U T   CHA N NE L   DAT A   I MME DI A T E   DA T A   RES U LT_B US   Inp u t   Qu eue d Stack   Res u lt   Qu e u ed Stack   RE S U LT _BU S   RE S U LT _BUS     PO P / INSERT   PUS H   TOS   BO S   Inp u t   Qu eue d Stack   RES U LT_B US   IN P U T    C H A NNE L   DA T A           Da tap a th                 Out put   FI FO   (C hann e l   No de)       RES U LT_B US     POP / IN SE R T     Mi c r o Cod e   En gi ne       Se qu enc e r   GPIO   IN PUT   GPIO   OU T P U T   R E S U LT_B US   Op   Qu eu e   Even ts   Re c i r c ula t e   IN P U T    C H A NNE L   DA T A   Evaluation Warning : The document was created with Spire.PDF for Python.
               I S SN :2089 -48 64    I J RES   Vo l. 1 ,  N o . 3 ,    Nov e mb er  201 75  –  86    78 The m i crocode  engi ne ha ndl e s  t h e QS  dat a  m a nagem e nt . The en gi ne ca n  sel ect  i f  t h e QS i s  avai l a bl e   to receive inse rted data  while  the com putational e ngi ne  is active (“push m ode”) or  if t h e QS  will fetch the  dat a  f r om  t h e c h an nel   once  t h e com put at i on  t a sk i s  c o m p let e d  (“pu ll m o d e”). Pu ll-m o d e   allo ws t h e QS  to  be  u s ed  as a circular bu ffer t o  st o r e i n term ed iat e  d a ta  u s ed  i n   man y  filterin g   alg o rith m s . Note: in  p u ll-m o de, th out put   dat a  m u st  be st ore d  i n   an  out put   FI F O  c h an nel   no d e  t o   pre v e n t  st a l l i ng t h p r oce ssi ng  el em ent .        Figu re 4.   Th re e-dee p  In p u Q u eue d -Stack       As sh o w n a b o v e i n  Fi g u re  4,  bot h t h e t o p - o f-st a c k  (T OS)  dat a  and t h e b o t t o m - of-st a c k  (B OS)  dat a   can  be acce sse d sim u ltaneously. In add ition, the  pointers c a be m a nipul ated   by the m i croc ode to sele ct data   anywhere i n  the circular  buffer. For  e x am pl e, t h e LI FO  p o i nt er can  be  ro t a t e d fi ve  po si t i ons t o  t h e ri g h t  an t h F I F O  poi nt er  ca n be rot a t e d 5 po si t i ons  t o   t h e   l e ft  in a sing le in stru ct io n   b y  ex ecu tin g a  n on-write POP  command, a  non-write INSE RT  com m and wi t h  a R E P E A T  o f  5  w h i l e  execut i n g a  dat a  pat h  i n st r u ct i on  a n d   sto r ing  t h resu lt in  th e RESULT-QS,  t h e I n p u t- QS,  a n d  the  Out put -FI F O.    Tabl e 1  bel o w s h o w s t h ope rat i o ns t h at  t h e Q S  s u p p o rt The  basi c  ope rat i o ns i n cl ude  PUS H ,   POP/POP_W R  an d   INSERT  th at write d a ta to  eith er th e T O S or BOS and selectively rotate the appropriate   p o i n t ers. Th e sa m e  o p e ration s  can also b e  merg ed  t o   p r ov id e t h e ab ility t o  st o r e resu lts  to  th e TOS and  B O in a si ngle  writ e cycle.    Table 1. Queue d -Stac k  Operat ions   Operation  Description   PUSH  Rotate T O S pointer  “r ight” a nd write  result-bus value to new TOS   POP   Rotate TOS  pointer “ l eft” (no write)  POP_WR   Rotate TOS  pointer “ l eft” a nd write  result-bus value to new TOS   INS   Rotate BOS pointer “ l eft” a nd write  result-bus value to BOS  INS_N W   Rotate BOS pointer “ l eft” without writing   PUSH_NW  Rotate T O S pointer  “r ight” ( no wr ite)  T O W r ite r e sult bus value to T O w/o r o tating pointer   BOT  W r ite r e sult bus value to BOS w/o  r o tating pointer   TOP_BOT   Writ e result bus va lue to  T O S/BOS w/o r o tating pointer PUSH_I NS  Rotate both pointe r s and wr ite  result-bus value to TOS/ BOS    POP_BOT  Rotate T O S pointer  “lef t” and write  result-bus to BOS  POP_INS   Rotate TOS  pointer “ l eft”, rotate  BO S “ l eft” and write result-bus to new BOS  POP_W R _BOT  Rotate T O S pointer  “left” a nd wr ite  result- bus to BOS and to new T O PUSH_BOT  Rotate T O S pointer  “r ight” and  write  result-bus to BOS  and to new TOS   T O P_I N Rotate BOS pointer  “left” and  write  result-bus to TOS a nd to new BOS   NOP  No  Operation    C h anne l Dat a   Re ad  BO S   R e ad T O S   PU S H   POP   INSER T   Wr i t e  B O S   Wr i t e  T O S   Re s u l t  B u s   St a ck P o inter   R e gi s t er   St ack  P o inter   R egister  Stac k Pointe Re gi st er   Que u e P o inter   R egister  2 R D/ 2 W RA M  W o r d   2RD/2WR  RA M  W o r d   2 R D/ 2 W RAM W o r d   Queue Point e R e gi s t er   Que u e Pointer   Re gi st er   Evaluation Warning : The document was created with Spire.PDF for Python.
I J RES   I S SN 208 9-4 8 6 4         Que u e d - S t a ck   Dat a f l o w  Pr oc essi ng  El eme n t  f o a C o g n i t i ve Se ns or Pl at f o rm ( McDe r m o t t )     79 5.   DPE DAT AP ATH   Th e DPE d a tap a th  is co m p o s ed  o f  fi v e  m a j o r elem en ts: s h ifter, m u ltip li er, add e r, lo g i cal u n it (LU)  an d  a sp ecial fu n c tion  un it (SFU). Th e latter two  ele m en ts  can be eliminated during  syste m  synthesis if they  are  n o t   n e ed ed . Figu re 5 below sho w s th e datap a th  con f igu r ation  i n clud in g th e m u ltip le x i ng   u n its t h at  co n t rol   t h e dat a   fl o w  t h r o ug h t h dat a pat h .         Fi gu re 5.   D P E Dat a pat h       The dat a pat h   m u lt i p l e xers h a ve l a t c hed  o u t put s,  wh ich  can  store in termed iate d a ta an d  are u s ed  to  p r ev en t spu r i o u s  tran saction s  p r op ag ating  t h rou g h  th sh i f ter-m u ltip lier-ad d e p a th s t h u s  redu cing   po wer.  Th Write-Back - M UX m u ltip lex e s d a ta from th e Ad d e r,   SFU, lo g i cal un it an d  the GPIOs t o  th e result b u s The res u lt bus is connected to the th ree QS ele m ents and the output FIFO  v i a th e m u lt ip lex i ng  sch e m e  sh own  above i n  Fi gure 3. T h e Res u lt-QS is  used to  store t h re su lt s of th e d a tap a t h  tran saction s   an d is syn t h e si zed  to  be t h wi dt o f  t h e A dde r.  A n  In p u t - Q S  can  al so be  use d  to sto r resu lts,  ho wev e r it is li mited  to  sto r ing  d a ta  th at is th wid t h   o f  th e i n co m i n g  ch an nel d a ta.  Tab l e 2   b e low  show s th e op er an d sour ces  f o r  th co m p u t atio n a l in stru ction s .     Tab l e 2 .  D a tapath    O p er an So ur ces  Shifter  Multiplier/LU/ S F U   Adder   TOS/BOS  IQS1   SHIFT E R_A/SH I F TER_B   SHIFT E R_A/SH I F TER_B   TOS/BOS  IQS2   TOS/BOS  IQS1   TOS/BOS  IQS1   TOS/BOS  RQS   TOS/BOS  IQS2   TOS/BOS  IQS2   I M ME DI A T E  DAT T O S / BO S R Q T O S / B O S R Q   I M ME DI A T E  DAT I M ME DI A T E  DAT    MUL T IP LI ER      The functi ons  that the SFU  perform s  are determin ed duri ng the algorithmic design phase. Typical  fu nct i o ns i n cl u d e:  t a bl e-l o o k up  f o r se ns or  recal i b rat i o n,  i n terp o l ation ,  lin earizatio n, a v eragi n g, fuzzy  logic  calcu latio n s data co m p ressi o n , d a ta fu si on , ti m e  sta m p i ng, e dge det ect i on, t h resh ol d det ect i o n,  peri o d   measurem ents, etc.  The m i crocode engine indi vidually controls each  element in the datapa th resulting in a large  co m b in atio n   of p a rallel o p e ratio n s  in cl u d i ng : Sh i f t- Mu ltiply-Add , Sh ift - Mu ltip ly-Satu r atin g  Add ,   M u ltip ly- Add ,  Mu ltip ly-Saturatin g Add ,   Sh i f t-Add ,   Sh ift-Satura ting   Add ,  Arith metic & Log i cal  Sh i f t, Bit Clear, Bit   Set ,  B o ol ean  L ogi f unct i o ns,  t a bl e l o ok u p ,  i n t e r p o l ation ,  li n earization ,  abso lu te  v a lu e, et c.    Evaluation Warning : The document was created with Spire.PDF for Python.
               I S SN :2089 -48 64    I J RES   Vo l. 1 ,  N o . 3 ,    Nov e mb er  201 75  –  86    80 6.   MICROCODE ENGINE   The deci si on t o  use a m i crocode d i n st ruct i o n f o rm at  wa s p r im ari l y d r iv en b y  th e fact th at th e DPE is  not   pi pel i n e d   and t h ere a r a num ber  of  p a ral l e l  ope rat i o ns t h at  m u st  be per f o r m e d i n  a si ngl e cy cl e. Thi s   eliminates the  need for an instruc t i o deco der  an d se q u e n cer  t o  c o nt rol  t h vari ous  u n i t s  i n  t h e D P E. T h i s   resu lts i n  an   o p ti m a l ratio  of co n t ro l l o g i c t o   d a tap a th log i c.  There  are  f o u r   cont rol   fi el ds i n  t h e  m i crocod e w o r d  as  s h o w n  bel o w  i n   Fi gu re  6.         Fi gu re  6.  M i cr oco d e C o nt rol   Fi el ds     The first field defi nes  s p ecifi m i cro-operat ions  withi n  the  microc ode  engine. T h ese i n clude  neste d   l o o p i n g, re peat  fu nct i o n ,  b r an chi n g an d co n d i t i onal  exec ut i on. T h ree l e v e l s  of ha r d wa r e  nest ed l o o p i ng  [4]   are sup ported .  All n e sted  lo op  of fsets are backwards  while branc h   of fset s can b e  bot fo rwa r d s  and  b ackward s. The b r an ch   op eratio n  u tilizes th e o f fset fiel d  an d  t h e lo op  cou n t  fields, wh i c h  ex ten d s  t h rang e.  Th rep eat  operatio n   fu rther m o d i fies th p r og ram  flo w   b y  prov id i n g th e cap a b ility to  ex ecu te m u ltip le   n e sted  loo p s. Th is  is  u s efu l  for op erating  on   m u lti-d i m e n s io n a d a ta arrays. Th ere  are th ree rep eat  cou n t ers,  one  for eac h le vel of nesti n g.  A state m achine tracks t h e ne st i ng c ont e x t  o f  al l  act i v e l o o p s. M o st  m i crocode   ope rations can be conditionally execute d. The exce p tio n s  are loop  return s an d th e h a lt in stru ction .   Co nd itio n a l execu tio n uses con d ition  co des  deriv e d  fro m   th e arith m e tic u n its in  th d a tapath  and  t h e SFU.  The sec o nd  fi e l d i s  t h que ue d-st ac k c ont r o l .  A t y pi cal   ope rat i on i s   sh o w n  bel o w i n  Fi g u r e 7 .   Du ri n g   the first half  of the cycle the QS  prov id es th e op eran ds to  d a tap a th   and the second  half of the cycl e the  add r ess  o f  t h e   QS ca be m odi fi ed  f o r  t h wri t e   ope rat i on. For e x am ple if a PUSH  op eratio n  is  p e rfo rmed  th FIFO po in ter i s  “sh i fted   righ t” to  p o i n t  to  nex t  lo ca tio n   o n  th e stack . Th e resu lt d a ta can  b e   written  to th is  location at the  end  of t h e cycle. The  poi nters  in the IQ S u n i t s and t h e R Q S  uni t  al way s  p o i nt  t o  val i d  dat a  and  are  only m odified during a  write cycle.        Figure  7. Typi cal QS  rea d -write Cycles   RE P E A T   CN T QS 1   CT L O F FSE T CO N D   CO D E OP   CO DE Fi e l d   1 QS 2   CT L RS   CT L PU S H PO P IN S E R T Fi e l d   2 SH FT 1   CT L SH FT 2   CT L MU L T   CT L AD D   CT L LU T / B I T   CT L Fi e l d   3 IM M E DI A T E   DA T A Fi e l d   4 MU X   CT L GP I O   CT L OU T P U T   FI FO   CT L LO O P   CN T R   # CL O C K R E A D _ M UX E S Ho l d  S o u r c e   Bu s D r i ve S o u r ce   B u s e s RE A D / E X E CU T E    CY C L E PUSH ,  P O P ,   I N SERT   C Y CL E D r i ve R esu l t   B u ses H o l d  R esu l t   B u ses μ OP DA T A P A T H La t c h Q S   D a t a P O P ,  P U S H IN S E R T A d d r ess  t o   Q S Evaluation Warning : The document was created with Spire.PDF for Python.
I J RES   I S SN 208 9-4 8 6 4         Que u e d - S t a ck   Dat a f l o w  Pr oc essi ng  El eme n t  f o a C o g n i t i ve Se ns or Pl at f o rm ( McDe r m o t t )     81 Th e th ird  fiel d co n t ro ls th datap a th  using  “o n e -h o t ” co n t ro l b its. Th b its co n t ro l th m u l tip lex e rs  and t h e f u nct i onal  u n i t s . As  can be see n  fr om  Fi gures 3,  4 an d 5, t h e r e are 1 0  m u l t i p l e xers t h at  co nt rol  t h e   flow  o f   d a ta throug h th fun c t i o n a u n its, th e write-b ack  m u x  an d th QS ele m en ts.   The  fourt h   field is  used for immediate data and to a d d r ess  d a ta in  t h e look up  tab l e. Th wid t h of th is  fi el d i s  det e rm i n ed by  t h e wi dt h o f  t h e m i cr oco d e w o rd . I n  som e  im pl em ent a t i ons o f  t h e DP E, su b -fi el ds i n   the m i cro-engi ne c ont rol  field can  be  u s ed  t o  ex tend  t h w i dth  of   wo rd   The bl ock di a g ram  of t h e m i cro - en gi ne i s  sh ow n bel o w i n   Fi gu re 8 an d c onsi s t s  o f  f o u r  com pone nt s:   WC S,   m i cro-add r ess ge nerat i on , ope rat i o n q u eu e  and a  fi nite state  m achine controller.        Fi gu re  8.  B l oc Di ag ram  of  The M i cr oc ode  En gi ne     The m i cro-e n g i ne i s  co nt r o l l e vi a a  4- bi t  m i cro- o p co de  fi e l d. T h e m i cro- engi ne  opc o d e s  su p p o r t e d   are sh own   b e lo w in   Tab l 3 .  Th ere are two b a sic ex ecu tion  m o d e s:  n o rmal an d cond ition a l.  In no rm al m o d e   all  micro - o p eratio n s  ex ecu te  in d e p e nd en tly o f  t h e v a l u e of th e con d ition   co d e s. In  co nditio n a l ex ecu tio n  t h v a lu of th e con d ition  cod e fro m  th e prev iou s  cycle are  com p ared  with valu e in m i cro - co d e  word. If t h e two  code s are  not i d entical the  m i cr o-op eratio n is no t ex ecu ted .     Tabl 3. M i cr o - En gi ne  O p c o d e OPC O DE  REPEAT   OPER ATION   EXEC  Y  No r m al   Ex ecu tio n   COND_EX EC  N  Conditio nal  Execution   WFE  N  Wait  for  Event  JMP   Ju m p  to address sp ecified in IMMED _ DATA field   JUMP_HA L Ju m p  to address sp ecifi ed in IM MED _ DATA f i eld T H E N  Halt   L OOP_BACK  L oop back for  L o o p  # {1, 2 , 3 BRA N  Branch  Unconditionally  BR_WB_GT  N  Branch  Writeback  GR EAT E THAN  REFER E NCE  DA TA   BR_WB_LT  N  Branch  Writeback   LESS  TH AN R E F E RENCE  DA TA   BR_WB_EQ   Branch Writebakc  EQUA L toREF E R E NCE  DAT A   BR_ SFU_ G Bran ch  SFU  resu lt GREA TER  THA N  REF E RENC E D A TA   BR_SFU_LT   Branch SFU  result LES S T HAN R E FERENC E D A TA   BR_SFU_EQ  Branch SFU  result EQU A L to R E FE RENCE  DAT A   T X FR   T r ansfer  Output FIFO data to Channel    The fi ni t e  st at m achi n e (FS M ) cont r o l s  t h e nest ed l o o p i ng a nd re peat s  funct i ons . Th r ee l e vel s  of  n e sting  lo op ing  are supp orted  in  th e b a se a r chitecture. The repeat functi on  is u s ed  to  co n t ro l th e nu mb er  of  t i m e s a l oop i s  repeat e d The r e i s  a r e peat   cou n t e f o r ea ch  nest ed l o o p  t h at  i s  l o a d ed  fr om  t h e R P T_C N T   fi el d.  The  O F F S ET  fi el d i n  t h e m i crocode  i s  use d  t o  “l oo back wa rds”  i n   t h e l o o p   whe n   t h e L O O P _B A C K   opc ode is  exec uted. T h e RPT _ CNT  a n d OFFSET  fields  are use d   by t h BRANCH  opc ode  to inc r eas e the   t w os -com pl em ent  o f f s et  ra ng e o f  t h e  branc h  into t h e m i cro-ROM.    Datapath   Co nt ro l   Ze ro   One   FF   RPT   OFFSE T   DATAPA T H   CON T ROL   Mi cro en g i ne   In struc on   FF   OP   LOOP   uADDR   FSM   IMM   Op   Qu e u e   Events   Re cir c u l a t e   Evaluation Warning : The document was created with Spire.PDF for Python.
               I S SN :2089 -48 64    I J RES   Vo l. 1 ,  N o . 3 ,    Nov e mb er  201 75  –  86    82 Fi gu re 9 b e l o w sh ow s a t y pi cal  nest ed l o o p i n g m i croco d e  seque nce. I n   t h i s  seque nce there are two  nest ed l o o p s a nd  o n e co n d i t i onal l y  ex ec ute d  bra n ch l o op. The  nested  l o ops e x ec ute 10 tim es before the  b r an ch  in st ru ct io n  is ex ecu t ed No te th at t h e m i cro i n s tructio n s  are ex ecu t ed in   p a rallel, resu ltin g in zero - o v e rh ead  loop an d   b r an ch   in stru ction s . O n ce t h e cond itio n a l bran ch  is no t tak e n  th e JU MP_H A L m i croi nst r uct i o n i s  e x ec ut ed.       Fi gu re  9.  Ty pi cal  “Nest e d  L o opi ng”  M i croc ode  Se que nce     The J U MP_HALT is a m e rged m i croinstruction that  jum p s to address s p ecified and hal t s the  m i cro- engi ne to wait  for the ne xt “ f ire” signal”.  The m i croc od e engi ne i s  “fi r ed”  whe n  t h e  new c h an nel   dat a  i s   in serted  i n to  th e qu eu ed-stack . No te: th micro - eng i ne clo c k s  are d i sab l ed   d u ring  id le m o d e  resultin g  in  m i nim a l  power  di ssi pat i o n.   The m i croco d e  en gi ne  co nt ai ns a n   ope rat i on  q u e u e t h a t  i s  use d  t o   r e gi st er e v e n t s  an d t r i g g e r   microcode ope r ations i n  res p ons e to the e v ents. T h o p er at i on q u e u e p r ovi des a m ech an ism   to  in terru p t  th norm al flow of the microcode  at speci fi c ent r y  poi nt s. T h que ue i s  ci rc ul ar an d can al s o  be  use d  t o  st ore a   sequence  of m acroi nstructions for  system s that  use R O stora g for t h e  m i crocode. T h e FSM c ont rols the   fl o w   of e v e n t s / m acro-i n st ruct i ons  t o  t h e m i cro-e n gi ne.   As m e nt i oned  abo v e, t h e m i croc o d e st ora g e  can be ei t h e r  read -o nl y - m e m o ry  (R OM ) or  wri t a bl e- cont rol - st ore  ( W C S )  ba sed .  I n  ei t h e r  case  t h e cl oc ks  t o  t h e stora g element are  co nt r o l l ed by  t h FS M .  Fo r   non-loopi ng re peat functions, the latched microcode  word is accessed instead of ac cessing the me m o ry   ele m en t. Th is  p r ov id es add itio n a l en erg y   sav i ng s as  it eliminates pre - charge  cl oc ki n g  ener gy T h e  WC i s   lo ad ed  v i a th e JTAG i n terface an d  is u s ed in  syste m where  ove rlaying of microcode  is n eed ed  due to  th size o f  th e code or for  d e bug gin g  m i cro c od b e fo re th e m i cro c od e is co mmitted  to  ROM.      7.   DPE OPERATION E X AMPLES   The D P E m i cro - arc h i t ect ur e i s  desi gne d  t o  pri m ari l y  sup p o rt  sens or  dat a  con v e rsi o n an d   co nd itio n i ng Typ i cal o p e ratio n s  in cl u d e :  d i g ital filte rin g ,   d ecim a ti o n , lin earizatio n, av erag ing, d a ta  com p ressi o n f eat ure e x t r act i o n ,   dat a   fusi ng , ed ge  det ect i o n, t h re sh ol d  de t ect i on, et c.  Fi gu re  1 1   bel o sho w s   an  FIR  filter co nfigu r ation  that can  b e  im p l e m en ted  w ith   fiv e  m i cro i n s tru c tio ns and  execu tes in  ten  clo c cycles.   IQS - 1 i s  used  t o  st ore t h e i n com i ng dat a  t oken s  fr om   t h e chan nel  n ode . The t o k e ns are  i n sert ed at   th e bo tto m  o f  th e stack. Th o l d  t o k e n s  are  o v e r-written  wh en  t h e BOS  po in ter  recircu l ates. IQS-2  is  used  to   store  t h e filter  va riables for each of  the  sta g e m u ltipliers. The  addition  re sults a r e acc um ulated in the R Q ele m ent. The  fi lter calculations  procee from olde st data t o ken to th e m o st  recent. The T O S pointe rs  for  IQS- 1 a n d  I Q S - 2  ar e “p op pe d” t o   poi nt  at  t h e  ne xt  va ri abl e  a n d  t oke f o r eac h  m u l t i p l i cat i on  st ep.      OFFS ET= 0   RP T   CN T   =   5   FIEL D   2,   3,   4   OP COD E   EN T E R   L OOP   1   PC   =   0   LP   CN T R   =   1   OFFS ET= 0   RP T   CN T   =   0   PC   =   1   LP   CN T R   =   0   OFFS ET= 0   RP T   CN T   =   2   PC   =   2   LP   CN T R   =   2   OFFS ET= 0   RP T   CN T   =   0   EX EC   PC   =   3   LP   CN T R   =   0   OFFS ET= 2   RP T   CN T   =   0   LO OP _ B ACK   PC   =   4   LP   CN T R   =   0   OFFS ET= 5   RP T   CN T   =   0   PC   =   5   LP   CN T R   =   0   BR A N C H   OF F S E T = 6   LP   CN TR   =   0   EX EC   EX EC   LO OP _ B ACK   BRA   CO N D   PC   =   6   I nne r   RP T   Loop   Ou t e r   RP T   Loop   Ou t e r   Cond. Br a n c h   L oop   FIE L D   2,   3,   4   OP C O D E   FIEL D   2,   3,   4   OP COD E   FIE L D   2,   3,   4   OP C O D E   FIE L D   2,   3,   4   OP C O D E   FIEL D   2,   3,   4   OP COD E   FIE L D   2,   3,   4   OP C O D E   A D DRESS   LP   CN T R   =   0   JU MP _ H AL T   PC   =   7   FI E L D   2,   3,   4   OPC O D E   Evaluation Warning : The document was created with Spire.PDF for Python.
I J RES   I S SN 208 9-4 8 6 4         Que u e d - S t a ck   Dat a f l o w  Pr oc essi ng  El eme n t  f o a C o g n i t i ve Se ns or Pl at f o rm ( McDe r m o t t )     83   Fig u re 11 . FIR   Filter  Con f i g uratio   Th d a ta storag for th e FIR  filter calcu lation s  is sho w n   b e l o w in   Figu re 12   Fig u re 12 . Dat a   Storag Fo r FIR  Filtercalculatio n s     Th e m i cro i n s tru c tio ns to ex ecu t e on filter cycle are:    1:    ADD, ZERO, ZERO,      ; ZERO -> ACC     POP_INS_RQS      ; INSERT AT BOS RQS and POP TOS    2:    MULT, TOS_QS1, TOS_QS2,     ; A(3,2,1) * X(N-3,2,1)   ADD,  BOS_RQS,    ;  ACC   WB[BOS_RQS],    ;  WRITEBACK->  ACC    POP_QS1, POP_QS2,      ; POINT AT NEW VARIABLE   RPT=3     ;  REPEAT  TIMES    3:  MULT, TOS_QS1, TOS_QS2    ; A(0) * X(N)   ADD,  BOS_RQS,    ;  ACC   WB_FIFO,     ;  WRITEBACK  TO  FIFO  ELEMENT   POP_QS1     ;  CONSUME  X(N)    4:  PUSH_NW_QS1, PUSH_NW_QS2,    ; RESET VARIABLE POINTERS   RPT=4     ;  REPEAT  TIMES    5:  JUMP_HALT 1;      ; JUMP and WAIT FOR TOKEN      Th first m i cr o i n s tru c tion  inserts a ZER O in to  th e BOS o f  t h e Resu lt-QS,  wh ich  is u s ed  as the  accum u lator for MULT -ADD instructions The sec o nd m i cr oi nstruction  is repeate d  3 tim e s and e x ec utes a   MULT-ADD  of th e last 3  stag es  o f  th filter, accu m u l a tin g  th resu lt in   th e RQS. Th e t h ird  m i cro i n s tru c tion  d o e s a M U LT-ADD of t h n e w d a ta t o k e n  an d th A( 0) filter  v a riab l e  and  issu es a POP co mma n d  t o   consum e the X(n) va riable. T h e res u lt is also sent to  t h e o u t p ut  FIF O   usi ng  WB _ F I F com m a nd i n  t h e sam e   micro i n s tru c tion .  The fou r t h  micro i n s tru c tion  resets th TOS po in ters to p o i n t  to  th e A(3) filter v a riab le an Z -1 Z -1 X( n ) Z -1 X A( 0 ) X A( 1 ) X A( 2 ) X A( 3 ) + + + + Y( n ) X ( n- 1 ) X ( n- 2 ) X ( n- 3 ) X(n )   X ( n-1)   X ( n-2)   X ( n-3)   TO S   X ( n-4)   BOS   I N SER T   IQ S- A( 0)   A( 1)   A( 2)   A( 3)   ?????   BOS   IN S E R T   IQS- ACC   ACC( - 1 )   ACC( - 2 )   ACC( - 3 )   TO S   ACC( - 4 )   BO S   INS E RT   RQS  TO S   Evaluation Warning : The document was created with Spire.PDF for Python.
               I S SN :2089 -48 64    I J RES   Vo l. 1 ,  N o . 3 ,    Nov e mb er  201 75  –  86    84 t h e ne w X ( - 3 )  dat a  t oke n. T h e JUM P _ H A LT m i croi nst r uct i on  bra n c h e s  back t o  t h fi rst  i n st r u ct i o n t h at   cl ears t h e acc u m ul at or an w a i t s  for t h e ne x t  dat a  t oke n.   On ce th X(n )   variab le is in serted  in to  th e B O o f   IQS - 1. T h e  cha nnel   n ode  i ssu es a F I R E  si gn al  to  th DPE an d th sequ en ce rep eats itself.  Fig u re  1 3   b e l o w sho w s a  Bi-Qu a d   IIR  filter co nfiguratio n  th at can  b e  im p l e m en ted  in   9   m i croi nst r uct i o ns a n 13  cl oc ks.        Fig u re 13 . IIR filter  Con f i g uratio n  (Bi-Qu ad)    There  are t w summing node s . Eac h   one is   a sepa rate  en t r y in  th e R Q S.  Th first su m   is in serted   in to  th e bo ttom o f  th e RQS. It will b ecome th e V(n - 1)  v a riab le th e nex t  ti m e  th e filter is ev alu a ted .  Th e   second sum  re places the  V(n-2)  varia b le  once it is use d The  data st ora g for t h IIR  filter calculati ons is  sho w n bel o i n   Fi gu re 1 4 .         Fig u re  14 Dat a  Storag e Fo IIR Filter Calculatio n s     Th e m i cro i n s tru c tio ns to ex ecu t e on IIR  filter cycle are:     1:    MULT, TOS_RQS, TOS_QS2,    ; V(N-2) * A(2)    WB[BOS_RQS],    ;  WRITEBACK  ->  ACC_1   INSERT_RQS,    ;  INSERT  BEFORE  WRITE   POP_QS2,     ;  POINT  A(1)   POP_RQS     ;  POINT  V(N-1)    2:  MULT, TOS_RQS, TOS_QS2,    ; V(N-1) * A(1)   Z -1 X( n ) X B( 1 ) + + + Y( n ) V( n ) Z -1 X B( 2 ) X A( 1 ) X A( 2 ) + X B( 0 ) + + V( n - 1 ) V( n - 2 ) B( 0)   B( 1)   B( 2)   A( 1)   A( 2)   BOS   IN S E R T   IQS_2   TO S   X(n )   X ( n- 1)   X ( n- 2)   X ( n- 3)   X ( n- 4)   TO S / B O S   IN SER T   IQS_1   AC C(n )   V ( n- 1)   V ( n- 2)   TO S   BO S   INS E RT   RQS  Evaluation Warning : The document was created with Spire.PDF for Python.