/* * _xc_test_combinable.xc * * Created on: 12. feb. 2021 * Author: teig * * */ #include // core #include // printf (sprintf because if lib_logging and floats) #include // delay_milliseconds(..), XS1_TIMER_HZ etc #include // readability #include // uint32_t #include // memcpy #include // xScope logging #include "xassert.h" // assert and fail #include "_version.h" // BOOLEAN #include if C99 // See http://www.teigfam.net/oyvind/home/technology/165-xc-code-examples/#bool typedef enum {false,true} bool; // 0,1 This typedef matches any integer-type type like long, int, unsigned, char, bool typedef signed int time32_t; // signed int (=signed) or unsigned int (=unsigned) both ok, as long as they are monotoneously increasing // XC/XMOS 100 MHz increment every 10 ns for max 2exp32 = 4294967296, // ie. divide by 100 mill = 42.9.. seconds #define min(a,b) (((a)<(b))?(a):(b)) #define max(a,b) (((a)>(b))?(a):(b)) #define abs(a) (((a)<0)?(-(a)):(a)) #define IS_MYTARGET_VOID 0 #define IS_MYTARGET_STARTKIT 1 // Not used #define IS_MYTARGET_XCORE_200_EXPLORER 2 // USED #define IS_MYTARGET_XCORE_XA_MODULE 3 // Not used #ifndef MYTARGET #error // Define in XCC_FLAGS like -DMYTARGET=XCORE-200-EXPLORER #elif (MYTARGET==XCORE-200-EXPLORER) #define IS_MYTARGET IS_MYTARGET_XCORE_200_EXPLORER #else #define IS_MYTARGET IS_MYTARGET_VOID #error NO TARGET DEFINED #endif // Control printing #define DEBUG_PRINT_TEST 1 // Here and in "makefile" #define DEBUG_PRINT_SPECIAL 0 // Here #define DEBUG_PRINT_EXTRA 0 // Here #if (((defined DEBUG_PRINT_ENABLE_ALL) and (DEBUG_PRINT_ENABLE_ALL==1)) or /* from "makefile" */ \ ((defined DEBUG_PRINT_ENABLE) and (DEBUG_PRINT_ENABLE==1 ))) #if (WARNINGS==1) // From "makefile" #warning Using /lib_logging (that is why sprintf is used when floats) #endif #include "debug_conf.h" #include "debug_print.h" // In makefile: // USED_MODULES = .. lib_logging .. // XCC_FLAGS += -DDEBUG_PRINT_ENABLE=1 /* AN00239: https://www.xmos.ai/download/AN00239:-Using-the-logging-library(1.0.0rc1).pdf A limited functionality version of printf that is low memory. This function works like C-standard printf except that it only accepts d, x, s, u and c format specifiers with no conversions. The p format specifier is treated the same as a x. The capital version of each format specifier performs the same as the lower case equivalent. Any alignment or padding characters are simply ignored. The function uses the functions from print.h to do the underlying printing. Unlike printf this function has no return value. Whether the function does any output can be controlled via defines such as DEBUG_PRINT_ENABLE or DEBUG_PRINT_ENABLE_[debug unit name] in the applicationŐs debug_conf.h */ #define debug_print(fmt, ...) do { if(DEBUG_PRINT_TEST) debug_printf(fmt, __VA_ARGS__); } while (0) // In /lib_logging/api/debug_print.h #define debug_print_special(fmt, ...) do { if(DEBUG_PRINT_SPECIAL) debug_printf(fmt, __VA_ARGS__); } while (0) // In /lib_logging/api/debug_print.h #define debug_print_extra(fmt, ...) do { if(DEBUG_PRINT_EXTRA) debug_printf(fmt, __VA_ARGS__); } while (0) // In /lib_logging/api/debug_print.h #elif (DEBUG_PRINT_TEST==1) #if (WARNINGS==1) // From "makefile" #warning jtag printing not as reliable #endif // See https://stackoverflow.com/questions/1644868/define-macro-for-debug-printing-in-c #define debug_print(fmt, ...) do { if(DEBUG_PRINT_TEST) printf(fmt, __VA_ARGS__); } while (0) #define debug_print_special(fmt, ...) do { if(DEBUG_PRINT_SPECIAL) printf(fmt, __VA_ARGS__); } while (0) #define debug_print_extra(fmt, ...) do { if(DEBUG_PRINT_EXTRA) printf(fmt, __VA_ARGS__); } while (0) #else #if (WARNINGS==1) // From "makefile" #warning No printing #endif #define debug_print(fmt, ...) #define debug_print_special(fmt, ...) #define debug_print_extra(fmt, ...) #endif #ifndef DEBUG_PRINTF_BUFSIZE #define SPRINTF_LEN 300 #else #define SPRINTF_LEN DEBUG_PRINTF_BUFSIZE // From "debug_conf.h", to here and /lib_logging #endif // ---- NEVER CHANGE: HARD CODED! ---------- #define NUM_CONNS_PER_NODE 3 // Physical #define NUM_NODES_PER_PAIR 2 // Every other #define SMALLEST_NUM_COLS NUM_NODES_PER_PAIR // LEGEND of config name, rather informally listed // '1_TILE' : 1 tile // '016_NODE' : 16 nodes (tasks) altogether // 'T0' : tile[0], then a list // 'T1' : tile[1], then a list // '2N' : 2 nodes on 2 cores, configured as normal task types // '2CN' : 2 combined nodes on 1 core // '4P' : 4 pairs of client and server // 'CC' : special config combined client and client on 1 core // 'CS' : special config combined client and server on 1 core // #define TOP_01_HAS_1_TILE_002_NODE_T0_2N_RUNS 1 #define TOP_02_HAS_2_TILE_016_NODE_T0_4P_T1_4P_RUNS 2 #define TOP_03_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_RUNS 3 #define TOP_04_HAS_1_TILE_016_NODE_T0_2N_AS_CS_6CN_8CN_RUNS 4 #define TOP_05_HAS_1_TILE_016_NODE_T0_2N_14CN_RUNS 5 #define TOP_06_HAS_1_TILE_032_NODE_T0_2N_30CN_RUNS 6 #define TOP_07_HAS_1_TILE_002_NODE_T0_2CN_RUNS 7 #define TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS 8 // #define TOP_10_HAS_1_TILE_016_NODE_T0_16CN_STOPS 10 #define TOP_11_HAS_2_TILE_016_NODE_T0_2CN_12CN_T1_2N_STOPS 11 #define TOP_12_HAS_1_TILE_012_NODE_T0_1N_2CN_8CN_1N_STOPS 12 #define TOP_13_HAS_1_TILE_016_NODE_T0_8CN_8CN_STOPS 13 #define TOP_14_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS 14 #define TOP_15_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS 15 // #define TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD 103 #define TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS 203 // #define TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR 20 // #define TOPOLOGY TOP_01_HAS_1_TILE_002_NODE_T0_2N_RUNS // OK FAIR_BY_ARCHITECTURE // #define TOPOLOGY TOP_02_HAS_2_TILE_016_NODE_T0_4P_T1_4P_RUNS // OK // #define TOPOLOGY TOP_03_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_RUNS // NotFair (1ms) // #define TOPOLOGY TOP_04_HAS_1_TILE_016_NODE_T0_2N_AS_CS_6CN_8CN_RUNS // NotFair only at the start (1ms) // #define TOPOLOGY TOP_05_HAS_1_TILE_016_NODE_T0_2N_14CN_RUNS // OK. "Default" // #define TOPOLOGY TOP_06_HAS_1_TILE_032_NODE_T0_2N_30CN_RUNS // OK // #define TOPOLOGY TOP_07_HAS_1_TILE_002_NODE_T0_2CN_RUNS // OK FAIR_BY_ARCHITECTURE // #define TOPOLOGY TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS // // // #define TOPOLOGY TOP_10_HAS_1_TILE_016_NODE_T0_16CN_STOPS // #define TOPOLOGY TOP_11_HAS_2_TILE_016_NODE_T0_2CN_12CN_T1_2N_STOPS // #define TOPOLOGY TOP_12_HAS_1_TILE_012_NODE_T0_1N_2CN_8CN_1N_STOPS // #define TOPOLOGY TOP_13_HAS_1_TILE_016_NODE_T0_8CN_8CN_STOPS // #define TOPOLOGY TOP_14_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS // #define TOPOLOGY TOP_15_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS // #define TOPOLOGY TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD // Guarded version (won't build) #define TOPOLOGY TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS // Asynchronous version (wrong usage of [[notification]] and [[clears_notification]]) // #define TOPOLOGY TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR // ----------------------------------------------------------------------------------------------------- // #if (TOPOLOGY == TOP_01_HAS_1_TILE_002_NODE_T0_2N_RUNS) #define NUM_ROWS 1 #define NUM_COLS 2 #define TOP_STR "Top_01 runs" #define FAIR_BY_ARCHITECTURE 1 #elif (TOPOLOGY == TOP_02_HAS_2_TILE_016_NODE_T0_4P_T1_4P_RUNS) #define NUM_ROWS 4 #define NUM_COLS 4 #define NUM_TILES 2 #define TOP_STR "Top_02 runs" #elif (TOPOLOGY == TOP_03_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_RUNS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_03 runs NotFair" #elif (TOPOLOGY == TOP_04_HAS_1_TILE_016_NODE_T0_2N_AS_CS_6CN_8CN_RUNS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_04 runs NotFair at init" #elif (TOPOLOGY == TOP_05_HAS_1_TILE_016_NODE_T0_2N_14CN_RUNS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_05 runs" #elif (TOPOLOGY == TOP_06_HAS_1_TILE_032_NODE_T0_2N_30CN_RUNS) #define NUM_ROWS 8 #define NUM_COLS 4 #define TOP_STR "Top_06 runs" #elif (TOPOLOGY == TOP_07_HAS_1_TILE_002_NODE_T0_2CN_RUNS) #define NUM_ROWS 1 #define NUM_COLS 2 #define TOP_STR "Top_07 runs" #define FAIR_BY_ARCHITECTURE 1 #elif (TOPOLOGY == TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS) #define NUM_ROWS 4 #define NUM_COLS 4 #define ROOT_DELAY_UNTIL_NEXT_ROUND_US 0 #define TOP_STR "Top_08 runs with 0 us and very NotFair" #elif (TOPOLOGY == TOP_10_HAS_1_TILE_016_NODE_T0_16CN_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define NUM_TILES 1 #define TOP_STR "Top_10 stops" #elif (TOPOLOGY == TOP_11_HAS_2_TILE_016_NODE_T0_2CN_12CN_T1_2N_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define NUM_TILES 1 // For calculations of indices, but one pair is on T1 #define TOP_STR "Top_11 stops" #elif (TOPOLOGY == TOP_12_HAS_1_TILE_012_NODE_T0_1N_2CN_8CN_1N_STOPS) #define NUM_ROWS 3 #define NUM_COLS 4 #define NUM_TILES 1 #define TOP_STR "Top_12 stops" #elif (TOPOLOGY == TOP_13_HAS_1_TILE_016_NODE_T0_8CN_8CN_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_13 stops" #elif (TOPOLOGY == TOP_14_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_14 stops" #elif (TOPOLOGY == TOP_15_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_15 stops" #elif (TOPOLOGY == TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_03G won't build" #define AVOID_COMPILER_CRASH 0 // If 1 no code to run! #define TOP_03G_AS_PARTLY_DISTRUBUTED 1 #elif (TOPOLOGY == TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS) #define NUM_ROWS 4 #define NUM_COLS 4 #define TOP_STR "Top_03A stops" // // THE PROBLEM IS that we would need some barrier, since [[notification]] [[clear_notofication]] is meant // to handle a single client-server relationship // #define ASYNCH_USE_CLEARS_NOTIFICATION 1 // 1 Standard and "correct", but stops // // 0 Not at all standard but comes further, still stops #define ASYNCH_GUARDED_DO_IO_SERVER 0 // 1 1 0 #define AVOID_COMPILER_CRASH 0 // 0 1 0 // // # Compiles and builds // // # Compiles the code,crash avoided, no final build // // # xcc1: internal compiler error // // # Failed in .../lower_combined_pars.cpp, line 183 #elif (TOPOLOGY == TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR) #define NUM_ROWS 2 #define NUM_COLS 2 // #define DO_XSCOPE 0 #define TOP_STR "Top_20 occam'ish" // #define ROOT_DELAY_UNTIL_NEXT_ROUND_US 0 // (0 allowed) Anything below round trip 1.25 us will be 1.25 us. #else #error Topology not implemented #endif #define NUM_ROWS_PER_TILE (NUM_ROWS/NUM_TILES) #if (NUM_COLS < SMALLEST_NUM_COLS) #error #endif #ifndef DO_TIME_DELAY_SLIDE #define DO_TIME_DELAY_SLIDE 0 #endif #ifndef FAIR_BY_ARCHITECTURE #define FAIR_BY_ARCHITECTURE 0 #endif #define NUM_PAIRS_PER_ROW (NUM_COLS / NUM_NODES_PER_PAIR) #define NUM_NODES (NUM_ROWS * NUM_NODE_COLS) #define NUM_CONNS_PER_PAIR 2 typedef struct pos_t { unsigned iof_row; // Y-axis unsigned iof_col; // X-axis } pos_t; #ifndef INIT_NUM_ROWS #define INIT_NUM_ROWS NUM_ROWS #endif #ifndef INIT_NUM_COLS #define INIT_NUM_COLS NUM_COLS #endif #ifndef DO_XSCOPE #define DO_XSCOPE 0 #endif #if (IS_MYTARGET == IS_MYTARGET_XCORE_200_EXPLORER) #define BOARD_LEDS_INIT 0x00 #define BOARD_LED_MASK_GREEN_ONLY 0x01 // BIT0 J1.7 #define BOARD_LED_MASK_RGB_BLUE 0x02 // BIT1 J1.5 #define BOARD_LED_MASK_RGB_GREEN 0x04 // BIT2 J1.3 #define BOARD_LED_MASK_RGB_RED 0x08 // BIT3 J1.1 #define BOARD_LED_MASK_RGB_ALL (BOARD_LED_MASK_RGB_BLUE bitor BOARD_LED_MASK_RGB_GREEN bitor BOARD_LED_MASK_RGB_RED) #else #error No LED configured #endif #ifndef ROOT_DELAY_UNTIL_NEXT_ROUND_US #define ROOT_DELAY_UNTIL_NEXT_ROUND_US 1000 // Default for all except TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS #endif #define ROOT_WAIT_FOR_NEXT_ROUND_US (ROOT_DELAY_UNTIL_NEXT_ROUND_US * XS1_TIMER_MHZ) #define VALUE_MAX 99999 // 999 all % 3u, 99999 all % 5u #define CALL_CNT_MAX 99 // 999 all % 2u typedef interface conn_if_t { {pos_t, unsigned} do_io_server ( const unsigned value_to, const pos_t pos, const unsigned call_cnt); } conn_if_t; typedef struct { unsigned values [NUM_CONNS_PER_NODE]; unsigned value; unsigned init; } vals_t; unsigned row_col_to_number ( const unsigned iof_row, const unsigned iof_col) { return (1 + ((iof_row * NUM_COLS) + iof_col)); } unsigned pos_to_number (const pos_t pos) { return row_col_to_number (pos.iof_row, pos.iof_col); } void init_value ( const unsigned iof_row, const unsigned iof_col, vals_t &context) { // Both must be set context.init = row_col_to_number (iof_row, iof_col); context.value = context.init; } {bool, unsigned} Calculate (const vals_t context) { unsigned value_return = context.value; bool overflow_return; for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++) { value_return += context.values[index]; } overflow_return = (value_return >= VALUE_MAX); if (overflow_return) { value_return = context.init; // 1 for (0 0) up to 16 } else {} return {overflow_return, value_return}; } bool analyze_all_unique_ok (unsigned value[NUM_CONNS_PER_NODE]) { bool error_return = false; error_return or_eq (value[0] == value[1]); error_return or_eq (value[0] == value[2]); error_return or_eq (value[1] == value[2]); return not error_return; } // ------- // SERVERS // ------- typedef struct server_context_t { pos_t my_pos; unsigned cycle_cnt; // timer time_tmr; time32_t time_now_ticks; time32_t time_previous_ticks; unsigned num_neighbours_seen; unsigned iof_client; // pos_t client_pos [NUM_CONNS_PER_NODE]; unsigned client_numbers [NUM_CONNS_PER_NODE]; unsigned iof_connections [NUM_CONNS_PER_NODE]; unsigned call_cnts [NUM_CONNS_PER_NODE]; // vals_t vals; } server_context_t; #if (DEBUG_PRINT_TEST==0) #define DEBUG_PRINT_HANDLE_SERVER_1(context,old_value,overflow,not_fair) // empty #else #define DEBUG_PRINT_HANDLE_SERVER_1(context,old_value,overflow,error) debug_print_handle_server_1 (context,old_value,overflow,not_fair) void debug_print_handle_server_1 (server_context_t &context, const unsigned old_value, const bool overflow, const bool not_fair) { int len; char chars_str [SPRINTF_LEN]; #if (TOPOLOGY == TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS) const bool leading_spaces = true; #else const bool leading_spaces = false; #endif len = sprintf (chars_str, "%s(%u %u):s(%4u) %5u %5u %s ", leading_spaces ? " " : "", context.my_pos.iof_row, context.my_pos.iof_col, context.cycle_cnt, old_value, context.vals.value, overflow ? "owfl" : "with"); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "[%5u] ", context.vals.values[index]); } len += sprintf (len+chars_str, "%s", "from "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "(%u %u) ", context.client_pos[index].iof_row, context.client_pos[index].iof_col); } len += sprintf (len+chars_str, "%s", "cnt "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "%2u ", context.call_cnts[index]); // CALL_CNT_MAX for 2u } len += sprintf (len+chars_str, "%s", "cli "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "%2u ", context.client_numbers[index]); } len += sprintf (len+chars_str, "%s", "con "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "%2u ", context.iof_connections[index]); } len += sprintf (len+chars_str, "%s", "\\ "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "%u ", context.iof_connections[index]%NUM_CONNS_PER_NODE); } len += sprintf (len+chars_str, "%s\n", not_fair ? "NotFair" : ""); debug_print ("%s", chars_str); // Prints DEBUG_PRINTF_BUFSIZE mnus some } #endif #if (DEBUG_PRINT_TEST==0) #define DEBUG_PRINT_HANDLE_SERVER_2(context) // empty #else #define DEBUG_PRINT_HANDLE_SERVER_2(context) debug_print_handle_server_2 (context) void debug_print_handle_server_2 (server_context_t &context) { int len; char chars_str [SPRINTF_LEN]; len = sprintf (chars_str, "(%u %u):s %u\n", context.my_pos.iof_row, context.my_pos.iof_col, context.vals.value); debug_print_special ("%s", chars_str); } #endif {pos_t, unsigned} Handle_server ( const unsigned value_received_now, const pos_t client_pos, const unsigned call_cnt, server_context_t &context) { pos_t pos_return; const unsigned old_value = context.vals.value; pos_return.iof_row = context.my_pos.iof_row; pos_return.iof_col = context.my_pos.iof_col; context.client_pos[context.iof_client] = client_pos; context.num_neighbours_seen++; debug_print_special ("HS %u @ %u\n", context.iof_client, context.num_neighbours_seen); context.vals.values [context.iof_client] = value_received_now; context.client_numbers [context.iof_client] = pos_to_number (client_pos); context.call_cnts [context.iof_client] = call_cnt; if (context.num_neighbours_seen == NUM_CONNS_PER_NODE) { time32_t time_used_ticks; bool overflow; bool not_fair; {overflow, context.vals.value} = Calculate (context.vals); // In Handle_server context.num_neighbours_seen = 0; context.time_tmr :> context.time_now_ticks; time_used_ticks = context.time_now_ticks - context.time_previous_ticks; if (FAIR_BY_ARCHITECTURE == 1) { not_fair = false; } else { not_fair = not analyze_all_unique_ok (context.client_numbers); } DEBUG_PRINT_HANDLE_SERVER_1 (context, old_value, overflow, not_fair); context.time_previous_ticks = context.time_now_ticks; if (time_used_ticks < ROOT_WAIT_FOR_NEXT_ROUND_US) { delay_ticks (ROOT_WAIT_FOR_NEXT_ROUND_US - time_used_ticks); // Now all should follow in step without skew } else { // error, signal this in return parameter delay_ticks (ROOT_WAIT_FOR_NEXT_ROUND_US); // This will delay it! } context.cycle_cnt++; } else { DEBUG_PRINT_HANDLE_SERVER_2 (context); } return {pos_return, old_value}; } // Handle_server // TASK Server_node // [[combinable]] void Server_node ( const unsigned iof_row, const unsigned iof_col, server conn_if_t i_conns[NUM_CONNS_PER_NODE], // all_conns[iof_row][iof_pair] const unsigned iof_pair) { server_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):S[%u] = %u.%u.d%u\n", iof_row, iof_col, context.vals.value, iof_row, iof_pair, NUM_CONNS_PER_NODE); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.num_neighbours_seen = 0; context.time_tmr :> context.time_now_ticks; context.time_previous_ticks = context.time_now_ticks; while (1) { select { case i_conns[const unsigned iof_connection].do_io_server ( const unsigned value_to, const pos_t client_pos, const unsigned call_cnt) -> {pos_t pos_return, unsigned value_from} : { context.iof_client = context.num_neighbours_seen; context.iof_connections[context.iof_client] = iof_connection; // {pos_return, value_from} = Handle_server (value_to, client_pos, call_cnt, context); } break; } } } // Server_node // TASK Server_node_alt // [[combinable]] void Server_node_alt ( const unsigned iof_row, const unsigned iof_col, server conn_if_t i_conn_internal, server conn_if_t i_conns[NUM_CONNS_PER_PAIR], // all_conns[iof_row][iof_pair] const unsigned iof_pair) { server_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):S[%u] = %u.%u.d%u\n", iof_row, iof_col, context.vals.value, iof_row, iof_pair, NUM_CONNS_PER_PAIR); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.num_neighbours_seen = 0; context.time_tmr :> context.time_now_ticks; context.time_previous_ticks = context.time_now_ticks; while (1) { select { case i_conns[const unsigned iof_connection].do_io_server ( const unsigned value_to, const pos_t client_pos, const unsigned call_cnt) -> {pos_t pos_return, unsigned value_from} : { context.iof_client = context.num_neighbours_seen; context.iof_connections[context.iof_client] = iof_connection; {pos_return, value_from} = Handle_server (value_to, client_pos, call_cnt, context); } break; case i_conn_internal.do_io_server ( const unsigned value_to, const pos_t client_pos, const unsigned call_cnt) -> {pos_t pos_return, unsigned value_from} : { context.iof_client = context.num_neighbours_seen; context.iof_connections[context.iof_client] = context.iof_client; {pos_return, value_from} = Handle_server (value_to, client_pos, call_cnt, context); } break; } } } // Server_node_alt // TASK Server_node_timeout // [[combinable]] void Server_node_timeout ( const unsigned iof_row, const unsigned iof_col, server conn_if_t i_conns[NUM_CONNS_PER_NODE], // all_conns[iof_row][iof_pair] const unsigned iof_pair) { timer time_tmr; time32_t timeout_ticks; server_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):S[%u] = %u.%u.d%u\n", iof_row, iof_col, context.vals.value, iof_row, iof_pair, NUM_CONNS_PER_NODE); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.num_neighbours_seen = 0; context.time_tmr :> context.time_now_ticks; context.time_previous_ticks = context.time_now_ticks; time_tmr :> timeout_ticks; timeout_ticks += XS1_TIMER_HZ; while (1) { select { case time_tmr when timerafter (timeout_ticks) :> void : { timeout_ticks += XS1_TIMER_HZ; } break; case i_conns[const unsigned iof_connection].do_io_server ( const unsigned value_to, const pos_t client_pos, const unsigned call_cnt) -> {pos_t pos_return, unsigned value_from} : { context.iof_client = context.num_neighbours_seen; context.iof_connections[context.iof_client] = iof_connection; // See https://www.teigfam.net/oyvind/home/technology/165-xc-code-examples/ // #replicated_select_case_index_not_in_range_of_input_array {pos_return, value_from} = Handle_server (value_to, client_pos, call_cnt, context); } break; } } } // Server_node_timeout // ------- // CLIENTS // ------- typedef struct client_context_t { pos_t my_pos; unsigned cycle_cnt; // timer time_tmr; time32_t timeout_ticks; time32_t time_previous_ticks; // unsigned iof_server; pos_t server_pos [NUM_CONNS_PER_NODE]; unsigned call_cnt; unsigned call_cnts [NUM_CONNS_PER_NODE]; // vals_t vals; } client_context_t; #if (DEBUG_PRINT_TEST_SPECIAL==0) #define DEBUG_PRINT_HANDLE_CLIENT_1(context) // empty #else #define DEBUG_PRINT_HANDLE_CLIENT_1(context) debug_print_handle_client_1 (context) void debug_print_handle_client_2 (client_context_t &context) { int len; char chars_str [SPRINTF_LEN]; len = sprintf (chars_str, "(%u %u):c link %u sending: %u\n", context.my_pos.iof_row, context.my_pos.iof_col, context.iof_server, context.vals.value); debug_print_special ("%s", chars_str); } #endif #if (DEBUG_PRINT_TEST_SPECIAL==0) #define DEBUG_PRINT_HANDLE_CLIENT_2(context) // empty #else #define DEBUG_PRINT_HANDLE_CLIENT_2(context) debug_print_handle_client_2 (context) void debug_print_handle_client_2 (client_context_t &context) { int len; char chars_str [SPRINTF_LEN]; len = sprintf (chars_str, "(%u %u):c i:%u from (%u %u) received: %u", context.my_pos.iof_row, context.my_pos.iof_col, context.iof_server, context.server_pos[context.iof_server].iof_row, context.server_pos[context.iof_server].iof_col, context.vals.values [context.iof_server]); debug_print_special ("%s\n", chars_str); } #endif #if (DEBUG_PRINT_TEST==0) #define DEBUG_PRINT_HANDLE_CLIENT_3(context,old_value,overflow) // empty #else #define DEBUG_PRINT_HANDLE_CLIENT_3(context,old_value,overflow) debug_print_handle_client_3 (context,old_value,overflow) void debug_print_handle_client_3 (client_context_t &context, const unsigned old_value, const bool overflow) { int len; char chars_str [SPRINTF_LEN]; len = sprintf (chars_str, "(%u %u):c(%4u) %5u %5u %s ", context.my_pos.iof_row, context.my_pos.iof_col, context.cycle_cnt, old_value, context.vals.value, overflow ? "owfl" : "with"); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "[%5u] ", context.vals.values[index]); } len += sprintf (len+chars_str, "%s", "from "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "(%u %u) ", context.server_pos[index].iof_row, context.server_pos[index].iof_col); } len += sprintf (len+chars_str, "%s", "cnt "); for (unsigned index = 0; index < NUM_CONNS_PER_NODE; index++){ len += sprintf (len+chars_str, "%2u ", context.call_cnts[index]); // CALL_CNT_MAX for 2u } debug_print ("%s\n", chars_str); } #endif bool Handle_client ( // return true when NUM_CONNS_PER_NODE client conn_if_t i_conn_0, // Hard coded: not possible to use NUM_CONNS_PER_NODE-dimensioned array here client conn_if_t i_conn_1, client conn_if_t i_conn_2, client_context_t &context) { bool all_servers_handled = false; debug_print_special ("HC0 %u\n", context.iof_server); DEBUG_PRINT_HANDLE_CLIENT_1 (context); switch (context.iof_server) { // Hard coded with NUM_CONNS_PER_NODE==3 case 0 : { {context.server_pos[0], context.vals.values[0]} = i_conn_0.do_io_server (context.vals.value, context.my_pos, context.call_cnt); } break; // OUTPUT and INPUT case 1 : { {context.server_pos[1], context.vals.values[1]} = i_conn_1.do_io_server (context.vals.value, context.my_pos, context.call_cnt); } break; // OUTPUT and INPUT case 2 : { {context.server_pos[2], context.vals.values[2]} = i_conn_2.do_io_server (context.vals.value, context.my_pos, context.call_cnt); } break; // OUTPUT and INPUT // default: break; // Not possible, crash } context.call_cnts[context.iof_server] = context.call_cnt; DEBUG_PRINT_HANDLE_CLIENT_2 (context); context.iof_server++; context.call_cnt = (context.call_cnt+1) % CALL_CNT_MAX; context.time_tmr :> context.timeout_ticks; // AFTER now = immediate (i.e. as often as possible), or will get added ROOT_WAIT_FOR_NEXT_ROUND_US later all_servers_handled = (context.iof_server == NUM_CONNS_PER_NODE); if (all_servers_handled) { const unsigned old_value = context.vals.value; time32_t time_used_ticks; bool overflow; {overflow, context.vals.value} = Calculate (context.vals); // In Handle_client context.iof_server = 0; context.time_tmr :> context.timeout_ticks; time_used_ticks = context.timeout_ticks - context.time_previous_ticks; if (time_used_ticks > 0) { const unsigned time_sec = (unsigned) time_used_ticks / (unsigned) XS1_TIMER_HZ; } else { fail ("time_used_ticks <= 0"); // Zero time or longer than some 21 seconds (2exp31 * 10 ns) } context.time_previous_ticks = context.timeout_ticks; DEBUG_PRINT_HANDLE_CLIENT_3 (context, old_value, overflow); context.cycle_cnt++; } else {} context.timeout_ticks += ROOT_WAIT_FOR_NEXT_ROUND_US; // delay_tics used in Server_node. No skew here return all_servers_handled; } // Handle_client // TASK Client_node // [[combinable]] void Client_node ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_0, // Hard coded: not possible to use NUM_CONNS_PER_NODE-dimensioned array here const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, client conn_if_t i_conn_1, const unsigned iof_row_1, const unsigned iof_pair_1, const unsigned iof_link_1, client conn_if_t i_conn_2, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2) { client_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):C[%u] = %u.%u.%u - %u.%u.%u - %u.%u.%u\n", iof_row, iof_col, context.vals.value, iof_row_0, iof_pair_0, iof_link_0, iof_row_1, iof_pair_1, iof_link_1, iof_row_2, iof_pair_2, iof_link_2); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.iof_server = 0; context.call_cnt = 0; context.time_tmr :> context.timeout_ticks; // AFTER now = immediate context.time_previous_ticks = context.timeout_ticks; while (1) { select { case context.time_tmr when timerafter (context.timeout_ticks) :> void : { // Needed, since main select in combinable function cannot have default case Handle_client (i_conn_0, i_conn_1, i_conn_2, context); } break; } } } // Client_node // TASK Client_node // [[combinable]] void Client_node_root ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_0, // Hard coded: not possible to use NUM_CONNS_PER_NODE-dimensioned array here const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, client conn_if_t i_conn_1, const unsigned iof_row_1, const unsigned iof_pair_1, const unsigned iof_link_1, client conn_if_t i_conn_2, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2, out buffered port:4 ?outP4_leds) { unsigned leds = BOARD_LEDS_INIT; client_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):R[%u] = %u.%u.%u - %u.%u.%u - %u.%u.%u as %s (_xc_test_combinable.xc compiled on %s %s)\n", iof_row, iof_col, context.vals.value, iof_row_0, iof_pair_0, iof_link_0, iof_row_1, iof_pair_1, iof_link_1, iof_row_2, iof_pair_2, iof_link_2, TOP_STR, __DATE__, __TIME__); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.iof_server = 0; context.call_cnt = 0; context.time_tmr :> context.timeout_ticks; // AFTER now = immediate context.time_previous_ticks = context.timeout_ticks; while (1) { select { case context.time_tmr when timerafter (context.timeout_ticks) :> void : { // Needed, since main select in combinable function cannot have default case bool all_servers_handled; const unsigned iof_server_pre = context.iof_server; // since it's incremented to next after Handle_client all_servers_handled = Handle_client (i_conn_0, i_conn_1, i_conn_2, context); // SET LEDS. Swap RGB=blue,red,green on each comms, green_only when all done if (not isnull(outP4_leds)) { if (all_servers_handled) { // ##.# XCORE-200-EXPLORER leds xor_eq BOARD_LED_MASK_GREEN_ONLY; // J1.7 CH1 } else {} // J1.x ### SCOPE switch (iof_server_pre) { // J1.x ### // Hard coded with NUM_CONNS_PER_NODE==3 // J1.x ### case 0: {leds xor_eq BOARD_LED_MASK_RGB_BLUE; } break; // J1.5 CH2 case 1: {leds xor_eq BOARD_LED_MASK_RGB_GREEN;} break; // J1.3 CH3 case 2: {leds xor_eq BOARD_LED_MASK_RGB_RED; } break; // J1.1 CH4 // default: break; // Not possible, crash } outP4_leds <: leds; } else {} } break; } } } // Client_node_root // TASK Client_node // [[combinable]] void Client_node_alt ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_0, // Hard coded: not possible to use NUM_CONNS_PER_NODE-dimensioned array here const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, client conn_if_t i_conn_1_internal, client conn_if_t i_conn_2, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2) { client_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):C[%u] = %u.%u.%u - internal - %u.%u.%u\n", iof_row, iof_col, context.vals.value, iof_row_0, iof_pair_0, iof_link_0, iof_row_2, iof_pair_2, iof_link_2); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.iof_server = 0; context.call_cnt = 0; context.time_tmr :> context.timeout_ticks; // AFTER now = immediate context.time_previous_ticks = context.timeout_ticks; while (1) { select { case context.time_tmr when timerafter (context.timeout_ticks) :> void : { // Needed, since main select in combinable function cannot have default case Handle_client (i_conn_0, i_conn_1_internal, i_conn_2, context); } break; } } } // Client_node_alt // TASK Client_node // [[combinable]] void Client_node_root_alt ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_0, // Hard coded: not possible to use NUM_CONNS_PER_NODE-dimensioned array here const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, client conn_if_t i_conn_1_internal, client conn_if_t i_conn_2, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2, out buffered port:4 ?outP4_leds) { unsigned leds = BOARD_LEDS_INIT; client_context_t context; init_value (iof_row, iof_col, context.vals); debug_print ("(%u %u):R[%u] = %u.%u.%u - internal - %u.%u.%u as %s (_xc_test_combinable.xc compiled on %s %s)\n", iof_row, iof_col, context.vals.value, iof_row_0, iof_pair_0, iof_link_0, iof_row_2, iof_pair_2, iof_link_2, TOP_STR, __DATE__, __TIME__); // un-const ok, since I don't change them anyhow: context.my_pos.iof_row = iof_row; context.my_pos.iof_col = iof_col; context.cycle_cnt = 0; context.iof_server = 0; context.time_tmr :> context.timeout_ticks; // AFTER now = immediate context.time_previous_ticks = context.timeout_ticks; while (1) { select { case context.time_tmr when timerafter (context.timeout_ticks) :> void : { // Needed, since main select in combinable function cannot have default case bool all_servers_handled; const unsigned iof_server_pre = context.iof_server; // since it's incremented to next after Handle_client all_servers_handled = Handle_client (i_conn_0, i_conn_1_internal, i_conn_2, context); // SET LEDS. Swap RGB=blue,red,green on each comms, green_only when all done if (not isnull(outP4_leds)) { if (all_servers_handled) { // ##.# XCORE-200-EXPLORER leds xor_eq BOARD_LED_MASK_GREEN_ONLY; // J1.7 CH1 } else {} // J1.x ### SCOPE switch (iof_server_pre) { // J1.x ### // Hard coded with NUM_CONNS_PER_NODE==3 // J1.x ### case 0: {leds xor_eq BOARD_LED_MASK_RGB_BLUE; } break; // J1.5 CH2 case 1: {leds xor_eq BOARD_LED_MASK_RGB_GREEN;} break; // J1.3 CH3 case 2: {leds xor_eq BOARD_LED_MASK_RGB_RED; } break; // J1.1 CH4 // default: break; // Not possible, crash } outP4_leds <: leds; } else {} } break; } } } // Client_node_root_alt // Composite pair task // This kind of task can only be NORMAL since COMBINABLE must be built with while(1)-select // However, as NORMAL it does not take any other resources than i_conn_internal // See https://www.teigfam.net/oyvind/home/technology/165-xc-code-examples/#composite_task_must_be_of_normal_type // void Client_Server_pair_task ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_hor, // Left or right const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, server conn_if_t i_conns_server [NUM_CONNS_PER_PAIR], // DIM 2 const unsigned iof_pair_1, client conn_if_t i_conn_ver, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2) { // Above or below conn_if_t i_conn_internal; // DIM 1, sum DIM 3: hidden \i_conn_internal par { Client_node_alt ( iof_row, iof_col, i_conn_hor, iof_row_0, iof_pair_0, iof_link_0, i_conn_internal, i_conn_ver, iof_row_2, iof_pair_2, iof_link_2); Server_node_alt ( iof_row, iof_col+1, i_conn_internal, i_conns_server, iof_pair_1); } } // Client_Server_pair_task void Client_Server_pair_root_task ( const unsigned iof_row, const unsigned iof_col, client conn_if_t i_conn_hor, // Left or right const unsigned iof_row_0, const unsigned iof_pair_0, const unsigned iof_link_0, server conn_if_t i_conns_server [NUM_CONNS_PER_PAIR], // DIM 2 const unsigned iof_pair_1, client conn_if_t i_conn_ver, const unsigned iof_row_2, const unsigned iof_pair_2, const unsigned iof_link_2, out buffered port:4 ?outP4_leds) { conn_if_t i_conn_internal; // DIM 1, sum DIM 3: hidden \i_conn_internal par { Client_node_root_alt ( iof_row, iof_col, i_conn_hor, iof_row_0, iof_pair_0, iof_link_0, i_conn_internal, i_conn_ver, iof_row_2, iof_pair_2, iof_link_2, outP4_leds); Server_node_alt ( iof_row, iof_col+1, i_conn_internal, i_conns_server, iof_pair_1); } } // Client_Server_pair_task // GUARDED VERSIONS // #if (TOPOLOGY == TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD) #include "top_03_guarded_xc.h" #if (AVOID_COMPILER_CRASH == 1) #undef TOPOLOGY // Any attempt causes "xcc1: internal compiler error" #endif #elif (TOPOLOGY == TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS) #include "top_03_asynch_xc.h" #if (AVOID_COMPILER_CRASH == 1) #undef TOPOLOGY // Any attempt causes "xcc1: internal compiler error" #endif #elif (TOPOLOGY == TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR) #include "top_20_occam_like_xc.h" #endif #if (IS_MYTARGET == IS_MYTARGET_XCORE_200_EXPLORER) out buffered port:4 outP4_leds = on tile[0]: XS1_PORT_4F; // xCORE-200 explorerKIT GPIO J1 P5, P3, P1. HIGH IS ON // Not used in buffered port:1 inP_button_left = on tile[0]: XS1_PORT_1M; // (*3) GPIO-J1.PIN63 (B1) in buffered port:1 inP_button_center = on tile[0]: XS1_PORT_1N; // (*3) GPIO-J1.PIN61 (B3) in buffered port:1 inP_button_right = on tile[0]: XS1_PORT_1O; // GPIO-J1.PIN59 (B2) #else #error No LED configured #endif // ---------------------- // ALWAYS TOROID TOPOLOGY // ---------------------- int main (void) { #if (TOPOLOGY == TOP_01_HAS_1_TILE_002_NODE_T0_2N_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_01 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 2 . OKAY Timers available: 10, used: 2 . OKAY Chanends available: 32, used: 4 . OKAY Memory available: 262144, used: 2916 . OKAY (Stack: 616, Code: 2030, Data: 270) Constraints checks PASSED. TOP_01_HAS_1_TILE_002_NODE_T0_2N_RUNS par Client core[0] Server core[1] */ // Case to avoid "error: interface used as both client and server in one task" // A single pair that communicates with itself conn_if_t all_conns [NUM_CONNS_PER_NODE]; // Dim [3] par { Client_node_root (0, 0, all_conns[0], 0,0,0, all_conns[1], 0,0,1, all_conns[2], 0,0,2, outP4_leds); Server_node (0, 1, all_conns, 0); } #elif (TOPOLOGY == TOP_02_HAS_2_TILE_016_NODE_T0_4P_T1_4P_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_02 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 8 . OKAY Timers available: 10, used: 8 . OKAY Chanends available: 32, used: 18 . OKAY Memory available: 262144, used: 7020 . OKAY (Stack: 3080, Code: 3468, Data: 472) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 8 . OKAY Timers available: 10, used: 8 . OKAY Chanends available: 32, used: 18 . OKAY Memory available: 262144, used: 6468 . OKAY (Stack: 3168, Code: 2908, Data: 392) Constraints checks PASSED. TOP_02_HAS_2_TILE_016_NODE_T0_4P_T1_4P_RUNS par on tile[0]: par Client+Server pair: par Client core[0] Server core[1] par (for 1 pair) Client+Server pair: par Client core[2] Server core[3] par (for 1 row) par (for 2 pairs) Client+Server pair: par Client core[4][6] Server core[5][7] on tile[1]: par (for 4 rows) par (for 2 pairs) Client+Server pair: par Client core[0][2][4][6] Server core[1][3][5][7] */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_PAIR]; // Observe [][][PAIR] par { #define IOF_ROW_VER ((iof_row + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( iof_col / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right on tile[0]: par { #define IOF_ROW_START 0 // ROOT at ROW,COL = 0.0 #define iof_row 0 #define iof_col 0 // Same param set and use of macros (1/3) (+outP4_leds) Client_Server_pair_root_task ( iof_row, iof_col, all_conns[iof_row] [IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row] [IOF_PAIR], IOF_PAIR, all_conns[IOF_ROW_VER][IOF_PAIR] [0], IOF_ROW_VER, IOF_PAIR, 0, outP4_leds); // THE OTHERS IN ROW 0 (to ther ight of ROOT) #undef iof_row #undef iof_col #define iof_row 0 #define IOF_ROW_START 0 #define IOF_COL_START NUM_NODES_PER_PAIR par (unsigned iof_col = IOF_COL_START; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // Same param set and use of macros (2/3) Client_Server_pair_task ( iof_row, iof_col, all_conns[iof_row] [IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row] [IOF_PAIR], IOF_PAIR, all_conns[IOF_ROW_VER][IOF_PAIR] [0], IOF_ROW_VER, IOF_PAIR, 0); } // THE OTHER FULL ROWS #undef iof_row #undef IOF_ROW_START #define IOF_ROW_START 1 par (unsigned iof_row = IOF_ROW_START; iof_row < (NUM_ROWS_PER_TILE); iof_row++) { par (unsigned iof_col = 0; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // Same param set and use of macros (3/3) Client_Server_pair_task ( iof_row, iof_col, all_conns[iof_row] [IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row] [IOF_PAIR], IOF_PAIR, all_conns[IOF_ROW_VER][IOF_PAIR] [0], IOF_ROW_VER, IOF_PAIR, 0); } } } #undef IOF_ROW_START #define IOF_ROW_START NUM_ROWS_PER_TILE on tile[1]: // Also using tile[1] par (unsigned iof_row = IOF_ROW_START; iof_row < (IOF_ROW_START + NUM_ROWS_PER_TILE); iof_row++) { par (unsigned iof_col = 0; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // Client_Server_pair_task ( iof_row, iof_col, all_conns[iof_row] [IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row] [IOF_PAIR], IOF_PAIR, all_conns[IOF_ROW_VER][IOF_PAIR] [0], IOF_ROW_VER, IOF_PAIR, 0 ); } } } #elif (TOPOLOGY == TOP_03_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_03 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 3 . OKAY Timers available: 10, used: 3 . OKAY Chanends available: 32, used: 11 . OKAY Memory available: 262144, used: 7444 . OKAY (Stack: 2680, Code: 4216, Data: 548) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 5 . OKAY Memory available: 262144, used: 5708 . OKAY (Stack: 1776, Code: 3480, Data: 452) Constraints checks PASSED. TOP_03_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_RUNS par on tile[0]: par Client core[0] (0 0) Client core[1] (0 2) [[combine]] par core [2] Server (0 1) Server (0 3) Client (1 0) Server (1 1) Client (1 2) Server (1 3) on tile[1]: [[combine]] par 8CN core[0] Client (2 0) Server (2 1) Client (2 2) Server (2 3) Client (2 4) Server (2 5) Client (2 6) Server (2 7) */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { // Two clients one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0, outP4_leds); Client_node (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); [[combine]] par { Server_node (0,1, all_conns[0][0], 0); Server_node (0,3, all_conns[0][1], 1); // [R][P][C] [R][P][C] [R][P][C] Client_node (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Server_node (1,3, all_conns[1][1], 1); } } on tile[1]: // Also using tile[1] (the routing error is there also with tile[0] here) [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Server_node (2,1, all_conns[2][0], 0); // Client_node (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Server_node (2,3, all_conns[2][1], 1); // Client_node (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Server_node (3,1, all_conns[3][0], 0); // Client_node (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); Server_node (3,3, all_conns[3][1], 1); } } #elif (TOPOLOGY == TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD) g_conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] #if (TOP_03G_AS_PARTLY_DISTRUBUTED == 1) /* Constraint check for tile[0]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1192 . OKAY (Stack: 348, Code: 678, Data: 166) Constraints checks PASSED. */ par { on tile[0]: par { // Two clients one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_guarded (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0); Client_node_guarded (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_guarded (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Client_node_guarded (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Client_node_guarded (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Client_node_guarded (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Client_node_guarded (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Client_node_guarded (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); } } on tile[0]: [[distribute]] Server_node_guarded (0,1, all_conns[0][0][0], all_conns[0][0][1], all_conns[0][0][2], 0); on tile[0]: [[distribute]] Server_node_guarded (0,3, all_conns[0][1][0], all_conns[0][1][1], all_conns[0][1][2], 1); on tile[0]: [[distribute]] Server_node_guarded (1,1, all_conns[1][0][0], all_conns[1][0][1], all_conns[1][0][2], 0); on tile[0]: [[distribute]] Server_node_guarded (1,3, all_conns[1][1][0], all_conns[1][1][1], all_conns[1][1][2], 1); on tile[0]: [[distribute]] Server_node_guarded (2,1, all_conns[2][0][0], all_conns[2][0][1], all_conns[2][0][2], 0); on tile[0]: [[distribute]] Server_node_guarded (2,3, all_conns[2][1][0], all_conns[2][1][1], all_conns[2][1][2], 1); on tile[0]: [[distribute]] Server_node_guarded (3,1, all_conns[3][0][0], all_conns[3][0][1], all_conns[3][0][2], 0); on tile[0]: [[distribute]] Server_node_guarded (3,3, all_conns[3][1][0], all_conns[3][1][1], all_conns[3][1][2], 1); } #elif (TOP_03G_AS_PARTLY_DISTRUBUTED == 0) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_03g won't build" #endif /* Disregard memory usage, since very dependent on printing TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD par on tile[0]: par Client core[0] (0 0) Client core[1] (0 2) [[combine]] par core [2] Server (0 1) Server (0 3) Client (1 0) Server (1 1) Client (1 2) Server (1 3) on tile[1]: [[combine]] par 8CN core[0] Client (2 0) Server (2 1) Client (2 2) Server (2 3) Client (2 4) Server (2 5) Client (2 6) Server (2 7) */ par { on tile[0]: par { // Two clients one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_guarded (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0); Client_node_guarded (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); [[combine]] par { Server_node_guarded (0,1, all_conns[0][0][0], all_conns[0][0][1], all_conns[0][0][2], 0); Server_node_guarded (0,3, all_conns[0][1][0], all_conns[0][1][1], all_conns[0][1][2], 1); // [R][P][C] [R][P][C] [R][P][C] Client_node_guarded (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Server_node_guarded (1,1, all_conns[1][0][0], all_conns[1][0][1], all_conns[1][0][2], 0); Client_node_guarded (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Server_node_guarded (1,3, all_conns[1][1][0], all_conns[1][1][1], all_conns[1][1][2], 1); } } on tile[1]: // Also using tile[1] (the routing error is there also with tile[0] here) [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_guarded (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Server_node_guarded (2,1, all_conns[2][0][0], all_conns[2][0][1], all_conns[2][0][2], 0); // Client_node_guarded (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Server_node_guarded (2,3, all_conns[2][1][0], all_conns[2][1][1], all_conns[2][1][2], 1); // Client_node_guarded (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Server_node_guarded (3,1, all_conns[3][0][0], all_conns[3][0][1], all_conns[3][0][2], 0); // Client_node_guarded (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); Server_node_guarded (3,3, all_conns[3][1][0], all_conns[3][1][1], all_conns[3][1][2], 1); } } #endif #elif (TOPOLOGY == TOP_03A_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_03a stops" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 3 . OKAY Timers available: 10, used: 3 . OKAY Chanends available: 32, used: 22 . OKAY Memory available: 262144, used: 23352 . OKAY (Stack: 6724, Code: 14288, Data: 2340) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 16 . OKAY Memory available: 262144, used: 18320 . OKAY (Stack: 3452, Code: 13012, Data: 1856) Constraints checks PASSED. TOP_03G_HAS_2_TILE_016_NODE_T0_2N_AS_CC_6CN_T1_8CN_NO_BUILD par on tile[0]: par Client core[0] (0 0) Client core[1] (0 2) [[combine]] par core [2] Server (0 1) Server (0 3) Client (1 0) Server (1 1) Client (1 2) Server (1 3) on tile[1]: [[combine]] par 8CN core[0] Client (2 0) Server (2 1) Client (2 2) Server (2 3) Client (2 4) Server (2 5) Client (2 6) Server (2 7) */ a_conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { // Two clients one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_asynch (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0); Client_node_asynch (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); [[combine]] par { Server_node_asynch (0,1, all_conns[0][0], 0); Server_node_asynch (0,3, all_conns[0][1], 1); // [R][P][C] [R][P][C] [R][P][C] Client_node_asynch (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Server_node_asynch (1,1, all_conns[1][0], 0); Client_node_asynch (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Server_node_asynch (1,3, all_conns[1][1], 1); } } on tile[1]: // Also using tile[1] (the routing error is there also with tile[0] here) [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_asynch (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Server_node_asynch (2,1, all_conns[2][0], 0); // Client_node_asynch (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Server_node_asynch (2,3, all_conns[2][1], 1); // Client_node_asynch (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Server_node_asynch (3,1, all_conns[3][0], 0); // Client_node_asynch (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); Server_node_asynch (3,3, all_conns[3][1], 1); } } #elif (TOPOLOGY == TOP_04_HAS_1_TILE_016_NODE_T0_2N_AS_CS_6CN_8CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_04 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 4 . OKAY Timers available: 10, used: 4 . OKAY Chanends available: 32, used: 11 . OKAY Memory available: 262144, used: 10460 . OKAY (Stack: 4160, Code: 5588, Data: 712) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_04_HAS_1_TILE_016_NODE_T0_2N_AS_CS_6CN_8CN_RUNS par on tile[0]: par par 2N Client core[0] Server core[1] [[combine]] par 6N core[2] Client Server Client Server Client Server [[combine]] par 8CN core[3] Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { par { // Client and server one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0, outP4_leds); Server_node (0,1, all_conns[0][0], 0); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); Server_node (0,3, all_conns[0][1], 1); Client_node (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Server_node (1,3, all_conns[1][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Server_node (2,1, all_conns[2][0], 0); Client_node (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Server_node (2,3, all_conns[2][1], 1); Client_node (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Server_node (3,1, all_conns[3][0], 0); Client_node (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); Server_node (3,3, all_conns[3][1], 1); } } } #elif (TOPOLOGY == TOP_05_HAS_1_TILE_016_NODE_T0_2N_14CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_05 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 3 . OKAY Timers available: 10, used: 3 . OKAY Chanends available: 32, used: 7 . OKAY Memory available: 262144, used: 10220 . OKAY (Stack: 3984, Code: 5532, Data: 704) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED TOP_05_HAS_1_TILE_016_NODE_T0_2N_14CN_RUNS par on tile[0]: par 2N Client core[0] Server core[1] on tile[0]: [[combine]] par 14CN core[2] Client Server Client Server Client Server Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; #define START_CLIENT_SERVER_TASK_PAIR_WITH_ROOT_CLIENT(leds_port) \ Client_node_root (IOF_ROW, IOF_COL, \ all_conns[IOF_ROW][IOF_PAIR_HOR][1], IOF_ROW, IOF_PAIR_HOR, 1, \ all_conns[IOF_ROW][IOF_PAIR][2], IOF_ROW, IOF_PAIR, 2, \ all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0, leds_port); \ Server_node (IOF_ROW, IOF_COL+1, \ all_conns[IOF_ROW][IOF_PAIR], IOF_PAIR) #define START_CLIENT_SERVER_TASK_PAIR \ Client_node (IOF_ROW, IOF_COL,\ all_conns[IOF_ROW][IOF_PAIR_HOR][1], IOF_ROW, IOF_PAIR_HOR, 1, \ all_conns[IOF_ROW][IOF_PAIR][2], IOF_ROW, IOF_PAIR, 2, \ all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); \ Server_node (IOF_ROW, IOF_COL+1,\ all_conns[IOF_ROW][IOF_PAIR], IOF_PAIR) par { // Quasi-indentation with macro defines to avoid replicated par - which uses a core per pair // ie. to take full advantage of [[combine]] for all but the pair with the client root #define IOF_ROW_VER ((IOF_ROW + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( IOF_COL / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right on tile[0]: par { #undef IOF_ROW // === FIRST ROW === #undef IOF_COL #define IOF_ROW 0 // Left part here.. #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR_WITH_ROOT_CLIENT(outP4_leds); } on tile[0]: [[combine]] par { #undef IOF_ROW #undef IOF_COL #define IOF_ROW 0 // ..right part here #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 1 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 2 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 3 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; } } #elif (TOPOLOGY == TOP_06_HAS_1_TILE_032_NODE_T0_2N_30CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_06 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 3 . OKAY Timers available: 10, used: 3 . OKAY Chanends available: 32, used: 7 . OKAY Memory available: 262144, used: 16604 . OKAY (Stack: 7432, Code: 8080, Data: 1092) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_06_HAS_1_TILE_032_NODE_T0_2N_30CN_RUNS par on tile[0]: par 2N client core[0] Server core[1] on tile[0]: [[combine]] par 30CN core [2] Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; #define START_CLIENT_SERVER_TASK_PAIR_WITH_ROOT_CLIENT(leds_port) \ Client_node_root (IOF_ROW, IOF_COL, \ all_conns[IOF_ROW][IOF_PAIR_HOR][1], IOF_ROW, IOF_PAIR_HOR, 1, \ all_conns[IOF_ROW][IOF_PAIR][2], IOF_ROW, IOF_PAIR, 2, \ all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0, leds_port); \ Server_node (IOF_ROW, IOF_COL+1, \ all_conns[IOF_ROW][IOF_PAIR], IOF_PAIR) #define START_CLIENT_SERVER_TASK_PAIR \ Client_node (IOF_ROW, IOF_COL,\ all_conns[IOF_ROW][IOF_PAIR_HOR][1], IOF_ROW, IOF_PAIR_HOR, 1, \ all_conns[IOF_ROW][IOF_PAIR][2], IOF_ROW, IOF_PAIR, 2, \ all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); \ Server_node (IOF_ROW, IOF_COL+1,\ all_conns[IOF_ROW][IOF_PAIR], IOF_PAIR) par { // Quasi-indentation with macro defines to avoid replicated par - which uses a core per pair // ie. to take full advantage of [[combine]] for all but the pair with the client root #define IOF_ROW_VER ((IOF_ROW + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( IOF_COL / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right on tile[0]: par { // Takes the two cores that a par pair needs #undef IOF_ROW // === FIRST ROW === #undef IOF_COL #define IOF_ROW 0 // Left part here.. #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR_WITH_ROOT_CLIENT(outP4_leds); } on tile[0]: [[combine]] par { // All 30 tasks share one core #undef IOF_ROW #undef IOF_COL #define IOF_ROW 0 // ..right part here #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 1 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 2 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 3 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 4 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 5 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 6 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; #undef IOF_ROW #undef IOF_COL #define IOF_ROW 7 // === NEXT ROW === #define IOF_COL 0 START_CLIENT_SERVER_TASK_PAIR; #undef IOF_COL #define IOF_COL (1 * NUM_NODES_PER_PAIR) START_CLIENT_SERVER_TASK_PAIR; } } #elif (TOPOLOGY == TOP_07_HAS_1_TILE_002_NODE_T0_2CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_07 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 3180 . OKAY (Stack: 632, Code: 2246, Data: 302) Constraints checks PASSED TOP_07_HAS_1_TILE_002_NODE_T0_2CN_RUNS [[combine] par Client core[0] Server core[1] */ // Case to avoid "error: interface used as both client and server in one task" // A single pair that communicates with itself conn_if_t all_conns [NUM_CONNS_PER_NODE]; // Dim [3] [[combine]] par { Client_node_root (0, 0, all_conns[0], 0,0,0, all_conns[1], 0,0,1, all_conns[2], 0,0,2, outP4_leds); Server_node (0, 1, all_conns, 0); } #elif (TOPOLOGY == TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_08 runs with 0 us and very NotFair" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 4 . OKAY Timers available: 10, used: 4 . OKAY Chanends available: 32, used: 13 . OKAY Memory available: 262144, used: 23368 . OKAY (Stack: 8180, Code: 13452, Data: 1736) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_08_HAS_1_TILE_016_NODE_T0_2N_AS_CC_6CN_8CN_RUNS par on tile[0]: par par 2N Client(0 0) core[0] Client(0 2) core[1] [[combine]] par 6N core[2] Server(0 1) Server(0 3) Client(1 0) Server(1 1) Client(1 2) Server(1 3) [[combine]] par 8CN core[3] Client(2 0) Server(2 1) Client(2 2) Server(2 3) Client(3 0) Server(3 1) Client(3 2) Server(3 3) */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { par { // Client and server one core each // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][1], 0,1,1, all_conns[0][0][2], 0,0,2, all_conns[3][0][0], 3,0,0, outP4_leds); Client_node (0,2, all_conns[0][0][1], 0,0,1, all_conns[0][1][2], 0,1,2, all_conns[3][1][0], 3,1,0); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Server_node (0,1, all_conns[0][0], 0); Server_node (0,3, all_conns[0][1], 1); Client_node (1,0, all_conns[1][1][1], 1,1,1, all_conns[1][0][2], 1,0,2, all_conns[0][0][0], 0,0,0); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][1], 1,0,1, all_conns[1][1][2], 1,1,2, all_conns[0][1][0], 0,1,0); Server_node (1,3, all_conns[1][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][1], 2,1,1, all_conns[2][0][2], 2,0,2, all_conns[1][0][0], 1,0,0); Server_node (2,1, all_conns[2][0], 0); Client_node (2,2, all_conns[2][0][1], 2,0,1, all_conns[2][1][2], 2,1,2, all_conns[1][1][0], 1,1,0); Server_node (2,3, all_conns[2][1], 1); Client_node (3,0, all_conns[3][1][1], 3,1,1, all_conns[3][0][2], 3,0,2, all_conns[2][0][0], 2,0,0); Server_node (3,1, all_conns[3][0], 0); Client_node (3,2, all_conns[3][0][1], 3,0,1, all_conns[3][1][2], 3,1,2, all_conns[2][1][0], 2,1,0); Server_node (3,3, all_conns[3][1], 1); } } } #elif (TOPOLOGY == TOP_10_HAS_1_TILE_016_NODE_T0_16CN_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_10 stops" #endif /* Constraint check for tile[0]: Cores available: 8, used: 8 . OKAY Timers available: 10, used: 8 . OKAY Chanends available: 32, used: 25 . OKAY Memory available: 262144, used: 28128 . OKAY (Stack: 13764, Code: 12856, Data: 1508) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED TOP_10_HAS_1_TILE_016_NODE_T0_16CN_STOPS par on tile[0]: [[combine]] par 2CN core[0] Client Server [[combine]] par 2CN core[1] Client Server par (for 3 rows) par (for 2 pairs) [[combine]] par core[2][3][4][5][6][7] Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; par { #define IOF_ROW_VER ((iof_row + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( iof_col / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right #define IOF_ROW_START 0 // ROOT at ROW,COL = 0.0 #define iof_row 0 #define iof_col 0 on tile[0]: [[combine]] par { Client_node_root ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0, outP4_leds); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } // THE OTHERS IN ROW 0 (to the right of ROOT) #undef iof_row #undef iof_col #define iof_row 0 #define IOF_ROW_START 0 #define IOF_COL_START NUM_NODES_PER_PAIR on tile[0]: par (unsigned iof_col = IOF_COL_START; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } // THE OTHER FULL ROWS #undef iof_row #undef IOF_ROW_START #define IOF_ROW_START 1 on tile[0]: par (unsigned iof_row = IOF_ROW_START; iof_row < NUM_ROWS_PER_TILE; iof_row++) { par (unsigned iof_col = 0; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // // Flatten out Client_Server_pair_task #define I_CONN_INTERNAL [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } } } #elif (TOPOLOGY == TOP_11_HAS_2_TILE_016_NODE_T0_2CN_12CN_T1_2N_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_11 stops" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 7 . OKAY Timers available: 10, used: 7 . OKAY Chanends available: 32, used: 23 . OKAY Memory available: 262144, used: 10732 . OKAY (Stack: 4616, Code: 5392, Data: 724) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 2 . OKAY Timers available: 10, used: 2 . OKAY Chanends available: 32, used: 6 . OKAY Memory available: 262144, used: 3396 . OKAY (Stack: 1256, Code: 1880, Data: 260) Constraints checks PASSED. TOP_11_HAS_2_TILE_016_NODE_T0_2CN_12CN_T1_2N_STOPS par on tile[1]: par Client core[0] Server core[1] on tile[0]: par (for 1 pair) [[combine]] par core[0][1] Client Server on tile[0]: par (for 3 rows) par (for 2 pairs) [[combine]] par core[2][3][4][5][6][7] Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; par { #define IOF_ROW_VER ((iof_row + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( iof_col / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right #define IOF_ROW_START 0 // ROOT at ROW,COL = 0.0 #define iof_row 0 #define iof_col 0 // Same param set and use of macros (1/3) (+outP4_leds) on tile[1]: // Also using tile[1] (first, this time) par { Client_node_root ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0, null); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } // THE OTHERS IN ROW 0 (to the right of ROOT) #undef iof_row #undef iof_col #define iof_row 0 #define IOF_ROW_START 0 #define IOF_COL_START NUM_NODES_PER_PAIR on tile[0]: par (unsigned iof_col = IOF_COL_START; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } // THE OTHER FULL ROWS #undef iof_row #undef IOF_ROW_START #define IOF_ROW_START 1 on tile[0]: par (unsigned iof_row = IOF_ROW_START; iof_row < NUM_ROWS_PER_TILE; iof_row++) { par (unsigned iof_col = 0; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // // Flatten out Client_Server_pair_task #define I_CONN_INTERNAL [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } } } #elif (TOPOLOGY == TOP_12_HAS_1_TILE_012_NODE_T0_1N_2CN_8CN_1N_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_12 stops" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 7 . OKAY Timers available: 10, used: 7 . OKAY Chanends available: 32, used: 19 . OKAY Memory available: 262144, used: 9652 . OKAY (Stack: 3864, Code: 5148, Data: 640) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_12_HAS_1_TILE_012_NODE_T0_1N_2CN_8CN_1N_STOPS par on tile[0]: par 1N Client core[0] on tile[0]: [[combine]] par 2N core[1] Client Server par (for 2 rows) par (for 2 pairs) [[combine]] par core[2][3][4][5] Client Server on tile[0]: par 1N Server core[6] */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; par { #define IOF_ROW_VER ((iof_row + (NUM_ROWS-1)) % NUM_ROWS) // Above or below #define IOF_PAIR ( iof_col / NUM_NODES_PER_PAIR) #define IOF_PAIR_HOR ((IOF_PAIR + (NUM_PAIRS_PER_ROW-1)) % NUM_PAIRS_PER_ROW) // Left of right #define IOF_ROW_START 0 // ROOT at ROW,COL = 0.0 #define iof_row 0 #define iof_col 0 // Same param set and use of macros (1/3) (+outP4_leds) on tile[0]: par { Client_node_root ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0, outP4_leds); } // THE OTHERS IN ROW 0 (to the right of ROOT) #undef iof_row #undef iof_col #define iof_row 0 #define IOF_ROW_START 0 #define IOF_COL_START NUM_NODES_PER_PAIR on tile[0]: par (unsigned iof_col = IOF_COL_START; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } // THE OTHER FULL ROWS #undef iof_row #undef IOF_ROW_START #define IOF_ROW_START 1 on tile[0]: par (unsigned iof_row = IOF_ROW_START; iof_row < NUM_ROWS_PER_TILE; iof_row++) { par (unsigned iof_col = 0; iof_col < NUM_COLS; iof_col = iof_col + NUM_NODES_PER_PAIR) { // // Flatten out Client_Server_pair_task #define I_CONN_INTERNAL [[combine]] par { Client_node ( iof_row, iof_col, all_conns[iof_row][IOF_PAIR_HOR][1], iof_row, IOF_PAIR_HOR, 1, all_conns[iof_row][IOF_PAIR] [2], iof_row, IOF_PAIR, 2, all_conns[IOF_ROW_VER][IOF_PAIR][0], IOF_ROW_VER, IOF_PAIR, 0); Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } } #undef IOF_ROW_START #define IOF_ROW_START 0 // ROOT at ROW,COL = 0.0 #define iof_row 0 #define iof_col 0 // Same param set and use of macros (1/3) (+outP4_leds) on tile[0]: //[[combine]] Makes no difference par { Server_node ( iof_row, iof_col+1, all_conns[iof_row][IOF_PAIR], IOF_PAIR); } } #elif (TOPOLOGY == TOP_13_HAS_1_TILE_016_NODE_T0_8CN_8CN_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_13 stops" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 2 . OKAY Timers available: 10, used: 2 . OKAY Chanends available: 32, used: 6 . OKAY Memory available: 262144, used: 10420 . OKAY (Stack: 4016, Code: 5704, Data: 700) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED TOP_13_HAS_1_TILE_016_NODE_T0_8CN_8CN_STOPS par on tile[0]: [[combine]] par 8CN core[0] Client Server Client Server Client Server Client Server [[combine]] par 8CN core[1] Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][2], 0,1,2, all_conns[0][0][0], 0,0,0, all_conns[3][0][1], 3,0,1, outP4_leds); Server_node (0,1, all_conns[0][0], 0); Client_node (0,2, all_conns[0][0][2], 0,0,2, all_conns[0][1][0], 0,1,0, all_conns[3][1][1], 3,1,1); Server_node (0,3, all_conns[0][1], 1); Client_node (1,0, all_conns[1][1][2], 1,1,2, all_conns[1][0][0], 1,0,0, all_conns[0][0][1], 0,0,1); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][2], 1,0,2, all_conns[1][1][0], 1,1,0, all_conns[0][1][1], 0,1,1); Server_node (1,3, all_conns[1][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][2], 2,1,2, all_conns[2][0][0], 2,0,0, all_conns[1][0][1], 1,0,1); Server_node (2,1, all_conns[2][0], 0); Client_node (2,2, all_conns[2][0][2], 2,0,2, all_conns[2][1][0], 2,1,0, all_conns[1][1][1], 1,1,1); Server_node (2,3, all_conns[2][1], 1); Client_node (3,0, all_conns[3][1][2], 3,1,2, all_conns[3][0][0], 3,0,0, all_conns[2][0][1], 2,0,1); Server_node (3,1, all_conns[3][0], 0); Client_node (3,2, all_conns[3][0][2], 3,0,2, all_conns[3][1][0], 3,1,0, all_conns[2][1][1], 2,1,1); Server_node (3,3, all_conns[3][1], 1); } } } #elif (TOPOLOGY == TOP_14_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_14 runs" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 4 . OKAY Timers available: 10, used: 4 . OKAY Chanends available: 32, used: 12 . OKAY Memory available: 262144, used: 10780 . OKAY (Stack: 4048, Code: 6016, Data: 716) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_14_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS par on tile[0]: par Server core[0] Server core[1] [[combine]] par 6CN core [2] Client Client Client Server Client Server [[combine]] par 8CN core[3] Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { par { // Two servers one core each Server_node (0,1, all_conns[0][0], 0); Server_node (0,3, all_conns[0][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][2], 0,1,2, all_conns[0][0][0], 0,0,0, all_conns[3][0][1], 3,0,1, outP4_leds); Client_node (0,2, all_conns[0][0][2], 0,0,2, all_conns[0][1][0], 0,1,0, all_conns[3][1][1], 3,1,1); Client_node (1,0, all_conns[1][1][2], 1,1,2, all_conns[1][0][0], 1,0,0, all_conns[0][0][1], 0,0,1); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][2], 1,0,2, all_conns[1][1][0], 1,1,0, all_conns[0][1][1], 0,1,1); Server_node (1,3, all_conns[1][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][2], 2,1,2, all_conns[2][0][0], 2,0,0, all_conns[1][0][1], 1,0,1); Server_node (2,1, all_conns[2][0], 0); Client_node (2,2, all_conns[2][0][2], 2,0,2, all_conns[2][1][0], 2,1,0, all_conns[1][1][1], 1,1,1); Server_node (2,3, all_conns[2][1], 1); Client_node (3,0, all_conns[3][1][2], 3,1,2, all_conns[3][0][0], 3,0,0, all_conns[2][0][1], 2,0,1); Server_node (3,1, all_conns[3][0], 0); Client_node (3,2, all_conns[3][0][2], 3,0,2, all_conns[3][1][0], 3,1,0, all_conns[2][1][1], 2,1,1); Server_node (3,3, all_conns[3][1], 1); } } } #elif (TOPOLOGY == TOP_15_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_15 stops" #endif /* Disregard memory usage, since very dependent on printing Constraint check for tile[0]: Cores available: 8, used: 4 . OKAY Timers available: 10, used: 4 . OKAY Chanends available: 32, used: 13 . OKAY Memory available: 262144, used: 22616 . OKAY (Stack: 8316, Code: 12788, Data: 1512) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 1 . OKAY Timers available: 10, used: 1 . OKAY Chanends available: 32, used: 0 . OKAY Memory available: 262144, used: 1072 . OKAY (Stack: 348, Code: 596, Data: 128) Constraints checks PASSED. TOP_15_HAS_1_TILE_016_NODE_T0_2N_AS_SS_6CN_8CN_STOPS par on tile[0]: par Server-tim core[0] Server core[1] [[combine]] par 6CN core [2] Client Client Client Server Client Server [[combine]] par 8CN core[3] Client Server Client Server Client Server Client Server */ conn_if_t all_conns [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { par { // Two servers, one core each Server_node_timeout (0,1, all_conns[0][0], 0); Server_node (0,3, all_conns[0][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node_root (0,0, all_conns[0][1][2], 0,1,2, all_conns[0][0][0], 0,0,0, all_conns[3][0][1], 3,0,1, outP4_leds); Client_node (0,2, all_conns[0][0][2], 0,0,2, all_conns[0][1][0], 0,1,0, all_conns[3][1][1], 3,1,1); Client_node (1,0, all_conns[1][1][2], 1,1,2, all_conns[1][0][0], 1,0,0, all_conns[0][0][1], 0,0,1); Server_node (1,1, all_conns[1][0], 0); Client_node (1,2, all_conns[1][0][2], 1,0,2, all_conns[1][1][0], 1,1,0, all_conns[0][1][1], 0,1,1); Server_node (1,3, all_conns[1][1], 1); } [[combine]] par { // [R][P][C] [R][P][C] [R][P][C] Client_node (2,0, all_conns[2][1][2], 2,1,2, all_conns[2][0][0], 2,0,0, all_conns[1][0][1], 1,0,1); Server_node (2,1, all_conns[2][0], 0); Client_node (2,2, all_conns[2][0][2], 2,0,2, all_conns[2][1][0], 2,1,0, all_conns[1][1][1], 1,1,1); Server_node (2,3, all_conns[2][1], 1); Client_node (3,0, all_conns[3][1][2], 3,1,2, all_conns[3][0][0], 3,0,0, all_conns[2][0][1], 2,0,1); Server_node (3,1, all_conns[3][0], 0); Client_node (3,2, all_conns[3][0][2], 3,0,2, all_conns[3][1][0], 3,1,0, all_conns[2][1][1], 2,1,1); Server_node (3,3, all_conns[3][1], 1); } } } #elif (TOPOLOGY == TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR) #if (TOP_WARNINGS==1) // From "makefile" #warning TOP_STR "Top_20 runs" #endif /* Constraint check for tile[0]: Cores available: 8, used: 6 . OKAY Timers available: 10, used: 6 . OKAY Chanends available: 32, used: 7 . OKAY Memory available: 262144, used: 5220 . OKAY (Stack: 1076, Code: 3328, Data: 816) Constraints checks PASSED. Constraint check for tile[1]: Cores available: 8, used: 6 . OKAY Timers available: 10, used: 6 . OKAY Chanends available: 32, used: 7 . OKAY Memory available: 262144, used: 4908 . OKAY (Stack: 1076, Code: 3060, Data: 772) Constraints checks PASSED. Build Complete TOP_20_HAS_2_TILE_004_T0_2N_BY3SUB_T1_2N_BY3SUB_RUNS_FAIR par on tile[0]: par Client (0 0) par subtask 1 on core[0] subtask 2 on core[1] subtask 1 on core[2] Server (0 1) par subtask 1 on core[3] subtask 2 on core[4] subtask 1 on core[5] on tile[1]: par Client (1 0) par subtask 1 on core[0] subtask 2 on core[1] subtask 1 on core[2] Server (1 1) par subtask 1 on core[3] subtask 2 on core[4] subtask 1 on core[5] */ chan chans [NUM_ROWS][NUM_PAIRS_PER_ROW][NUM_CONNS_PER_NODE]; // [ROW][PAIR][CONN] = [R][P][C] par { on tile[0]: par { Client_node_3_composite_par_root (0,0, chans[0][0][1], chans[0][0][2], chans[1][0][0], outP4_leds); Server_node_3_composite_par (0,1, chans[0][0][0], chans[0][0][1], chans[0][0][2]); } on tile[1]: par { Client_node_3_composite_par (1,0, chans[1][0][1], chans[1][0][2], chans[0][0][0]); Server_node_3_composite_par (1,1, chans[1][0][0], chans[1][0][1], chans[1][0][2]); } } #else #if (TOP_WARNINGS==1) // From "makefile" #error CODE MISSING #endif #endif return 0; } // main