PLDI'14 Artifact on SCCharts

Version 18.1 by cmot on 2014/02/10 21:50

title7.png

Modeling SCCharts with KIELER

This tutorial should guide you if you like to model SCCharts with KIELER and use the circuit based software synthesis path as explained in ourĀ [1] PLDI'14 submission. We will show you how to

1. Download & Start KIELER,

2. Model an SCChart, and

3. Generate C Code.

We will use a simple example here in order to illustrate the process. It should be straightforward to use these instructions in order to compile a more advanced SCChart. Note that there are known minor bugs in the current nightly build that will be fixed in the next release of KIELER 0.10.0. These bugs might in some cases prevent you from compiling more elaborate examples.

 

[1] PLDI submission: http://rtsys.informatik.uni-kiel.de/~biblio/downloads/papers/pldi14.pdf

Download & Start KIELER

Download a suitable KIELER version for your operation system. The zip bundles are fully compiled and ready-to-run, they do not need any further installation process. Just save and extract them to/at the location of your choice and start the KIELER executable.

RTEmagicC_download.png.png

Download Location: http://rtsys.informatik.uni-kiel.de/~kieler/files/pldi14/

When you start the KIELER executable, you probably need to set a (new) workspace location of your choice. (Click on the images to enlarge them).

kieler1.png

If you selected a new workspace location, you will see a welcome screen like this:

kieler02.png

Dismiss this "Welcome" tab. After that you'll be all set and KIELER should look like this:

kieler03.png

In order to prepare modeling, we must create a project. Right-click in the Project Explorer to do so.

kieler04.png

Select a General Project and click on next, then enter a project name, e.g. pldi14 and click on finish:

kieler05.pngkieler06.png

Now KIELER should look like this:

kieler07.png

Now you can proceed in modeling an SCChart as explained below.

Model an SCChart

Right-click on a project and create a (text) File:

kieler08.png

Name it abo.sct:

kieler09.png

The textual SCCharts Xtext based editor (for *.sct files) will automatically be opened:

kieler10.png

Now start modeling an SCChart. For example copy & paste the following sct code of abo, the hello world of SCCharts:

abo.sct
@VHLayout
scchart ABO {
  
input output bool A;
  
input output bool B;
  
output bool O1;
  
output bool O2;
  
region:
 
  
initial state Init
  
--> WaitAB immediate with / O1 = false; O2 = false;
  state WaitAB {
    
region HandleA:
    
initial state WaitA
    
--> DoneA  immediate with A / B = true; O1 = true;
    final state DoneA;
    
region HandleB:
    
initial state WaitB
    
--> DoneB with B / O1 = true;
    final state DoneB;
  
}
  
>-> GotAB with / O1 = false; O2 = true;
  
state GotAB;
}

As you save (Ctrl+S), KIELER will automatically draw the graphical SCChart diagram in a new KLigD view:

kieler11.png

You may want to re-arrange views. Just drag the KLighD view to the right side:

kieler12.png

You will now see how to generate a C tick function.

Generate C Code

You can do several transformations on SCCharts (*.sct files). Just right click the file you want to transform in the project explorer and select the Transform SCChart sub menu. As abo is already a Core SCCart you do not need the core transformations. Click the All Normalize Transformations, this will do the Split Trigger and Effects and the Surface and Depth transformations together (in this order).

kieler13.png

After performing a transformation the transformed SCChart will open (together with it's KLighD diagram visualization):

kieler14.png

Now generate the Sequentially Constructive Graph (SCG) from the normalized form. You do this also in the context menu of the Project Explorer by selecting the *.normalized.sct and choosing Generate SCG. When selecting the abo.normalized.scg file the SCG diagram will be automatically synthesized (you may also want to re-arrange the KLigD view by dragging in to the right side again).

kieler15.pngkieler16.png

 

You can now populate the SCG automatically with dependency data. Choose Transform SCG -> SCG with Dependency Data from the context menu (left side). This will result in the following SCG (right side).

kieler17.pngkieler18.png

 

Now populate the SCG with basic block information (left side). The SCG with calculated basic blocks will look like this (right side).

kieler19.pngkieler20.png

 

The next step in compilation is the (more fine grained) calculate of scheduling blocks (left side). The populated SCG with scheduling information looks like this (right side).

kieler21.pngkieler22.png

 

The SCG is now ready to be sequentialized. A primitive scheduler currently is included in KIELER but more elaborate ones are already in the pipe line (left side). The sequentialized SCG looks like this (right side).

kieler23.pngkieler24.png

 

From here its only a short hop to C code. Transform the sequentialized SCG into an S Tick Function (left side). When opening the S file (abo.normalized.seq.s) this already is very c like code (right side).

kieler25.pngkieler26.png

 

Selecting Generate SC will produce a C file:

kieler27.pngkieler28.png