Documentation APP4MC.sim
Overview
APP4MC.sim is a simulation framework for effective and early analysis of the runtime behavior of AMALTHEA models. It allows the consideration of software aspects and also the investigation of effects caused by concurrent accesses to shared hardware resources, especially memory in multi-core architectures. At its core, APP4MC.sim is based on the SystemC library with TLM extensions, which provides a solid foundation due to its widespread use and large user community.
This page provides an overview and step-by-step guide for the timing simulation of AMALTHEA models using APP4MC.sim.
APP4MC.sim Flow
The image below provides an overview on the procedure for timing simulation of an AMALTHEA model using APP4MC.sim. This procedure consists of two steps, namely, transformation and simulation, which are summarized in the following.
The (model-to-text) transformation step takes as input an AMALTHEA model and generates APP4MC.sim-specific code based on that model. The generated code, also called simulation model, consists of (i) C++ source files that describe the model and the timing simulation setup using APP4MC.sim and SystemC APIs and (ii) a set of scripts (e.g., CMake and batch) that are required for configuring, building, and running the simulation.
The simulation step is carried out by the APP4MC.sim simulator. For that, first, the simulation model generated in the transformation step and the source code of APP4MC.sim are used to build the simulation project. After that, the simulation can be performed which generates one or multiple trace files (in .vcd and .btf formats).
Prerequisites
- Java 11 SDK. The JAVA_HOME variable must be set to point to the java installation directory.
- Git (required at command line / command prompt)
This part provides a step-by-step guide on the tool setup and the transformation procedure to generate an APP4MC.sim simulation model for a given AMALTHEA model.
- Download APP4MC available at https://projects.eclipse.org/projects/automotive.app4mc (The APP4MC.sim simulation currently supports version 2.0.0).
- Launch APP4MC
- Unzip the downloaded package and launch “app4mc.exe”
- Specify a workspace directory (or use the default directory suggested) when prompted
- Close the welcome page
Add the required P2 Update sites
- From the Help menu, select the item Install New Software to open the Install window
- On the opened dialog, click Manage…
- On the new dialog, enable the APP4MC Model Transformation P2 Updatesite and the APP4MC AMALTHEA to SystemC transformation P2 Updatesite (see the image below).
Note: If the updatesites are not available in the list, add them using the Add… button and then check the box next to the newly added items.
- Click Apply and Close
Install the transformation framework
- In the Install window, under Work with: drop-down menu, select APP4MC Model Transformation P2 Updatesite (snapshot below)
- Check box for the item APP4MC Model Transformation Framework and the item APP4MC Model Transformation UI Feature
- Click Next > Next > Finish
Note: The installation may take a few seconds (progress state is shown in the APP4MC status bar at the lower-right corner of APP4MC)
- After the installation is complete, you will be prompted to restart the APP4MC platform. Click Restart Now on the opened prompt to proceed with the restart
Install the AMALTHEA-to-SystemC transformation framework
- In the Install window, under Work with: drop-down menu, select APP4MC AMALTHEA to SystemC transformation P2 Updatesite (snapshot below)
- Check box for the item Amalthea to SystemC transformation
- Click Next > Next > Finish
Note: The installation may take a few seconds (progress state is shown in the APP4MC status bar at the lower-right corner of APP4MC)
- After the installation is complete, you will be prompted to restart the APP4MC platform. Click Restart Now on the opened prompt to proceed with the restart
Clone the APP4MC.sim repository (recursively with the submodules) from the APP4MC.sim Eclipse Repository. Then, update the repository and switch to the version compatible with APP4MC 2.0.0 as follows
git fetch --all --tags
git checkout tags/APP4MC_v2.0.0
The following describes the procedure of transforming an AMALTHEA model to generate its corresponding simulation model for timing simulation using APP4MC.sim.
Note: The page Getting Started with APP4MC provides details on the structure, contents, and the creation of an AMLTHEA model.
Open AMALTHEA model in the standard AMALTHEA tree editor and validate it for APP4MC.sim using the APP4MC.sim Validations as shown in the following image.
In the Project Explorer, under the context menu of the model, select Amalthea > Transformation
Note: The transformation option will not be available if your model is at an older version of AMALTHEA compared to the APP4MC platform. To solve the issue, migrate the model to the platform’s version as follows:
- In the Project Explorer, under the context menu of the model, select Amalthea > Model Migration
- Click on Migrate Model and then OK
- In the Project Explorer, under the context menu of the migrated model, select Amalthea > Transformation
In the opened AMALTHEA transformation dialog, provide the information required for the transformation
- Output Folder: Optionally modify the output folder (this is where the simulation model generated during the transformation will be stored)
- APP4MC.sim folder: Provide the path to the root folder of the APP4MC.sim clone on your system
- Simulation duration [ms]: Optionally provide the simulation duration (default set to 1000ms)
- Trace folder: Optionally provide the target directory for the traces generated during the simulation (default set to .\traces)
- Model to Text Transformation: Check the box for Amalthea to APP4MC.sim project transformation
- click OK
Once the transformation is complete, the generated simulation model files will be available at the output folder specified in the previous step. The generated sub-directory “APP4MCSIM” contains the transformation outputs required for timing simulation using APP4MC.sim.
Note: If the output folder is not shown in the Project Explorer, refresh the parent directory of the target output folder from its context menu.
Simulation Guide
This part provides a step-by-step guide on the tool setup and the procedure to perform (in Windows) the timing simulation using APP4MC.sim for simulation models generated through the transformation procedure detailed above.
- Download the “Visual Studio Build Tools 2019” available at https://visualstudio.microsoft.com/de/downloads/
- Once downloaded, launch the installer “vs_BuildTools.exe” and install “C++ build tools” or alternatively, called “Desktop Development with C/C++” (requires admin rights)
APP4MC.sim Timing Simulation
Build the simulation project (in Developer Command Prompt for VS 2019)
- Switch the working directory to the transformation output sub-directory “APP4MCSIM”
- Configure the project using the command
build.bat --configure
- Once the configuration has finished, build the project using the command
build.bat --build
Run the simulation
- Run the simulation using the command
run.bat
- Optionally, you can change the simulation duration and/or the trace directory at this point by directly running the command highlighted in the snapshot above with modified values passed to arguments
-t
(simulation duration in ms) and -o
(output trace directory)
- After the simulation has finished, the generated trace file is available in the trace output directory