Your Solution to Analyze the Data Dependencies of Your Application
Data dependency analysis provides crucial information on how different parts of the software interact, e.g. to fulfil system functions. Growing complexity of the software architecture as well as increasing regulatory requirements, e.g. for re-certification, lead to the a demand for automation tools to detect and keep track of data dependencies.
A dependency analysis of C source code is necessary to perform correct parallelization of C software within ePS. Therefore, emmtrix has already more than 10 years of experience in this field. The data dependency chain analysis uses the internally available dependency information to calculate dependency chains. For any given C function it is analyzed which output variables depend on which input variables. This allows the identification of all output signals that are influenced by changes of selected input signals.
Introduction to Data Dependency Analysis
Data-dependencies exist for different reasons: the implementation of system functions, the implementation of on-board diagnosis, and plausibility checks for functional safety within the software. The data flow for the implementation of a system function is also referred to as “cause-effect chain”. System functions are designed on a high level of abstraction. The implementation may be distributed over different components (or modules). Therefore, in order to keep track of the course of a cause-effect chain through the system, engineers need to be able to track data dependency chains through an implementation. Conducting such analysis manually is complex and prone to error as cause-effect chains tend to span multiple modules or, in the case of the AUTOSAR world, multiple Software Components (SWCs) and Runnable Entities.
Dependency Analysis Example
A small source code example is shown in the next figure. The code uses three global variables g1. g2 and g3 as well as two output variables out1 and out2. The dependency analysis extracts how the output depend on the input variables.
The results are shown in the XML file in the next figure. Variable out1 depends on g3 and g2 whereas the dependency to g3 is a control dependency and to g2 a data dependency. Variable out2 only depends on g1.
More information can be seen as comments inside of the C code. The next figure shows all use (read) and def (write) accesses to all variables in the program. Control dependencies are marked with (c), delayed dependencies that depend on values from a previous iteration by ^-1. Phi statements are virtual instructions that are placed when the value of a variable depends on a condition. This kind of representation is useful to see the dependencies directly where they come from in the source code.
An extract from the full dependency graph can be seen in the next figure. It shows statements from the source code and how they depend on each other:
- SSA: there exists a use/def dependency where one signal writes a value and another one reads it
- Control: a control dependency caused by a condition (branch) instruction exists
- CallArg: the statement depends on an argument of the function
- Expr: the statement is part of the previous expression.
This kind of visualization can help pinpoint the root of a specific dependency.
- Analysis takes all possible paths of the control flow graph into consideration to ignore dependencies that can never occur
- Data and control dependencies between variables are calculated
- All calls to sub-functions are taken into account
- Supports analysis of programs consisting of multiple compilation unit (source files)
- Supports analysis of delayed dependencies where values are stored in a variable and only fed to the output when the function is called again.
- Verify your expected dependencies
- Ensure that there are no unwanted connections between input and output signals
- Identify code clusters to help you better distribute your code onto the available resources
- Track down all modules affected by an input signal
- Identify which code will be affected by code changes
- Document all dependencies for the certification process
For more information on emmtrix data dependency chain analysis or to request a demo, a chat or a meeting use our contact form or get directly in touch. We’re looking forward to hearing from you.