Commit 89ae492c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files
parents 56f8884e b57d0d6f
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2018 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -332,17 +332,13 @@ package body Ocarina.Backends.C_Values is
if V.Sign < 0 then
Add_Char_To_Name_Buffer ('-');
elsif V.Base = 16 then
Add_Str_To_Name_Buffer ("16#");
Add_Str_To_Name_Buffer ("0x");
elsif V.Base = 8 then
Add_Str_To_Name_Buffer ("8#");
Add_Str_To_Name_Buffer ("0");
end if;
Add_ULL_To_Name_Buffer (V.IVal, ULL (V.Base));
if V.Base = 16 or else V.Base = 8 then
Add_Char_To_Name_Buffer ('#');
end if;
when K_Float =>
Add_Str_To_Name_Buffer (Long_Double'Image (V.FVal));
declare
......
......@@ -1493,7 +1493,7 @@ package body Ocarina.Backends.Build_Utils is
Write_Line
("###################################################");
Write_Eol;
Write_Str
Write_Line
("SUBDIRS = " &
"$(filter-out Makefile polyorb-hi-c, $(wildcard *))");
Write_Eol;
......@@ -1502,6 +1502,25 @@ package body Ocarina.Backends.Build_Utils is
(ASCII.HT &
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
Write_Eol;
Write_Line ("coverage:");
Write_Line (ASCII.HT & "-rm lcov.args");
Write_Line (ASCII.HT & "touch lcov.args");
Write_Line (ASCII.HT & "for d in $(SUBDIRS); do \");
Write_Line (ASCII.HT & ASCII.HT &
"lcov -c -i -d $$d -o coverage.$$d ;\");
Write_Line (ASCII.HT & ASCII.HT &
"lcov -c -d $$d -o coverage.$$d ;\");
Write_Line (ASCII.HT & ASCII.HT &
"echo ""-a coverage.$$d "" >> lcov.args ;\");
Write_Line (ASCII.HT & "done");
Write_Line (ASCII.HT
& "lcov `cat lcov.args` -o coverage.total");
Write_Line (ASCII.HT &
"genhtml --no-branch-coverage " &
"-o ../gcov_output coverage.total");
Write_Line (ASCII.HT & "rm lcov.args coverage.*");
Write_Eol;
Write_Line ("clean:");
Write_Line
(ASCII.HT &
......
......@@ -280,7 +280,7 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Char (ASCII.HT);
Write_Str
(" $(GNATMAKE) -x -p -P$(PROJECT_FILE) -XTARGET=$(TARGET)" &
" -XBUILD=$(BUILD) -XCGCTRL=$(CGCTRL) ${USER_CFLAGS}");
" -XBUILD=$(BUILD) -XCGCTRL=$(CGCTRL) -cargs ${USER_CFLAGS}");
-- If there are C source or C libraries, there will be more
-- options.
......@@ -290,7 +290,7 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Eol;
-- Use gnateliim to determine which portion of code is
-- Use gnatelim to determine which portion of code is
-- unused and recompile the application with Eliminate
-- pragmas. Note: gnatelim is available in GNAT GPL/Pro,
-- but not GCC
......
......@@ -1947,16 +1947,9 @@ package body Ocarina.Backends.PO_HI_C.Activity is
Make_Defining_Identifier
(Map_C_Variable_Name (S, Port_Queue => True)),
Array_Size =>
Make_Expression
(Left_Expr =>
Make_Literal
(CV.New_Int_Value (Fifo_Size, 0, 10)),
Operator => Op_Asterisk,
Right_Expr =>
Make_Call_Profile
(Make_Defining_Identifier (FN (F_Sizeof)),
Make_List_Id (RE (RE_Request_T))))),
Used_Type => RE (RE_Port_T));
(CV.New_Int_Value (Fifo_Size, 0, 10))),
Used_Type => RE (RE_Request_T));
Append_Node_To_List (N, CTN.Declarations (Current_File));
N :=
......
......@@ -1649,13 +1649,11 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
or else No
(CTN.Global_Port_Node (Backend_Node (Identifier (F))))
then
N := (Make_Literal (CV.New_Int_Value (-1, 0, 10)));
N := (Make_Literal (CV.New_Int_Value (1, -1, 10)));
Used_Bus := Get_Associated_Bus (F);
if Used_Bus /= No_Node then
if AAU.Is_Virtual_Bus (Used_Bus) then
Used_Bus :=
Parent_Component (Parent_Subcomponent (Used_Bus));
......
......@@ -2,733 +2,129 @@
---------- Ocarina LNT Generator ---------
------------------------------------------
FCS.aadl:110:03FCS.aadl:111:03FCS.aadl:112:03FCS.aadl:113:03FCS.aadl:114:03FCS.aadl:115:03FCS.aadl:116:03Begin Thread
FCS.aadl:110:03: warning: FF references a component type
FCS.aadl:111:03: warning: NL references a component type
FCS.aadl:112:03: warning: NF references a component type
FCS.aadl:113:03: warning: PL references a component type
FCS.aadl:114:03: warning: PF references a component type
FCS.aadl:115:03: warning: FL references a component type
FCS.aadl:116:03: warning: AP references a component type
FCS.aadl:163:04: warning: cpu_rm references a component type
FCS.aadl:164:04: warning: operator references a component type
FCS.aadl:165:04: warning: GPS references a component type
FCS.aadl:166:04: warning: IMU references a component type
FCS.aadl:167:04: warning: platform references a component type
FCS.aadl:168:04: warning: i2c references a component type
ocarina: Total: 0 error and 13 warnings
Begin Thread
Begin Processor
Begin Types
Begin Port
Begin Main
FCS.aadl:73:03 FCS.aadl:9:03 FCS.aadl:10:03 FCS.aadl:22:03 FCS.aadl:34:03 FCS.aadl:35:03 FCS.aadl:47:03 FCS.aadl:59:03 FCS.aadl:60:03 FCS.aadl:84:03 FCS.aadl:85:03 "Main.bcg"= divbranching reduction of "FLIGHTCONTROLSYSTEM_Main.lnt";
property PROPERTY_Deadlock is
deadlock of "Main.bcg";
expected FALSE;
end property;
property Scheduling_Test (ID) is
"Main_$ID.bcg"="Main.bcg"|=
[ true* . "ACTIVATION_$ID !T_Error" ] false;
expected TRUE;
end property;
module FLIGHTCONTROLSYSTEM_Threads (FLIGHTCONTROLSYSTEM_Types) is
process Thread_FF [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_ANGLE_O: LNT_Channel_Data,
AADL_PORT_ANGLE: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_ANGLE (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ANGLE_O (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_ANGLE (AADLDATA);
AADL_PORT_ANGLE_O (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_NL [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_POS_C: LNT_Channel_Data,
AADL_PORT_POS_O: LNT_Channel_Data,
AADL_PORT_ACC_C: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_POS_C (AADLDATA);
AADL_PORT_POS_O (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ACC_C (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_POS_C (AADLDATA);
AADL_PORT_POS_O (AADLDATA);
AADL_PORT_ACC_C (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_NF [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_POS_I: LNT_Channel_Data,
AADL_PORT_POS_O: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_POS_I (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_POS_O (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_POS_I (AADLDATA);
AADL_PORT_POS_O (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_PL [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_ACC_C: LNT_Channel_Data,
AADL_PORT_ACC_O: LNT_Channel_Data,
AADL_PORT_ANGLE_C: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_ACC_C (AADLDATA);
AADL_PORT_ACC_O (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ANGLE_C (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_ACC_C (AADLDATA);
AADL_PORT_ACC_O (AADLDATA);
AADL_PORT_ANGLE_C (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_PF [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_ACC_I: LNT_Channel_Data,
AADL_PORT_ACC_O: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_ACC_I (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ACC_O (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_ACC_I (AADLDATA);
AADL_PORT_ACC_O (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_FL [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_ANGLE_C: LNT_Channel_Data,
AADL_PORT_ANGLE_O: LNT_Channel_Data,
AADL_PORT_ORDER: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_ANGLE_C (AADLDATA);
AADL_PORT_ANGLE_O (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ORDER (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_ANGLE_C (AADLDATA);
AADL_PORT_ANGLE_O (AADLDATA);
AADL_PORT_ORDER (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Thread_AP [
ACTIVATION: LNT_Channel_Dispatch,
AADL_PORT_POSITION: LNT_Channel_Data,
AADL_PORT_ACC: LNT_Channel_Data,
AADL_PORT_ACC_I: LNT_Channel_Data,
AADL_PORT_POS_I: LNT_Channel_Data]
is
loop
select
select
ACTIVATION (T_Begin);
AADL_PORT_POSITION (AADLDATA);
AADL_PORT_ACC (AADLDATA)
[]
ACTIVATION (T_End);
AADL_PORT_ACC_I (AADLDATA);
AADL_PORT_POS_I (AADLDATA)
[]
ACTIVATION (T_All);
AADL_PORT_POSITION (AADLDATA);
AADL_PORT_ACC (AADLDATA);
AADL_PORT_ACC_I (AADLDATA);
AADL_PORT_POS_I (AADLDATA)
[]
ACTIVATION (T_Preempt)
end select ;
ACTIVATION (T_Ok)
[]
ACTIVATION (T_Error)
[]
ACTIVATION (T_Stop)
end select
end loop
end process
process Device_Operator [
AADL_PORT_POS_C: LNT_Channel_Data]
is
loop
select
AADL_PORT_POS_C (AADLDATA)
[]
null
end select
end loop
end process
process Device_GPS [
AADL_PORT_POSITION: LNT_Channel_Data]
is
loop
select
AADL_PORT_POSITION (AADLDATA)
[]
null
end select
end loop
end process
process Device_IMU [
AADL_PORT_ANGLE: LNT_Channel_Data,
AADL_PORT_ACC: LNT_Channel_Data]
is
loop
select
AADL_PORT_ANGLE (AADLDATA)
[]
AADL_PORT_ACC (AADLDATA)
end select
end loop
end process
process Device_Platform [
AADL_PORT_ORDER: LNT_Channel_Data]
is
loop
select
AADL_PORT_ORDER (AADLDATA)
[]
null
end select
end loop
end process
end module
module FLIGHTCONTROLSYSTEM_Ports (FLIGHTCONTROLSYSTEM_Types) is
FCS.aadl:73:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:9:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:10:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:22:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:34:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:35:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:47:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:59:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:60:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:84:03 Backends: warning : LNT generation requires the definition of Queue_Size property. For this generation, the default value (Queue_Size = 3) is used.
FCS.aadl:85:03 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 --
process Data_Port [
Input: LNT_Channel_Data,
Output: LNT_Channel_Data]
Input: LNT_Channel_Port,
Output: LNT_Channel_Port]
is
var Data : LNT_Type_Data in
Data := EMPTY;
loop
select
Input (AADLDATA)
Input (?Data)
[]
Output (AADLDATA)
Output (Data)
end select
end loop
end var
end process
process Event_Port_Periodic [
Input: LNT_Channel_Data,
Output: LNT_Channel_Data](
-- event port --
-- for no periodic threads --
process Event_Port [
Input: LNT_Channel_Port,
Output: LNT_Channel_Port,
Notify: LNT_Channel_Event](
Queue_Size: Nat)
is
var
Nb_Input : Nat
Data : LNT_Type_Data,
FIFO : LNT_Type_Data_FIFO,
Is_New : bool
in
Nb_Input := 0;
FIFO := {};
Data := EMPTY;
Is_New := false;
loop
select
Input (AADLDATA);
if (Nb_Input < Queue_Size)
then
Nb_Input := Nb_Input + 1
end if
Input (?Data);
Is_New := true;
if length (FIFO) >= Queue_Size then
FIFO := tail (FIFO)
end if;
FIFO := append (Data, FIFO)
[]
if (Nb_Input > 0)
then
Output (AADLDATA);
Nb_Input := Nb_Input - 1
end if
end select
end loop
end var
end process
end module
module FLIGHTCONTROLSYSTEM_Types
with "==", "eq" , "<", "lt" , "<=", "le" , ">", "gt" , ">=", "ge" is
type LNT_Type_Data is
AADLDATA
end type
channel LNT_Channel_Data is
(LNT_Type_Data)
end channel
type LNT_Type_Time_Constraint is
range 0 .. 240 of Nat
end type
type LNT_Type_Thread is
array [0 .. 11 ]of LNT_Type_Time_Constraint
end type
type LNT_Type_Thread_Array is
array [1 .. 7 ]of LNT_Type_Thread
end type
type LNT_Type_Dispatch is
T_Begin, T_End, T_All, T_Preempt, T_Stop, T_Error, T_Ok
end type
type LNT_Type_Event is
Incoming_Event, No_Event
end type
channel LNT_Channel_Dispatch is
(LNT_Type_Dispatch)
end channel
channel LNT_Channel_Event is
(LNT_Type_Event)
end channel
function Thread_Number : Nat
is
return 7
end function
function PPCM_THREAD : LNT_Type_Time_Constraint
is
return LNT_Type_Time_Constraint ( 120)
end function
function _+_ (
n1: LNT_Type_Time_Constraint,
n2: LNT_Type_Time_Constraint) : LNT_Type_Time_Constraint
is
return LNT_Type_Time_Constraint (Nat (n1) + Nat (n2) mod 240)
end function
function _-_ (
n1: LNT_Type_Time_Constraint,
n2: LNT_Type_Time_Constraint) : LNT_Type_Time_Constraint
is
if (n1 < n2)
then
return LNT_Type_Time_Constraint (((240 - Nat (n2)) + Nat (n1)) mod 240)
if (FIFO != {}) then
Output (Head (FIFO));
FIFO := tail (FIFO)
else
return LNT_Type_Time_Constraint (Nat (n1) - Nat (n2) mod 240)
Output (EMPTY)
end if
end function
function _*_ (
n1: LNT_Type_Time_Constraint,
n2: LNT_Type_Time_Constraint) : LNT_Type_Time_Constraint
is
return LNT_Type_Time_Constraint (Nat (n1) * Nat (n2) mod 240)
end function
end module
module FLIGHTCONTROLSYSTEM_Processor (FLIGHTCONTROLSYSTEM_Types) is
function Assign (
in var Threads: LNT_Type_Thread_Array,
I: Nat,
K: Nat,
Val: LNT_Type_Time_Constraint) : LNT_Type_Thread_Array
is
var
P : LNT_Type_Thread
in
P := Threads[I];
P[K] := Val;
Threads[I] := P
end var;
return Threads
end function
function Update_Thread (
in var Aux_Threads: LNT_Type_Thread_Array,
I: Nat,
TODO: LNT_Type_Time_Constraint) : LNT_Type_Thread_Array
is
var
P : LNT_Type_Thread
in
P := Aux_Threads[I];
if (P[2] == LNT_Type_Time_Constraint (0))
then
P[6] := LNT_Type_Time_Constraint (1)
end if;
P[2] := P[2] + TODO;
P[8] := LNT_Type_Time_Constraint (1);
if ((P[11] == LNT_Type_Time_Constraint (1)) and (P[2] == P[0]) )
then
P[7] := LNT_Type_Time_Constraint (1);
P[2] := LNT_Type_Time_Constraint (0);
P[4] := P[5];
P[5] := PPCM_THREAD;
P[10] := LNT_Type_Time_Constraint (0)
elsif ((P[11] == LNT_Type_Time_Constraint (0)) and (P[2] == P[0]) )
then
P[7] := LNT_Type_Time_Constraint (1);
P[2] := LNT_Type_Time_Constraint (0);
P[3] := P[3] + LNT_Type_Time_Constraint (1);
P[4] := P[4] + P[1];
P[5] := P[3] * P[1]
end if;
Aux_Threads[I] := P
end var;
return Aux_Threads
end function
process Sporadic_Notif [
INCOMING_EVENT_GATE: LNT_Channel_Event](
in out Threads: LNT_Type_Thread_Array,
k: Nat,
Counter: LNT_Type_Time_Constraint,
in out Is_Activated: bool)
is
select
INCOMING_EVENT_GATE (Incoming_Event);
Threads := Assign (Threads, K, 3, (Threads[k][3] + LNT_Type_Time_Constraint (1)) )