DAMSON/xsl/HtoL.xsl 0000664 0001750 0001750 00000001772 12107175043 012740 0 ustar paul paul
DAMSON/xsl/SpineML_2_DAMSON_alias.xsl 0000664 0001750 0001750 00000041335 12107161572 016035 0 ustar paul paul
#alias
num_neurons_actual = ;
// data for hash tables ///////////////////////
hashCreation={
{
},
{
}
};
// close unused output ports (neuron only) //
portOn = {
1,
0,
};
// initialise explicit lists //////////////////
// parameters / SVs
// synapse
// postsynapse
= {
};
// neuron
= {
};
// connections (synapse)
// connections (generic inputs)
// setup interrupts:
clock_int: 0
event_int:
,
// outputs
0
1000000
#snapshot "spike" "%f %f" t current_neuron_index
#log "
"
0.000001 "%f
\n" t
#log "
"
0.000001 "%f
\n" t
//######################
DAMSON/xsl/SpineML_2_DAMSON_noalias.xsl 0000664 0001750 0001750 00000144061 12107161572 016372 0 ustar paul paul
#timestamp on
#monitor off
#define e 2.71828183
#define EXP_MAX 10.397
#define INPUTS_PER_PORT
//#define MAX_NUMBER_OF_PORTS 10
#define MAX_HASH_SIZE ;
#define MAX_TOTAL_INPUTS ;
#define INIT_TIME 20000
#define NUM_NODES
// regime definitions:
// Neuron numbers for each population component type
#define N_ 10
/*
Autogenerated DAMSON file from 9ML description.
Engine: XSLT
Engine Author: Alex Cope 2012
Node name:
*/
#node
// number of neurons for this instance
int num_neurons_actual;
// counter for init
int nodes_to_see = NUM_NODES;
// array for which ports should be output
int portOn[];
// are we done with the initialisation?
int trigger = 0;
// the counter for clock interrupts (i.e. number of iterations)
int timerCounter = 0;
float t;
float dt = ;
float inv_dt = ;
int hashLookupTable[MAX_HASH_SIZE];
int hashSwitchTable[MAX_HASH_SIZE];
int hashInputIndexTable[MAX_HASH_SIZE];
int hashCreation[MAX_TOTAL_INPUTS][];
// for logging events
int current_neuron_index;
// helper functions #############################################
////////////////////////////////// Integrate
float solveDE(float,float);
////////////////////////////////// RNG
float convert_no_cast(float);
int seed = 11;
int a_RNG = 1103515245;
int c_RNG = 12345;
float uniformRNG(float, float);
float pow(float, int);
float exp(float);
////////////////////////////////// #1
int hashSwitch(int);
////////////////////////////////// #2
int hashInputIndex(int);
// SYNAPSES DECLARATIONS //////////////////////////////////
// PostSynapse DECLARATIONS ///////////////////////////////////////
// NEURON DECLARATIONS ////////////////////////////////////
// GENERIC INPUTS /////////////////////////////////////////
///////////////////////////////////////////////////////////
// SYNAPSE GENERIC INPUTS /////////////////////////////////
!!! Error: learing not implemented yet - generic inputs to synapses are not permitted !!!
// PostSynapse GENERIC INPUTS /////////////////////////////////////
// NRN GENERIC INPUTS /////////////////////////////////////
// PROTOTYPES FOR THE INTERRUPTS
int event_int(int,int,float,int);
void clock_int(int,int,int);
// FUNCTIONS FOR THE PostSynapse COMPONENTS
// //
void
(int i,
float
,
float
INST[
],
, int regimeINST[
]);
// FUNCTION FOR THE NEURON BODY COMPONENT
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]);
// MAIN FUNCTION
int main()
{
// DEFINITIONS
int i;
int j;
int k;
int index;
int input;
int counter;
// temporary storage for generated values
int tempInts[]; // this population's size
float tempFloats[]; // this population's size
int connRowLengths[100]; // a temporary array for probabalistic connections that stores row lengths for initialising Pars SVs etc... since we don't know the number of nrns in the src the num of elements is quite large
//printf("IN MAIN\n");
// set the tickrate for the simulation
tickrate(1000000000);
// SET INITIAL HASH TABLE VALUES
for (i = 0; i < MAX_HASH_SIZE; i+=1) {
hashLookupTable[i]=-200;
}
// GENERATE THE HASH TABLES
for (i = 0; i < MAX_TOTAL_INPUTS; i+=1) {
if (hashCreation[i][0] != 0) {
// add value into first hash table
input = hashCreation[i][0];
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (1==1){
if(hashLookupTable[index]==-200)
{
hashLookupTable[index]=input;
hashSwitchTable[index]=hashCreation[i][1];
hashInputIndexTable[index]=hashCreation[i][2];
break;
}
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
}
}
// HACK
seed = 123;
//////////////////////////////////////////////////////
// BEGIN INITIALISATION OF DATA //
//////////////////////////////////////////////////////
////// COMPONENTS ####################################
////// INPUTS #######################################
//////////////////////////////////////////////////////
// END INITIALISATION OF DATA //
//////////////////////////////////////////////////////
printf("MAIN COMPLETE\n");
// broadcast that setup is done
//sendpkt(0);
return 0;
}
// helper functions #############################################
////////////////////////////////// Integrate
float solveDE(float x,float fx) {
return x + fx*dt;
}
float convert_no_cast(float val) {
return val;
}
////////////////////////////////// RNG
float uniformRNG(float ub, float lb) {
float val;
float seed2;
seed = abs(seed*a_RNG+c_RNG);
seed2 = convert_no_cast(seed>>15);
val = (seed2)*(ub-lb)+lb;
return val;
}
////////////////////////////////// POW
float pow(float value, int power) {
int i;
float result = 1;
for (i = 0; i < power; i += 1) {
result *= value;
}
return result;
}
////////////////////////////////// EXP
float exp(float x) {
int n = 1; //expansion step
float f = 1.0; //factorial n!
float r = 1.0; //result is sum of expansion steps
float s = 1.0; //expansion step value is x^n/n!
float p = x; //power x^n
if (x>EXP_MAX) //will overflow so return max float or error
return 32768.0;
if (x>1) //recursive step exploits exponential indentity (exp(1+x) = E*exp(x))
return e*exp(x-1.0);
else //Taylor expansion
{
while (s > 0){ //while step value is within fixed point range
f = f*n;
s = (p/f);
r = r + s;
p = p * x;
n += 1;
}
return r;
}
}
////////////////////////////////// #1
int hashSwitch(int input) {
int index;
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (hashLookupTable[index] != -200){
if(hashLookupTable[index]==input)
return hashSwitchTable[index];
if(hashLookupTable[index]==-200)
return -1;
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
return -1;
}
////////////////////////////////// #2
int hashInputIndex(int input) {
int index;
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (hashLookupTable[index] != -200){
if(hashLookupTable[index]==input)
return hashInputIndexTable[index];
if(hashLookupTable[index]==-200)
return -1;
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
return -1;
}
//////////////////////////////////// CLOCK INTERRUPT - THIS IS USED TO UPDATE THE SYSTEM EACH ITERATION
void clock_int(int not_using_this_1, int not_using_this_2, int t_not_used) {
// declare variables
int i;
int t2; // used for rolling buffers
float sum;
int portNum;
int portID;
// make time available
t = (float) timerCounter * dt;
// if we are not still initialising the system
if (trigger == 1) { // if simulation started
// engage semaphores:
_input_
wait(&_semaphore);
for (i=0; i < num_neurons_actual; i+=1) {
// current neuron index for logging purposes
current_neuron_index = i;
// do PostSynapses ##########################################################
// NRN -> PostSynapse (Conductance-based synapses)
[i] = [i];
(i,
[i]
,
,
regimeCurr
);
// PostSynapse -> NRN
[i] = [i];
// do NRN ##########################################################
(i,
[i]
,
,
regimeCurr
);
// zero analog input ports
[i] = 0;
[i] = 0;
}
// disengage semaphores:
_input_
signal(&_semaphore);
} // end of if simulation started
timerCounter += 1;
if (trigger == 0 && timerCounter < 10000000)
{
timerCounter = 0;
trigger = 1;
}
if (trigger == 1 && timerCounter >= )
{
exit(1);
}
}
//////////////////////////////////////
// //
// THREAD FUNCTIONS //
// //
//////////////////////////////////////
// synapses //////////////////////////
// inputs ////////////////////////////
// DO EVENTS ##################################################
int event_int(int the_src_node_number, int the_port_and_Neuron_number, float the_packet_payload, int the_current_clock_tick) {
int thread;
// switch between inputs - are they synaptic, or inputs to other components?
// for now we will only use 7-5 split of the 12 bits of port (7 for Neuron num, 5 for port ID)
int the_port_number = 0xf&(the_port_and_Neuron_number);
int the_nrn_number = 0x7f&(the_port_and_Neuron_number>>4);
int switch_value = hashSwitch(the_src_node_number);
int split_value = hashInputIndex(the_src_node_number);
// startup:
//if (nodes_to_see > 0 && the_port_and_Neuron_number==0) {
//printf("Nodes to see = %d\n", nodes_to_see);
//nodes_to_see -= 1;
//return 0;
//}
// switch on input number
switch (switch_value) {
case :
// switch on port on input src
switch (the_port_number) {
case :
// inputs
_input_
thread = createthread(_schedule, 1000, the_nrn_number, split_value, the_packet_payload);
break;
case :
// projections
thread = createthread(_schedule, 1000, the_nrn_number, split_value);
// inputs
_input_
thread = createthread(_schedule, 1000, the_nrn_number, split_value);
break;
default:
//printf("Warning - unhandled packet!\n"); //exit(-1);
}
break;
default:
//printf("Warning - unhandled packet!\n"); //exit(-1);
}
return 1;
}
// FUNCTIONS FOR THE PostSynapse COMPONENTS
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]) {
int regimeNext;
int transition;
// define temp variables for time derivatives
// define aliases that are not port aliases...
// assign aliases that are not port aliases...
// zero analog ports
[i] = 0;
}
// FUNCTION FOR THE NEURON BODY COMPONENT
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]) {
int j;
int portID;
int regimeNext;
int transition;
// define temp variables for time derivatives
// define aliases that are not port aliases...
// assign aliases that are not port aliases...
// output any analog ports
// zero analog ports
[i] = 0;
}
/// ############### ALIASES #############
#include "alias_file.d"
#alias
num_neurons_actual = ;
// data for hash tables ///////////////////////
hashCreation={
{
},
{
}
};
// close unused output ports (neuron only) //
portOn = {
1,
0,
};
// initialise explicit lists //////////////////
// parameters / SVs
// synapse
// postsynapse
= {
};
// neuron
= {
};
// connections (synapse)
// connections (generic inputs)
// setup interrupts:
clock_int: 0
event_int:
,
// outputs
0
1000000
#snapshot "spike" "%f %f" t current_neuron_index
#log "
"
0.000001 "%f
\n" t
#log "
"
0.000001 "%f
\n" t
//######################
DAMSON/xsl/SpineML_Alias.xsl 0000664 0001750 0001750 00000012166 12107161572 014513 0 ustar paul paul
float ;
float ;
=
;
// aliases for output ports
=
;
float
,
=
;
float ;
=
;
//Alias assignment for ports
[num]=
;
DAMSON/xsl/SpineML_AnalogPort.xsl 0000664 0001750 0001750 00000003553 12107161572 015530 0 ustar paul paul
[i] = the_packet_payload;
// engage semaphore
wait(&semaphore);
[i] += the_packet_payload;
[i] *= the_packet_payload;
signal(&semaphore);
float ;
if (portOn[]) {
//for (j = 0; j < ; j+=1) {
// create the port ID
portID = i<<4|;
sendpkt(portID,[i]);
//}
}
DAMSON/xsl/SpineML_Component.xsl 0000664 0001750 0001750 00000003514 12107161572 015421 0 ustar paul paul
transition = 1;
DAMSON/xsl/SpineML_Dynamics.xsl 0000664 0001750 0001750 00000002525 12107161572 015227 0 ustar paul paul
//Dynamics transitions
regimeNext = regime[i];
// switch on regime:
switch (regime[i]) {
}
regime[i] = regimeNext;
//Dynamics time derivatives
// switch on regime:
switch (regime[i]) {
}
DAMSON/xsl/SpineML_EventOut.xsl 0000664 0001750 0001750 00000002021 12107161572 015220 0 ustar paul paul
//EventOut
//printf("%f %d %d\n",timerCounter*dt,100000,i);
// create the port ID
//int portID;
portID = i<<4|;
//sendpkt(portID);
sendpkt(portID);
DAMSON/xsl/SpineML_EventPort.xsl 0000664 0001750 0001750 00000001216 12107161572 015402 0 ustar paul paul
[i] += 1;
DAMSON/xsl/SpineML_helpers.xsl 0000664 0001750 0001750 00000123207 12107161572 015123 0 ustar paul paul
1
0
}{
{
1
0
}
1
0
{
-1
}
-1
-1
{
-1
}
,
{
{
1
0
}
,
{
{
-1
}
,
{
{
}
true
0
0
[]
[]
, %f
[]
, %f
DAMSON/xsl/SpineML_ImpulseOut.xsl 0000664 0001750 0001750 00000002301 12107161572 015556 0 ustar paul paul
//ImpulseOut
//printf("%f %d %d\n",timerCounter*dt,100000,i);
// create the port ID
//int portID;
portID = i<<4|;
// send an impulse using val from the created array - this is the same for all ImpulseOuts
sendpkt(portID, [the_nrn_index]);
DAMSON/xsl/SpineML_Input.xsl 0000664 0001750 0001750 00000270662 12107161572 014570 0 ustar paul paul
EVENT
ANALOG
_input_
// input to : ///////////////
// delay
float delay = ;
// prototypes for thread functions
void (int nrn_index, int split_index);
void _schedule(int src_nrn_index, int split_index);
// delay
float delay[][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
//connection
extern int connectionSD[][][];
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
//connection
extern int connectionSD[][][];
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
//semaphore:
int _semaphore = 1;
// delay (121 fixed)
float delay = ;
// prototypes for thread functions
void _schedule(int src_nrn_index, int split_index, float value);
// delay (121 prob)
float delay[][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
// delay (A2A fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (A2A prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
//connection
extern int connectionSD[][][];
// delay (el fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (el prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (el expl)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay, float value);
void _schedule(int src_nrn_index, int split_index, float value);
//connection
extern int connectionSD[][][];
// delay (fp fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (fp prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
EVENT
ANALOG
_input_
// input to : ///////////////
// delay
float delay = ;
// prototypes for thread functions
void (int nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
float delay[][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
//connection
extern int connectionSD[][][];
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
//connection
extern int connectionSD[][][];
// delay
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index);
// delay
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
//semaphore:
int _semaphore = 1;
// delay (121 fixed)
float delay = ;
// prototypes for thread functions
void _schedule(int src_nrn_index, int split_index, float value);
// delay (121 prob)
float delay[][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
// delay (A2A fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (A2A prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
//connection
extern int connectionSD[][][];
// delay (el fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index, int split_index, float value);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (el prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (el expl)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay, float value);
void _schedule(int src_nrn_index, int split_index, float value);
//connection
extern int connectionSD[][][];
// delay (fp fixed)
float delay = ;
// prototypes for thread functions
void (int src_nrn_index);
void _schedule(int src_nrn_index, int split_index, float value);
// delay (fp prob)
extern float delaySD[][][];
// prototypes for thread functions
void (int src_nrn_index, int dst_nrn_index, float delay);
void _schedule(int src_nrn_index, int split_index, float value);
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
EVENT
ANALOG
_input_
// input to : ///////////////
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
delay[i][j] = uniformRNG((float) , (float) );
}
}
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
// connectivity
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
counter = 0;
for (k=0; k < ; k += 1) {
if (uniformRNG(1.0, 0.0) < ) {
tempInts[counter] = k;
counter += 1;
}
}
connRowLengths[j] = counter; // for use in pars init
tempInts[counter+1] = -1; // terminate list
writesdram(&connectionSD[i][j][0], &tempInts, );
}
}
// delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
delay[i][j] = uniformRNG((float) , (float) );
}
}
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
// delay
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
// connectivity
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
counter = 0;
for (k=0; k < ; k += 1) {
if (uniformRNG(1.0, 0.0) < ) {
tempInts[counter] = k;
counter += 1;
}
}
connRowLengths[j] = counter; // for use in pars init
tempInts[counter+1] = -1; // terminate list
writesdram(&connectionSD[i][j][0], &tempInts, );
}
}
// delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&delay[i][j][0], &tempFloats, );
}
}
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
EVENT
ANALOG
_input_
// input to : ///////////////
// function threads
void (int nrn_index) {
int i = nrn_index;
// run relevant OnEvent
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 100, nrn_index, split_index);
}
// function threads
void (int nrn_index, int split_index) {
int i = nrn_index;
delay(delay[i]*inv_dt);
// run relevant OnEvent
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
thread = createthread(, 100, nrn_index, split_index);
}
// function threads
void (int src_nrn_index) {
int i;
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
}
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 100, src_nrn_index);
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay) {
int i;
i = dst_nrn_index;
delay(delay*inv_dt);
}
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
int i;
float delay[];
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
thread = createthread(, 100, src_nrn_index, i, delay[i]);
}
}
// function threads
void (int src_nrn_index, int split_index) {
int i;
int connection[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
if (connection[i] == 0) continue;
}
}
void _schedule(int nrn_index, int split_index){
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 1000, src_nrn_index, split_index);
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay) {
int i;
i = dst_nrn_index;
delay(delay*inv_dt);
}
void _schedule(int nrn_index, int split_index){
// no fetching, all we need to do is pass the delays to the threads
int thread;
int i;
int connection[];
float delay[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
if (connection[i] == 0) continue;
thread = createthread(, 100, src_nrn_index, i, delay[i]);
}
}
// function threads
void (int src_nrn_index, int split_index) {
int i;
int index;
int connection[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
// run relevant OnEvent for each dst nrn
index=0;
while (connection[index] != -1) {
index+=1;
i = connection[index];
}
}
void _schedule(int nrn_index, int split_index){
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 1000, src_nrn_index, split_index);
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay) {
int i;
i = dst_nrn_index;
delay(delay*inv_dt);
}
}
void _schedule(int nrn_index, int split_index){
// no fetching, all we need to do is pass the delays to the threads
int thread;
int index;
int connection[];
float delay[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// launch thread for each dst nrn
index=0;
while (connection[index] != -1) {
index+=1;
thread = createthread(, 100, src_nrn_index, connection[index], delay[index]);
}
}
!!! Error - Non-Explicit List inputs with Explicit List delays are not supported () !!!
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
void _schedule(int nrn_index, int split_index, float value) /* split index not used for 1-2-1 */ {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
// transfer data to input array
// semaphore:
wait(&_semaphore);
[nrn_index] += value;
signal(&_semaphore);
}
void _schedule(int nrn_index, int split_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay[nrn_index]*inv_dt);
// transfer data to input array
// semaphore:
wait(&_semaphore);
[nrn_index] += value;
signal(&_semaphore);
}
void _schedule(int nrn_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
int i;
delay(delay*inv_dt);
// transfer data to input array
for (i = 0; i < num_neurons_actual; i += 1) {
// semaphore:
wait(&_semaphore);
[i] += value;
signal(&_semaphore);
}
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay, float value) {
delay(delay*inv_dt);
// transfer data to input array
// semaphore:
wait(&_semaphore);
[dst_nrn_index] += value;
signal(&_semaphore);
}
void _schedule(int nrn_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
int i;
float delay[];
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
thread = createthread(, 100, src_nrn_index, i, delay[i], value);
}
}
// function threads
void (int src_nrn_index, int split_index, float value) {
int i;
int connection[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
if (connection[i] == 0) continue;
// semaphore:
wait(&_semaphore);
[i] += value;
signal(&_semaphore);
}
}
void _schedule(int src_nrn_index, int split_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 1000, src_nrn_index, split_index, value);
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay, float value) {
int i;
i = dst_nrn_index;
delay(delay*inv_dt);
// semaphore:
wait(&_semaphore);
[i] += value;
signal(&_semaphore);
}
void _schedule(int src_nrn_index, int split_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
int i;
int connection[];
float delay[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// run relevant OnEvent for each dst nrn
for (i = 0; i < num_neurons_actual; i += 1) {
if (connection[i] == 0) continue;
thread = createthread(, 1000, src_nrn_index, i, delay[i], value);
}
}
// function threads
void (int src_nrn_index, int split_index, float value) {
int index;
int connection[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
// run relevant OnEvent for each dst nrn
index=0;
while (connection[index] != -1) {
index+=1;
// semaphore:
wait(&_semaphore);
[connection[index]] += value;
signal(&_semaphore);
}
}
void _schedule(int nrn_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(delay*inv_dt);
thread = createthread(, 1000, src_nrn_index, split_index, value);
}
// function threads
void (int src_nrn_index, int dst_nrn_index, float delay, float value) {
int i;
i = dst_nrn_index;
delay(delay*inv_dt);
// semaphore:
wait(&_semaphore);
[i] += value;
signal(&_semaphore);
}
}
void _schedule(int src_nrn_index, float value) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
int index;
int connection[];
float delay[];
readsdram(&connectionSD[split_index][src_nrn_index][0], &connection, );
readsdram(&delaySD[split_index][src_nrn_index][0], &delay, );
// run threads for each dst nrn
index=0;
while (connection[index] != -1) {
index+=1;
thread = createthread(, 1000, src_nrn_index, index, delay[i], value);
}
}
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
_input_
// input to : ///////////////
connectionSD = {
{
}
,
{
}
{
}
};
delaySD = {
{
}
,
};
!!! Error - connection type not recognised (, src=, src_port=, dst_port=)
// ############ ANALOG PORT ##########
// assign port value:
[the_nrn_number] = the_packet_payload;
// ############ ANALOG PORT (REDUCE) ##########
// assign port value:
[the_nrn_number] += the_packet_payload;
[the_nrn_number] *= the_packet_payload;
// ############ EVENT PORT ##########
// create WeightUpdate caches:
// define aliases:
for (i = 0; i < NEURONS_PER_CORE; i += 1) {
// calculate Aliases
// do OnEvent for port
}
DAMSON/xsl/SpineML_Neuron.xsl 0000664 0001750 0001750 00000017276 12107161572 014737 0 ustar paul paul
// #########################
// parameters:
float
;
float []; // (number of dst neurons per core)
// state variables:
float []; // (number of dst neurons per core)
// aliases:
float []; // (number of dst neurons per core)
// analog input ports:
float []; // (number of dst neurons per core)
// regime variable:
int regimeCurr[];
// #########################
// parameters:
for (j=0; j < ; j += 1) {
[j] = uniformRNG((float) , (float) );
}
// state variables:
for (j=0; j < ; j += 1) {
[j] = ;
}
for (j=0; j < ; j += 1) {
[j] = uniformRNG((float) , (float) );
}
// analog inputs:
for (j=0; j < ; j += 1) {
[j] = 0;
}
// regime variable:
for (j=0; j < ; j += 1) {
regimeCurr[j] = 1;
}
DAMSON/xsl/SpineML_OnCondition.xsl 0000664 0001750 0001750 00000004663 12107161572 015710 0 ustar paul paul
//OnCondition
if (
) {
//transition = 1;
// Regime switch
regimeNext=;
}
//OnCondition
if (
) {
//transition = 1;
// Regime switch
regimeNext=;
}
DAMSON/xsl/SpineML_OnEvent.xsl 0000664 0001750 0001750 00000003517 12107161572 015040 0 ustar paul paul
//OnEvent1
// Regime switch
regimeCurr[i]=;
//OnEvent1
// Regime switch
regimeCurrINST=;
DAMSON/xsl/SpineML_OnImpulse.xsl 0000664 0001750 0001750 00000003305 12107161572 015370 0 ustar paul paul
//OnEvent1
// Regime switch
regimeCurr[i]=;
//OnEvent1
// Regime switch
regimeCurrINST=;
DAMSON/xsl/SpineML_Parameter.xsl 0000664 0001750 0001750 00000002641 12107161572 015377 0 ustar paul paul
float ;
extern float SD[NEURONS_PER_CORE][NEURONS_PER_CORE];
float
float [NEURONS_PER_CORE];
readsdram(&, &SD[the_input_index][the_nrn_number],NEURONS_PER_CORE);
DAMSON/xsl/SpineML_Postsynapse.xsl 0000664 0001750 0001750 00000017761 12107161572 016020 0 ustar paul paul
// #########################
// parameters:
float
;
float []; // (number of dst neurons per core)
// state variables:
float []; // (number of dst neurons per core)
// aliases:
float []; // (number of dst neurons per core)
// analog input ports:
float []; // (number of dst neurons per core)
// impulse input ports:
float []; // (number of dst neurons per core)
// regime variable:
int regimeCurr[];
// #########################
// parameters:
for (j=0; j < ; j += 1) {
[j] = uniformRNG((float) , (float) );
}
// state variables:
for (j=0; j < ; j += 1) {
[j] = ;
}
for (j=0; j < ; j += 1) {
[j] = uniformRNG((float) , (float) );
}
// analog inputs:
for (j=0; j < ; j += 1) {
[j] = 0;
}
// regime variable:
for (j=0; j < ; j += 1) {
regimeCurr[j] = 1;
}
DAMSON/xsl/SpineML_Property.xsl 0000664 0001750 0001750 00000013452 12107161572 015305 0 ustar paul paul
{
}
= {
};
= ;
{
}
SD = {
};
= {
};
0
=
;
for (j=0; j < NEURONS_PER_CORE; j += 1) {
tempf[j] = uniformRNG((float) , (float) );
printf("%f", tempf[j]);
}
writesdram(&SD[i], &tempf, NEURONS_PER_CORE);
[i] = uniformRNG((float) , (float) );
[counter] = ;
[counter] = 0;
float
[counter] = -1;
writesdram(&SD[i], &, );
DAMSON/xsl/SpineML_Regime.xsl 0000664 0001750 0001750 00000003623 12107161572 014670 0 ustar paul paul
//Regime
case :
break;
//Regime Transforms
case :
transition = 1;
while (transition == 1) {
transition = 0;
}
break;
#define
DAMSON/xsl/SpineML_StateAssignment.xsl 0000664 0001750 0001750 00000003515 12107161572 016571 0 ustar paul paul
[i]
//StateAssignment
=
;
[i]
//StateAssignment
=
;
DAMSON/xsl/SpineML_StateVariable.xsl 0000664 0001750 0001750 00000003515 12107161572 016206 0 ustar paul paul
float ;
float _tempVARforINT;
extern float SD[][];
float [NEURONS_PER_CORE];
readsdram(&, &SD[the_input_index][the_nrn_number],NEURONS_PER_CORE);
DAMSON/xsl/SpineML_TimeDerivative.xsl 0000664 0001750 0001750 00000002434 12107161572 016400 0 ustar paul paul
//TimeDerivative
_tempVARforINT = solveDE(, (float)
);
//Assign back to State Variable
= _tempVARforINT;
DAMSON/xsl/SpineML_WeightUpdate.xsl 0000664 0001750 0001750 00000462440 12107161572 016060 0 ustar paul paul
// ##########################
// parameters:
float [][]; // (number of dst neurons per core)
float
;
// state variables:
float [][]; // (number of dst neurons per core)
// regime variable:
int regimeCurrSD[][]; // (number of dst neurons per core)
//delays
float mainDelay = ;
// function thread prototypes
void (int nrn_index, int split_index);
void _schedule(int nrn_index, int split_index);
float mainDelay[][];
// function thread prototypes
void (int nrn_index, int split_index, float delay);
void _schedule(int nrn_index, int split_index);
!!! Error - Explicit delays are not supported for onetoone connections () !!!
// parameters:
extern float SD[][][]; // (number of src neurons per core)(number of dst neurons per core)
float
;
// state variables:
extern float SD[][][]; // (number of src neurons per core)(number of dst neurons per core)
// regime variable:
int regimeCurrSD[][][]; // (number of src neurons per core)(number of dst neurons per core)
// delays
float mainDelay = ;
// function thread prototypes
void (int src_nrn_index, int split_index);
void _schedule(int src_nrn_index, int split_index);
extern float mainDelaySD[][][];
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Explicit delays are not supported for all to all connections () !!!
// parameters:
extern float SD[][][]; // (number of src neurons per core)(ceil(number of dst neurons per core * 6 * probability))
float
;
!!! Error - Explicit parameters are not supported for fixed probability connections () !!!
// state variables:
extern float SD[][][]; // (number of src neurons per core)(ceil(number of dst neurons per core * 6 * probability))
// regime variable:
int regimeCurrSD[][][]; // (number of src neurons per core)(ceil(number of dst neurons per core * 6 * probability))
// connectivity
extern int mainConnectionSD[][][];
// delays
float mainDelay = ;
// function thread prototypes
void (int src_nrn_index, int split_index);
void _schedule(int src_nrn_index, int split_index);
extern float mainDelaySD[][][]; // (number of src neurons per core)(ceil(number of dst neurons per core * 6 * probability))
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - Explicit delays are not supported for fixed probability connections () !!!
// parameters:
extern float SD[][][]; // (number of src neurons per core)(number of dst neurons per core)
float
;
// state variables:
extern float SD[][][]; // (number of src neurons per core)(number of dst neurons per core)
// regime variable:
int regimeCurrSD[][][]; // (number of src neurons per core)(number of dst neurons per core)
//connectivity
extern int mainConnectionSD[][][]; // (number of src neurons per core)(number of dst neurons per core)
// delays
float mainDelay = ;
// function thread prototypes
void (int src_nrn_index, int split_index);
void _schedule(int src_nrn_index, int split_index);
extern float mainDelaySD[][][]; // array (number of src neurons per core)(number of dst neurons per core) (Probabilistic Delays)
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay);
void _schedule(int src_nrn_index, int split_index);
extern float mainDelaySD[][][]; // array (number of src neurons per core)(number of dst neurons per core) (Explicit Delays)
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay);
void _schedule(int src_nrn_index, int split_index);
!!! Error - connection type not recognised () !!!
// ##########################
// parameters:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
[i][j] = uniformRNG((float) , (float) );
}
}
// state variables:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
[i][j] = ;
}
}
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
[i][j] = uniformRNG((float) , (float) );
}
}
// regime variable:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
regimeCurrSD[i][j] = 0;
}
}
//delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
mainDelay[i][j] = uniformRNG((float) , (float) );
}
}
!!! Error - Explicit delays are not supported for onetoone connections () !!!
// parameters:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&[i][j][0], &tempFloats, );
}
}
// state variables:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = ;
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
// regime variable:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempInts[k] = 0;
}
writesdram(®imeCurrSD[i][j][0], &tempInts, );
}
}
// delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&mainDelaySD[i][j][0], &tempFloats, );
}
}
// connectivity
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
counter = 0;
for (k=0; k < num_neurons_actual; k += 1) {
if (uniformRNG(1.0, 0.0) < ) {
tempInts[counter] = k;
counter += 1;
if (counter > ) {printf("Error - too many connectivity values for FP conn\n"); exit(0);}
}
}
connRowLengths[j] = counter; // for use in pars init
tempInts[counter] = -1; // terminate list
writesdram(&mainConnectionSD[i][j][0], &tempInts, );
}
}
// parameters:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
// state variables:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = ;
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
// regime variable:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = 0;
}
writesdram(®imeCurrSD[i][j][0], &tempFloats, );
}
}
// delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < connRowLengths[j]; k += 1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
writesdram(&mainDelaySD[i][j][0], &tempFloats, );
}
}
// parameters:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
// fetch connectivity
readsdram(&mainConnectionSD[i][j][0], &tempInts, );
for (k=0; k < ; k += 1) {
if (tempInts[k]==1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
// state variables:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = ;
}
writesdram(&SD[i][j], &tempFloats, );
}
}
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
// fetch connectivity
readsdram(&mainConnectionSD[i][j][0], &tempInts, );
for (k=0; k < ; k += 1) {
if (tempInts[k]==1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
}
writesdram(&SD[i][j][0], &tempFloats, );
}
}
// regime variable:
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
for (k=0; k < ; k += 1) {
tempFloats[k] = 0;
}
writesdram(®imeCurrSD[i][j], &tempFloats, );
}
}
// delays
for (i=0; i < ; i += 1) {
for (j=0; j < ; j += 1) {
// fetch connectivity
readsdram(&mainConnectionSD[i][j][0], &tempInts, );
for (k=0; k < ; k += 1) {
if (tempInts[k]==1) {
tempFloats[k] = uniformRNG((float) , (float) );
}
}
writesdram(&mainDelaySD[i][j][0], &tempFloats, );
}
}
!!! Error - connection type not recognised () !!!
// ##########################
= {
{
}
,
{
}
};
= {
{
}
,
{
}
{
}
};
= {
{
}
,
{
}
{
}
};
!!! Error - connection type not recognised () !!!
// ##########################
mainConnectionSD = {
{
}
,
{
}
{
}
};
mainDelaySD = {
{
}
,
};
!!! Error - connection type not recognised () !!!
// ##########################
// function threads
void (int nrn_index, int split_index) {
// declare aliases for ports
// declare fixed value parameters as local vars (work-around to stop having to write very complicated template for substituting into MathInLines)
float = ;
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(nrn_index,
_temp[nrn_index];
);
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
delay(mainDelay*inv_dt*0.1);
thread = createthread(, 100, nrn_index, split_index);
}
// function threads
void (int nrn_index, int split_index, float delay) {
// declare aliases for ports
// delay
delay(delay*inv_dt*0.1);
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
void _schedule(int nrn_index, int split_index) {
// no fetching, all we need to do is pass the delays to the threads
int thread;
thread = createthread(, 100, nrn_index, split_index, mainDelay[nrn_index]);
}
// function thread prototypes
void (int src_nrn_index, int split_index){
int i;
int dst_nrn_index;
// declare aliases for ports
// create temporary storage for pars
float _temp[];
float ;
// create temporary storage for SVs
float _temp[];
float ;
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
for (dst_nrn_index = 0; dst_nrn_index < num_neurons_actual; dst_nrn_index += 1) {
// assign non-fixed pars and SVs
= _temp[dst_nrn_index];
= _temp[dst_nrn_index];
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// write back SVs
_temp[dst_nrn_index] = ;
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
}
void _schedule(int src_nrn_index, int split_index) {
int thread;
delay(mainDelay*inv_dt*0.1);
thread = createthread(, 1000, src_nrn_index, split_index);
}
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay) {
// declare aliases for ports
delay(delay*inv_dt*0.1);
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][dst_nrn_index], &, 1);
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_number, );
}
void _schedule(int src_nrn_index, int split_index) {
int dst_nrn_index;
int thread;
float mainDelay[];
// create temporary storage for pars
float [];
// create temporary storage for SVs
float [];
readsdram(&mainDelaySD[split_index][src_nrn_index][0], &mainDelay, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// launch threads
for (dst_nrn_index = 0; dst_nrn_index < num_neurons_actual; dst_nrn_index += 1) {
thread = createthread(, 1000, src_nrn_index, split_index, dst_nrn_index,
[dst_nrn_index]
,
[dst_nrn_index],
mainDelay[dst_nrn_index]);
}
}
// function thread prototypes
void (int src_nrn_index, int split_index){
int i;
int dst_nrn_index;
// declare aliases for ports
// create temporary storage for connectivity
int connection_temp[];
// create temporary storage for pars
float _temp[];
float ;
// create temporary storage for SVs
float _temp[];
float ;
// load connectivity from SDRAM
readsdram(&mainConnectionSD[split_index][src_nrn_index][0], &connection_temp, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
i = 0;
while (connection_temp[i] != -1) {
dst_nrn_index = connection_temp[i];
// assign non-fixed pars and SVs
= _temp[i];
= _temp[i];
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// write back SVs
_temp[i] = ;
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
i += 1;
}
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][0], &_temp, );
}
void _schedule(int src_nrn_index, int split_index) {
int thread;
delay(mainDelay*inv_dt*0.1);
thread = createthread(, 1000, src_nrn_index, split_index);
}
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay) {
// declare aliases for ports
delay(delay*inv_dt*0.1);
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][dst_nrn_index][0], &, 1);
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
void _schedule(int src_nrn_index, int split_index) {
int i;
int thread;
int dst_nrn_index;
float mainDelay[];
// create temporary storage for connectivity
int connection_temp[];
// create temporary storage for pars
float [];
// create temporary storage for SVs
float [];
// load delay from SDRAM
readsdram(&mainDelaySD[split_index][src_nrn_index][0], &mainDelay, );
// load connectivity from SDRAM
readsdram(&mainConnectionSD[split_index][src_nrn_index][0], &connection_temp, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// launch threads
i = 0;
while (connection_temp[i] != -1) {
dst_nrn_index = connection_temp[i];
thread = createthread(, 1000, src_nrn_index, split_index, dst_nrn_index,
[i]
,
[i],
mainDelay[i]);
i += 1;
}
}
// function thread prototypes
void (int src_nrn_index, int split_index){
int i;
int dst_nrn_index;
// declare aliases for ports
// create temporary storage for connectivity
int connection_temp[];
// create temporary storage for pars
float _temp[];
float ;
// create temporary storage for SVs
float _temp[];
float ;
// load connectivity from SDRAM
readsdram(&mainConnectionSD[split_index][src_nrn_index][0], &connection_temp, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &_temp, );
for (dst_nrn_index = 0; dst_nrn_index < num_neurons_actual; dst_nrn_index += 1) {
// if no connection then skip...
if (connection_temp[dst_nrn_index]==0) continue;
// assign non-fixed pars and SVs
= _temp[i];
= _temp[i];
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// write back SVs
_temp[i] = ;
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][0], &, );
}
void _schedule(int src_nrn_index, int split_index) {
int thread;
delay(mainDelay*inv_dt*0.1);
thread = createthread(, 1000, src_nrn_index, split_index);
}
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay) {
// declare aliases for ports
delay(delay*inv_dt*0.1);
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][dst_nrn_index][0], &, 1);
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
}
void _schedule(int src_nrn_index, int split_index); {
int i;
int dst_nrn_index;
float mainDelay[];
// create temporary storage for connectivity
int connection_temp[];
// create temporary storage for pars
float [];
// create temporary storage for SVs
float [];
// load delay from SDRAM
readsdram(&mainDelaySD[split_index][src_nrn_index][0], &mainDelay, );
// load connectivity from SDRAM
readsdram(&mainConnectionSD[split_index][src_nrn_index][0], &connection_temp, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// launch threads
for (dst_nrn_index=0; dst_nrn_index < num_neurons_actual; dst_nrn_index += 1) {
if (connection_temp[dst_nrn_index]==0) continue;
thread = createthread(, 1000, src_nrn_index, split_index, dst_nrn_index,
[i]
,
[i],
mainDelay[i]);
}
}
// function thread prototypes
void (int src_nrn_index, int split_index, int dst_nrn_index,
float
,
float
,
float delay) {
// declare aliases for ports
delay(delay*inv_dt*0.1);
// run relevant OnEvent
// run OnConditions
while (transition == 1) {
transition = 0;
}
// do aliases for ports
// return State Variables to SDRAM
writesdram(&SD[split_index][src_nrn_index][dst_nrn_index][0], &, 1);
// if there is an impulse out that is the WU->PS connection
// call the handler function for the OnImpulse
HANDLE_IMPULSE__(dst_nrn_index,
_temp[dst_nrn_index];
);
}
void _schedule(int src_nrn_index, int split_index) {
int thread;
int dst_nrn_index;
float mainDelay[];
// create temporary storage for connectivity
int connection_temp[];
// create temporary storage for pars
float [];
// create temporary storage for SVs
float [];
// load delay from SDRAM
readsdram(&mainDelaySD[split_index][src_nrn_index][0], &mainDelay, );
// load connectivity from SDRAM
readsdram(&mainConnectionSD[split_index][src_nrn_index][0], &connection_temp, );
// load pars from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// load State Variables from SDRAM
readsdram(&SD[split_index][src_nrn_index][0], &, );
// launch threads
for (dst_nrn_index=0; dst_nrn_index < num_neurons_actual; dst_nrn_index += 1) {
if (connection_temp[dst_nrn_index]==0) continue;
thread = createthread(, 1000, src_nrn_index, split_index, dst_nrn_index,
[dst_nrn_index]
,
[dst_nrn_index],
mainDelay[dst_nrn_index]);
}
}
!!! Error - connection type not recognised () !!!
DAMSON/xsl/ 0000775 0001750 0001750 00000000000 12107213275 011333 5 ustar paul paul DAMSON/model/ 0000775 0001750 0001750 00000000000 12107213700 011616 5 ustar paul paul DAMSON/ 0000775 0001750 0001750 00000000000 12107213666 010531 5 ustar paul paul DAMSON/xsl/DAMSON_program.xsl 0000664 0001750 0001750 00000120356 12107435676 014615 0 ustar paul paul
#timestamp on
#monitor off
#define e 2.71828183
#define EXP_MAX 10.397
#define INPUTS_PER_PORT
//#define MAX_NUMBER_OF_PORTS 10
#define MAX_TOTAL_INPUTS ;
#define MAX_HASH_SIZE ;
#define NUM_NODES
// regime definitions:
// Neuron numbers for each population component type
#define N_ 10
/*
Autogenerated DAMSON file from SpineML description.
Engine: XSLT
Engine Author: Alex Cope 2012
Node name:
*/
#node
// number of neurons for this instance
int num_neurons_actual;
// counter for init
int nodes_to_see = NUM_NODES;
// array for which ports should be output
int portOn[];
// the counter for clock interrupts (i.e. number of iterations)
int timerCounter = 0;
float t;
float dt = ;
float inv_dt = ;
int hashLookupTable[MAX_HASH_SIZE];
int hashSwitchTable[MAX_HASH_SIZE];
int hashInputIndexTable[MAX_HASH_SIZE];
int hashCreation[MAX_TOTAL_INPUTS][];
// for logging events
int current_neuron_index;
// helper functions #############################################
////////////////////////////////// Integrate
float solveDE(float,float);
////////////////////////////////// RNG
float convert_no_cast(float);
int seed = 11;
int a_RNG = 1103515245;
int c_RNG = 12345;
float uniformRNG(float, float);
float pow(float, int);
float exp(float);
////////////////////////////////// #1
int hashSwitch(int);
////////////////////////////////// #2
int hashInputIndex(int);
// SYNAPSES DECLARATIONS //////////////////////////////////
// PostSynapse DECLARATIONS ///////////////////////////////////////
// NEURON DECLARATIONS ////////////////////////////////////
// GENERIC INPUTS /////////////////////////////////////////
///////////////////////////////////////////////////////////
// SYNAPSE GENERIC INPUTS /////////////////////////////////
!!! Error: learing not implemented yet - generic inputs to synapses are not permitted !!!
// PostSynapse GENERIC INPUTS /////////////////////////////////////
// NRN GENERIC INPUTS /////////////////////////////////////
// PROTOTYPES FOR THE INTERRUPTS
int event_int(int,int,float,int);
void clock_int(int,int,int);
// FUNCTIONS FOR THE PostSynapse COMPONENTS
// //
void
(int i,
float
,
float
INST[
],
, int regimeINST[
]);
// FUNCTION FOR THE NEURON BODY COMPONENT
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]);
// IMPULSE HANDLER
void HANDLE_IMPULSE__(int i, float );
// MAIN FUNCTION
int main()
{
// DEFINITIONS
int i;
int j;
int k;
int index;
int input;
int counter;
// temporary storage for generated values
int tempInts[]; // this population's size
float tempFloats[]; // this population's size
int connRowLengths[100]; // a temporary array for probabalistic connections that stores row lengths for initialising Pars SVs etc... since we don't know the number of nrns in the src the num of elements is quite large
//printf("IN MAIN\n");
// set the tickrate for the simulation
tickrate(1000000000);
// SET INITIAL HASH TABLE VALUES
for (i = 0; i < MAX_HASH_SIZE; i+=1) {
hashLookupTable[i]=-200;
}
// GENERATE THE HASH TABLES
for (i = 0; i < MAX_TOTAL_INPUTS; i+=1) {
if (hashCreation[i][0] != 0) {
// add value into first hash table
input = hashCreation[i][0];
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (1==1){
if(hashLookupTable[index]==-200)
{
hashLookupTable[index]=input;
hashSwitchTable[index]=hashCreation[i][1];
hashInputIndexTable[index]=hashCreation[i][2];
break;
}
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
}
}
// HACK
seed = 123;
//////////////////////////////////////////////////////
// BEGIN INITIALISATION OF DATA //
//////////////////////////////////////////////////////
////// COMPONENTS ####################################
////// INPUTS #######################################
//////////////////////////////////////////////////////
// END INITIALISATION OF DATA //
//////////////////////////////////////////////////////
printf("MAIN COMPLETE\n");
syncnodes();
return 0;
}
// helper functions #############################################
////////////////////////////////// Integrate
float solveDE(float x,float fx) {
return x + fx*dt;
}
float convert_no_cast(float val) {
return val;
}
////////////////////////////////// RNG
float uniformRNG(float ub, float lb) {
float val;
float seed2;
seed = abs(seed*a_RNG+c_RNG);
seed2 = convert_no_cast(seed>>15);
val = (seed2)*(ub-lb)+lb;
return val;
}
////////////////////////////////// POW
float pow(float value, int power) {
int i;
float result = 1;
for (i = 0; i < power; i += 1) {
result *= value;
}
return result;
}
////////////////////////////////// EXP
float exp(float x) {
int n = 1; //expansion step
float f = 1.0; //factorial n!
float r = 1.0; //result is sum of expansion steps
float s = 1.0; //expansion step value is x^n/n!
float p = x; //power x^n
if (x>EXP_MAX) //will overflow so return max float or error
return 32768.0;
if (x>1) //recursive step exploits exponential indentity (exp(1+x) = E*exp(x))
return e*exp(x-1.0);
else //Taylor expansion
{
while (s > 0){ //while step value is within fixed point range
f = f*n;
s = (p/f);
r = r + s;
p = p * x;
n += 1;
}
return r;
}
}
////////////////////////////////// #1
int hashSwitch(int input) {
int index;
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (hashLookupTable[index] != -200){
if(hashLookupTable[index]==input)
return hashSwitchTable[index];
if(hashLookupTable[index]==-200)
return -1;
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
return -1;
}
////////////////////////////////// #2
int hashInputIndex(int input) {
int index;
index = (input * 137 + 92731) % MAX_HASH_SIZE;
while (hashLookupTable[index] != -200){
if(hashLookupTable[index]==input)
return hashInputIndexTable[index];
if(hashLookupTable[index]==-200)
return -1;
index += 1;
if(index >= MAX_HASH_SIZE)
index = 0;
}
return -1;
}
//////////////////////////////////// CLOCK INTERRUPT - THIS IS USED TO UPDATE THE SYSTEM EACH ITERATION
void clock_int(int not_using_this_1, int not_using_this_2, int t_not_used) {
// declare variables
int i;
int t2; // used for rolling buffers
float sum;
int portNum;
int portID;
// make time available
t = (float) timerCounter * dt;
// engage semaphores:
_input_
wait(&_semaphore);
for (i=0; i < num_neurons_actual; i+=1) {
// current neuron index for logging purposes
current_neuron_index = i;
// do PostSynapses ##########################################################
// NRN -> PostSynapse (Conductance-based synapses)
[i] = [i];
(i,
[i]
,
,
regimeCurr
);
// PostSynapse -> NRN
[i] = [i];
// do NRN ##########################################################
(i,
[i]
,
,
regimeCurr
);
// zero analog input ports
[i] = 0;
[i] = 0;
}
// disengage semaphores:
_input_
signal(&_semaphore);
timerCounter += 1;
if ( timerCounter >= )
{
exit(1);
}
}
//////////////////////////////////////
// //
// THREAD FUNCTIONS //
// //
//////////////////////////////////////
// synapses //////////////////////////
// inputs ////////////////////////////
// DO EVENTS ##################################################
int event_int(int the_src_node_number, int the_port_and_Neuron_number, float the_packet_payload, int the_current_clock_tick) {
int thread;
// switch between inputs - are they synaptic, or inputs to other components?
// for now we will only use 7-5 split of the 12 bits of port (7 for Neuron num, 5 for port ID)
int the_port_number = 0xf&(the_port_and_Neuron_number);
int the_nrn_number = 0x7f&(the_port_and_Neuron_number>>4);
int switch_value = hashSwitch(the_src_node_number);
int split_value = hashInputIndex(the_src_node_number);
// startup:
//if (nodes_to_see > 0 && the_port_and_Neuron_number==0) {
//printf("Nodes to see = %d\n", nodes_to_see);
//nodes_to_see -= 1;
//return 0;
//}
// switch on input number
switch (switch_value) {
case :
// switch on port on input src
switch (the_port_number) {
case :
// inputs
_input_
thread = createthread(_schedule, 1000, the_nrn_number, split_value, the_packet_payload);
break;
case :
// projections
thread = createthread(_schedule, 1000, the_nrn_number, split_value);
// inputs
_input_
thread = createthread(_schedule, 1000, the_nrn_number, split_value);
break;
case :
// projections
thread = createthread(_schedule, 1000, the_nrn_number, split_value, the_packet_payload);
// inputs
_input_
thread = createthread(_schedule, 1000, the_nrn_number, split_value, the_packet_payload);
break;
default:
//printf("Warning - unhandled packet!\n"); //exit(-1);
}
break;
default:
//printf("Warning - unhandled packet!\n"); //exit(-1);
}
return 1;
}
// FUNCTIONS FOR THE PostSynapse COMPONENTS
// impulse handlers for PS ////////////
void HANDLE_IMPULSE__(int i, float )
{
// define parameter handlers
float ;
// define aliases that are not port aliases...
// assign non-fixed parameter handlers
= [i];
// assign fixed parameter handlers
= ;
// assign aliases that are not port aliases...
// do state assignments
}
// main functions for PS //////////////
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]) {
int regimeNext;
int transition;
// define temp variables for time derivatives
// define aliases that are not port aliases...
// assign aliases that are not port aliases...
// zero analog ports
[i] = 0;
}
// FUNCTION FOR THE NEURON BODY COMPONENT
// //
void
(int i,
float
,
float
INST[
],
int regimeINST[
]) {
int j;
int portID;
int regimeNext;
int transition;
// define temp variables for time derivatives
// define aliases that are not port aliases...
// assign aliases that are not port aliases...
// output any analog ports
// zero analog ports
[i] = 0;
}
/// ############### ALIASES #############
#include "data.d"
DAMSON/xsl/DAMSON_data.xsl 0000664 0001750 0001750 00000042411 12107443414 014037 0 ustar paul paul
#alias
num_neurons_actual = ;
// data for hash tables ///////////////////////
hashCreation={
{
},
{
}
};
// close unused output ports (neuron only) //
portOn = {
1,
0,
};
// initialise explicit lists //////////////////
// parameters / SVs
// synapse
// postsynapse
= {
};
// neuron
= {
};
// connections (synapse)
// connections (generic inputs)
// setup interrupts:
clock_int: 0
event_int:
,
// outputs
0
1000000
#snapshot "spike" 0 1000000 0.000001 "%f %d\n" t current_neuron_index
#log "
"
0.000001 "%f
\n" t
#log "
"
0.000001 "%f
\n" t
//######################