producer_consumer.aadl.out 2.98 KB
Newer Older
Bechir Zalila's avatar
Bechir Zalila committed
1
2
3
4
------------------------------------------
---------- Ocarina LNT Generator ---------
------------------------------------------

yoogx's avatar
yoogx committed
5
6
7
8
9
producer_consumer.aadl:123:05: warning: T references a component type
producer_consumer.aadl:127:05: warning: CPU references a component type
producer_consumer.aadl:128:05: warning: the_bus references a component type
ocarina: Total: 0 error and 3 warnings
Begin Thread
Bechir Zalila's avatar
Bechir Zalila committed
10
11
12
Begin Processor
Begin Types
Begin Main
yoogx's avatar
yoogx committed
13
14
15
16
17
producer_consumer.aadl:53:05 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default  value (Queue_Size = 3) is used.
Begin Port
module LNT_Generic_Process_For_Port_Connections (Types) is 
-- No Behavior Annex
--  data port --
Bechir Zalila's avatar
Bechir Zalila committed
18
   process Data_Port [
yoogx's avatar
yoogx committed
19
20
   Input: LNT_Channel_Port, 
   Output: LNT_Channel_Port] 
Bechir Zalila's avatar
Bechir Zalila committed
21
   is 
yoogx's avatar
yoogx committed
22
23
      var Data : LNT_Type_Data in
         Data := EMPTY;
Bechir Zalila's avatar
Bechir Zalila committed
24
25
         loop 
            select 
yoogx's avatar
yoogx committed
26
27
28
               Input (?Data)
               [] 
               Output (Data)
Bechir Zalila's avatar
Bechir Zalila committed
29
30
31
            end select 
         end loop
      end var
yoogx's avatar
yoogx committed
32
   end process
Bechir Zalila's avatar
Bechir Zalila committed
33
   
yoogx's avatar
yoogx committed
34
35
36
37
38
--  event port --
--  for no periodic threads --
   process Event_Port [
   Input: LNT_Channel_Port, 
   Output: LNT_Channel_Port, 
Bechir Zalila's avatar
Bechir Zalila committed
39
40
41
42
   Notify: LNT_Channel_Event](
   Queue_Size: Nat) 
   is 
      var 
yoogx's avatar
yoogx committed
43
44
         Data : LNT_Type_Data,
         FIFO : LNT_Type_Data_FIFO,
Bechir Zalila's avatar
Bechir Zalila committed
45
46
         Is_New : bool
      in 
yoogx's avatar
yoogx committed
47
48
         FIFO := {};
         Data := EMPTY;
Bechir Zalila's avatar
Bechir Zalila committed
49
50
51
         Is_New := false; 
         loop 
            select 
yoogx's avatar
yoogx committed
52
53
54
55
56
57
               Input (?Data); 
               Is_New := true;
               if length (FIFO) >= Queue_Size then
                  FIFO := tail (FIFO)
               end if;
               FIFO := append (Data, FIFO)
Bechir Zalila's avatar
Bechir Zalila committed
58
               []
yoogx's avatar
yoogx committed
59
60
61
62
63
               if (FIFO != {}) then 
                  Output (Head (FIFO));
                  FIFO := tail (FIFO)
               else
                  Output (EMPTY)
Bechir Zalila's avatar
Bechir Zalila committed
64
65
               end if
               []
yoogx's avatar
yoogx committed
66
               if (Is_New) then 
Bechir Zalila's avatar
Bechir Zalila committed
67
68
69
70
71
72
73
74
                  Notify (Incoming_Event); 
                  Is_New := false
               else 
                  Notify (No_Event)
               end if
            end select 
         end loop
      end var
yoogx's avatar
yoogx committed
75
76
77
78
79
80
81
   end process

-- for periodic threads
   process Event_Port_For_Periodic [
   Input: LNT_Channel_Port, 
   Output: LNT_Channel_Port](
   Queue_Size: Nat) 
Bechir Zalila's avatar
Bechir Zalila committed
82
83
   is 
      var 
yoogx's avatar
yoogx committed
84
85
86
         Data : LNT_Type_Data,
         FIFO : LNT_Type_Data_FIFO,
         Is_New : bool
Bechir Zalila's avatar
Bechir Zalila committed
87
      in 
yoogx's avatar
yoogx committed
88
89
90
         FIFO := {};
         Data := EMPTY;
         Is_New := false; 
Bechir Zalila's avatar
Bechir Zalila committed
91
92
         loop 
            select 
yoogx's avatar
yoogx committed
93
94
95
96
97
98
               Input (?Data); 
               Is_New := true;
               if length (FIFO) >= Queue_Size then
                  FIFO := tail (FIFO)
               end if;
               FIFO := append (Data, FIFO)
Bechir Zalila's avatar
Bechir Zalila committed
99
               []
yoogx's avatar
yoogx committed
100
101
102
103
104
               if (FIFO != {}) then 
                  Output (Head (FIFO));
                  FIFO := tail (FIFO)
               else
                  Output (EMPTY)
Bechir Zalila's avatar
Bechir Zalila committed
105
106
107
108
               end if
            end select 
         end loop
      end var
yoogx's avatar
yoogx committed
109
110
   end process
end module