AUBURN COMP 3510 - Software architectures

Unformatted text preview:

Software ArchitecturesDesign ApproachState DiagramExampleSlide 5Example (2)One Loop …Initialize VariablesCompute TransitionsSolve States EvolutionCompute ActionsPutting Things TogetherMore General I/OTypical SystemSlide 15Round Robin (Polling)Round Robin (2)PowerPoint PresentationRound Robin With InterruptsSlide 20Max Time Available to Handle Interrupt?Example (2, cont’d): “Most Urgent” Steps to Handle the InterruptExample (3, cont’d): Main LoopSlide 24Function Queue SchedulingFunction Queue Scheduling (2)What Can we do?Software ArchitecturesRead Chapter 5(David E. Simon, An Embedded Software Primer)(01/14/19)Embedded Systems Development Software Architectures S.Biaz 2Design Approach•State Diagram:–For systems with binary I/O system•Classical software approach–For more sophisticated I/O systems(01/14/19)Embedded Systems Development Software Architectures S.Biaz 3State Diagram•Identify:–States–Condition Transitions–Initial (states)•Express your system as a state diagram(01/14/19)Embedded Systems Development Software Architectures S.Biaz 4Example•Consider a wagon that works as follows:–The wagon starts a cycle when a human operator pushes the “Start” button–The wagon starts moving to the right–When the wagon hits the sensor R, it stops–After 15 seconds or if we push the “Start” button, the wagon starts moving to the left.– When the wagon hits the sensor L, it stopsL RStart(01/14/19)Embedded Systems Development Software Architectures S.Biaz 5ExampleL RStart0Rising edge on “Start”1Move RightR=12No ActionRising edge on “Start”Move Left3L=1Embedded SystemLRStartGo Right (GR)Go Left (GL)(01/14/19)Embedded Systems Development Software Architectures S.Biaz 6Example (2)L RStart0Rising edge on “Start”1Move RightR=12No ActionRising edge on “StartMove Left3L=1Embedded SystemLRStartGo Right (GR)Go Left (GL)1) Associate Variables to statesS0S1S2S32) Associate Variables to transitionsT0T1T2T3(01/14/19)Embedded Systems Development Software Architectures S.Biaz 7One Loop …1. Initialize variables Si and Ti2. Compute Transitions Ti3. Solve States Evolution4. Compute Actions5. Go Step 2(01/14/19)Embedded Systems Development Software Architectures S.Biaz 8Initialize Variables•Set all Si to 0, Set S0 to 1•Set all Ti to 0•(Due to computation of “Rising” edges on start button, initialize ex-state of buttons) ExS = Start (Copy button start on variable ExS)0Rising edge on “Start”1Move RightR=12No ActionRising edge on “Start”Move Left3L=1S0S1S2S3T0T1T2T3(01/14/19)Embedded Systems Development Software Architectures S.Biaz 9Compute Transitions•T1 = R•T3 = L•T0 = 0•if ((Start ==1) && (ExS==0)) then T0 = 1;•ExS = Start•T2 = T0 0Rising edge on “Start”1Move RightR=12No ActionRising edge on “Start”Move Left3L=1S0S1S2S3T0T1T2T3(01/14/19)Embedded Systems Development Software Architectures S.Biaz 10Solve States Evolution•if (S0 == 1) then if (T0 == 1) then {S0= 0; S1= 1}•if (S1 == 1) then if (T1 == 1) then {S1 = 0, S2 = 1}•if (S2 == 1) then if (T2 == 1) then S2= 0, S3 = 1 •if (S3 == 1) then if (T3 == 1) then S3= 0, S0 = 1 0Rising edge on “Start”1Move RightR=12No ActionRising edge on “Start”Move Left3L=1S0S1S2S3T0T1T2T3(01/14/19)Embedded Systems Development Software Architectures S.Biaz 11Compute Actions•GR = S1•GL = S30Rising edge on “Start”1Move RightR=12No ActionRising edge on “Start”Move Left3L=1S0S1S2S3T0T1T2T3(01/14/19)Embedded Systems Development Software Architectures S.Biaz 12Putting Things TogetherSet all Si to 0, Set S0 to 1Set all Ti to 0ExS = StartT1 = RT3 = LT0 = 0if ((Start ==1) && (ExS==0)) then T0 = 1;ExS = StartT2 = T0if (S0 == 1) then if (T0 == 1) then {S0= 0; S1= 1}if (S1 == 1) then if (T1 == 1) then {S1 = 0, S2 = 1}if (S2 == 1) then if (T2 == 1) then S2= 0, S3 = 1 if (S3 == 1) then if (T3 == 1) then S3= 0, S0 = 1 GR = S1GL = S3More General I/O(01/14/19)Embedded Systems Development Software Architectures S.Biaz 14Typical SystemDevice 1Device 2Device 3Device 4Device 5Data BusAddress BusPHere, the device makes some preprocessing..(01/14/19)Embedded Systems Development Software Architectures S.Biaz 15Software Architectures•Round-Robin (Polling)•Round-Robin with Interrupts•Function-Queue Scheduling•Concurrent Programming (Over an OS)(01/14/19)Embedded Systems Development Software Architectures S.Biaz 16Round Robin (Polling)While (1){Process Device 1;Process Device 2;…………………;Process Device i;………………….;Process Device n-1;Process Device n;}Process Device iIf (Device i needs attention){……………..………………………………………………}(01/14/19)Embedded Systems Development Software Architectures S.Biaz 17Round Robin (2)•A simple technique, but…•No control on latency for any device handler•Worst case latency time for any device: –Sum of execution time of all other handlers•Can we have some control on latency? Suppose we want to minimize Device 3 latency, what to do?(01/14/19)Embedded Systems Development Software Architectures S.Biaz 18Round Robin: Minimizing Latency for Device 3While (1){Process Device 3;Process Device 1;Process Device 3; Process Device 2; …………………; Process Device 3Process Device i;………………….;Process Device n-1; Process Device 3Process Device n;}What is the worst case for Device 3?The execution time of the longest device handler routineHow is impacted the latency of theother device handlers?1) Loop is longer2) If device 3 requests attention multiple times in a loop.. 3) How about I add a new device?(01/14/19)Embedded Systems Development Software Architectures S.Biaz 19Round Robin With Interrupts•A device requests service through interrupt•The interrupt routine handler must :–execute only the URGENT STEPS (things that cannot wait), raise flags, update some variables…–Leave the remaining processing to be done in the main loop(01/14/19)Embedded Systems Development Software Architectures S.Biaz 20Example•An alarm message consists of a variable number of characters terminated with the CR character•Receipt of a character triggers an


View Full Document

AUBURN COMP 3510 - Software architectures

Documents in this Course
Load more
Download Software architectures
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Software architectures and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Software architectures 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?