⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csma2.cta

📁 很好的一本书
💻 CTA
字号:
/* * File: CTA-model of Carrier Sense Multiple Access Collision Detect *       Protocol (CSMA/CD). * modules: Sender, Medium * author:  Dirk Beyer, 2002 * last change: mvogel 2002-03-18 *  * Based on: "A case study: the CSMA/CD protocol", Sergio Yovine, *           VERIMAG-SPECTRE, November 18, 1994 */ // This module represents the template for one sender.MODULE Sender{  INPUT    propTime   : CONST; // time for signal propagation. (paper: Sigma)    transmTime : CONST; // time for data transmission. (paper: Lambda)    collDetect : SYNC;  // Collision detection by medium.  MULTREST    // Senders syncronisation events.    begin      : SYNC; // Begin of data transmitting    end        : SYNC; // End of data transmitting    busy       : SYNC; // Busy signaling by medium.  // Set initial state of automaton and clock values.  INITIAL STATE(Sender) = init AND x = transmTime + 1;  AUTOMATON Sender  {    STATE init         { TRANS { SYNC ?collDetect;                                 DO x' = x;                                 GOTO init;                               }                         TRANS { DO x' = x;                                 GOTO send;                               }                       }    STATE send         { INV FALSE;                         TRANS { SYNC #begin;                                 DO x' = 0;                                 GOTO transmit;                               }                         TRANS { SYNC #busy;                                 DO x' = 0;                                 GOTO collDetected;                               }                         TRANS { SYNC ?collDetect;                                 DO x' = 0;                                 GOTO collDetected;                               }                       }    STATE collDetected { INV x <= propTime + propTime;                         TRANS { SYNC ?collDetect;                                 DO x' = x;                                 GOTO collDetected;                               }                         TRANS { DO x' = transmTime + 1;                                 GOTO send;                               }                       }    STATE transmit     { INV x <= transmTime;                         TRANS { SYNC ?collDetect;                                 DO x' = 0;                                 GOTO collDetected;                               }                         TRANS { GUARD x = transmTime;                                 SYNC #end;                                 DO x' = transmTime + 1;                                 GOTO init;                               }                       }  }  LOCAL    // A clock to measure the time in a state.    x:  CLOCK(5);  // transmTime + 1}// Module of the whole system.MODULE System{  LOCAL    // Constants for time bounds.    propTime = 1   : CONST; // time for signal propagation. (paper: Sigma)    transmTime = 4 : CONST; // time for data transmission. (paper: Lambda)    collDetect     : SYNC;  // Collision detect signal. (Same signal for all)    // Begin signals for every Sender.    begin1        : SYNC;    begin2        : SYNC;    // End signals fro every Sender.    end1          : SYNC;    end2          : SYNC;    // Busy signals for every Sender.    busy1         : SYNC;    busy2         : SYNC;  INITIAL STATE(Medium)= init AND x = propTime + 1;  AUTOMATON Medium  {    STATE init         { INV FALSE;                         TRANS { SYNC #begin1;                                 DO x' = 0;                                 GOTO transmit;                               }                         TRANS { SYNC #begin2;                                 DO x' = 0;                                 GOTO transmit;                               }                       }    STATE transmit     {                         TRANS { GUARD x >= propTime;                                 SYNC #busy1;                                 DO x' = propTime + 1;                                 GOTO transmit;                               }                         TRANS { GUARD x >= propTime;                                 SYNC #busy2;                                 DO x' = propTime + 1;                                 GOTO transmit;                               }                         TRANS { SYNC #end1;                                 DO x' = propTime + 1;                                 GOTO init;                               }                         TRANS { SYNC #end2;                                 DO x' = propTime + 1;                                 GOTO init;                               }                         TRANS { GUARD x + 1 <= propTime;                                 SYNC #begin1;                                 DO x' = 0;                                 GOTO collDetected;                               }                         TRANS { GUARD x + 1 <= propTime;                                 SYNC #begin2;                                 DO x' = 0;                                 GOTO collDetected;                               }                       }    STATE collDetected { INV x <= propTime;                         TRANS { SYNC !collDetect;                                 DO x' = propTime + 1;                                 GOTO init;                               }                       }  }  LOCAL    x:         CLOCK(2); // propTime + 1  // Instances of Sender template.  INST iSender1 FROM Sender WITH  {    propTime   AS propTime;    transmTime AS transmTime;    collDetect AS collDetect;    begin      AS begin1;    end        AS end1;    busy       AS busy1;  }  INST iSender2 FROM Sender WITH  {    propTime   AS propTime;    transmTime AS transmTime;    collDetect AS collDetect;    begin      AS begin2;    end        AS end2;    busy       AS busy2;  }}// Analysis section:// The module name which should be checked and the type of the internal// representation for the region of reachable configurations is specified.REACHABILITY CHECK SystemUSE BDD{  // Declaration of region variables.  VAR    reached, error : REGION;  COMMANDS    // Define an error region. If this region is reachable from the initial    // region the ... is violated    //error :=     reached := REACH FROM INITIALREGION FORWARD;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -