-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix doxygen intro page naming scheme. Adding tutorial: baseline int32…
… on ibex done.
- Loading branch information
xiaywang
committed
Jan 20, 2022
1 parent
689f682
commit 186bbaa
Showing
23 changed files
with
299 additions
and
718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../tutorial/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PULP_APP = dotprod | ||
PULP_APP_FC_SRCS = main.c | ||
|
||
PULP_LDFLAGS += -lplpdsp -lm | ||
|
||
PULP_CFLAGS += -O3 -g | ||
|
||
-include $(PULP_SDK_HOME)/install/rules/pulp.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "rtos_hal.h" | ||
|
||
#define VLEN 80 | ||
|
||
int32_t a[VLEN] = {9, 8, 9, -5, 6, -8, -1, -8, 8, -3, 2, 5, -2, | ||
3, -7, 2, -10, -10, 1, 7, 1, -10, -1, 8, -7, -4, | ||
4, -8, 2, -9, -9, 9, -3, 6, -6, 6, 4, 8, -9, | ||
-9, -9, 4, -4, 3, -9, 1, -1, -1, 2, 7, 9, 4, | ||
-9, 2, -7, 3, 9, -7, 1, 5, -8, 2, -6, -3, -8, | ||
-2, -1, -4, 8, -8, -4, 3, 3, -10, 9, 1, -3, 6, | ||
-2, -9}; | ||
int32_t b[VLEN] = {-5, -3, 6, 8, -9, -6, 9, -8, -2, 0, -9, 5, 1, | ||
1, 3, 7, 9, -6, -2, 1, -7, 0, 1, -3, -6, 2, | ||
-10, 0, -7, -8, -8, -4, -6, -6, -7, 4, -10, 2, -5, | ||
-1, -9, 6, 5, 5, 3, 2, -2, -7, 5, -5, 0, 4, | ||
-4, 0, 6, -6, 1, -9, -2, 2, 7, 7, -9, 9, -10, | ||
9, 0, -2, 1, 6, -5, -3, 2, 3, -3, 0, -3, -5, | ||
9, -7}; | ||
|
||
int32_t res = 218; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "rtos_hal.h" | ||
#include "stdio.h" | ||
#include "plp_math.h" | ||
#include "data.h" | ||
|
||
int main(){ | ||
|
||
int32_t result=0; | ||
|
||
printf("\nComputing dot prod of i32 numbers\n\n"); // it's better to always end with \n | ||
|
||
// We also count the number of cycles taken to compute it. | ||
// This tructure will hold the configuration and also the results in the | ||
// cumulative mode | ||
rt_perf_t perf; | ||
|
||
// It must be initiliazed at least once, this will set all values in the | ||
// structure to zero. | ||
rt_perf_init(&perf); | ||
|
||
// Activate specified events | ||
rt_perf_conf(&perf, (1<<RT_PERF_CYCLES) | (1<<RT_PERF_INSTR)); // Note: on gvsoc you can actiate as many counters as you want, while when you run on board, there is only one HW counter. | ||
|
||
// Reset HW counters now and start and stop counters so that we benchmark | ||
// only around the printf | ||
rt_perf_reset(&perf); | ||
rt_perf_start(&perf); | ||
|
||
plp_dot_prod_i32(a, b, VLEN, &result); | ||
|
||
rt_perf_stop(&perf); | ||
|
||
printf("The true result is %d, the calculated result is %d.\n", res, result); | ||
printf("Total cycles: %d\n", rt_perf_read(RT_PERF_CYCLES)); | ||
printf("Instructions: %d\n", rt_perf_read(RT_PERF_INSTR)); | ||
|
||
printf("\nThe glue code also took few cycles. If we call directly the kernel function to compute the dot product we have:\n"); | ||
|
||
// Reset HW counters now and start and stop counters so that we benchmark | ||
// only around the printf | ||
rt_perf_reset(&perf); | ||
rt_perf_start(&perf); | ||
|
||
plp_dot_prod_i32s_rv32im(a, b, VLEN, &result); | ||
|
||
rt_perf_stop(&perf); | ||
|
||
printf("The true result is %d, the calculated result is %d.\n", res, result); | ||
printf("Total cycles: %d\n", rt_perf_read(RT_PERF_CYCLES)); | ||
printf("Instructions: %d\n", rt_perf_read(RT_PERF_INSTR)); | ||
printf("(The effect might be more evident with SIMD and parallel computation.)\n"); | ||
|
||
return 0; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "rtos_hal.h" | ||
|
||
int32_t a = {9, 8, 9, -5, 6, -8, -1, -8, 8, -3, 2, 5, -2, | ||
3, -7, 2, -10, -10, 1, 7, 1, -10, -1, 8, -7, -4, | ||
4, -8, 2, -9, -9, 9, -3, 6, -6, 6, 4, 8, -9, | ||
-9, -9, 4, -4, 3, -9, 1, -1, -1, 2, 7, 9, 4, | ||
-9, 2, -7, 3, 9, -7, 1, 5, -8, 2, -6, -3, -8, | ||
-2, -1, -4, 8, -8, -4, 3, 3, -10, 9, 1, -3, 6, | ||
-2, -9}; | ||
int32_t b = {-5, -3, 6, 8, -9, -6, 9, -8, -2, 0, -9, 5, 1, | ||
1, 3, 7, 9, -6, -2, 1, -7, 0, 1, -3, -6, 2, | ||
-10, 0, -7, -8, -8, -4, -6, -6, -7, 4, -10, 2, -5, | ||
-1, -9, 6, 5, 5, 3, 2, -2, -7, 5, -5, 0, 4, | ||
-4, 0, 6, -6, 1, -9, -2, 2, 7, 7, -9, 9, -10, | ||
9, 0, -2, 1, 6, -5, -3, 2, 3, -3, 0, -3, -5, | ||
9, -7}; | ||
|
||
int32_t res = 218; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PULP_APP = dotprod | ||
PULP_APP_FC_SRCS = main.c | ||
|
||
PULP_LDFLAGS += -lplpdsp -lm | ||
|
||
PULP_CFLAGS += -O3 -g | ||
|
||
-include $(PULP_SDK_HOME)/install/rules/pulp.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "rtos_hal.h" | ||
|
||
#define VLEN 80 | ||
|
||
int32_t a[VLEN] = {9, 8, 9, -5, 6, -8, -1, -8, 8, -3, 2, 5, -2, | ||
3, -7, 2, -10, -10, 1, 7, 1, -10, -1, 8, -7, -4, | ||
4, -8, 2, -9, -9, 9, -3, 6, -6, 6, 4, 8, -9, | ||
-9, -9, 4, -4, 3, -9, 1, -1, -1, 2, 7, 9, 4, | ||
-9, 2, -7, 3, 9, -7, 1, 5, -8, 2, -6, -3, -8, | ||
-2, -1, -4, 8, -8, -4, 3, 3, -10, 9, 1, -3, 6, | ||
-2, -9}; | ||
int32_t b[VLEN] = {-5, -3, 6, 8, -9, -6, 9, -8, -2, 0, -9, 5, 1, | ||
1, 3, 7, 9, -6, -2, 1, -7, 0, 1, -3, -6, 2, | ||
-10, 0, -7, -8, -8, -4, -6, -6, -7, 4, -10, 2, -5, | ||
-1, -9, 6, 5, 5, 3, 2, -2, -7, 5, -5, 0, 4, | ||
-4, 0, 6, -6, 1, -9, -2, 2, 7, 7, -9, 9, -10, | ||
9, 0, -2, 1, 6, -5, -3, 2, 3, -3, 0, -3, -5, | ||
9, -7}; | ||
|
||
int32_t res = 218; |
Oops, something went wrong.