promela and spin
play

Promela and SPIN Mads Dam Dept. Microelectronics and Information - PDF document

Promela and SPIN Mads Dam Dept. Microelectronics and Information Technology Royal Institute of Technology, KTH


  1. Promela and SPIN Mads Dam Dept. Microelectronics and Information Technology Royal Institute of Technology, KTH ������������� � ������������� ��������� �������������� Promela and SPIN • Promela (Protocol Meta Language): – Language for modelling discrete, event-driven systems as transition systems • SPIN – Tool for performing simulations and full state-space validations of Promela models • XSPIN – X-interface to SPIN with graphic and textual representation of execution traces, message sequence diagrams, state- transition diagrams when running a Promela model ������������� � ������������� ��������� �������������� 1

  2. Promela and SPIN Promela and SPIN/XSPIN are – Developed by Gerard Holzmann at Bell Labs – Freeware for non-commercial use – State-of-art model checker (another is SMV) – Used by more than 2000 users See course binder and SPIN home page for more information ������������� � ������������� ��������� �������������� Promela Models • Describe (possibly very large but) finite transition system • Essentially: – No unbounded data – No recursive processes – No unbounded process creation • SPIN traverses the finite transition system • States constructed as they are visited (on-the-fly) – CWB equivalence checker constructs state space in advance • Temporal logic: Specifications represented as transition systems • This lecture: Getting started with Promela ������������� � ������������� ��������� �������������� 2

  3. SPIN vs CCS SPIN: CCS: • Dressed up automata • Dressed up automata • Verification by traversing • Verification by traversing states states • ”Realistic” program model • Elegance of theory • Linear time • Branching time • Properties as automata • Properties as logic • On-the-fly state space • State space constructed ”in exploration advance” • Sharable store • No store • Buffered comms • Primitive, synchronous comms ������������� � ������������� ��������� �������������� Alternating Bit Protocol �������������������� ���������*����������������������� �! ������������������������������������ � ������������������������������������ �������"�#� �� ������������������������������� �! $$���(�������"�#!�&' � � �%�������"�#! ��������"�#�����"�#� $$������ ��&' �� � �%�������"�#! $$�� �%��������"�#!�&' �� ��(�������"�#!� � �� $$����"�#��������"�#�&' ���� ����"�#���)�& ���"�# � $$��#���&'����� � ������������������������!� �� � ��*�����������������������! �� � � ������������� � ������������� ��������� �������������� 3

  4. Promela ���������������+++ Promela model: • Process types ��������������������������������� �! � • Channel declarations +++ � • Variable declarations • Main program ���������*������������������������ �! � +++ � ���� � +++ � ������������� � ������������� ��������� �������������� Processes A process – executes concurrently with all other processes, independent of speed and behaviour – communicates with other �������������������������������� �! processes using channels � – may access shared +++ variables � – follows the description of a process type There may be several processes of the same type Each process has own local state ������������� � ������������� ��������� �������������� 4

  5. A Process Type Process name A process type consists of – a name ������������������������������� �! � – a list of formal parameters Formal ��������"�#�����"�#� – local variable declarations �� parameters – body $$�� �%��������"�#!�&' ��(�������"�#!� �� Local variable $$����"�#��������"�#�&' ����"�#�%�� declarations ���"�# $$��#���&'����� �� �� Body � ������������� � ������������� ��������� �������������� Process Creation • Processes created by � � ����������������,! statement �����+++����� • Value of run statement is a ���� process identifier � +++�� � �����!�� • Processes can be created at ���-���� �����!�� any point of execution +++ • Processes start executing � after execution of run Number of processes created (optional) statement • Processes can also be �������.�����������/���������! created by adding ������ in ����+++����� Obs: No parameter front of process type when using active declaration ������������� �� ������������� ��������� �������������� 5

  6. Data Types and Variables Integers • Five different types of �����#����� ���) [0..1] integers as basic types ���#������ [0..1] • Records and arrays for ������� ���� [0..255] [-2 15 ..2 15 -1] compound data ��������#���� [-2 31 ..2 31 -1] ��������� • Type conflicts detected at Records ”runtime” ��������0��#��� • Default initial value 0 ������������1�� �������� ��� Arrays ��������2������ ������#����-� �� ������������� �� ������������� ��������� �������������� Tests and Assignment • Assignment with single equals sign: ����� • Testing for equality: ������ • Inequality: ��%��� • Comparisons: ��'�������3��� • Logical conjunction: ����44���� • Disjunction: ����55���� • Negation: %��� ������������� �� ������������� ��������� �������������� 6

  7. Channels �������������������������� Channels model transfer of data between processes Type of fields Name in each slot Size of buffer Each channel has typed buffer of finite length ������������������� Special type mtype used for Has value 1 enumerating message types ��������������������������������� Enumerated from 1 upwards ������������� �� ������������� ��������� �������������� Channels, cont’d • Channel: Fifo buffer with Receive statement: number of slots, each with ���6(�������"�# same number and types of Equivalently: fields ���6(�������"�#! Executable only if buffer nonempty • Several processes can share same channel Send statement: � ��6%��������"�# • A channel is usually, but not Equivalently: always, used unidirectionally � ��6%��������"�#! between two processes Default: Executable when buffer has at least 1 free slot ������������� �� ������������� ��������� �������������� 7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend