sPyNNaker neural_modelling  7.4.2
neuron-typedefs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
25 #ifndef __NEURON_TYPEDEFS_H__
26 #define __NEURON_TYPEDEFS_H__
27 
28 #include <common-typedefs.h>
29 #include "maths-util.h"
30 
31 #ifndef UNUSED
32 #define UNUSED __attribute__((__unused__))
33 #endif
34 
35 // Determine the type of a spike
36 #ifndef __SPIKE_T__
37 
39 typedef uint32_t key_t;
41 typedef uint32_t payload_t;
42 
43 #ifdef SPIKES_WITH_PAYLOADS
44 
46 typedef uint64_t spike_t;
47 
48 union _spike_t {
49  spike_t pair;
50  struct {
51  payload_t payload;
52  key_t key;
53  };
54 };
55 
59 static inline key_t spike_key(spike_t s) {
60  union _spike_t spike;
61  spike.pair = s;
62  return spike.key;
63 }
64 
69 static inline payload_t spike_payload(spike_t s) {
70  union _spike_t spike;
71  spike.pair = s;
72  return spike.payload;
73 }
74 
75 #else /*SPIKES_WITHOUT_PAYLOADS*/
76 
78 typedef uint32_t spike_t;
79 
83 static inline key_t spike_key(spike_t s) {
84  return s;
85 }
86 
91 static inline payload_t spike_payload(UNUSED spike_t s) {
92  return 0;
93 }
94 #endif /*SPIKES_WITH_PAYLOADS*/
95 #endif /*__SPIKE_T__*/
96 
118 typedef struct synaptic_row *synaptic_row_t;
119 
121 typedef REAL input_t;
122 
124 typedef REAL state_t;
125 
126 #endif /* __NEURON_TYPEDEFS_H__ */
static uint32_t key
Base multicast key for sending messages.
maths-util.h - first created 7/10/2013 version 0.1
accum REAL
Type used for "real" numbers.
Definition: maths-util.h:91
uint32_t key_t
The type of a SpiNNaker multicast message key word.
struct synaptic_row * synaptic_row_t
The type of a synaptic row.
uint32_t payload_t
The type of a SpiNNaker multicast message payload word.
uint32_t spike_t
The type of a spike.
static payload_t spike_payload(spike_t s)
helper method to retrieve the pay-load from a spike
REAL state_t
The type of a state variable.
REAL input_t
The type of an input.
static key_t spike_key(spike_t s)
helper method to retrieve the key from a spike