-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTheSyDeKick_tutorial.tex
561 lines (515 loc) · 16.9 KB
/
TheSyDeKick_tutorial.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
\documentclass{sdkslides}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{amssymb,amsmath}
\usepackage{url}
\usepackage{lastpage}
\usepackage{epstopdf}
%\usepackage[pdfpagemode=None,colorlinks=true,urlcolor=red, linkcolor=black,citecolor=black,pdfstartview=FitH]{hyperref}
\usepackage{mdframed}
\usepackage{caption}
\usepackage{apacite}
\usepackage{listings}
\usepackage{adjustbox}
\usepackage[nomessages]{fp}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\tikzset{
every overlay node/.style={
%draw=black,fill=white,rounded corners,
anchor=north west, inner sep=0pt,
},
thick/.style= {line width=0.3mm},
}
\def\tikzoverlay{
\tikz[remember picture, overlay]\node[every overlay node]
}%
%%%%%%%%%%%%%%%The functions are collected here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{./aaltobeamerfunctions.tex}
%%%% To insert lecture date
%\newcommand{\lectdate}{19.11.2015}
\newcommand{\lectdate}{\today}
\newcommand{\slidetitle}{TheSyDeKick tutorial}
%%%%
\title{\slidetitle}
\author[Marko Kosunen]{Marko Kosunen}
\institute[MNT]{Department of Micro and Nanosciences\\
Aalto University, School of Electrical Engineering\\[email protected]}
\sdkfootertext{Analog macro releases}{\lectdate}{\arabic{page}/\pageref{LastPage}\ }
\date{\lectdate}
\begin{document}
\lstset{language=python,
basicstyle=\small,
stringstyle=\ttfamily
}
\newcommand{\setlines}[2][1]{
\FPeval{\firstline}{clip(#1)}
\FPeval{\lines}{clip(#2)}
\FPeval{\lastline}{clip(\firstline+\lines-1)}
}
\newcommand{\nextlines}[1][\lines]{
\FPeval{\firstline}{clip(\lastline+1)}
\FPeval{\lines}{clip(#1)}
\FPeval{\lastline}{clip(\firstline+\lines-1)}
}
\newcommand{\codeclip}[2][python]{
\FPeval{\scale}{min(clip(0.44/25*\lines),0.44)}
\begin{adjustbox}{height=\scale\textheight , keepaspectratio}
\lstinputlisting[
frame=L,
numbers=left,
showlines=true
language=#1,
firstline=\firstline,
lastline=\lastline,
firstnumber=\firstline]{#2}
\end{adjustbox}
}
\newcommand{\setol}[1][0]{
\FPeval{\oln}{clip(#1)}
}
\newcommand{\incol}{
\FPeval{\oln}{clip(\oln+1)}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generates the titleframe
\sdktitleframe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% CONTENTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Outline}
\section*{\sectionname}
\begin{frame}[c]
\frametitle{\sectionname}
\tableofcontents
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Prerequisites}
\section*{\sectionname}
\begin{frame}[t]
\frametitle{\sectionname}
\begin{itemize}
\item Project template is available at
\emph{https://github.com/TheSystemDevelopmentKit/thesdk\_template}.
\item If you have access to any valid, up-to-date clone of the
template, you can use that as well.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[TheSyDeKick project structure]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Directory structures of TheSyDeKick project}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item All TheSyDeKick projects look the same
\end{itemize}
\adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
TheSyDeKick_project
init_submodules.sh
configure
sourceme.csh
pip3userinstall.sh
Entities <- All design modules are ``entities''
thesdk <- The SyDeKick core entity
rtl <- rtl entity for rtl simulations
spice <- spice entity for analog simulations
thesdk_helpers
shell
initentity.sh <- Shell script for creating new entities
inverter_tests
inverter_testbench
inverter <- Example entity inverter. All entities look the same
init_submodules.sh
configure
doc
sv
spice
vhdl
simulations <- Temporary directory for simulation results
rtlsim
inverter
__init__.py <- Python description of the entity
controller.py <- Additional entity related Python
\end{lstlisting}
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{TheSyDeKick project structure}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item All TheSyDeKick projects look the same
\item TheSydeKick entities are git submodules initiated in the
\emph{init\_submodules.sh}
\item TheSydeKick entitities are transferable to any
TheSyDeKick project.
\item TheSydeKick entities are transferable to any
TheSyDeKick project.
\item TheSydeKick entities do not run stand-alone. They need the
project.
\item Obey the structure. It is not yours to change.
\item New entities are initiated with
\emph{thesdk\_helpers/shell/initentity.sh}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Testing the environment]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Testing the environment}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item To test TheSyDeKick installation, do the following
\end{itemize}
% \adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
cd TheSyDeKick_project
./init_submodules.sh
./configure
source sourceme.csh
pip3userinstall.sh
\end{lstlisting}
%}
\begin{itemize}
\item Then \textbf{check the Python versions from Thesdk.config}. Release
v1.10 is tested with Python 3.10.
\item Thesdk.config is created and will be overwritten by the configure
script. Usually no need to re-run it.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Testing the environment}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Then we test the simulation execution
\end{itemize}
% \adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
cd Entities/inverter
./configure
python3 inverter/__init__.py
\end{lstlisting}
%}
\begin{itemize}
\item Simulation of an inverter modeled in Python, verilog (icarus), vhdl
(ghdl) and ngspice is executed.
\item Press \emph{Return} to close the figures
\item This is the elementary way of running simulations, i.e.you provide
the scriptfile to python shell.
\item The ''production way'' is
\end{itemize}
\begin{lstlisting}
./configure && make sim
\end{lstlisting}
\begin{itemize}
\item Try it. If it works, you are good to go for the next step.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Creating a new Entity]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Creating a new Entity}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item All the Entities are eventually git submodules.
\item Go through the following steps and try to think what happens in
in term of version control
\item The <my\_entity> refers to the entity you are creating. \emph{it should be
replaced with your entity name}
\item By default, the remote points to GitHub, and you do not have
push permissions there.
\end{itemize}
\adjustbox{height=0.21\textheight}{%
\begin{lstlisting}
cd entities
./thesdk_helpers/shell/initentity -h
./thesdk_helpers/shell/initentity <my_entity>
cd Entities/<my_entity>
#This is just to test the operation
python3 <my_entity>/__init__.py
git remote -v
git remote remove origin
git remote add origin \
<URL of your TheSyDeKickgroup/<my_entity>.git
git push --set-upstream origin master
\end{lstlisting}
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Converting the new entity to submodule}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Go through the following steps and try to think what happens in
in term of git submodules
\end{itemize}
% \adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
cd TheSyDeKick_project
rm -rf Entities/<my_entity>
git submodule add \
<URL of your TheSyDeKickgroup/<my_entity>.git Entities/<my_module>
\end{lstlisting}
\begin{itemize}
\item Edit the ./init\_submodules.sh script to contain\\
\emph{Entities/<my\_entity>}. Then:
\end{itemize}
\begin{lstlisting}
./init_submosules.sh
\end{lstlisting}
%}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Working with the submodules}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item If you want to edit a submodule \emph{within the master project}
this is how it goes
\end{itemize}
% \adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
cd Entities/<my_entity>
git chekout master # Or your favorite branch
# Do your edits
git add -i `#Add and select the files you want to commit
git commit # You may use -m, but follow the good practices
# https://chris.beams.io/posts/git-commit/
git push
# Now comes the trick
cd ../
git add <my_entity>
git commit -m``Update <my_entity> submodule''
git push
# To test if everything went as you really wanted
# ../init_submodules.sh
\end{lstlisting}
%}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Simplifying the model to the bone]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The simplest TheSyDeKick model}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item The template (<my\_entity>) contains features that support
python,eldo and rtl simulations.
\item Next, we will remove all the parts from the model, and leave
only the python model in place.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[The target code]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\setlines{21}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Edit the \emph{Docstring}
\end{itemize}
\codeclip{./myentity/myentity/__init__.py}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\nextlines[8]
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Edit the \emph{package imports}
\end{itemize}
\codeclip{./myentity/myentity/__init__.py}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\nextlines[52]
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Edit the \emph{Class definition}
\end{itemize}
\codeclip{./myentity/myentity/__init__.py}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\nextlines[45]
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Edit the \emph{Main script}
\end{itemize}
\codeclip{./myentity/myentity/__init__.py}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\nextlines[45]
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item Now you are ready to run you model
\end{itemize}
\begin{lstlisting}
cd Entities/<my_entity>
#This is just to test operation
python3 <my_entity>/__init__.py
\end{lstlisting}
\begin{itemize}
\item The result should look like this:
\end{itemize}
\begin{center}
\includegraphics[width=0.6\textwidth]{./Pics/inv_py.eps}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{The target code}
\section*{\sectionname}
\nextlines[45]
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item You can now try to run the test with the ``Production method''
\end{itemize}
\begin{lstlisting}
#cd Entities/<my_entity>
./configure
make sim
\end{lstlisting}
\begin{itemize}
\item The result should be the same:
\end{itemize}
\begin{center}
%This is generated by make
\includegraphics[width=0.6\textwidth]{./Pics/inv_py.eps}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Documentation with Doctrings]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Building the documentation}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item TheSyDeKick takes also care for you basic documentation needs
\item We are ysing Python Docstrings for that. You may do a web search
to figure out what it means.
\item Create the documentation or your module with:
\end{itemize}
\begin{lstlisting}
#cd Entities/<my_entity>
./configure
make doc
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Reading the documentation}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item You may read the documentation with
\end{itemize}
\begin{lstlisting}
#cd Entities/<my_entity>
firefox ./doc/build/html/index.html
\end{lstlisting}
\begin{itemize}
\item Compare the documentation to your source code. You may already
guess how it is created.
\end{itemize}
\begin{center}
\includegraphics[width=0.7\textwidth]{./Pics/Documentation.png}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Getting production ready]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Production version}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item To minimize the need for documentation, TheSydeKick follows the
following principles
\begin{itemize}
\item \emph{./init\_submodules.sh} gets the submodules
\item \emph{configure} does the configuration and creates the
Makefile
\item \emph{make} does the actual work with some functional
defaults, and creates the documentation.
\end{itemize}
\item You are now ready to build you module for 'production' use.
\end{itemize}
\begin{lstlisting}
#cd Entities/<my_entity>
configure && make
\end{lstlisting}
\begin{itemize}
\item Press \emph{Return} close the figure.
\item This runs the simulation and generates the documentation.
\item You may study the structure of \emph{configure}
\item You are now ready to release your module:
\end{itemize}
\begin{lstlisting}
git add -i #Select the files you have edited
git commit `# Give a nice and clean commit message
git push
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Working with the submodules, again}
\section*{\sectionname}
\begin{frame}[t,fragile]
\frametitle{\sectionname}
\begin{itemize}
\item As you are workin \emph{within the master project}
remember to update it
\end{itemize}
% \adjustbox{height=0.4\textheight}{%
\begin{lstlisting}
cd Entities/
git add <my_entity>
git commit -m``Update <my_entity> submodule''
git push
# To test if everything went as you really wanted
# ../init_submodules.sh
\end{lstlisting}
%}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\sectionname}{Next Steps}
\subsection*{\sectionname}
\begin{frame}[c]
\frametitle{\sectionname}
\begin{itemize}
\item Once you understand how to one entity is constructed,please
familiarize yoursel to \emph{inverter\_testbenchses} and
\emph{inverter\_tests} enetities.
\item By studying them yous should learn how to connect entities
together, and how to construct simulations for different
simulators.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectiontitle[Congratulations, You are DONE!]
\end{document}