Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
5bcaae76
Commit
5bcaae76
authored
Aug 01, 2016
by
yoogx
Browse files
Merge branch 'master' of
https://github.com/OpenAADL/ocarina
parents
1503bc62
3cb309df
Changes
6
Hide whitespace changes
Inline
Side-by-side
resources/runtime/python/ocarina/lmp.py
View file @
5bcaae76
...
...
@@ -285,4 +285,3 @@ def getRoot ():
'''
return
runOcarinaFunction
(
libocarina_python
.
getRoot
)
resources/runtime/python/ocarina/ocarina.py
View file @
5bcaae76
...
...
@@ -88,7 +88,7 @@ def set_real_theorem (theorem_name):
def
add_real_library
(
libraryname
):
'''
:param libraryname: name of the
theorem
:param libraryname: name of the
REAL library file to include
:type libraryname: string
'''
...
...
resources/runtime/python/test/rma.aadl
0 → 100644
View file @
5bcaae76
--
This
AADL
model
illustrates
how
to
conduct
schedulability
analysis
--
using
Cheddar
,
and
then
code
generation
of
periodic
tasks
.
--
--
Two
periodic
tasks
run
in
parallel
,
without
interaction
.
Tasks
--
parameters
allows
RMA
analysis
package
RMAAadl
public
-----------------
--
Subprograms
--
-----------------
subprogram
Hello_Spg_1
properties
source_language
=>
(
C
);
source_name
=>
"user_hello_spg_1"
;
source_text
=>
(
"hello.c"
);
end
Hello_Spg_1
;
subprogram
Hello_Spg_2
properties
source_language
=>
(
C
);
source_name
=>
"user_hello_spg_2"
;
source_text
=>
(
"hello.c"
);
end
Hello_Spg_2
;
-------------
--
Threads
--
-------------
thread
Task
end
Task
;
thread
implementation
Task
.
impl_1
calls
Mycalls
:
{
P_Spg
:
subprogram
Hello_Spg_1
;
};
properties
Dispatch_Protocol
=>
Periodic
;
Priority
=>
1
;
Period
=>
1000
ms
;
Compute_Execution_time
=>
0
ms
..
3
ms
;
Deadline
=>
1000
ms
;
end
Task
.
impl_1
;
thread
implementation
Task
.
impl_2
calls
Mycalls
:
{
P_Spg
:
subprogram
Hello_Spg_2
;
};
properties
Dispatch_Protocol
=>
Periodic
;
Priority
=>
2
;
Period
=>
500
ms
;
Compute_Execution_time
=>
0
ms
..
5
ms
;
Deadline
=>
500
ms
;
end
Task
.
impl_2
;
---------------
--
Processor
--
---------------
processor
cpu
end
cpu
;
processor
implementation
cpu
.
impl
properties
Scheduling_Protocol
=>
(
POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL
);
end
cpu
.
impl
;
---------------
--
Processes
--
---------------
process
node_a
end
node_a
;
process
implementation
node_a
.
impl
subcomponents
Task1
:
thread
Task
.
impl_1
;
Task2
:
thread
Task
.
impl_2
;
end
node_a
.
impl
;
------------
--
System
--
------------
system
rma
end
rma
;
system
implementation
rma
.
impl
subcomponents
node_a
:
process
node_a
.
impl
;
cpu
:
processor
cpu
.
impl
;
properties
Actual_Processor_Binding
=>
(
reference
(
cpu
))
applies
to
node_a
;
end
rma
.
impl
;
end
RMAAadl
;
resources/runtime/python/test/rma.real
0 → 100644
View file @
5bcaae76
theorem check_scheduling
foreach e in system_set do
check(1=1);
end check_scheduling;
resources/runtime/python/test/test.py
View file @
5bcaae76
...
...
@@ -7,45 +7,25 @@ def main ():
'''Test function'''
err
=
ocarina
.
load
(
"rma.aadl"
);
# load a file
print
'load("rma.aadl")'
print
err
if
err
[
1
]
!=
None
:
print
'info message: '
,
err
[
1
]
if
err
[
2
]
!=
[]:
print
'warning message: '
,
err
[
2
]
if
err
[
3
]
!=
[]:
print
'error message: '
,
err
[
3
]
sys
.
exit
(
2
)
print
'load("rma.aadl"),:'
,
err
err
=
ocarina
.
load
(
"deployment.aadl"
);
# load a file
print
'load("deployment.aadl")'
if
err
[
1
]
!=
None
:
print
'info message: '
,
err
[
1
]
if
err
[
2
]
!=
[]:
print
'warning message: '
,
err
[
2
]
if
err
[
3
]
!=
[]:
print
'error message: '
,
err
[
3
]
sys
.
exit
(
2
)
print
'load("deployment.aadl"):'
,
err
err
=
ocarina
.
analyze
();
# analyze models
print
'ocarina.analyze()'
if
err
[
1
]
!=
None
:
print
'info message: '
,
err
[
1
]
if
err
[
2
]
!=
[]:
print
'warning message: '
,
err
[
2
]
if
err
[
3
]
!=
[]:
print
'error message: '
,
err
[
3
]
sys
.
exit
(
2
)
print
'ocarina.analyze():'
,
err
err
=
ocarina
.
instantiate
(
"rma.impl"
);
# instantiate system
print
'ocarina.instantiate("rma.impl")'
if
err
[
1
]
!=
None
:
print
'info message: '
,
err
[
1
]
if
err
[
2
]
!=
[]:
print
'warning message: '
,
err
[
2
]
if
err
[
3
]
!=
[]:
print
'error message: '
,
err
[
3
]
sys
.
exit
(
2
)
print
'ocarina.instantiate("rma.impl"):'
,
err
err
=
ocarina
.
add_real_library
(
"rma.real"
);
print
err
;
err
=
ocarina
.
set_real_theorem
(
"check_scheduling"
);
print
err
;
err
=
ocarina
.
generate
(
ocarina
.
Backends
.
real_theorem
);
print
err
;
if
__name__
==
"__main__"
:
main
()
...
...
tools/mknodes/parser.adb
View file @
5bcaae76
...
...
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-201
5
ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-201
6
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- --
...
...
@@ -2723,56 +2723,12 @@ package body Parser is
Output
.
Write_Str
(
" (N):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"res = libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
)));
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
A
);
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error"
);
Output
.
Write_Str
(
".getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2784,56 +2740,12 @@ package body Parser is
Output
.
Write_Str
(
" (N, V):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
)));
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
WS
(
A
));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N, V)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N, V)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2859,56 +2771,12 @@ package body Parser is
Output
.
Write_Str
(
" (N):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"res = libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
))
&
"_python"
);
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
GNS
(
Identifier
(
A
)));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
@@ -2920,56 +2788,12 @@ package body Parser is
Output
.
Write_Str
(
" (N, V):"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"info = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"error = io.BytesIO()"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"raisedError = []"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"res = ''"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"with std_redirector(info,error):"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"try:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"libocarina_python."
);
Output
.
Write_Str
(
"return runOcarinaFunction (libocarina_python."
);
Output
.
Write_Str
(
Ada
.
Directories
.
Base_Name
(
Namet
.
Get_Name_String
(
Output_Name
))
&
"_python"
);
Output
.
Write_Str
(
"_"
);
Output
.
Write_Str
(
WS
(
GNS
(
Identifier
(
A
))));
Output
.
Write_Str
(
" ("
);
Output
.
Write_Eol
;
W_Indentation
(
4
);
Output
.
Write_Str
(
"N, V)"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"except:"
);
Output
.
Write_Eol
;
W_Indentation
(
3
);
Output
.
Write_Str
(
"raisedError.append(getErrorMessage())"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"stderrMsg = sortStderrMessages(error."
);
Output
.
Write_Str
(
"getvalue().decode('utf-8'))"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"if stderrMsg[1]!=[]:"
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError.append(stderrMsg[1])"
);
Output
.
Write_Eol
;
W_Indentation
(
1
);
Output
.
Write_Str
(
"return [ res , info.getvalue()."
);
Output
.
Write_Str
(
"decode('utf-8'), stderrMsg[0] , "
);
Output
.
Write_Eol
;
W_Indentation
(
2
);
Output
.
Write_Str
(
"raisedError ]"
);
Output
.
Write_Str
(
", N, V)"
);
Output
.
Write_Eol
;
Output
.
Write_Eol
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment