1 / 20

Formal Synthesis and Code Generation of Embedded Real-Time Software

Formal Synthesis and Code Generation of Embedded Real-Time Software. Pao-Ann Hsiung National Chung Cheng University Chiayi-621, Taiwan, ROC. 9th ACM/IEEE International Symposium on Hardware-Software Codesign, Copenhagen, Denmark, April 25-27, 2001. Contents. Embedded Real-Time Software

margot
Télécharger la présentation

Formal Synthesis and Code Generation of Embedded Real-Time Software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Formal Synthesis and Code Generation of Embedded Real-Time Software Pao-Ann Hsiung National Chung Cheng University Chiayi-621, Taiwan, ROC. 9th ACM/IEEE International Symposium on Hardware-Software Codesign, Copenhagen, Denmark, April 25-27, 2001.

  2. Contents • Embedded Real-Time Software • Model and Problem • Synthesis Algorithm • Code Generation • Example • Conclusions

  3. Bounded Memory Execution • Real-Time Constraints Quasi-Static Data Scheduling (QSDS) Dynamic Real-Time Scheduling (DRTS) Embedded Real-Time Software • Two Main Issues: Proposed Solutions

  4. Model Each arc from a place is either a uniqueoutgoingarc or a uniqueincoming arc to a transition. Time Free-Choice Petri Nets (TFCPN)

  5. Synthesis Problem • Given a set of TFCPNs, an upper-bound on memory use, and a set of real-time constraints, a software code is to be generated such that: • it can be executed on a single processor, • its memory usage does not exceed the upper bound, and • it satisfies all real-time constraints.

  6. Synthesis Algorithm • ERTS_Synth(S, ,E) { • // Quasi-Static Data Scheduling (QSDS) • for each Aiin S { • Bi = CF_generate(Ai); // Bi: set of CF components • for each CF component Aijin Bi { • QSSij = quasi_static_schedule(Aij, ); • if QSSij= NULL{ print “QSDS failed for Aij”; return QError;} • else QSSi = QSSi {QSSij}; } } • // Dynamic Real-Time Scheduling (DRTS) • RTS = real_time_schedule(QSS1,…,QSSn, B1,…,Bn, E); • if RTS = NULL { • print “DRTS failed for S”; return DRTS_Error; } • else generate_code(S, QSS1,…, QSSn,RTS); • return Synthesized; }

  7. net decomposition Finite Complete Cycle Deadlock-Free Quasi-Static Data Scheduling Conflict-Free Components TFCPN Quasi-Static Data Scheduled CF-Components

  8. Dynamic Real-Time Scheduling • Single Processor • Worst Case Timing Analysis for each TFCPN • Rate-Monotonic Scheduling • Earliest Deadline First Scheduling

  9. Code Generation • generate_code(S, QSS1, QSS2, …, QSSn, RTS) { • for i = 1, …, n { • Di = create_process(QSSi); • for j = 1, …, IFR(Ai) { • dij = create_task(QSSi); • generate_task_code(dij); • add_task(dij, Di);}} • create_main(); • output “for(i=0, i<length(RTS); i++) {”; • for k = 1, …, RTS output_code(Dik); • output “}”; } IFR(Ai): # transitions in Aiwith independent firing rates

  10. Processi Task 1 Task 2 Task k … Main Program Optimal Code Hierarchy Source Transitions in TFCPN

  11. Task Code Generation • generate_task_code(dij) { • output t0; // t0: source transition • for each ICF sub-component dijkin dij { • for l = 1, …, uk { • if tlis visited continue; • if tlis a conflicting transition in Ti { • if p = in_place(tl) not visited • output “switch(p){”; • else output “break;”; • output “case tl: call tl;”; • for all p = out_place(tl) • output “count(p’)+=F(t(l),p’);”; • times_visitedp++; }

  12. Task Code Generation (contd.) • if NumFire(tl) < NumFire(tl-1) { • output “if(count(p)>=F(p,tl) {call tl;”; • output “count(p)=NumFire(t(l1)); }”; } • if NumFire(tl) > NumFire(tl-1) { • output “while(count(p)>=F(p,tl)){call tl;”; • for all p = in_place(tl) • output “count(p)=F(p, tl);”; • output “}”; } • if NumFire(tl) = NumFire(tl-1) { • output “count(p) = F(p, tl); call tl”; • output “count(p) += F(tl,p);”; } • if times_visitedp = num_choice(p) • output “}”; } } }

  13. Example S = {F1, F2}

  14. Conflict Free Components for F1 Quasi-Static Data Scheduling v11 = (t11, t12, t11, t12, t14) 11  (v11)  22 v12 = (t11, t13, t15, t15) 13  (v12)  26

  15. Quasi-Static Data Scheduling Conflict Free Components for F2 v21 = (t21, t22, 2t24, 4t26, t28,t29, t26)31  (v21)  68 v22 = (t21, t23, t25, 2t27, t28,t29, t26)15  (v22)  36

  16. Dynamic Real-Time Scheduling 1 = {v11, v12} 2 = {v12, t11 t12 k  v12 t11 t12 t14, k  1}

  17. ERTS Code for task11 • task11( ) {// d11 = {t11, t12, t14, t13, t15} • call t11; • switch(p1) { • case t12: call t12; count(p2) + = 1; • if(count(p2) 2) • { call t14; count(p2) = 2; } • break; • case t13: call t13; count(p3) += 2; • while(count(p3) 1) • { call t15; count(p3) =1; } • break; } • }

  18. ERTS Code for task21 • task21( ) { // d21 = {t21, t22, t24, t26, t23, t25, t27} • call t21; • switch(p1) { • case t22: call t22; count(p2) += 2; • while(count(p2) 1) { • count(p4) += 2; call t24; count(p2) =1;} • while(count(p4) 1) { • call t26; count(p4) =1;} break; • case t23: call t23 ; count(p3 ) += 1; count(p3) =1; • call t25 ; count(p5 ) += 2; count(p6 ) += 2; • while(count(p5)  1 count(p6)  1) { • call t27; count(p5) =1; count(p6) =1; } • break; } }

  19. ERTS Code for task22 and main() • task22( ) { // d22 = {t28, t29, t26} • call t28; call t29; call t26; • } • main( ) { • k11 = k21 = k22 = 0; // iteration numbers • while true { • if(now()11k11 100) { task11(); k11++;} • if(now()21k21110) { task21(); k21++;} • if(now()22k22110) { task22(); k22++;} } • }

  20. Conclusions • An algorithm proposed for synthesizing Embedded Real-Time Software • Bounded Memory Execution Quasi-Static Data Scheduling • Real-Time Constraints Dynamic Real-Time Scheduling • Code Generation  Optimal # of tasks • Future Work: Exception Handling, Verification, Theory on Separation of Concerns

More Related