This repository contains an adaptive R peak detection algorithm implemented for the PULP platform with the following steps:
- The REWARD algorithm detects the R peaks and runs all the time as it is low complex. The algorithm runs on the main core of PULP.
- An error detection routine checks if REWARD performs well. If not, point 3) is triggered. This routine also runs on the main core of PULP.
- A more accurate but more complex algorithm BayeSlope runs on the same window of analysis. This algorithm runs on 1 core of the cluster of PULP as it is more capable (floating point unit, higher IPC).
Additionally, the repo contains:
- the input raw signals in the folder data/input_signals/, in .csv format
- the error detection parameters in the file error_detection/input_errdet.csv, containing the subject number, and the low and high percentiles of the distribution of the RR ratio computed on the full set of signals with a leave-one-out strategy for each subject.
These input signals and parameters can be used to test the algorithm. The input signal should be assigned to the ecg_1l array in data/signal.h, while the error detection parameters to PERCENTILE_LOO_LOW and PERCENTILE_LOO_HIGH in *error_detection.h*
To run the accuracy uncomment #define ACCURACY, while to run the profiling uncomment #define PROFILING.
- The accuracy output shows the R peaks from REWARD with the tag RW, the error detection with the tag Err and BayeSlope with the tag BS (in the dataset outputs the tag for BayeSlope might be CL). To test the accuracy you can configure PULP with the gvsoc platform for faster simulations and execute make clean all run in the PULP/ folder of this repo.
- The algorithm is divided in modules that you can profile together or separated. At this moment, the profiling is divided in the one from the main core and the one from the cluster. They can be distinguished in the output by the printf start profile FC, which indicates the main core, and start profile CL, which indicates the cluster. The profiling is done for every window. You can sum up the output to have the total profiling over each window or the full excerpt. To test that the profiling works, you can configure PULP with the gvsoc platform for faster simulations and execute make clean all run in the PULP/ folder of this repo. However, do not use the results from the gvsoc to estimate the energy consumption (next point), as they are not cycle-accurate.
- Considering that the energy consumption of the platform was estimated based on the power numbers of Mr.Wolf (a PULP implementation), the profiling of the main core was done in PULPissimo and the one of the cluster in PULP. In fact, the PULPissimo core is the same as the main core in Mr.Wolf. However, PULPissimo doesn't have a cluster of cores (different type than the PULPissimo one) which is present in PULP. To test the profiling in the RTL platform (cycle-accurate simulation), you can configure the pulp sdk as PULPissimo with the zeroriscy core for the main core, and as PULP with a riscy core for the cluster of cores, and execute make clean all run in the PULP/ folder of this repo.
**N.B. The version of the PULP sdk used for this publication is the one on the v1 branch.