void c_main() { // Copy this core's experimental configuration from SDRAM load_config(); // Set up the core map spin1_application_core_map( system_width, system_height , (uint (*)[system_height])&core_map[0] ); // Accept packets freely from the network spin1_callback_on(MC_PACKET_RECEIVED, on_mc_packet_received, -1); // Set up timer spin1_set_timer_tick(config_root.tick_microseconds); spin1_callback_on(TIMER_TICK, on_timer_tick, 3); setup_router(); // Report that we're ready io_printf(IO_BUF, "Waiting for spin1_start barrier...\n"); // Run the experiment spin1_start(); cleanup_router(); store_results(); }
void c_main (void) { io_printf (IO_STD, "Starting communication test.\n"); // get this core's ID coreID = spin1_get_core_id(); chipID = spin1_get_chip_id(); // get this chip's coordinates for core map my_x = chipID >> 8; my_y = chipID & 0xff; my_chip = (my_x * NUMBER_OF_YCHIPS) + my_y; // operate only if in core map! if ((core_map[my_x][my_y] & (1 << coreID)) == 0) { io_printf (IO_STD, "Stopping comm. (Not in core map)\n"); return; } // set the core map for the simulation spin1_application_core_map(NUMBER_OF_XCHIPS, NUMBER_OF_YCHIPS, core_map); spin1_set_timer_tick (TIMER_TICK_PERIOD); // register callbacks spin1_callback_on (MC_PACKET_RECEIVED, receive_data, 0); spin1_callback_on (TIMER_TICK, update, 0); spin1_callback_on (SDP_PACKET_RX, host_data, 0); // Initialize routing tables routing_table_init (); // Initialize SDP message buffer sdp_init (); // go spin1_start(); }