Wiki source code of PLDI'14 Artifact on SCCharts

Version 22.1 by cmot on 2014/02/11 11:11

Show last authors
1 [[image:attach:title7.png]]
2
3 = Modeling SCCharts with KIELER =
4
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/~~biblio/downloads/papers/pldi14.pdf||shape="rect"]]. We will show you how to
6
7 ~1. Download & Start KIELER,
8
9 2. Model an SCChart, and
10
11 3. Generate C Code.
12
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.
14
15
16
17 [1] PLDI submission: [[http:~~/~~/rtsys.informatik.uni-kiel.de/~~~~biblio/downloads/papers/pldi14.pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/papers/pldi14.pdf||shape="rect" class="moz-txt-link-freetext"]]
18
19 = Download & Start KIELER =
20
21 [[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.
22
23 [[~[~[image:attach:RTEmagicC_download.png.png~]~]>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/||shape="rect"]]
24
25 Download Location: [[http:~~/~~/rtsys.informatik.uni-kiel.de/~~~~kieler/files/pldi14/>>url:http://rtsys.informatik.uni-kiel.de/~~kieler/files/pldi14/||shape="rect"]]
26
27 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).
28
29 [[image:attach:kieler1.png]]
30
31 If you selected a new workspace location, you will see a welcome screen like this:
32
33 [[image:attach:kieler02.png]]
34
35 Dismiss this "Welcome" tab. After that you'll be all set and KIELER should look like this:
36
37 [[image:attach:kieler03.png]]
38
39 In order to prepare modeling, we must create a project. Right-click in the Project Explorer to do so.
40
41 [[image:attach:kieler04.png]]
42
43 Select a General Project and click on next, then enter a project name, e.g. pldi14 and click on finish:
44
45 [[image:attach:kieler05.png]][[image:attach:kieler06.png]]
46
47 Now KIELER should look like this:
48
49 [[image:attach:kieler07.png]]
50
51 Now you can proceed in modeling an SCChart as explained below.
52
53 = Model an SCChart =
54
55 Right-click on a project and create a (text) File:
56
57 [[image:attach:kieler08.png]]
58
59 Name it abo.sct:
60
61 [[image:attach:kieler09.png]]
62
63 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. 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.
64
65 The textual SCCharts Xtext based editor (for *.sct files) will automatically be opened:
66
67 [[image:attach:kieler10.png]]
68
69 Now start modeling an SCChart. For example copy & paste the following sct code of abo, the hello world of SCCharts:
70
71 {{code title="abo.sct"}}
72 @VHLayout
73 scchart ABO {
74 input output bool A;
75 input output bool B;
76 output bool O1;
77 output bool O2;
78 region:
79
80 initial state Init
81 --> WaitAB immediate with / O1 = false; O2 = false;
82 state WaitAB {
83 region HandleA:
84 initial state WaitA
85 --> DoneA immediate with A / B = true; O1 = true;
86 final state DoneA;
87 region HandleB:
88 initial state WaitB
89 --> DoneB with B / O1 = true;
90 final state DoneB;
91 }
92 >-> GotAB with / O1 = false; O2 = true;
93 state GotAB;
94 }
95 {{/code}}
96
97 As you save (Ctrl+S), KIELER will automatically draw the graphical SCChart diagram in a new KLigD view:
98
99 [[image:attach:kieler11.png]]
100
101 You may want to re-arrange views. Just drag the KLighD view to the right side:
102
103 [[image:attach:kieler12.png]]
104
105 You will now see how to generate a C tick function.
106
107 = Generate C Code =
108
109 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).
110
111 [[image:attach:kieler13.png]]
112
113 After performing a transformation the transformed SCChart will open (together with it's KLighD diagram visualization):
114
115 [[image:attach:kieler14.png]]
116
117 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).
118
119 [[image:attach:kieler15.png]][[image:attach:kieler16.png]]
120
121
122
123 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).
124
125 [[image:attach:kieler17.png]][[image:attach:kieler18.png]]
126
127
128
129 Now populate the SCG with basic block information (left side). The SCG with calculated basic blocks will look like this (right side).
130
131 [[image:attach:kieler19.png]][[image:attach:kieler20.png]]
132
133
134
135 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).
136
137 [[image:attach:kieler21.png]][[image:attach:kieler22.png]]
138
139
140
141 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).
142
143 [[image:attach:kieler23.png]][[image:attach:kieler24.png]]
144
145
146
147 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).
148
149 [[image:attach:kieler25.png]][[image:attach:kieler26.png]]
150
151
152
153 Selecting Generate SC will produce a C file:
154
155 [[image:attach:kieler27.png]][[image:attach:kieler28.png]]
156
157
158
159
160
161