wiki:CaseStudyLustre
close Warning: Can't synchronize with repository "(default)" (Couldn't open Subversion repository /var/repositories/svn/aadl: SubversionException: ("Failed to load module for FS type 'fsfs'", 160033)). Look in the Trac log for more information.

Lustre integration

About Lustre

Lustre is a synchronous language. It is available in the Scade toolsuite (released by Esterel Technologies) and allows the simulation and verification of application code. Developping application with Lustre is nice. However, Lustre don't generate code at an architecture level and does not describe architecture requirements while AADL do. For these reason, we integrate Lustre application code in our code generated from AADL models.

Modeling Lustre application code

Lustre application code is describe in AADL models using the subprogram component. We add the property Source_Language => Lustre in the component to indicate the implementation language. Then, our code generator automatically generates glue code to interface its own code with Lustre code.

This integration offers the possibility to distribute a Lustre program over a distributed system. Each node of the system can be bound to a Lustre subprogram and interact with each other. By doing that, we can design system without writing a line of code.

Model example

The following model is available in the examples of POK. We define three partitions, one partition executes a Lustre node.

AADL model

package lustre_integration

public

with Data_Model;
with POK;


data integer
properties
  Data_Model::Data_Representation => integer;
end integer;

virtual processor partition
properties
   POK::Scheduler => RR;
end partition;

virtual processor implementation partition.impl
end partition.impl;

subprogram spg_producer
features
   output : out parameter integer;
properties
   source_name => "user_send";
   source_language => C;
   POK::Source_Location => "../../send.o";
end spg_producer;

subprogram spg_computer
features
	input : in parameter integer {Source_Name => "n";};
	output : out parameter integer {Source_Name => "r";};
properties
	source_name => "inc";
	source_language => Lustre;
	POK::Source_Location => "../../lustre-code/";
end spg_computer;

subprogram spg_printer
features
   input : in parameter integer;
properties
   source_language => C;
   source_name => "user_receive";
   POK::Source_Location => "../../receive.o";
end spg_printer;

processor pok_kernel
properties
   POK::Architecture => x86;
   POK::BSP => x86_qemu;
end pok_kernel;

processor implementation pok_kernel.three_partitions
subcomponents
   producer_runtime : virtual processor partition.impl;
   computer_runtime : virtual processor partition.impl {POK::Additional_Features => (stdlib);};
   printer_runtime  : virtual processor partition.impl;
properties
   POK::Major_Frame => 900ms;
   POK::Scheduler => static;
   POK::Slots => (300ms, 300ms, 300ms);
   POK::Slots_Allocation => ( reference (producer_runtime), reference (computer_runtime), reference (printer_runtime));
end pok_kernel.three_partitions;

thread thread_printer
features
   datain : in event data port integer;
properties
   Dispatch_Protocol => Periodic;
   Recover_Execution_Time => 10 ms .. 20 ms;
   Period => 300 Ms;
end thread_printer;

thread thread_producer
features
   dataout : out event data port integer;
properties
   Dispatch_Protocol => Periodic;
   Period => 300 Ms;
   Recover_Execution_Time => 10 ms .. 20 ms;
end thread_producer;

thread thread_computer
features
   dataout : out event data port integer;
	datain  : in event data port integer;
properties
   Dispatch_Protocol => Periodic;
   Period => 300 Ms;
   Recover_Execution_Time => 10 ms .. 20 ms;
end thread_computer;

thread implementation thread_printer.impl
calls 
   call1 : { pspg : subprogram spg_printer;};
connections
   parameter datain -> pspg.input;
end thread_printer.impl;

thread implementation thread_producer.impl
calls 
   call1 : { pspg : subprogram spg_producer;};
connections
   parameter pspg.output -> dataout;
end thread_producer.impl;

thread implementation thread_computer.impl
calls 
   call1 : { pspg : subprogram spg_computer;};
connections
   parameter pspg.output -> dataout;
   parameter datain -> pspg.input;
end thread_computer.impl;


process process_printer
features
   printer_datain : in event data port integer;
properties
   POK::Needed_Memory_Size => 85000 Kbyte;
end process_printer;

process process_producer
features
   producer_dataout : out event data port integer;
properties
   POK::Needed_Memory_Size => 85000 Kbyte;
end process_producer;

process process_computer
features
   computer_datain  : in event data port integer;
   computer_dataout : out event data port integer;
properties
   POK::Needed_Memory_Size => 85000 Kbyte;
end process_computer;


process implementation process_printer.impl
subcomponents
   thr : thread thread_printer.impl;
connections
   port printer_datain -> thr.datain; 
end process_printer.impl;

process implementation process_producer.impl
subcomponents
   thr : thread thread_producer.impl;
connections
   port thr.dataout -> producer_dataout;
end process_producer.impl;

process implementation process_computer.impl
subcomponents
	thr : thread thread_computer.impl;
connections
	port thr.dataout -> computer_dataout;
	port computer_datain -> thr.datain;
end process_computer.impl;

system partitioned_lustre
end    partitioned_lustre;

system implementation partitioned_lustre.impl
subcomponents
   pok_runtime        : processor pok_kernel.three_partitions;
   producer_partition : process process_producer.impl;
   computer_partition : process process_computer.impl;
   printer_partition  : process process_printer.impl;
connections
   port producer_partition.producer_dataout -> computer_partition.computer_datain;
	port computer_partition.computer_dataout -> printer_partition.printer_datain;
properties
   actual_processor_binding => 
      (reference (pok_runtime.producer_runtime)) applies to producer_partition;
   actual_processor_binding => 
      (reference (pok_runtime.computer_runtime)) applies to computer_partition;
   actual_processor_binding => 
      (reference (pok_runtime.printer_runtime)) applies to printer_partition;
end partitioned_lustre.impl;

end lustre_integration;



Lustre code

node inc (n : int) returns ( r : int);
let
   r = 0 -> pre (r) + n;
tel
Last modified 9 years ago Last modified on 03/11/09 15:38:10