34#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
39#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
59 uint32_t size =
sizeof(
int16_lut) + (sdram_lut->
size *
sizeof(int16_t));
62 log_error(
"Not enough space to allocate LUT. Try reducing the timestep,"
63 " the number of neurons per core, or the tau value; size = %u", size);
69 const uint32_t num_words = (lut->
size / 2) + (((lut->
size & 1) != 0) ? 1 : 0);
70 *address += num_words + 1;
85 return (lut_index < lut->size) ? lut->
values[lut_index] : 0;
93 uint32_t y = x >> shift;
95 x = ~y >> (32 - shift);
120 int32_t a, int32_t b,
const int32_t fixed_point_position) {
122 return __smulbb(a, b) >> fixed_point_position;
132 int32_t a, int32_t b,
const int32_t fixed_point_position) {
136 return (mul >> fixed_point_position);
uint32_t time
The current timer tick value.
void log_error(const char *message,...)
int16_t values[]
Table of actual values.
static int32_t maths_clamp_pot(int32_t x, uint32_t shift)
Clamp to fit in number of bits.
static int16_lut * maths_copy_int16_lut(address_t *address)
Copy a Lookup Table from SDRAM to DTCM, updating the address.
static int32_t maths_mul_16x16(int16_t x, int16_t y)
multiply two 16-bit numbers to get a 32-bit number.
static int32_t maths_fixed_mul16(int32_t a, int32_t b, const int32_t fixed_point_position)
multiply two 16-bit fixed point numbers (encoded in int32_t)
static int32_t maths_lut_exponential_decay(uint32_t time, const int16_lut *lut)
Get value from lookup table.
static int32_t maths_fixed_mul32(int32_t a, int32_t b, const int32_t fixed_point_position)
multiply two 32-bit fixed point numbers (encoded in int32_t)
uint16_t shift
Mapping from time to table index.
uint16_t size
Number of entries in table.
Lookup Table of 16-bit integers.
Data type definitions for SpiNNaker Neuron-modelling.
void rt_error(uint code,...)
void spin1_memcpy(void *dst, void const *src, uint len)