void c_main(void) { address_t address = system_load_sram(); if (!data_system(region_start(1, address)) || !data_get_output_keys(region_start(2, address)) || !input_filter_get_filters(&g_input, region_start(3, address)) || !input_filter_get_filter_routes(&g_input, region_start(4, address)) || !data_get_transform(region_start(5, address)) ) { io_printf(IO_BUF, "[Filter] Failed to initialise.\n"); return; } // Setup timer tick, start spin1_set_timer_tick(g_filter.machine_timestep); spin1_callback_on(MCPL_PACKET_RECEIVED, mcpl_callback, -1); spin1_callback_on(TIMER_TICK, filter_update, 2); while (true) { // Wait for data loading, etc. event_wait(); // Determine how long to simulate for config_get_n_ticks(); // Perform the simulation spin1_start(SYNC_WAIT); } }
void c_main(void) { // Load in all data address_t address = system_load_sram(); if (!get_packets(region_start(2, address), &start_packets) || !get_packets(region_start(4, address), &end_packets) ) { return; } spin1_set_timer_tick(1000); spin1_callback_on(TIMER_TICK, tick, 2); while(true) { // Wait for data loading, etc. event_wait(); // Determine how long to simulate for config_get_n_ticks(); // Transmit all packets assigned to be sent prior to the start of the // simulation transmit_packet_region(start_packets); // Synchronise with the simulation spin1_start(SYNC_WAIT); } }
void system_reset(void) { cpu_reset(); vdp_reset(); sms_reset(); render_reset(); system_load_sram(); if(snd.enabled) { OPLL_reset(opll) ; OPLL_reset_patch(opll,0) ; /* if use default voice data. */ } }
void c_main(void) { address_t address = system_load_sram(); if (!data_system(region_start(1, address)) || !data_get_output_keys(region_start(2, address)) || !input_filter_get_filters(&g_input, region_start(3, address)) || !input_filter_get_filter_routes(&g_input, region_start(4, address)) || !data_get_transform(region_start(5, address)) ) { io_printf(IO_BUF, "[Filter] Failed to initialise.\n"); return; } // Set up routing tables if(leadAp) { system_lead_app_configured(); } // Setup timer tick, start spin1_set_timer_tick(g_filter.machine_timestep); spin1_callback_on(MCPL_PACKET_RECEIVED, mcpl_callback, -1); spin1_callback_on(TIMER_TICK, filter_update, 2); spin1_start(SYNC_WAIT); }
void c_main(void) { // Set the system up io_printf(IO_BUF, "[Ensemble] C_MAIN\n"); address_t address = system_load_sram(); if (!data_system(region_start(1, address))) { io_printf(IO_BUF, "[Ensemble] Failed to start.\n"); return; } // Get data data_get_bias(region_start(2, address), g_ensemble.n_neurons); data_get_encoders(region_start(3, address), g_ensemble.n_neurons, g_input.n_dimensions); data_get_decoders(region_start(4, address), g_ensemble.n_neurons, g_n_output_dimensions); data_get_keys(region_start(5, address), g_n_output_dimensions); // Get the inhibitory gains g_ensemble.inhib_gain = spin1_malloc(g_ensemble.n_neurons * sizeof(value_t)); if (g_ensemble.inhib_gain == NULL) { io_printf(IO_BUF, "[Ensemble] Failed to malloc inhib gains.\n"); return; } spin1_memcpy(g_ensemble.inhib_gain, region_start(10, address), g_ensemble.n_neurons * sizeof(value_t)); for (uint n = 0; n < g_ensemble.n_neurons; n++) { io_printf(IO_BUF, "Inhib gain[%d] = %k\n", n, g_ensemble.inhib_gain[n]); } // Load subcomponents if (!input_filter_get_filters(&g_input, region_start(6, address)) || !input_filter_get_filter_routes(&g_input, region_start(7, address)) || !input_filter_get_filters(&g_input_inhibitory, region_start(8, address)) || !input_filter_get_filter_routes(&g_input_inhibitory, region_start(9, address)) || !input_filter_get_filters(&g_input_modulatory, region_start(11, address)) || !input_filter_get_filter_routes(&g_input_modulatory, region_start(12, address))) { io_printf(IO_BUF, "[Ensemble] Failed to start.\n"); return; } if(!get_pes(region_start(13, address))) { io_printf(IO_BUF, "[Ensemble] Failed to start.\n"); return; } // Set up recording if (!record_buffer_initialise(&g_ensemble.recd, region_start(15, address), simulation_ticks, g_ensemble.n_neurons)) { io_printf(IO_BUF, "[Ensemble] Failed to start.\n"); return; } // Set up routing tables io_printf(IO_BUF, "[Ensemble] C_MAIN Configuring system.\n"); if(leadAp){ system_lead_app_configured(); } // Setup timer tick, start io_printf(IO_BUF, "[Ensemble] C_MAIN Set timer and spin1_start.\n"); spin1_set_timer_tick(g_ensemble.machine_timestep); spin1_start(SYNC_WAIT); }