diff options
author | JanHenrik <janhenrik@janhenrik.org> | 2020-01-19 00:56:37 +0100 |
---|---|---|
committer | JanHenrik <janhenrik@janhenrik.org> | 2020-01-19 00:56:37 +0100 |
commit | a81fc41c3eb99e8fc52aa734ee63e13c937aab81 (patch) | |
tree | 19974c4676ed64d6e4260b79fc3f1eaeda58a289 /Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h | |
parent | a96ec5d9995e7e4b7315a192e543b88f0aff4930 (diff) | |
download | minikbd-a81fc41c3eb99e8fc52aa734ee63e13c937aab81.tar.gz minikbd-a81fc41c3eb99e8fc52aa734ee63e13c937aab81.tar.bz2 minikbd-a81fc41c3eb99e8fc52aa734ee63e13c937aab81.zip |
added blink example
Diffstat (limited to 'Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h')
-rw-r--r-- | Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h b/Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h new file mode 100644 index 0000000..2e33988 --- /dev/null +++ b/Blink/Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h @@ -0,0 +1,78 @@ +#ifndef _MAIN_H_
+#define _MAIN_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "arm_math.h"
+
+#include "arm_nnfunctions.h"
+#include "ref_functions.h"
+
+extern int test_index;
+extern q7_t test_flags[50];
+
+void initialize_results_q7(q7_t * ref, q7_t * opt, int length)
+{
+ arm_fill_q7(0, ref, length);
+ arm_fill_q7(37, opt, length);
+}
+
+void initialize_results_q15(q15_t * ref, q15_t * opt, int length)
+{
+ arm_fill_q15(0, ref, length);
+ arm_fill_q15(0x5F5, opt, length);
+}
+
+void verify_results_q7(q7_t * ref, q7_t * opt, int length)
+{
+
+ bool if_match = true;
+
+ for (int i = 0; i < length; i++)
+ {
+ if (ref[i] != opt[i])
+ {
+ printf("Output mismatch at %d, expected %d, actual %d\r\n", i, ref[i], opt[i]);
+
+ if_match = false;
+ }
+ }
+
+ if (if_match == true)
+ {
+ printf("Outputs match.\r\n\r\n");
+ test_flags[test_index++] = 0;
+ } else {
+ test_flags[test_index++] = 1;
+ }
+
+}
+
+void verify_results_q15(q15_t * ref, q15_t * opt, int length)
+{
+
+ bool if_match = true;
+
+ for (int i = 0; i < length; i++)
+ {
+ if (ref[i] != opt[i])
+ {
+ printf("Output mismatch at %d, expected %d, actual %d\r\n", i, ref[i], opt[i]);
+
+ if_match = false;
+ }
+ }
+
+ if (if_match == true)
+ {
+ printf("Outputs match.\r\n\r\n");
+ test_flags[test_index++] = 0;
+ } else {
+ test_flags[test_index++] = 1;
+ }
+
+}
+
+#endif
|