-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout_pulpino.tex
416 lines (314 loc) · 13.8 KB
/
about_pulpino.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
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{secdot}
\usepackage{url}
\usepackage{graphicx}
\usepackage{cleveref}
\renewcommand{\labelitemii}{$\star$}
\newcommand{\cmdbox}{\textwidth}
%\newcommand{\picbox}{width = .8\textwidth}
\newcommand{\picbox}[2]{\centering
\includegraphics[width = .8\textwidth]{{#1}}
\caption{{#2}}
}
\title{\bfseries About Pulpino}
\author{Aamir Sultan,\\Associate Design Engineer,\\Lampromellon.}
\date{November, 2020}
\begin{document}
\maketitle
In this document we will see the finding and knowledge obtained during the study of Pulpino micro-controller in this week.
\section{What is Pulpino?}
Pulpino is a microcontroller developed at ETH Zurich university\cite{pulp_ref}. This microcontroller is using single-core which can configured for RISCY or Zero-Riscy core.
\subsection{RISCY properties}
Properties of the RISCY core are given as follows:
\begin{itemize}
\item Pipeline stages 4, In order, IPC nearly 1.
\item Support for RV32IMC, can also be configure for the RV32F.
\item Other supported ISA extensions.
\begin{itemize}
\item hardware loops
\item post-incrementing load and store instructions
\item bit-manipulation instructions
\item MAC operations
\item support fixed-point operations
\item packed-SIMD instructions
\item dot product
\end{itemize}
\subsection{Zero-Riscy Properties}
Zero-Riscy is an In order, single issue with 2 pipeline stages. It supports RV32IMCE of RISC-V architecture extensions. Other properties of the Zero-Riscy are as folows:
\begin{itemize}
\item Ultra Low Power.
\item Ultra Low Area.
\item Switch to Ultra Low power mode while IDLE.
\item Wake up unit in-case of interrupt or event.
\end{itemize}
\end{itemize}
\section{Building the Pulpino}
Following is the command list that is used for the building of the core form the Git repository\cite{pulp_ref}.
\begin{enumerate}
\item One can check for the packages using the following command which looks for packages in \emph{PyPI} with yaml in the short description. That reveals various packages, including \emph{PyYaml}, \emph{yamltools}, and \emph{PySyck}, among others (Note that \emph{PySyck} docs recommend using \emph{PyYaml}, since \emph{syck} is out of date). Now you know a specific package name, you can install it.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ pip search yaml
}}}
\end{center}
\item If the pip is not installed you can install it via the following code.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt install python-pip
}}}
\end{center}
\item First of all install the pyyaml for python2 incase if it is used in the building process of the SoC.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ pip install pyyaml
}}}
\end{center}
\item In the second step install the yaml library with pyhton3 using the following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ pip3 install pyyaml
}}}
\end{center}
\item Make a build folder inside the sw folder of the pulpino main directory. We will use it for keeping the settings of the core that we want to generate. Following command will create the build folder.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ mkdir ./sw/build
}}}
\end{center}
\item For copying the configuration file we use the copy command as follows.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cp ./sw/cmake\_configure.zeroriscy.gcc.sh ./sw/build
}}}
\end{center}
the configuration files are placed in sw folder. The other configuration files can be used for building also. One has to repeat the step 6 and change the \emph{cmake\_configure.zeroriscy.gcc.sh} by other configuration files that are given as follows.
\begin{itemize}
\item cmake\_configure.zeroriscy.gcc.sh
\item cmake\_configure.riscvfloat.gcc.sh
\item cmake\_configure.riscv.gcc.sh
\item cmake\_configure.microriscy.gcc.sh
\end{itemize}
\item We need to install a special makefile utility by the name of Cmake. CMake uses a simple platform and compiler-independent configuration files to control the software compilation process. We the follow the following commands\cite{cmake_ref}:
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt update\\
\$ sudo apt upgrade\\
\$ sudo snap install cmake -{}-classic
}}}
\end{center}
Check the version of the cmake by using the the follwoing command if it is correctly installed then it will show the version of the Cmake installed.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cmake -{}-version
}}}
\end{center}
\item We also need the modelsim for the simulation of the SoC \cite{modelsim_install_ref}. However the modelsim should be installed on the system but incase if is not installed you can send a request for download at \url{https://fpgasoftware.intel.com/20.1/?edition=lite&platform=linux}. On this page goto individual files and click on the down arrow for downloading the Modelsim Starter Pack, \Cref{fig:modelsim_download}.
\emph{Note :} If ModelSim is already installed then you skip to step number 15.
%On this page click \emph{Download}.
%This will bring up another page click on \emph{Create Account}.
%This will bring up a form and after filling the form \Cref{fig:form}. It send a download link at your given email.
\begin{figure}
\picbox{modelsim_download}{Download Options}
\label{fig:modelsim_download}
\end{figure}
Once the ModelSim is downloaded it will in the form of \emph{.run} file. To install go to the download location of the Modelsim \emph{.run} file and run the following commands.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ chmod +x ModelSimSetup-*.run
}}}
\end{center}
\item Next we will install the ModelSim by using the following commands.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ ./ModelSimSetup-*.run
}}}
\end{center}
\item Change your directory to\\ \emph{``ModelSim-Installation-Directory/intelFPGA/20.*/modelsim\_ase/linuxaloem”} using the command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cd ModelSim-Installation-Directory/intelFPGA/20.*/modelsim\_ase/linuxaloem
}}}
\end{center}
\item Type the following command to run modelsim.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cd ./vsim
}}}
\end{center}
\item if the ModelSim is executed its fine otherwise you will have add few libraries. if the error is given as \emph{./vsim: No such file or directory} then use following commands.
\emph{Note:} In case the model-sim is invoked successfully you can skip to step number 15.
\item Type the following command to run modelsim.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo dpkg -{}-add-architecture i386\\
\bfseries \$ sudo apt-get update \\
\bfseries \$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386\\
\bfseries \$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
}}}
\end{center}
\item try again if executed otherwise it will possibly give the following \emph{errorlibXft.so.2: cannot open shared object file}.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt-get install libxft2 libxft2:i386 lib32ncurses5
}}}
\end{center}
Another error that will pop \emph{libXext.so.6: cannot open shared object file. libXext.so.6 not found}. Use following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt install libxext6\\
\bfseries \$ sudo apt install libxext6:i386
}}}
\end{center}
Hopefully this will solve the problem.
\item We need Verillator for evaluation. We can install the Verillator using following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ apt-get install verilator
}}}
\end{center}
\item We need to clone the RISC-V toolchain for the compilation and running of the SoC. We will clone the toolchain from pulp platform using the following commands, \cite{pulp_plat_ref}.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ git clone -{}-recursive https://github.com/pulp-platform/pulp-riscv-gnu-toolchain
}}}
\end{center}
\item Setting and building the tool-chain using command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev
}}}
\end{center}
\item To set the path to the binaries use following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ export PATH=\$PATH:/opt/riscv/bin
}}}
\end{center}
\item To build the Newlib cross-compiler for all pulp variants, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command in the cloned directory:
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ ./configure -{}-prefix=/opt/riscv --with-arch=rv32gc --with-cmodel=medlow --enable-multilib\\
\bfseries \$ sudo make
}}}
\end{center}
\item To build the Newlib cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ ./configure --prefix=/opt/riscv\\
\bfseries \$ sudo make
}}}
\end{center}
\item If it gives error then try installing the essentials for correct working using the following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ sudo apt-get update\\
\bfseries \$ sudo apt-get install -y build-essential
}}}
\end{center}
\item Setting the Environment paths.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ export PULP\_RISCV\_GCC\_TOOLCHAIN=/opt/riscv/bin
}}}
\end{center}
\item Change the directory to the \emph{/pulpino/sw/build} and use the following command.
\item We need to change some flags for the correct building of the pulpino. We will do these steps by using a script that we can get from \cite{additional_scripts}. We can get the script as follows.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cd ../../ \\
\bfseries \$ git clone [email protected]:Lampro-Mellon/Pulpino-Setup.git \\
\bfseries \$ cd sw/build/ \\
\bfseries \$ cp ../../Pulpino-Setup/replace\_m32.sh ./..; cp ../../Pulpino-Setup/repair\_riscv\_linker.sh .
}}}
\end{center}
\item We will run these scripts and the configuration script for pulpino. Use the following commands to run the \emph{replace\_m32.sh} script.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cd ../; ./replace\_m32.sh; cd build
}}}
\end{center}
it will ask twice for \emph{yes\slash no}. Use \emph{n} for both entries.
\item We need to copy the configuration script to the build folder.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ cp ../cmake\_configure.zeroriscy.gcc.sh .
}}}
\end{center}
This command will copy the cmake\_configure.zeroriscy.sh file to build folder that we created. One can change the script file for riscy or other that are included in the \emph{sw} folder.
\item We need to change the configuration script mode for execution of the script using following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ chmod +x cmake\_configure.zeroriscy.gcc.sh
}}}
\end{center}
\item We need to change the configuration script mode for execution of the script using following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ ./cmake\_configure.zeroriscy.gcc.sh
}}}
\end{center}
\item The script running will throw an error at the first running of the configuration script. The error is basically generated from a linker file that is not existent in the generated files. This linker has no use but just a file. We need to generate this file somehow so we wrote a script that we already copied from the additional files repository. Other thing to mention is that after one execution the configuration script deletes this file again so we will be running the previous step and this step multiple times. The script is executed with the following command.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ ./repair\_riscv\_linker.sh
}}}
\end{center}
After multiple times repetition of the steps \emph{28} and \emph{29} it will create the \emph{makefile} and other files for further executions. If correctly generated it will show something like this \Cref{fig:succes_exec}
\begin{figure}[hb]
\picbox{success_exec.png}{Successful execution of the configuration script}
\label{fig:succes_exec}
\end{figure}
\item Use the following command to compile the pulpino using Modelsim.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ make vcompile
}}}
\end{center}
\item We will run the \emph{helloworld} test on the compiled pulpino using the following commands.
\begin{center}
\fbox{\centering
\parbox{\cmdbox}{\centering{
\bfseries \$ make helloworld.vsim
}}}
\end{center}
\item The above command will execute and invoke the Modelsim GUI but there is a chance of it throwing an error like in \Cref{fig:modelsim_error}.
\begin{figure}
\picbox{modelsim_error.png}{Modelsim error on the execution of the \emph{helloworld} test}
\label{fig:modelsim_error}
\end{figure}
\end{enumerate}
\bibliography{ref}
\bibliographystyle{ieeetr}
\end{document}