Internati o nal  Journal of Ele c trical   and Computer  Engineering  (IJE CE)  Vol .   5 ,  No . 3,  J une   2 0 1 5 ,  pp . 49 1~ 50 2   I S SN : 208 8-8 7 0 8           4 91     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 / IJECE  Software for Simplifying Embedde d System Design Based on  Event - Driven M e thod       Maman Abdu rohm an *,  Ari f  S a s o n g k o **  *School of Com puting, Tel kom University Indo nesia  ** School of  E l ectri cal  and  Infor m atics Eng i neeri ng, Bandung  Ins titut e  of  T echnol og y ,  Indonesi     Article Info    A B STRAC T Article histo r y:  Received  Ma r 1, 2015  Rev i sed  Ap 19 , 20 15  Accepte May 3, 2015      Complexity  of  embedded s y s t em appl i c a tion  incr eases a l on g with th e   escalation of market demand . Embedde d s y stem design process  must be  enhanced to f a ce design complex i ty  pr oblem. One of ch allenges in designing   em bedded s y st e m  is speed, acc urac y,  and fl exi b ilit y.  Th e desig n  process is  usually  condu cted recursively  to  fulfill  requir e ment of user and o p timization .   To s o lve th is  problem , it n eeds  a  s y s t em  des i gn th at is  fl exibl e  for  adapt a tio n .   One of solutions is b y  optim iz in g all or  some of the design steps. This paper   proposes a design framework  with an  automatic framework co de generator   with of  event driven appro ach . This software  is a  part of  a d e sign  flow which   is  flexible  and fas t . Tron gam e  and s i m p le calc u lator ar e pres en ted as  a cas e   study .  Te st re sult shows tha t   this  fra m e work gen e rator  can  in crea s e  s p eed o f   de si gn’s fl e x i b i lity .   Keyword:  Em bedded  Sy s t em   Ev en t Driv en   Soft ware   State Chart   Copyright ©  201 5 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 M a m a n A b d u r ohm an    Scho o l  of   Co m p u ting  Telk o m  Un i v ersity   Jln .  Telek o m un ik asi  no 1  Ban dun g 402 57 , In don esia  Em a il: ab d u roh m an @telk o m u n i v e rsity .ac.i d , m _ abd u ro hman @yaho o .co m       1.   INTRODUCTION  The inc r ease  of em bedded  syste m ’s  complexity affects  the design  pr ocess. It   i s   be com i ng  m o re  com p l e x an d t i m e -cons um i ng.  Devel opi ng  em bedde d sy st em  i s  not  o n l y  desi gni ng  s o ft ware a n d  h a rd ware   part b u t  al so  d e si gni ng  an d i n t e grat i n bot h t h em  at  t h e sam e  t i m e  [1] .     The em bedde d  sy st em  desi gn  proce ss en gag e m a ny  exper t s who  have  di ffe rent  p o i n t  o f  vi ews t o   the syste m . Not all the expert s are capable  i n  vari et y  of fi e l ds;  t h eref ore ,  we nee d  a st andar d  f o rm  for t h em . It   need s a f r am ewo r k  t h at  i s   agree d   by  a t e am  whi c h  w hol e i n t e ract i o n am ong al g o r i t h m s  i n cl udi ng  t h e   har d ware a n d s o ft ware  pa rts.   In de si g n i n g em bedded sy st em , one of  pr o b l em s t h at   m u st be han d l e d i s  t h e opt i m i zati on bet w e e n   soft ware  or  ha rd ware i m pl em ent a t i on an d  con f o r m a nce t o  t h e use r  re qui rem e nt . So m e t i m e s, t h i s  pr ocess  n eeds rep e titio n  in   d e fin i n g   fra m ewo r k  design Detail i m p l e m en tatio n  step   is co nd u c ted  after its d e sig n   really  fu lfills th o p ti mizatio n  either fro m  th e sid e   o f   sp eed ,   b udg et,  o r  fun c tio n. Reg a rd ing  t h e easi n ess of  m o d i ficatio n  of arch itecture for alg o rith m  i m p l e m en ta tio n ,  it n eed s a flex ib ility o f  framewo rk . Gen e ratin fram e wo rk  auto m a ticall y  is  o n e   o f   g ood  altern ativ es to  co m e  to  th is flex ib ility. Th ere are  m a n y   i m p l e m en tatio n   o f   software fo au t o m a t i o n   an d ad ap tiv syste m  [2 -5 ]. Th flex ib ility is n e ed ed to   h a nd le th fact s t h at  pr o d u ct  age i s  ve ry  sho r t .  S o m e t i mes, ne w ve rsi o n o f  o n e p r od u c t   m u st  be l a un ched se ve ral  m ont hs  later after th p r ev iou s   p r odu ct is laun ch ed It n e ed shor t ti m e  to  ch an g e  pr ev i o us desig n  i n to  t h n e w e st  m odel ,  and cer t a i n l y , i t  wi ll   need a fl e x i b l e  fram e wor k M a ny  eff o rt s/ r e search s ha ve been  do ne f o desi g n   im pro v i n g i n  t h fi el har d w a re a n d  so ft wa re a n d  eve n t   dr i v en c o nt ext   [6 -9] .        Thi s  pa per  p r op oses a  wel l - de fi ne d ne desi g n  m e t hod t h at  i s  st art e d f r om  t h e fi rst   m odel .   C h aract eri s t i c s  of t h i s   m odel  are:  easy   t o  un de rst a n d , p r eci si ont use i n  ge nerat i n g code , an d fl exi b l e  t o   Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  IJEC E V o l .  5, No . 3,  J u ne 2 0 1 5   :    49 1 – 5 0 2   49 2 m odi fy . The q u i t e  sim i l a met h o d  t h at  ha s  been  pr o p o s e d  i s  [ 10] . T h i s   m e t hod  gene r a t e s fram e wor k  co de   fr om  UM L di a g ram .  The  di f f e rence  o f  t h e   m e t hod  fr om  thi s  pa pe r i s   [1 0]  i n  t e rm s of  i m pl em ent a t i on t h at  i s   sp ecified   on  a p l atform  o r  OS, wh ile in  th is  p a p e r, th e m e tho d  o f  ge ne rating  fram e wor k   code  fo r so ftw a re an har d ware  d o es  not   de pen d s  o n  a s p eci fi c pl at f o rm     2.   R E SEARC H M ETHOD  The m e thod  of devel opi ng e m bedded  syste m  using tra d itional  way has  m u ch weaknes s  suc h  as 1)  We  n eed so meo n e  who   u nderstand b i g imag e fro m  th e syste m  th at will b e   b u ilt;  2 )   W e  n e ed  a lo of  coo r di nat i o n a m ong pl a nne rs  t o   gua ra nt ee t h e si m i l a ri ty  of  pe rcept i o n a n pr ocess  am ong  su sy st em s.    Desi g n i n g p r o cess and c o or di nat i o n are c o n d u ct ed m a nual l y . The we akne ss i n  bi g scal e i s  t h in ab ility to  su p port reu s ab le co n c ep t. Th is p a p e r co m e s u p  with  a n e w d e sign ing  pro c ess with  ev en t-dri v en  m e thod approa ch. It is taken because na tura lly, the system works reactively to  an event. Its design is started  b y  d e fin i n g  the syste m  as sev e ral i n teracting  su bsyste m  i n  form  o f  Fin i te State Mach in with  ev en t - d r i v en  base d com m uni cat i on. B a se on t h desi g n  t h at  i s  de fi ne cor r ect l y , t h next  st e p  i s  ge nerat i n fram e wo rk   au to m a tical ly fo r wh o l e app licatio n .   Figu re  1  s h ows   the fra mework design  concept.          Fi gu re  1.  Fram ewo r k D e si g n   C once p t       The first m odel describes that syste m  is  a n  asse m b lage of Finite State Machine and  events . Two  u s es of th first  m o d e l are: 1 )  as th e first inpu t for  ge ne rat i ng  fram e wor k   code , an d 2 )  as  a  m odel  t h at  i s  easy  Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       S o ftwa r e fo r S i mp lifyin g Embed d e d   S y stem  Design  Ba sed   o n  Even t-Driven  Met h o d   (Mam an  Abdu rohm an 49 3 t o   be u nde rst o od by   e ngi nee r s/ de vel o pers . Out put   t h at  i s  pr o duce d   fr om  fram e wor k   ge nerat o r i s :   1)  FSM   code f o al l   bl ock s , 2)  c o m m uni cat i o am ong FSM , 3) Pr ot ot y p e fu nct i on (s oft w are ) , 4) har d ware  i n t e rface   m odul t h at   i s  use d  by   FSM ,  and   5 )  In st ant i a t i on of   f unct i on .   Out put   fr om  fr am ewor gen e rat o r  i s  f r am ewo r k  co de  fo r  so ft ware  an har d ware t h at   m u st  st il l  be  com p l e t e d by  pr og ram m er  by  i n sert i n g f unct i o n i n t o  e ach bl ock sy s t em . A pr og ra m m e r can foc u o n   im pl em ent i ng fu nct i o n as ef fi ci en tly as p o ssi b l e. In  th e last step , th e in teg r atio n  on  th wh o l p a rt of so ftware  and  ha r d wa re  was c o nd uct e d .     Ap pr oac h   of e v ent   dri v en i s   use d  beca use t h e em bedde sy st em  nat u ral l y  wor k s i n  t h i s  way .   It  i s   reactive to a si gnal a n d e n vironm ent [11]. T h e si gnal t h at  i s  received by t h is em bedde syste m  is as an eve n th at in fl u e n c es a system  to  do  so m e th in g ,  as Figu re  2 .   The streng t h   o f  th is  d e sign  is t h at eith er so ft ware or  hardware  uses   event  drive n  a p proach so that  we ca n d o  des i gni n g  p r oces s wi t h   s o ft ware  and   ha r d wa re.           Fi gu re  2.  Fl o w  o f  Em bedde Sy st em  Desi gn       There  are  sev e ral  ass u m p t i ons t h at  are  u s ed   i n  t h i s  m e t hod:   1.   Base assu m p tio n in  t h is m e th od  is that all  m a n a g e m e n t  stu f fs  n eed  m u ch  less com p u tin g  power   com p ared t o  t h e a ppl i cat i o n  of be ha vi or  p a rt . T h ese m a nagem e nt  st uf fs ar e a n y t hi n g  t h at   rel a t e t o   sy nch r o n i zat i o n, c o m m uni cat i on am on g t a s k s, a n d  co nt ext   swi t c hes.     2.   Com m unicatio n am ong  FS M is im plem ented as  send ing and  receivi ng signal. T h is  com m unication  signal  has a  rol e  as e v ent  for a  sub system 3.   Im pl em ent i ng sy st em  uses pl at form  cov e ri n g   pr ocess o r ,   O S , c o m p iler, libra ries a n d  FP GA . It  m eans that   p r o cesso r and   RTOS t h at are  n o t   bu ilt sp ecifically fo r t h is im p l e m en tatio n .     The Str u cture  of Ge nerated  Code   In t h e eve n t - d r i v e n  m e t hod  vi ews ,  em bedd ed sy st em  design c o nsi s t s  o f  t h ree  part s s u ch as e v ent   gene rat o r,  di sp at cher an d ha n d l e r m odul e.  Aut o m a ti cal l y   gene rat e d c o d e  i n  t h i s  pape r  i s  consi s t s  co  t h ree   p a rts n a m e ly  ev en t g e n e rator, d i sp atch er an d  ev en t h a nd ler.  Th b e hav i or th at  will co mm u n i cate  with  envi ro nm ent  i s  d one  m a nual l y , as Fi g u r e 3 .   In fo rm at i on fr om  envi r onm ent  o r   ot he r sy st em s are p r oc es sed  by  ev en t con v e rter. Th ou tpu t  of ev en t con v e rt er  will d i sp atch  to su itab l e even t h a nd ler  for  n e x t  acti o n.    Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  IJEC E V o l .  5, No . 3,  J u ne 2 0 1 5   :    49 1 – 5 0 2   49 4     Fi gu re  3.  Ge ne rat e d C ode  St r u ct u r e       The Star ting  Model  St art i ng m odel  as Fi gu re 4 i s  a descri pt i on  whi c h t h e t o ol  t a kes as i n p u t .  Thi s  d e si g n   m odel   m u st  h a v e  t h ree criterias: 1 .  Easy to  b e   u n d e rstoo d   b eca u s e it will b e  d i scu s sed   b y  m a n y  t e a m   m e m b ers with  di ffe re nce ba c k g r ou n d ;  2.  Pr eci se si nce t h i s  m odel  has t o  be  use d  as   t h e i n put   of  fr am ewor k a u t o m a t i gene rat o r;  a n d   3.  The  m odel  sho u l d  s u p p o rt   m odul ari t y At each m o dule, a dditional  inform ation  is nee d ed to  descri be t h m odule and i n ter-m odule  co mm u n i catio n .  Th e feat u r ess o f  t h e in itial m o d e ls are  as fo llows: 1. The u s o f  FSM m o d e ls wh ich   can  be  u n d e r s too d  eit h er   b y  sof t w a re en g i n eers or   h a rdw a r e  en g i n eer s;  2 .   I t  is ab str act en ough  and  it do esn’ t n e ed   detail process  containe d in each m odule ;  3.  FSM  provides  inform ati on a bout control,  datafl ow,  and  com m uni cat i on  bet w ee n a n d  wi t h i n  m odul es;  4.  F unct i o nal  an FSM   di ag ram s  are easi l y  vi sual i zed  usi n g   diagram s  or pictures; and 5. Key  poi nts in the m odel are how the c o mm u n ication a nd interface are  des c ribe (as e v ent ) .         A t a s k   i n   pr oce s s o r 1   wi t h   p ri o r i t y   y   S e n d i ng da ta  usi n V  v a ri abl E v e n t usi n i n t e rr upt   s p ec i f i c  nu m ber n   S e n d i ng d a ta  usi n reg i s t er T   A H W   a cce l e r a to r   m odu l e  c o nn e c t e to b u s   Z   A t a s k   i n   proc e s s o r 1  wi t h   p ri o r i t y  x      Fig u re  4 .  Th Startin g Mod e l of th e System      Platform   Pl at form  i s  an  art i f act  t h at  i s   use d f o de vel o pi n g  em bedde d sy st em s. Har d wa re  part   of t h pl at fo rm   can  b e   a pr o c esso r, D M A  con t ro ller ,  per i pher a ls and  bu syste m . Part of the s o ft ware  in syste m  can be a n   ope rat i n g sy st e m , li brary   or  st anda r d  t a sk . Fi gu re  5 s h ows  t h pl at fo rm  used.   Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       S o ftwa r e fo r S i mp lifyin g Embed d e d   S y stem  Design  Ba sed   o n  Even t-Driven  Met h o d   (Mam an  Abdu rohm an 49 5     Figu re 5.   The  Platform   and   t h e Fram ework  of the  Syste m     FPG boa rd  can be  use d  a s  a pr ot ot y p i n g pl at f o rm  for  devel opm ent  of em bed d ed  appl i cat i o n s   sy st em . The c o m m uni cat i on of  ha rd wa re a n d  so ft wa re i n  t h e em bedde d  sy st em  i s  sho w n i n  Fi gu re  6. T h e   process o r used m a ybe a physi cal pro cess o r or s o ft  process o rs in FPGA.          Fi gu re  6.  The  c o m m uni cat i on  of  ha rd wa re a n d s o ft ware  i n  t h e em bedde s y st em   Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  IJEC E V o l .  5, No . 3,  J u ne 2 0 1 5   :    49 1 – 5 0 2   49 6 3.   FRA M EW O R K GENE RA TOR  S Y STE M   3. 1. Em bedde d S y stem  Platform   Em bedded  sy s t em  consi s t s   o f  t w pa rt s:  h a rd ware  an d  s o ft ware.  Ge ne rally , ha rd war e  co nsists  of   process o r, coproces sor, a nd  supporte d  co m p on en ts th at are lo cated   o n   d a ta p a th  lik e p l u s , m i n e s, ti m e s,  di vi de s, re gi st e r s et c.  Whi l e gene ral l y , so ft ware c o nsi s t s  of  op erat i n g sy st em , funct i o and c u st om  t e m p l a t e   th at supp ort app licatio n .   The p r o b l e m   that   m u st  be answere d  i n  de ve l opi n g  em bedd ed sy st em  i s  t h e com posi t i on of o p t i m u m   har d ware o r   s o ft ware f o r   o n e   nee d  fr om   the per f o r m a nce  an d b u d g et  pers pect i v e.   T h i s  pape r foc u ses o n   d e sign ing  and   fu lfillin n eed s of  u s er and  app licatio n   p e rform an ce. In th h a rdware  step , p a rtitio n s  t h at  n eed  fast  com put at i on l i k e ari t h m e t i c  co m pone nt s  are im pl em ente d as a part  o f  har d ware.  Whi l e, fu nct i ons t h at  are  related  to  u s er  in terface lik bu tto n for tri g ger are im p l e m e n ted as so ft ware.  Targ et  o f  im p l e m en tatio n  cod e   for so ft ware is C file wh ile hardware im p l e m en tatio n   is in VHDL  file. Syste m  i m p l e m en tatio n i u s ed u s ing  Fi el d P r o g ram m abl e  Gri d   Ar ray  (F PG A) , a n d  m i cropr oce ssor  used in t h i s  system  is ARM and MicroC  OS/ II  ope rat i o n sy st e m   3. 2.  E v en t Driven Me th od   Naturally, ev en t-d r iv en  concep t (Figu r 7 )  is u s ed  in i m p l e m en tin g  em b e d d e d   syste m . Th is  ap pro ach  is mo re efficien t that an o t h e r on th at is p r o active. Th e system   is in  id le situ atio n  as waiting   ev en from  outside,  whe n  t h e e v ent happe n s s o  t h e system  will  react s u itable  with the  ki nds  of eve n t a nd i t s last  sy st em ’sst at us. Thi s  eve n t  t r i gge rs t h e sy st e m  t o  change  fr om  one st at us t o  an ot her .  Ev ent  fr om  out si de i s   han d led  by   so ftware  an ha r d wa re.  I n  the   soft ware  is  even t g e n e rato r th at g e n e rates  ev en ts th at mu st be  h a nd led   b y  its syste m . All ev en ts in  th e syst e m  are h a nd l e d  i n  l i n e of  gl o b a l  t o  be arr a n g e d by  di s p at ch er, an d   they will be spread to a p propriate  event ha ndler. In the  hardwa re, e v en ts  are receive d from   their envi ronm ent  and  ha n d l e b y  di st ri b u t o r. T h en , eac h e v en t  i s  ha ndl e d   by  ap pr o p ri at e ev ent  ha n d l e r.  O u t p ut  f r om  one  ev e n t   activ ates ano t her ev en t t h at will b e  tran sferred   b y  d i stri b u t or.            Fi gu re  7.  Eve n t - dri v en  co nce p t  i n   Em bedde Har d w a re a n d S o ft ware   Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       S o ftwa r e fo r S i mp lifyin g Embed d e d   S y stem  Design  Ba sed   o n  Even t-Driven  Met h o d   (Mam an  Abdu rohm an 49 7 3. 3. Framew o r Gener a tor  Sys t em  W o r k f l ow   Startin g   fro m  d e sig n  th at is d e fin e d  correctly b y  d e sign ers, till th is step , th e syste m  h a s b een  d e fined  rep eated ly b y  con s id ering  sev e ral  fun c tion a l n e ed s and li m ita tio n s Design  t h at is d e fin e d  co rrectly is   t r ans f o r m e d aut o m a t i call y  and   becom i ng  several  f r am ewo r k s   of  em bedde d  so ft wa r e  an ha rd wa re, a s     Fi gu re 8.          Fi gu re  8.  Fram ewo r gene rat o r  sy st em  proc ess      Fram ework is  entity for s o ftware  function or hardware  c o m ponents.   All fram e works a r e em pty, and  m u st be completed by programm er with detail code  that is  appropriate to each function.  Detail  im pl em ent a t i o n of   s o ft w a re  m odul es  u s e p r o g ram   C   an d Har d w a re ’s us es  V H D l a ng uage . It  needs  t o  be   n o ticed th at t h e streng th  o f  t h is tran sform a tio n  co n cept i s  ge nerati ng  h a rd ware  an d  s o ft ware  fram e wo rk   au to m a tical ly.  After d e tail i m p l e m en tatio n  u s ing  C  l a ng ua ge fo r e m bedded so ft ware u s i n g V HDL  fo em bedde har d wa re, t h n e xt  st ep i s  t e st i ng i n  FP GA  boa r d . S y st em   im pl ement a t i on  uses  NI OS   microprocess o r a n d MicroC  OS  II operating system .     3. 4. Har d w a re / S of tw are Fra mew ork C o de   Gener a t o r   D u r i ng  the imp l em en tatio n  of  fr am ew o r k  co d e  g e n e r a to r, th er w e r e  t w o step s condu cted . Th ey   were  be havi or  det e rm i n at i o n  by  de fi ni ng  F S M  o b ject f o r em bedde ha rd ware/ s oft w ar e an d c ode  st r u ct u r writing  in C (fo r em b e d d e d  so ft ware) an d in VHDL  (for em b e d d e d   h a rdware), as Fi g u re 9 .     Ob ject   be havi or  o f  em bed d e har d ware  a n d  s o ft wa re  f unct i o ns  del i n eat ed i n  eve n t  ha ndl e r   was  defi ned  usi n Fi ni t e  St at e Machi n e ( FSM ) .  Each o b j ect  w a s defi ned i n  F S M ,  b o t h  ha r d ware a nd s o ft ware . I n   d e fi n i ng  FSM , th ere  was a  set o f  states an tran sitio ns.  Tran sitio n  is an  even t th at beco m e s a trigg e r t o   m o v e   fro m  o n e  state to  ano t h e r.  State is filled  with  fu n c tion   cal ls to  b e  carried  ou t.  FSM can  b e  translated in to  pr o g ram  code s (C fo r s o ft ware a nd  V H D L f o ha rd w a re)  usi n g ne s t ed swi t c h st a t em ent  concep t .  The  t r ans f o r m a ti on  from  FSM  i n t o  pr o g ram  codes use d  n e sted  switch   p r i n cip l es. Th ere is a  m a in  switc h  to  d e term in e stat e p o s itio n. Th e tran sfo r m a tio n / actio n  p e rformed  b y  th e sy ste m   is d e ter m in ed  b y  th e o c cu rring  event .  B o t h  e m bedded s o ft ware a nd  har d ware  were i m pl em ent e d usi ng si m i l a m e tho d . T h e ne xt  st ep was   fillin g  o u t  fu n c tio n  d e tails  in   each   state.        Evaluation Warning : The document was created with Spire.PDF for Python.
         IJEC E 49 8     Soft w s w                                }   Har d p ro ce begi n   case  c                 end c a end p r p ro ce begi n   i f e e n end p r      E  Vo l.  5 ,  N o .   Figu r w are  Imp e l e m w itch  (state)  { case  S1  :                        case  S2  :  s       case  S3   s w         s w      d w a re Im ple m ss (cu rre n t _st a c u rre nt _st a t e   i whe n  S1  =   i f   e   e whe n  S2 =   i f whe n  S3 =   I f a se;   r ocess;   ss (iRST_ N, i C f (iRST_ N =  ‘ 0 lseif  (iCLK e v ndi f r ocess;     3 ,  Jun e   201 (a)   r e 9.   FSM fro m m enta tio n   {   switch  ( c ond i case   s       case   e s witch  ( c ond i t case   s case   e w itch (con d iti o case   e case   s w itch (e ve nt case   e m entati on  a te, T1, T 2 ,  T 3 i s   = >   --Act1  f ( T 1 = ’1 ’)   th e n e lseif ( T 2 = ’1 ’)  e ndi f = >   - - A c t2  f ( T 3 = ’1 ’)   th e n = > --A ct3  f ( T 4 = ’1 ’)   th e n C LK 0 ’)   th en   c u rre n v enta nd iCL K :    49 1 – 5 0 2   m  an object   o n i tio n){  case  e n s teady :  fucnt i switch  (e v    e x it :  fun c tio n t i on)  {   case  e n s teady :  funct i e x it: fun c tio n 6 o n)  {  e n t ry: functio n s teady: functi o case  T4:  e x it: fun c tio n 8 3 , T 4 )   n  next _st a t e next _st a t e n  next _st a t e n  next _st a t e n t_state<= S1 K =’ 1’ th en     c     n  (a ) Em bed d   n try : fucn tio n i on 1 ();   v en t) {   case   T                  case   T n 3 () ;   }  n try : fun c tio n i on 5 ();  switc h 6 () n 1 ();   o n 7 ();   TRA N 8 () ; }  e <=S2;  e <=S3;  e <=S3  e <=S1;  c ur rent _st a t e < S1 , sta t d ed S o ftware   a n 1 ();   T 1 : TRAN _ T T 2 :  TR AN _ T n 4 ();   h (e ve nt ) {   c N _T O( S2 )   = ne xt _st a t e ;   ,  S2  an d S3   a r t es  T1, T2 , are the   syste m   (b )   a n d  (b Em be d T O( S2 T O( S3)  c ase T3:   TRA N S s r  T3  and T4  eve n ts as  trig er.           ISS N 2 d de d Har d w a r N _TO( S2 } S1,  S 2  a n d S 3 s tates  entry,   stea d exit are c o n d in each stat e T1, T2, T 3   a are the  eve n syste m  trig e 2 088 -87 08    r }   3  are  d y an d itio n s   e   a nd T4  n ts as  e r.   Evaluation Warning : The document was created with Spire.PDF for Python.
I J ECE   I S SN 208 8-8 7 0 8       S o ftwa r e fo r S i mp lifyin g Embed d e d   S y stem  Design  Ba sed   o n  Even t-Driven  Met h o d   (Mam an  Abdu rohm an 49 9 4.   CA SE  ST UD O N   T R O N  GA ME AN D SIMPLE C A L CUL ATOR   4. 1. T r on  G a me  As a pr o o f t h at  t h e generat o r ha s bee n  ru nni ng  wel l ,  Tr on gam e  appl i cat i on fram e wo rk h a s bee n   gene rat e d a s  s h o w n i n   Fi g u r e  10 . B y  ad di n g  s p eci fi c f u nc t i ons t o  t h fra m e wor k Tr on  gam e  can ru wel l  o n   Ni os  Pl at fo rm . The r e a r e s o m e  st eps i n  de vel o pi n g  T r on gam e . The  fi rs t  st ep i s   defi ni ng  o b j ect req u i r e d  i n   Trongam e. There are  four  obj ect defi n e d  a s  f o l l o w s :  A r e n a,  Tr on  1 ,  T r on  2  an Lase r.  Are n f unct i ons  as  b ackgroun d, Tron  1  and  Tron  2  as acto r who  p e rfo r m   p o s ition  sh ift  an d  Laser as ob stacle th at ap p ears at  certain position and tim e . The second  step is defini ng Fi nite State  M achine for each object: Are n a ha s two  states whic h are “Start” and “ P la y . Tr on 1 a n d  Tr o n2  ha ve  “m ove_ H or”  a n d  “m ove_ V er ” st at es. M ean whi l e ,   Laser  has “ O FF” a n d  “O N  st at es. T h t h i r d  st ep i s   m a ki ng  di ag ra m  object s i n   soft ware  ge ne rat o r .   Ni os pr ocess o and  uc os ope rat i on sy st em  were use d  as a p pl i cat i on pl at f o r m . The fou r t h   st ep i s  m a ki ng  st at chart  diagram  for eac object . T h fift h   step is g e n e rato r fra m e wo rk  t h at  au to m a tical ly  g e n e rated files .c and   .h. T h ere are files for each ob ject in which there are 4 f ile objects he re : laser.c, tr on1.c, tron2.c, are n a.c .   There a r e f o ur  fi l e s ha nd l i ng com m uni cat i on am ong  ob ject s:   g l obal . h,  gl o b a l .c, en vi r onm ent . h ,   envi ro nm ent . c.          Fi gu re  1 0 Pr o cess o f   o b ject   di ag ram  devel opm ent  o f  t r on  gam e       4. 2. Si mpl e  C a l c ul a t or   In sim p le calc u lato r, arith m e tic fun c tio ns are d e fi ne as   h a rd ware   w h i l e  but t o n f unct i o ns rel a t e d t o   users a r e i m plem ent e d as pa rt  of s o ft ware .  B e fore m a ki ng  di ag ram  of em bedde d sy st em  used a s e t  of   gene rator, at fi rst, we  determ ine objects in t h e em be dde d s y ste m . Then,  we dete rm ine  whet her t h e object i s   i m p o r ted in to em b e d d e d software or  h a rd ware.  Afte r t h at, th e obj ect will b e  im p o r ted  in t o  emb e dd ed  so ft ware if its  o r d e rs n e ed   h i g h   flex i b ility,  an d  t h e obj ect  will b e  im p o r ted  in to  em b e d d e d   h a rdware if its  o r d e rs need a h i gh   p e rfo r m a n ce.  So, in th is calcu lator, ex trapo l atio n p r o cesses  will b e  im p o r ted  in t o   e m b e d d e d   h a rd ware  wh ereas p r o cess  o f   g r aph i c screen an d   d a ta m a n a g e m e n t  will b e  im p o r ted in to  em bedde d s o f t ware. T h e o b j ect s were  di vi de d i n t o   t w o pa rt s:  t h e em bedded s o ft ware a nd em bed d e d   h a rdware.  Th e fun c tion s  th at  requ ire  qu ick p r o cess  were  defi ned a s  ha rd ware  suc h  a s  ad der,  su bst r act or ,   m u lt i p l i e r and   m a i n  com pone nt s,  whi l e  t h e r e st  act s as s o ft ware .   Each   o f th ese ob j ects  will h a ve state  m ach in e d e scri b e d  i n   form  o f  state ch art d i ag ram ,  as Fig u re  1 1 The  followings  are t h proces s of c r ea ting state chart  from  three  objects.  1.   State  chart object-oneButton (em b edde s o ftware)  On eB u tton  ob ject will p e rfo r m a b i g  n u m b e r of 1 i f m o u s p o i n t er is on  the b u tton   o f  th n u m b e r 1, and   it will  i m p o r t th e num b e r 1  to an activ e op erand  i f  th e m o u s e is  p r essed. Th is  ob j ect  h a s th follo wing  states:   a)   Un di spl a ye d st at   Th is state will  p e rform  a n o r mal b u tto n  of  n u m b e r 1   when  an   o b j ect leav es th is state with ou t do ing   an process .  The e v ents that caus e  th e ob ject  t u rns  out  fr om  thi s  st at e are OVERONE (when the pointer  is   o n  th bu tto n of  th e nu m b er  1) .    Evaluation Warning : The document was created with Spire.PDF for Python.
                        I S SN 2 088 -87 08  IJEC E V o l .  5, No . 3,  J u ne 2 0 1 5   :    49 1 – 5 0 2   50 0     Fi gu re 1 1 . O b j ect   di ag ram   of Em bedded   Ha r d wa re/ S oft w a r     b)   Displ a yed stat e   This state  will pe rform  a bi g button  of  num ber 1  whe n   an  object lea v es this state  without  doing a n process .  The e v ents that caus e  th e ob ject  t u rn  out  f r om  t h i s  st at e are ONE ( b y  pres si ng t h but t on  of  num ber 1) , OU TON E  (w he t h e poi nt er g o es   o ff fr om   area of   t h e b u t t o n   o f  num ber 1) .   c)   Inserti n g St ate    Th is state will co ndu ct th e pro cess  o f  insertin g   nu m b er 1  into  an  activ o p erand  wh en  an   o b j ect en ters t o   the state eve n   though t h e object tu rns ou t fro m  th e state with ou d o i ng  any proce ss. T h e e v ents t h at   cau se th ob j e ct tu rn s ou t fro m  th is state  are ONE  (by  pressi ng th e bu tto n  of   nu m b er   1) , O U TONE  ( w h e n  th p o i nter  go es of f fr om  ar ea o f  th bu tto o f  nu m b er   1 ) O V E R ONE (w hen th e poin t er  is  on  t h b u tton   of  th e nu m b er  1)   2.   Object state c h art-Ope r and C ont roller (em b edde d so ftwa re )   Thi s  o b ject  wi l l  cont rol  an d d e t e rm i n e opera nds t h at  m u st   be act i v e. The  ope ra nds  of t h i s  cal cul a t o r   project are   o p e r an d 1 I n t ,  ope ran d  1 Fr ac, o p er an d 2 Int ,   o p er an d 2  F r ac . Conside r  thes e states:  a)   O p er an d 1 in t.  Wh en  an   ob j e ct en ters i n to  t h e state, it will activ ate  o p eran d1 in t  and   d e activ ate it wh en go ing   o f f fro this state. The  events t h at cause  th ob j ect  tu rn s ou t fro m  th is  state are COMMA (pre ssing  button  of  co mma) ,  AD D ( p r e ssing   bu tto n  +) , M U (p r e ssi ng  bu tton  *) SU ( p r e ssin g   bu tto n -), CLR (p r e ssi ng   but t o n C ) .   b)   O p eran d 1 frac.  Whe n  a n   obje ct enters i n to t h e state, it wil l  activate  oper a n d 1 f r ac And d eactiv ate it  wh en   go ing  off  from  this state. The e v e n ts that cause the object tu rn s ou t fro m  th is state are ADD (pressin g   bu tton  +),  M U L ( p res s i n g b u t t o n * ) , S U B  ( p ressi ng  but t o -), C L R  (p ressi n g   but t on C )  F U LLB AC (I f dat a  i n   ope ra n d  1  f r ac .  is  u s ed up)     Evaluation Warning : The document was created with Spire.PDF for Python.