Stage 13: Error Correction

The error correction stage is the fourteenth and final stage of the pipeline, and is specified by the “ecc model” attribute of the radio receiver. It is invoked when a packet completes reception, immediately after the final return of the error allocation stage, with no simulation time elapsing in between. Exactly one invocation of this stage occurs for each packet that is considered valid (as determined by the channel match stage). The purpose of this stage is to determine whether or not the arriving packet can be accepted and forwarded via the channel’s corresponding output stream to one of the receiver’s neighboring modules in the destination node. This is usually dependent upon whether the packet has experienced collisions, the result computed in the error allocation stage, and the ability of the receiver to correct the errors affecting the packet (hence the name of the stage). Based on the determination of this stage, the Kernel will either destroy the packet, or allow it to proceed into the destination node. In addition, this result affects error and throughput results collected for the receiver channel.

The Simulation Kernel requires that the error correction stage procedure accept a packet address as its sole argument. The determination to accept or reject the packet is then expected by the Kernel within the TDA represented by the symbolic constant OPC_TDA_RA_PK_ACCEPT. The assigned value should be an integer equal to the constant OPC_TRUE to indicate acceptance; otherwise the integer value OPC_FALSE should be assigned to indicate rejection. No other results are required. Interface requirements for this stage are specified in Figure 100.

Figure 100: Templates for Radio Transceiver Pipeline: Error Correction Stage

Not MT-safe (will execute sequentially in a parallel simulation):

void
error_correction_template (Packet* pk)
	{
	int result;

	FIN (error_correction_template (Packet* pk))

	/* extract required information from packet. */

	/* determine if packet should be accepted or rejected. */

	/* place result in TDA to return to Simulation Kernel. */

	op_td_set_int (pk, OPC_TDA_RA_PK_ACCEPT, result);

	FOUT
	}

MT-safe (can execute in parallel in a parallel simulation):

void
error_correction_template_mt (OP_SIM_CONTEXT_ARG_OPT_COMMA Packet* pk)
	{
	int result;

	FIN_MT (error_correction_template (Packet* pk))

	/* extract required information from packet. */

	/* determine if packet should be accepted or rejected. */

	/* place result in TDA to return to Simulation Kernel. */
	op_td_set_int (pk, OPC_TDA_RA_PK_ACCEPT, result);

	FOUT
	}