Supplementing Generated Ada : Implementing Primitive Activities

Implementing Primitive Activities

The file user_activities.a contains templates for every primitive activity that is to be implemented in the compilation profile’s activity-stub options. Each selected primitive activity contains a stub with the following format:

procedure user_code_for<activity_name> IS
-- Parameter :

-- Input <input data-elements>;
-- Output <output data-elements>;
-- Input/Output <Inout data-elements>;
--
begin
null ;
end;
 

The parameters list describes the interface of the activity to the rest of the model. Note that these are not parameters in the programming-language sense. The parameters list is actually a reference list that shows the context of the activity to be implemented in the model.

procedure user_code_for FFT IS
-- Input double sonar_datal;
-- Input double sonar_date2;
-- Output double processed_data;
--
begin
null ;
end ;
 

The previous example shows a primitive activity that represents an FFT filter. The data-items sonar_data1, sonar_data2 are flowing into FFT, and the processed_data is flowing outside. This is actually the interface of the FFT activity with the rest of the model. Mathematical processing functions such as an FFT filter, are typical cases where something is implemented as a primitive activity, and the algorithm could be taken from an existing library.

Once the user_activities.a file is generated, it is not overwritten when the code is regenerated. In subsequent generations of the code, a user_activities.a_temp file is generated. If new templates are generated, they should be merged from user_activities.a_temp into user_activities.a.

Note: Empty stubs stop right after activation and the sp (activity) event is generated in the next step.