Kazoo

From TASTE
Revision as of 15:17, 2 December 2019 by Rbabski (talk | contribs)
Jump to: navigation, search

Kazoo is a part of TASTE tool-chain.


Input files

  • InterfaceView.aadl
  • DeploymentView.aadl
  • DataView.aadl
  • DataView.asn
  • DataView.acn

Internal representation of system

Taste uses Ocarina library to parse input aadl files. The internal representation of system consists of thre major structures:

  • InterfaceView
  • DeploymentView
  • ConcurrencyView

The InterfaceView representation contains of list of functions. Every function contains provided interfaces and required interfaces. Optionally a function may contain context parameters. The InterfaceView representation contains also connections between provided interfaces and required interfaces. The InterfaceView representation is used to create skeletons and glue code.

The DeploymentView constists of Nodes, Buses and connections between them. The Node contains Partitions, Processors and Drivers. The Partition contains a list of bounded functions. The DeploymentView is not directly used for code generation.

The ConcurrencyView is generated from DeploymentView. The ConcurrencyView consists of list of Nodes. Every Node consists of list of Partitions and list of Drivers. Every Partition consists of list of Threads. Every Thread has a list of assigned functions from InterfaceView.

The ConcurrencyView is used for generation of rest of glue code and also middleware integration.

build-script.sh generation

The file build-script.sh is generated from build-script.tmplt. The template files: build-script-gen.tmplt, build-script-func.tmplt and build-script-zip.tmplt are evaluated earlier, and the output is passed to main template as parameters.

Code skeletons generation

Algorithm in pseudocode:

for every function from InterfaceView:
    for every subdirectory
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            evaluate template function-filename.tmplt if exists
            evaluate template makefile-filename.tmplt if exists
            evaluate template interface.tmplt for required interfaces of function
            evaluate template interface.tmplt for provided interfaces of function
            evaluate template makefile.tmplt and optionally save output to file
            evaluate template function.tmplt and optionally save output to file
    if function has context parameters then
        evaluate template context_parameters.tmplt and save the output to file


Glue code generation

Algorithm in pseudocode:

for every function from InterfaceView:
    for every subdirectory
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            evaluate template function-filename.tmplt if exists
            evaluate template makefile-filename.tmplt if exists
            evaluate template interface.tmplt for required interfaces of function
            evaluate template interface.tmplt for provided interfaces of function
            evaluate template makefile.tmplt and optionally save output to file
            evaluate template function.tmplt and optionally save output to file


Concurrency View generation

Algorithm in pseudocode:

for every subdirectory
    for every node from ConcurrencyView
        evaluate template filenode.tmplt
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            for every partition from node:
                evaluate template filepart.tmplt
                evaluate template thread.tmplt
                evaluate template filethread.tmplt
                evaluate template fileblock.tmplt
                evaluate template pi.tmplt
                evaluate template pi.tmplt (with other parameters)
                evaluate template ri.tmplt
                evaluate template block.tmplt
                evaluate template partition.tmplt
        evaluate template node.tmplt
    evaluate template system.tmplt

Templates

build-script-func.tmplt

This template is evaluated for every function from InterfaceView.

Parameter name Description
Function_Name Name of the function
Language Implementation language of the function

build-script-gencode.tmplt

This template is evaluated for every function from InterfaceView.

Parameter name Description
Function_Name Name of the function
Language Implementation language of the function

build-script-zip.tmplt

This template is evaluated for every function from InterfaceView.

Parameter name Description
Function_Name Name of the function
Language Implementation language of the function

build-script.tmplt

This template is evaluated only once. The output is saved to the file build-script.sh within output directory.

Parameter name Description
Interface_View_Path Path to the interface view file
Output_Path Output directory
Generate_Code Concatenated result from evaluation of build-script-gencode.tmplt
Zip_Code Concatenated result from evaluation of build-script-zip.tmplt
Functions Concatenated result from evaluation of build-script-func.tmplt

makefile.tmplt for skeletons

This template is evaluated only once. The output is saved to the Makefile within output directory.

Parameter name Description
Function_Names Combined table: list of fuction names...
Language ... and corresponding implementation language
Is_Type ... and flag if it is a function type
Has_Context_Param ... and flag to indicate if function has context parameters
Has_Context_Param_Tag
CP_Files List of all context parameters ASN.1 files
Unique_Languages List of all languages used in the system
ASN1_Files List of all ASN.1 files
ACN_Files List of all ACN files
ASN1_Modules List of all ASN.1 modules

context-parameters.tmplt

This template is evaluated for every function which has context parameters. The output is saved to the file Context-<function name>.asn

Parameter name Description
Name Function name
Sort_Set Set of types used for this Context Parameter file
Module_Set ... corresponding module (needed for ASN.1 "IMPORTS")
CP_Name Table of context parameter names
CP_Sort ... corresponding ASN.1 type
CP_ASN1_Module ... in ASN.1 module
CP_Value ... with default value

trigger.tmplt for skeletons and glue

This template is evaluated to trigger processing of other files from given directory. If the result of evaluation is equal to "TRUE", then other files will be processed.

Parameter name Description
Name The name of the function
Is_Type True if function type
Instance_Of Name of instance or empty string
Language Implementation language for the function
Filename_Is_Present True if target function output already exists
Makefile_Is_Present True if target build script already exists
Zip_File Optional path to zip file
Use_POHIC Command line configuration

makefile-filename.tmplt

This file is optional, if exists the result of parsing of this file is a name of output file for makefile.tmplt, otherwise this template will not be processed.

Parameter name Description
Name The name of the function

function-filename.tmplt

This file is optional, if exists the result of parsing of this file is a name of output file for function.tmplt, otherwise this template will not be processed.

Parameter name Description
Name The name of the function

interface.tmplt

This file is processed twice, first time for required interfaces of the function from Interface View, second time for the provided interfaces. The results are parameters for processing function.tmplt

Parameter name Description
Name The name of the interface
Direction "PI" or "RI"
Kind The RCM Kind
Parent_Function The name of the function
Language The implementation language of the function
Property_Names All AADL properties (names) associated to the function
Property_Values ... and corresponding values
Param_Names List of parameter names
Param_Types _ Corresponding parameter types
Param_Directions _ Corresponding direction
Param_Encodings _ Corresponding ASN.1 encoding
Is_Timer Flag set to true if this is a timer interface
Period Property of the interface
WCET Property of the interface
Queue_Size Property of the interface
IF_Property_Names and Values User-defined properties (vector tag)

makefile.tmplt

This template is processed when makefile-filename.tmplt exists. The output of this template is saved to the file with name returned by processing makefile-filename.tmplt In directory [functionname]/[ languagename]

Parameter name Description
Name The function name
ASN1_Files List of all ASN.1 files
ASN1_Modules List of all ASN.1 modules
Is_Type Flag set to True for function type
Instance_Of Name of function type if instance

function.tmplt

This template is processed when function-filename.tmplt exists. The output of this template is save to the file with name returned by processing function-filename.tmplt in directory [functionname]/[languagename]/src.

Parameter name Description
Name The name of the function
Language The implementation language
List_Of_PIs List of all Provided Interfaces (just names)
List_Of_RIs List of all Required Interfaces (just names)
List_Of_Sync_PIs List of synchronous Provided Interfaces
List_Of_Sync_RIs List of synchronous Required Interfaces
List_Of_ASync_PIs List of asynchronous Provided Interfaces
List_Of_ASync_RIs List of asynchronous Required Interfaces
ASN1_Modules List of ASN.1 Modules names
ASN1_Files List of ASN.1 Files with path
Timers List of timers (just names)
Has_Context Flag, True if there are context parameters
CP_Names List of Context Parameter names
CP_Types List of Context Parameter types
Provided_Interfaces From template: Provided interfaces with params
Required_Interfaces From template: Required interfaces with params
Property_Names List of User-defined properties (names)
Property_Values List of User-defined properties (values)
Is_Type Flag True if function is a component type
Instance_Of Optional name of component type

filenode.tmplt

This file is optional. This file is processed for every node. The result of this file is a filename for result of processing node.tmplt.

trigger.tmplt

This file is processed for every node. The result of this file indicates if the rest of templates for given node will be processed.

Parameter name Description
Node_Name Name of the node as defined in the Deployment View
Parameter name Description
Filename_Is_Present true if file with name returned by filenode.tmplt exists
Skeletons from kazoo configuration
Glue from kazoo configuration
POHIC from kazoo configuration
Debug from kazoo configuration
No_Stdlib from kazoo configuration

filepart.tmplt

This file is processed for every partition in every node. This file is optional. If the result is not empty then is used as a file name for parsing partition.tmplt

Parameter name Description
Partition_Name Partition name

thread.tmplt

This file is processed for every thread in every partition in every node.

Parameter name Description
Thread_Name Thread name
Partition_Name Partition containing this thread
Entry_Port_Name Name of the PI
RCM One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
Need_Mutex True if the PI is shared with others in the protected block
Pro_Block_Name Name of the protected function
Node_Name Name of the deployment node
Remote_Threads Vector tag: output remote thread list
RI_Port_Name _ Corresponding local RI name
Remote_PIs _ Associated PI Name
Remote_PI_Sorts _ Optional param type of the remote thread
Remote_PI_Modules _ Asn1 module of the optional param type
Name
Kind
Parent_Function Tags related to the PI that is at the origin of the thread creation: shoud be useless here
Param_Names
Types
ASN1_Modules
Encodings
Directions param vector tag
Period
WCET
Queue_Size relevant here
IF_Property_Names
Values user properties (vector tag)
Skeletons from kazoo configuration
Glue from kazoo configuration
POHIC from kazoo configuration
Debug from kazoo configuration
No_Stdlib from kazoo configuration