//! \brief Initialises the model by reading in the regions and checking //! recording data. //! \param[in] timer_period a pointer for the memory address where the timer //! period should be stored during the function. //! \return True if it successfully initialised, false otherwise static bool initialise(uint32_t *timer_period) { log_info("Initialise: started"); // Get the address this core's DTCM data starts at from SRAM address_t address = data_specification_get_data_address(); // Read the header if (!data_specification_read_header(address)) { return false; } // Get the timing details address_t system_region = data_specification_get_region( SYSTEM_REGION, address); if (!simulation_read_timing_details( system_region, APPLICATION_NAME_HASH, timer_period)) { return false; } // setup recording region if (!initialise_recording()){ return false; } // Set up the neurons uint32_t n_neurons; uint32_t incoming_spike_buffer_size; if (!neuron_initialise( data_specification_get_region(NEURON_PARAMS_REGION, address), recording_flags, &n_neurons, &incoming_spike_buffer_size)) { return false; } // Set up the synapses input_t *input_buffers; uint32_t *ring_buffer_to_input_buffer_left_shifts; if (!synapses_initialise( data_specification_get_region(SYNAPSE_PARAMS_REGION, address), n_neurons, &input_buffers, &ring_buffer_to_input_buffer_left_shifts)) { return false; } neuron_set_input_buffers(input_buffers); // Set up the population table uint32_t row_max_n_words; if (!population_table_initialise( data_specification_get_region(POPULATION_TABLE_REGION, address), data_specification_get_region(SYNAPTIC_MATRIX_REGION, address), &row_max_n_words)) { return false; } // Set up the synapse dynamics if (!synapse_dynamics_initialise( data_specification_get_region(SYNAPSE_DYNAMICS_REGION, address), n_neurons, ring_buffer_to_input_buffer_left_shifts)) { return false; } if (!spike_processing_initialise( row_max_n_words, MC, SDP_AND_DMA_AND_USER, SDP_AND_DMA_AND_USER, incoming_spike_buffer_size)) { return false; } log_info("Initialise: finished"); return true; }
//! \brief Initialises the model by reading in the regions and checking //! recording data. //! \param[in] timer_period a pointer for the memory address where the timer //! period should be stored during the function. //! \return True if it successfully initialised, false otherwise static bool initialize(uint32_t *timer_period) { log_info("Initialise: started"); // Get the address this core's DTCM data starts at from SRAM address_t address = data_specification_get_data_address(); // Read the header if (!data_specification_read_header(address)) { return false; } // Get the timing details address_t system_region = data_specification_get_region( SYSTEM_REGION, address); if (!simulation_read_timing_details( system_region, APPLICATION_NAME_HASH, timer_period, &simulation_ticks, &infinite_run)) { return false; } regions_e regions_to_record[] = { BUFFERING_OUT_SPIKE_RECORDING_REGION, BUFFERING_OUT_POTENTIAL_RECORDING_REGION, BUFFERING_OUT_GSYN_RECORDING_REGION }; uint8_t n_regions_to_record = NUMBER_OF_REGIONS_TO_RECORD; uint32_t *recording_flags_from_system_conf = &system_region[SIMULATION_N_TIMING_DETAIL_WORDS]; regions_e state_region = BUFFERING_OUT_CONTROL_REGION; recording_initialize( n_regions_to_record, regions_to_record, recording_flags_from_system_conf, state_region, 2, &recording_flags); log_info("Recording flags = 0x%08x", recording_flags); // Set up the neurons uint32_t n_neurons; if (!neuron_initialise( data_specification_get_region(NEURON_PARAMS_REGION, address), recording_flags, &n_neurons)) { return false; } // Set up the synapses input_t *input_buffers; uint32_t *ring_buffer_to_input_buffer_left_shifts; if (!synapses_initialise( data_specification_get_region(SYNAPSE_PARAMS_REGION, address), n_neurons, &input_buffers, &ring_buffer_to_input_buffer_left_shifts)) { return false; } neuron_set_input_buffers(input_buffers); // Set up the population table uint32_t row_max_n_words; if (!population_table_initialise( data_specification_get_region(POPULATION_TABLE_REGION, address), data_specification_get_region(SYNAPTIC_MATRIX_REGION, address), &row_max_n_words)) { return false; } // Set up the synapse dynamics if (!synapse_dynamics_initialise( data_specification_get_region(SYNAPSE_DYNAMICS_REGION, address), n_neurons, ring_buffer_to_input_buffer_left_shifts)) { return false; } if (!spike_processing_initialise(row_max_n_words)) { return false; } log_info("Initialise: finished"); return true; }