Modeling EventBased Systems in Ptolemy II EE 249

Modeling Event-Based Systems in Ptolemy II EE 249: Design of Embedded Systems: Models, Validation, and Synthesis Elaine Cheong Yang Zhao December 8, 2001

Outline ® Project Goals ® Tiny. OS Architecture ® Demo 1 ® Demo 2 ® Conclusions

Our Goals ® Problem: ® Tiny. OS applications can be difficult to program and debug. ® Our Project: ® Understand Tiny. OS architecture. ® Model Tiny. OS in Ptolemy II. ® Investigate different models of computation.

Commands RX_packet_done (buffer) send_msg_thread TX_packet_done (success) ® Component msg_send_done (success) msg_rec (type, data) send_msg (addr, type, data) power(mode) init ® TX_packet (buf) Power (mode) Frame ® Command handlers ® Event handlers ® Tasks init Tiny. OS Architecture Messaging Component Internal State Events

Sample Tiny. OS Application Component B Internal State event 2 Component A Task 1 Internal State event 1 Component C LEDs Internal State Clock Internal State HW clock

Sample Tiny. OS Code // Component A char TOS_EVENT (Event_1) () { TOS_POST_TASK (Task_1); TOS_SIGNAL_EVENT (Event_2); return 1; } TOS_TASK () { delay (2 s); } // Component B char TOS_EVENT (Event_2) () { TOS_CALL_COMMAND (LEDS_on)(); return 1; } // Component C char TOS_COMMAND (LEDS_on)() { VAR(LEDS_on) = 1; return 1; }

Demo 1: DE/FSM ® Discrete ® New Event (DE) domain actor: Preemptable. Task Inputs: Input, Interrupt ® Output: Output ® ® Finite State Machine (FSM) domain ® Models component logic

Demo 2: TM/FSM ® Timed Multitasking (TM) domain ® Formerly known as RTOS ® Priority-driven multitasking ® Prioritized event queue ® Preemption ® Finite State Machine (FSM) domain ® Models component logic

Conclusions ® DE/FSM ® TM/FSM ® Future Work
- Slides: 9