Commit df432470 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add STG code

parent 399c42bc
......@@ -143,6 +143,7 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
return
# Generate the code for each input signal (provided interface) and timers
pi_code = []
for signal in process.input_signals + [
{'name': timer.lower()} for timer in process.timers]:
sig_template = STG.getInstanceOf('pi_signature')
......@@ -167,6 +168,7 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
# For each input signal, define the possible transition based on the
# current state.
cases = []
for state in process.mapping.viewkeys():
if state.endswith(u'START'):
continue
......@@ -209,6 +211,13 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
# Execute the correponding transition
if input_def.transition:
case_template['transition'] = input_def.transition_id
cases.append(str(case_template))
pi_template['cases'] = cases
# Generate the template amd add it to a list
pi_code.append(str(pi_template))
process_template['arrs_inp'] = pi_code
# for the .ads file, generate the declaration of the required interfaces
# output signals are the asynchronous RI - only one parameter
......
......@@ -6,12 +6,13 @@ group adb;
* pdecl : inner procedure declarations (array)
* pcode : inner procedure code (array)
* vars: list of local variables and sort: { name: str, sort: str })
* arrs_inp : code handling the reception of messages (array of <input_signal>)
* constants: list of start named start transitions (when using substates)
* states: list of states
* asn1_mod : list of ASN.1 modules
* simu, dll : flags set by the user for generation of optional code
*/
process(name, decl, pdecl, pcode vars, constants, states, asn1_mod, simu, dll) ::= <<
process(name, decl, pdecl, pcode vars, arrs_inp, constants, states, asn1_mod, simu, dll) ::= <<
-- This file was generated automatically: DO NOT MODIFY !
<if(asn1_mod)>
......@@ -89,6 +90,7 @@ end dll_set_l_<each.name>;
---------------------------------------------------------------------------
<endif>
<pcode; separator="\n">
<arrs_inp; separator = "\n">
-- Process initialization: execute the START transition)
begin
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment