320 likes | 329 Views
This talk discusses real-time embedded software synthesis, including the concepts of real-time systems and embedded systems, the importance of software in these systems, the need for synthesis, and how to generate code automatically. It also explores real-world applications and future work in this field.
E N D
Real-Time Embedded Software Synthesis即時嵌入式軟體合成 熊博安 國立中正大學資訊工程學系 民國九十年十一月廿九日
What do I want to talk about ? • What is a real-time system? • What is an embedded system? • Why software? • Why synthesis? • How to generate code automatically? • Real-world applications? • Future work?
What is a REAL-TIME SYSTEM? • Timely Response • Predictable Response • System Correctness: • Timing (period, deadlines, etc.) • Function • Constraints: • Hard (meet ALL deadlines) • Soft (miss SOME deadlines)
Examples of Real-Time Systems air crafts telecommunications automobiles multimedia servers
What is an EMBEDDED SYSTEM? • Installed in a larger system • Dedicated task • Small Memory Space (200~400 KB) • Low Processing Power (100~200 MHz) • Unstable Environment (mobile, …) • Reactive • Real-Time
Embedded Systems Example research lab equipments space crafts factory automation home appliances office equipments medical instruments
Why SOFTWARE? • more than 70% software in many real-time embedded systems!!! • software is more flexible and easily reconfigurable, hence more errors!!! • real-time need correct software • embedded need small, efficient software
Why SYNTHESIS? • More software high complexity need for automatic design (synthesis) • Eliminate human and logical errors • Relatively immature synthesis techniques for software • Code optimizations • size • efficiency • Automatic code generation
How to generate CODE automatically? • Real-Time Embedded System Model? Set of concurrent tasks with memory and timing constraints! • How to execute in an embedded system (e.g. 1 CPU, 100 KB Mem)? Task Scheduling! • How to generate code?Map schedules to software code! • Code optimizations?Minimize size, maximize efficiency!
Bounded Memory Execution • Real-Time Constraints Hard Real-Time Soft Real-Time Quasi-Static Scheduling (QSS) Real-Time Scheduling (RTS) Firing Interval Bound Synthesis (FIBS) Design Issues and Solutions Proposed Solutions
Real-Time Embedded System Model Each arc from a place is either a uniqueoutgoingarc or a uniqueincoming arc to a transition. Time Free-Choice Petri Nets (TFCPN)
Synthesis Algorithm (Hard RTES) Synthesize_Hard_RTES(S, , ) { • QSS = Quasi_Static_Schedule(S, ); • If (QSS = NULL) return MemOverFlow; • RTS = Real_Time_Sched(S, QSS, ); • If (RTS = NULL) return RTS_Error; else Code = Code_Gen(S,QSS,RTS); • return Code; }
Synthesis Algorithm (Soft RTES) Synthesize_Soft_RTES(S, , ) { • QSS = Quasi_Static_Schedule(S, ); • If (QSS = NULL) return MemOverFlow; • FIB = Firing_Interv_Synth(S, QSS, ); • If (FIB = NULL) return FIB_Error; else Code = Code_Gen(S, QSS, FIB); • return Code; }
net decomposition • Finite Complete Cycle • Deadlock Free • Satisfy Memory Reqts Quasi-Static Scheduling TFCPN Conflict-Free Components MemoryOK!!! Quasi-Static Schedules
Real-Time Scheduling • Single Processor • Worst Case Timing Analysis: • Rate Monotonic (RM) • fixed priority • small period high priority • Earliest Deadline First (EDF) • dynamic priority • early deadline high priority
Firing Interval Bound Synthesis • 2 issues in Soft Real-Time Embedded System Control: • Synchronization Wait: (for completion of other tasks) • Real-Time Specification: (complete before deadlines) • Proposed Solutions: • Postpone Release Time: + w, w> 0 • Advance Finish Time: n, n>0
Code Generation • generate_code(S, QSS1, QSS2, …, QSSn, RTS) { • for i = 1, …, n { • Di = create_process(QSSi); • for j = 1, …, Indep_Tasks(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 “}”; • }
Processi Task 1 Task 2 Task k … Optimal Code Hierarchy Main Program TFCPN # Tasks = # Independent Source Transitions
Example S = {F1, F2}
Conflict Free Components for F1 Quasi-Static Scheduling v11 = (t11, t12, t11, t12, t14) 11 (v11) 22 v12 = (t11, t13, t15, t15) 13 (v12) 26
Conflict Free Components for F2 Quasi-Static Scheduling v21 = (t21, t22, 2t24, 4t26, t28,t29, t26)31 (v21) 68 v22 = (t21, t23, t25, 2t27, t28,t29, t26)15 (v22) 36
Real-Time Scheduling 1 = {v11, v12} 2 = {v12, t11 t12 k v12 t11 t12 t14, k 1}
CASE STUDY: AN ATM VIRTUAL PRIVATE NETWORK SERVER WFQ SCHEDULER CLASSIFIER CONGESTION CONTROL (MSD) ATM OUT (155 Mbit/s) ATM IN (155 Mbit/s) SUPERVISOR DISCARDED CELLS
0 MSD 1 CID 2 PTI 3 t1 4 READ_STATE_VCC 7 READ_OUT_QUID 10 t2 11 t3 t4 t5 12 READ_THRESHOLD 15 CHECK_QLENGTH2 18 t8 19 12 t6 UPDATE_STATE_INIT 13 18 12 READ_MAX_QLENGTH 15 CHECK_QLENGTH1 18 t7 19 t6 UPDATE_STATE_INIT t6 UPDATE_STATE_INIT • 20 • 21 21 • 30 • 31 • 52 20 21 26 30 36 46 37 58 25 26 31 35 41 51 42 63 t11 UPDATE_STATE_REJ • t11 UPDATE_STATE_REJ t10 t9 • 25 • 26 26 • 35 • 36 • 57 PUSH PUSH PUSH t10 t9 UPDATE_STATE_ACC UPDATE_STATE_ACC COMPUTE_OUT_TIME t12 *SCHEDULE_WFQ PUSH COMPUTE_OUT_TIME t12 *SCHEDULE_WFQ COMPUTE_OUT_TIME t12 COMPUTE_OUT_TIME t12 *SCHEDULE_WFQ *SCHEDULE_WFQ *SCHEDULE_WFQ Schedule Results: 49 markings 14 schedules 63 instructions 12 Kbytes Memory
Conclusions • Software needs to be synthesized automatically because it is getting more and more complex! • Hard RTES Synthesis Method = QSS + RTS + Code-Generation • Soft RTES Synthesis Method = QSS + FIBS + Code-Generation • ATM VPN Server Example showsfeasibility of our approach
Current and Future Work • Integrate Time & Memory Scheduling • A general Petri Net system model • Java Implementation: install into embedded systems such as PDA for dynamic code change and management by user (web computing) • C Code Generation: for embedding into prototyping systems such as SoC design and verification platform