//! \brief The entry point for this model. void c_main(void) { // Load DTCM data uint32_t timer_period; // initialise the model if (!initialise(&timer_period)){ rt_error(RTE_API); } // Start the time at "-1" so that the first tick will be 0 time = UINT32_MAX; // Set timer tick (in microseconds) log_info("setting timer tick callback for %d microseconds", timer_period); spin1_set_timer_tick(timer_period); // Set up the timer tick callback (others are handled elsewhere) spin1_callback_on(TIMER_TICK, timer_callback, TIMER_AND_BUFFERING); // Set up callback listening to SDP messages simulation_register_simulation_sdp_callback( &simulation_ticks, &infinite_run, SDP_AND_DMA_AND_USER); // set up provenance registration simulation_register_provenance_callback( c_main_store_provenance_data, PROVENANCE_DATA_REGION); simulation_run(); }
// Entry point void c_main(void) { // Initialise uint32_t timer_period = 0; if (!initialize(&timer_period)) { log_error("Error in initialisation - exiting!"); rt_error(RTE_SWERR); } // Initialise the incoming spike buffer if (!in_spikes_initialize_spike_buffer(8192)) { return; } // Set timer_callback spin1_set_timer_tick(timer_period); // Register callbacks spin1_callback_on(MC_PACKET_RECEIVED, incoming_spike_callback, MC); spin1_callback_on(TIMER_TICK, timer_callback, TIMER); // Start the time at "-1" so that the first tick will be 0 time = UINT32_MAX; simulation_run(timer_callback, TIMER); }
// Entry point void c_main(void) { // Initialise uint32_t timer_period = 0; if (!initialize(&timer_period)) { log_error("Error in initialisation - exiting!"); rt_error(RTE_SWERR); } // Start the time at "-1" so that the first tick will be 0 time = UINT32_MAX; // Initialize the incoming spike buffer if (!in_spikes_initialize_spike_buffer(256)) { rt_error(RTE_SWERR); } // Set timer tick (in microseconds) spin1_set_timer_tick(timer_period); // Register callbacks spin1_callback_on(MC_PACKET_RECEIVED, incoming_spike_callback, -1); spin1_callback_on(USER_EVENT, spike_process, 1); spin1_callback_on(TIMER_TICK, timer_callback, 2); log_info("Starting"); simulation_run(); }
int main(int argc, char **argv) { int population_size, exit_status; char *endp; if (argc == 2) { population_size = strtol(argv[1], &endp, 10); if ((*endp == '\0') && (population_size > 0)) { simulation_run(population_size); simulation_print_summary(0); putchar('\n'); simulation_print_visits(0); exit_status = EXIT_SUCCESS; } else { fprintf(stderr, "Population size must be a positive integer\n"); exit_status = EXIT_FAILURE; } } else { fprintf(stderr, "Wrong number of arguments. Synopsis: %s population-size\n", argv[0]); exit_status = EXIT_FAILURE; } return exit_status; }
//! \brief The entry point for this model. void c_main(void) { // Load DTCM data uint32_t timer_period; // initialise the model if (!initialize(&timer_period)){ rt_error(RTE_API); } // Start the time at "-1" so that the first tick will be 0 time = UINT32_MAX; // Set timer tick (in microseconds) log_info("setting timer tic callback for %d microseconds", timer_period); spin1_set_timer_tick(timer_period); // Set up the timer tick callback (others are handled elsewhere) spin1_callback_on(TIMER_TICK, timer_callback, 2); log_info("Starting"); simulation_run(); }