A commented example

The following example is a complete AADLv2 model. It exhibits a full hierarchy of component types, and component implementations.

You’ll note we do not provide implementations for subprograms and threads: these are fully determined using properties.

AADL being a textual language, it follows many conventions from other languages: packages, declarations of types and implementations. Let us review the first set of elements:

Basic AADL model (hello_world.aadl) download
--  This small example is a basic AADL model, with a full hierarchy of components

package Hello_World
  -- Entities are attached to a package


  subprogram Hello_Spg_1
    --  Simple subprogram: actual behavior, not modeled in AADL
    Source_Language => (C);                                  --  Implementation language is C
    Source_Name     => "user_hello_spg_1";                   --  Name of the corresponding C function
    Source_Text     => ("hello.c");                          --  Implementation file
  end Hello_Spg_1;

  thread Task
    --  A task: a concurrent flow of execution
    Priority                => 1;                            --  Priority, interpretation given by the processor
    Dispatch_Protocol       => Periodic;                     --  Periodic
    Period                  => 1000 ms;                      --  Period of the task
    Compute_Execution_Time  => 0 ms .. 3 ms;                 --  Execution time
    Compute_Entrypoint      => classifier (Hello_Spg_1);    --  Hello_Spg_1 is executed at each dispatch
  end Task;

  process node_a
    --  A process, gathers several threads as subcomponents
  end node_a;

  process implementation node_a.impl
    Task1 : thread Task;
  end node_a.impl;

  processor cpu
    --  A processor provides execution resources
    Scheduling_Protocol => (RMS);                             -- How thread are given access to the CPU
  end cpu;

  system rma
     --  A system combines both hardware and software elements
  end rma;

  system implementation rma.impl
    node_a : process node_a.impl;
    cpu	   : processor cpu;
    Actual_Processor_Binding                                  -- Binding relations between hardware and software
       => (reference (cpu)) applies to node_a;             -- node_a is allocated resources on cpu
  end rma.impl;

end Hello_World;

Related Posts