You are here
SystemC and SDL co-modelling
Nowadays SDL and SystemC are two very popular languages for embedded systems modeling. SDL thanks to its specific advance features is good for reflection of the multi-object systems and interactions between object’s modules. It is also good for the system model validation. While the SystemC models are better suitable for tracing internal functions of the modeled modules. The hypothetical possibility of combined use of these two languages promises a number of benefits for researchers. This project includes researches on the following issues: integration of SDL and SystemC modeling environments, exchange the data and control information between the SDL and SystemC sub-modules, the real-time co-modeling aspects of the integrated SDL/SystemC system, etc.
Embedded Systems Design Flow
An embedded system is a specific combination of computer hardware and software which is specifically designed to perform a particular function (or a range of functions) of a larger system. The embedded systems design encounters a number of difficulties caused by increasing complexity of projects, increasing requirements to products reliability, power consumption and demand to speed-up the project design phase. So the modern approach to the system design implies the parallel execution of some design tasks. It is includes the following stages:
- Conceptual system design – the primary goal of this stage is the main system description, analysis of the system mechanisms and development of the first specification draft;
- Specification – this stage is targeted to get the final version of the system specification and the system model in a high-level language (usually in С/С++, SDL);
- Logical (architectural) design includes translation of the executable project specification to the register level (in Verilog/VHDL) and further at the gate level;
- Project verification – verification of the design decisions on conformity to the specification and other requirements;
- physical design – this stage begins from the selection of technological and library basis and it is completed when everything is ready for the final product production.
Two Approaches for the Embedded Networks Simulation
Modeling of the embedded networks is usually related to the modeling of the protocol mechanisms that this network uses for the communication. The model of the communication protocol clearly describes the behavior of the node in the network and also behavior of the whole network with multiple nodes. So during the embedded network development the communication protocol model is one of the major things that should be very well tested.
The first basic way for testing the protocol stability and work characteristics is by implementing the network model. This model consists of models of devices that use this protocol. For example, if you need to simulate the network, and, particularly, packets exchange, then the interaction of components and processes inside the device (e.g. between levels of the stack) is not so important for simulation. The real interest is mainly focused on the mechanism of inter-devices communication, for example, all steps of packets transmission, routing, etc. The general idea of network modeling is illustrated by figure.
There is another way to study things that are not covered in first approach – protocol stack modeling (see figure below). The purpose of creation of such a model is to check the protocol characteristics. This approach is good to study mechanisms of packets formation, intra-device operations, inter-layers services, internal timers, layers management and so on. It gives an ability to check the protocol specification and algorithms on errors and inconsistencies.
This way of modeling is better for the protocol testing, because we model the internal protocol mechanisms in details. For the protocol stack modeling it is enough to model the point-to-point communication of two nodes for most of the purposes.
General Principles of Co-Modeling
The integration of SDL model into SystemC model can be divided into the following general stages:
- Preparation of the SDL system to be the part of the whole model.
- Generation of C/C++ code on basis of the created SDL system. The SDL code is not used hereafter.
- Insertion of this C/C++ code to the SDL kernel.
- Preparation of the SystemC part of the model.
- Integration of the SDL kernel with the generated C code into the whole model.
Network Simulation on the Basis of SDL/SystemC Co-modeling
The protocol Model Tester primarily provides a strong means for exploration of functional characteristics of the protocols. Due to its structure it does not provide facilities for performance analysis and simulation of network operation. The task of network modeling can be also solved on the basis of the SDL/SystemC co-modeling. This problem can be solved by means of a special library, which can be applied during networks simulation in SystemC. This library should implement the original SDL model and SDL simulation kernel as well as provide special services for the user.
The Library Development Flow
The solution is aimed to develop an environment that allows creating the target library. This library provides an ability to use a different number of SDL model instances in the SystemC user’s project and contains both the SDL model and the SDL simulation kernel (see figure).
These are the steps of the proposed library development flow:
- Analysis of requirements and implementation of an SDL model.
- Obtaining a PR-model using the GR-to-PR converter.
- Obtaining C code of the SDL model with use of CAdvanced. The code consists of three parts: a symbol table, which corresponds to the SDL model architecture, a set of initialization functions and a set of PAD (Process Activity Description) functions which implement the behavior of SDL processes.
- Code post-processing of the obtained C code. Generation of initialization functions and patching of some parts of PAD functions.
- Building a target library according to the proposed approach. Creation of the symbol table selector. Development of a user’s code interface, which is a set of C++ classes.
Then all the generated source code is compiled and linked, so the user gets a target library ‘component.lib’. The implementation of the SDL kernel stays unchanged during the library development flow, but the new functionality for operating with a different number of SDL model instances is added. User’s project operates with the target library and the SystemC library simultaneously. User interface is intended for using services provided by the library.
Application Structure
The example model contains a Switch module and four ports connected to four independent SDL model instances. The Switch and Port modules are implemented in SystemC. According to the proposed approach it is possible to design a switch model, where each port includes the implementation of the full protocol stack in SDL. In this case the network layer is implemented in SystemC while the bottom ones – in SDL. The structure of the application implemented in accordance with the proposed approach is shown in figure. It consists of the following parts:
- The SystemC library, which includes SystemC kernel.
- The SystemC model implemented by a user.
- The target library, which provides an ability to create a number of different SDL model instances.
User’s SystemC model is a single threaded application, which is controlled by the SystemC kernel. The Switch module with its ports communicates with the SDL kernel via user’s interface. The SDL kernel is responsible for scheduling of SDL model processes. The kernel calls different PAD functions and each PAD function chooses an SDL model instance by means of ST selector.
An Example of the Approach Application
This example will give more details of the proposed approach and will show how the SystemC developer can use it in his project. Let us assume that we need to create a network model in SystemC and also we need to use it for an exploration of non-functional properties of a protocol while the SDL model of a protocol has already been implemented. To simplify the SDL model we use the same SDL model as we used in the previous section. The example is shown in figure.
The SystemC model includes the Source node, three switches and the Destination node. The Source node is responsible for data generation while the Destination node is responsible for its reception. Each switch contains the SystemC module, which includes a number of SystemC threads, each of which corresponds to an independent instance of the SDL model. All these instances are created by the user in C++. The library controls all of them.
Yuriy Sheynin, SUAI
Michel Gillet, Nokia
Valentin Olenev, SUAI
Irina Lavrovskaya, SUAI
Contact details
Yuriy Sheynin (Sheynin@aanet.ru)
Valentin Olenev (Valentin.Olenev@guap.ru)
May 2010 – Write the SDL\SystemC wrapper for the simulation and run the part of the SDL model in the SystemC environment
Sep. 2010 – Upgrade the SDL\SystemC modelling wrapper and add new functionality to the model. E.g. new SAPs for testing.
Dec. 2010 – Run the whole SDL model in the SystemC testing environment
Apr. 2012 – Make a overview of existing approaches for the generation of SystemC code from the SDL code.
Apr. 2013 – Develop a first experimental version of SystemC/SDL code generator.
Sept. 2013 – Research in methods for network modelling using multi-language models.
Jan. 2014 – Develop an approach for network sumilation with use of SDL models.
Apr. 2016 – First implementaion of the approach as a software library, based on simple SDL models.
Sept. 2017 – Intensive testing of the approach and checking its correcntess (based on simple SDL models).
Dec. 2017 – Intensive testing of the approach and checking its correcntess (based on existed industrial SDL models).
Jan. 2018 – Start of the software development for automation of the approach.