You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/embedded/patmos.mdx
+20-77
Original file line number
Diff line number
Diff line change
@@ -18,93 +18,35 @@ Patmos can run in an FPGA, but there are also two simulators available:
18
18
1.`pasim`: a software ISA simulator that is written in C++.
19
19
2.`patemu`: a cycle-accurate hardware emulator generated from the hardware description.
20
20
21
-
Consider the following simple LF program inside the HelloWorld.lf file:
21
+
Consider the following simple LF program inside the HelloPatmos.lf file located in `test/C/src/patmos/HelloPatmos.lf`:
22
22
```lf-c
23
23
target C {
24
-
single-threaded: true
24
+
platform: "Patmos",
25
+
single-threaded: true,
26
+
build-type: Debug,
25
27
}
28
+
26
29
main reactor {
27
-
reaction(startup) {=
28
-
lf_print("Hello World!");
29
-
=}
30
+
reaction(startup) {=
31
+
printf("Hello World!\n");
32
+
=}
30
33
}
34
+
31
35
32
36
```
33
-
After generating C code using `lfc HelloWorld.lf` command, add a Makefile file to compile LF-generated code inside `src-gen/HelloWorld` folder. In this Makefile mention the name of all generated c files, and the pathes of all header files. Here is a sample of such a Makefile file:
Since LF still doesn't support Patmos officialy, you need to copy some files inluding `lf_patmos_support` c and h files in the related folders before executing make command whether manually or by executing the following shell file that automates the copying process (considering those files are located in a folder called `files`). If you choose shell file, you can also add Makefile to the list.
If there is no error after making, an HelloWorld.elf file must be generator inside `src-gen\HelloWorld` folder. Then, the reactor can be executed on the SW simulator with the following command:
105
-
106
-
pasim src-gen\HelloWorld\HelloWorld.elf
44
+
If there is no error after making, an executable file must be generator inside `src-gen/patmos/HelloPatmos` folder. Then, the reactor can be executed on the SW simulator with the following command:
107
45
46
+
```
47
+
cd ../../src-gen/patmos/HelloPatmos/build
48
+
pasim HelloPatmos
49
+
```
108
50
After executing the above command, the following lines must be printed.
109
51
```
110
52
Hello World!
@@ -114,7 +56,9 @@ Hello World!
114
56
115
57
The reactor can also be executed on the hardware emulator of Patmos:
116
58
117
-
patemu src-gen\helloworld\HelloWorld.elf
59
+
```
60
+
patemu HelloPatmos
61
+
```
118
62
119
63
This execution is considerably slower than the SW simulator, as the concrete hardware
120
64
of Patmos is simulated cycle-accurate. Here is a sample of its output:
@@ -124,4 +68,3 @@ Hello World!
124
68
---- Elapsed logical time (in nsec): 0
125
69
---- Elapsed physical time (in nsec): 3,459,000
126
70
```
127
-
For doing WCET analysing, you can execute wcet target by running `make wcet` command.
0 commit comments