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
/* | |
* A 32-bit floating pont random number generator [0,1) for the Adapteva Epiphany | |
* Based on http://simul.iro.umontreal.ca/rng/lfsr113.c | |
* A shortcut was taken for conversion of unsigned int to floating point so that | |
* half of the results are off by the least significant bit. This probably shouldn't | |
* be used for Monte Carlo simulation, but should still have a normal distribution | |
* and the underlying state remains the same. | |
* C Prototype: float randf(void); | |
*/ | |
.section .text |
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
/* // Optimized Dot Product routine follows this protoype | |
float dot_product(const float* a, const float* b, int nd8m1) { | |
int i; | |
float c = 0.0f; | |
int n = (nd8m1+1)*8; | |
for (i=0; i<n; i++) { | |
c += a[i] * b[i]; | |
} | |
return c; | |
} */ |
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
/* | |
unsigned int t0, t1; | |
ctimer_start(); | |
t0 = ctimer_get(); | |
// place timed code here | |
t1 = ctimer_get(); | |
unsigned int dt = t0 – t1; // elapsed time in clock cycles | |
*/ | |
static void ctimer_start(void) |