Wiki source code of PLDI'14 Artifact on SCCharts

Version 34.1 by cmot on 2014/06/28 11:29

Hide last authors
cmot 7.1 1 [[image:attach:title7.png]]
2
3 = Modeling SCCharts with KIELER =
4
Reinhard von Hanxleden 28.1 5 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>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/papers/pldi14-submitted.pdf||shape="rect"]]. We will show you how to
cmot 7.1 6
cmot 9.1 7 ~1. Download & Start KIELER,
cmot 7.1 8
9 2. Model an SCChart, and
10
11 3. Generate C Code.
12
cmot 30.1 13 We will use a simple example here in order to illustrate the process. Please refer to the SCCharts superpage for the [[project status>>doc:SCCharts]] and [[known limitations>>doc:SCCharts]]. If you are interested in the source code you can find instruction how to download and compile it here: [[Getting Started>>url:http://rtsys.informatik.uni-kiel.de/confluence/display/KIELER/Getting+Started||shape="rect"]].
cmot 7.1 14
cmot 33.1 15 See a list of the evaluated examples at the end.
16
cmot 8.1 17
18
Reinhard von Hanxleden 28.1 19 [1] PLDI submission: [[http:~~/~~/rtsys.informatik.uni-kiel.de/~~~~biblio/downloads/papers/pldi14-submitted.pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/papers/pldi14-submitted.pdf||shape="rect"]]
cmot 8.1 20
cmot 24.1 21
cmot 7.1 22
cmot 25.1 23 In addition to the step-by-step tutorial below we also captured a [[video >>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/sccharts.swf||shape="rect"]]that shows each of the explained steps:
cmot 24.1 24
cmot 25.1 25 [[~[~[image:attach:RTEmagicC_demo.png.png~]~]>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/sccharts.swf||shape="rect"]]
cmot 24.1 26
cmot 25.1 27 Download location: [[http:~~/~~/rtsys.informatik.uni-kiel.de/~~~~kieler/files/pldi14/sccharts.swf>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/sccharts.swf||shape="rect"]]
28
cmot 24.1 29 = 1. Download & Start KIELER =
30
cmot 9.1 31 [[Download>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/||shape="rect"]] 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.
cmot 7.1 32
cmot 8.1 33 [[~[~[image:attach:RTEmagicC_download.png.png~]~]>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/||shape="rect"]]
34
cmot 25.1 35 Download location: [[http:~~/~~/rtsys.informatik.uni-kiel.de/~~~~kieler/files/pldi14/>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/||shape="rect"]]
cmot 8.1 36
cmot 9.1 37 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).
38
39 [[image:attach:kieler1.png]]
40
41 If you selected a new workspace location, you will see a welcome screen like this:
42
43 [[image:attach:kieler02.png]]
44
45 Dismiss this "Welcome" tab. After that you'll be all set and KIELER should look like this:
46
47 [[image:attach:kieler03.png]]
48
cmot 10.1 49 In order to prepare modeling, we must create a project. Right-click in the Project Explorer to do so.
50
51 [[image:attach:kieler04.png]]
52
53 Select a General Project and click on next, then enter a project name, e.g. pldi14 and click on finish:
54
55 [[image:attach:kieler05.png]][[image:attach:kieler06.png]]
56
57 Now KIELER should look like this:
58
59 [[image:attach:kieler07.png]]
60
61 Now you can proceed in modeling an SCChart as explained below.
62
cmot 24.1 63 = 2. Model an SCChart =
cmot 7.1 64
cmot 11.1 65 Right-click on a project and create a (text) File:
cmot 7.1 66
cmot 11.1 67 [[image:attach:kieler08.png]]
68
69 Name it abo.sct:
70
71 [[image:attach:kieler09.png]]
72
cmot 23.1 73 SCT is a textual description language for SCCharts. Due to space limitations SCT is not documented in the PLDI paper, but examples can be found [[here>>doc:SCT - Textual Description Language for SCCharts]]. Also the code completion functionality of the textual editor for SCT is very helpful. It can be invoked by pressing <Ctrl> + <Space>. It will list all syntactically possible input according to the SCT/SCCharts meta model.
cmot 22.1 74
cmot 12.1 75 The textual SCCharts Xtext based editor (for *.sct files) will automatically be opened:
76
77 [[image:attach:kieler10.png]]
78
79 Now start modeling an SCChart. For example copy & paste the following sct code of abo, the hello world of SCCharts:
80
81 {{code title="abo.sct"}}
cmot 13.1 82 @VHLayout
cmot 12.1 83 scchart ABO {
84 input output bool A;
85 input output bool B;
86 output bool O1;
87 output bool O2;
88 region:
89
90 initial state Init
91 --> WaitAB immediate with / O1 = false; O2 = false;
92 state WaitAB {
93 region HandleA:
94 initial state WaitA
95 --> DoneA immediate with A / B = true; O1 = true;
96 final state DoneA;
97 region HandleB:
98 initial state WaitB
99 --> DoneB with B / O1 = true;
100 final state DoneB;
101 }
102 >-> GotAB with / O1 = false; O2 = true;
103 state GotAB;
104 }
105 {{/code}}
106
cmot 13.1 107 As you save (Ctrl+S), KIELER will automatically draw the graphical SCChart diagram in a new KLigD view:
108
109 [[image:attach:kieler11.png]]
110
111 You may want to re-arrange views. Just drag the KLighD view to the right side:
112
113 [[image:attach:kieler12.png]]
114
cmot 14.1 115 You will now see how to generate a C tick function.
cmot 12.1 116
cmot 24.1 117 = 3. Generate C Code =
cmot 7.1 118
cmot 14.1 119 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).
120
121 [[image:attach:kieler13.png]]
122
123 After performing a transformation the transformed SCChart will open (together with it's KLighD diagram visualization):
124
125 [[image:attach:kieler14.png]]
126
cmot 18.1 127 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).
cmot 15.1 128
cmot 18.1 129 [[image:attach:kieler15.png]][[image:attach:kieler16.png]]
cmot 16.1 130
cmot 18.1 131
cmot 16.1 132
cmot 18.1 133 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).
cmot 16.1 134
cmot 18.1 135 [[image:attach:kieler17.png]][[image:attach:kieler18.png]]
cmot 16.1 136
cmot 18.1 137
cmot 16.1 138
cmot 18.1 139 Now populate the SCG with basic block information (left side). The SCG with calculated basic blocks will look like this (right side).
cmot 16.1 140
cmot 18.1 141 [[image:attach:kieler19.png]][[image:attach:kieler20.png]]
cmot 16.1 142
cmot 18.1 143
cmot 16.1 144
cmot 18.1 145 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).
cmot 16.1 146
cmot 18.1 147 [[image:attach:kieler21.png]][[image:attach:kieler22.png]]
cmot 16.1 148
cmot 18.1 149
cmot 16.1 150
cmot 18.1 151 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).
cmot 16.1 152
cmot 18.1 153 [[image:attach:kieler23.png]][[image:attach:kieler24.png]]
cmot 16.1 154
cmot 18.1 155
cmot 16.1 156
cmot 18.1 157 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).
cmot 16.1 158
cmot 18.1 159 [[image:attach:kieler25.png]][[image:attach:kieler26.png]]
cmot 16.1 160
cmot 18.1 161
cmot 16.1 162
cmot 17.1 163 Selecting Generate SC will produce a C file:
164
165 [[image:attach:kieler27.png]][[image:attach:kieler28.png]]
166
cmot 15.1 167
cmot 16.1 168
cmot 31.1 169 = 4. Evaluated Examples =
cmot 16.1 170
cmot 31.1 171 In the following, you find the examples used for evaluation. Be advised that there currently is no tool integrated evaluation possible. Please refer to the SCCharts superpage for the [[project status>>doc:SCCharts]] and [[known limitations>>doc:SCCharts]].
172
cmot 34.1 173 Find the list of Examples used for evaluation [[here>>doc:Examples]].