macsim/src/noc/pnbe0.c
/*
 * Initialize the paternoster NoC
 * - overwrite generic functions of node
 * - allocate memory for the context specific variables
 * - initialize these variables
 */
Initialize the paternoster NoC
- overwrite generic functions of node
- allocate memory for the context specific variables
- initialize these variables
Initialize the paternoster NoC - overwrite generic functions of node - allocate memory for the context specific variables - initialize these variables
void pnbe0_init(node_t *node)
{
	node->noc_send_flit         = pnbe0_send_flit;
	node->noc_recv_flit         = pnbe0_recv_flit;
	node->noc_sender_ready      = pnbe0_sender_ready;
	node->noc_probe_rank        = pnbe0_probe_rank;
	node->noc_probe_any         = pnbe0_probe_any;
	node->noc_route_one_cycle   = pnbe0_route_one_cycle;
	pnbe0_context_t *context = malloc(sizeof(pnbe0_context_t));
	if(context == NULL){
		fatal("Malloc failed to allocate memory");
	}
	node->noc_context = context;
	msg_field_clear_back_up(&((pnbe0_context_t *)node->noc_context)->paternoster_in_south);
	msg_field_clear_back_up(&((pnbe0_context_t *)node->noc_context)->paternoster_in_west);
	msg_field_clear_back_up(&((pnbe0_context_t *)node->noc_context)->paternoster_in_core);
	uint_fast32_t size;
	size = CORNER_BUFFER_SIZE;
	buffer_init(&((pnbe0_context_t *)node->noc_context)->corner_buffer, size);
	size = conf_noc_width;
	buffer_init(&((pnbe0_context_t *)node->noc_context)->core_buffer, size);
	size = conf_noc_width - 1;
	buffer_init(&((pnbe0_context_t *)node->noc_context)->injectionQueue, 128);
	((pnbe0_context_t *)node->noc_context)->sentNorth = false;
	((pnbe0_context_t *)node->noc_context)->sentEast = false;
	((pnbe0_context_t *)node->noc_context)->isSignaledNorth = false;
	((pnbe0_context_t *)node->noc_context)->isSignaledEast = false;
	((pnbe0_context_t *)node->noc_context)->signalWest = false;
	((pnbe0_context_t *)node->noc_context)->signalSouth = false;
	int i;
	((pnbe0_context_t *)node->noc_context)->h_timers = malloc(sizeof(rank_t)*conf_noc_width);
	for(i = 0; i < conf_noc_width; i++){
		((pnbe0_context_t *)node->noc_context)->h_timers[i] = 0;
	}
	((pnbe0_context_t *)node->noc_context)->receive_timeout = 0;
	((pnbe0_context_t *)node->noc_context)->sendBlock = 0;
}
void pnbe0_init ( node_t * node ) { node -> noc_send_flit = pnbe0_send_flit ; node -> noc_recv_flit = pnbe0_recv_flit ; node -> noc_sender_ready = pnbe0_sender_ready ; node -> noc_probe_rank = pnbe0_probe_rank ; node -> noc_probe_any = pnbe0_probe_any ; node -> noc_route_one_cycle = pnbe0_route_one_cycle ; pnbe0_context_t * context = malloc ( sizeof ( pnbe0_context_t ) ) ; if ( context == NULL ) { fatal ( " " ) ; } node -> noc_context = context ; msg_field_clear_back_up ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> paternoster_in_south ) ; msg_field_clear_back_up ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> paternoster_in_west ) ; msg_field_clear_back_up ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> paternoster_in_core ) ; uint_fast32_t size ; size = CORNER_BUFFER_SIZE ; buffer_init ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> corner_buffer , size ) ; size = conf_noc_width ; buffer_init ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> core_buffer , size ) ; size = conf_noc_width - 1 ; buffer_init ( & ( ( pnbe0_context_t * ) node -> noc_context ) -> injectionQueue , 128 ) ; ( ( pnbe0_context_t * ) node -> noc_context ) -> sentNorth = false ; ( ( pnbe0_context_t * ) node -> noc_context ) -> sentEast = false ; ( ( pnbe0_context_t * ) node -> noc_context ) -> isSignaledNorth = false ; ( ( pnbe0_context_t * ) node -> noc_context ) -> isSignaledEast = false ; ( ( pnbe0_context_t * ) node -> noc_context ) -> signalWest = false ; ( ( pnbe0_context_t * ) node -> noc_context ) -> signalSouth = false ; int i ; ( ( pnbe0_context_t * ) node -> noc_context ) -> h_timers = malloc ( sizeof ( rank_t ) * conf_noc_width ) ; for ( i = 0 ; i < conf_noc_width ; i ++ ) { ( ( pnbe0_context_t * ) node -> noc_context ) -> h_timers [ i ] = 0 ; } ( ( pnbe0_context_t * ) node -> noc_context ) -> receive_timeout = 0 ; ( ( pnbe0_context_t * ) node -> noc_context ) -> sendBlock = 0 ; }
Initialize the paternoster NoC
 - overwrite generic functions of node
 - allocate memory for the context specific variables
 - initialize these variables
Initialize the paternoster NoC - overwrite generic functions of node - allocate memory for the context specific variables - initialize these variables
// Override functions // add NoC specific fields to the node // initialize the just added fields // This sets the corner-buffer size // This sets the core-buffer size // This sets the injectionQueue size (+1) // add and initialize timers