# bonus assignment.

Added on - 19 Sep 2019

Showing pages 1 to 1 of 2 pages
BONUS ASSIGNMENTWrite a program to implement the checksum method.The implementation has two parts:a.Calculating the checksum at the senderb.Verifying the checksum at the receiverCalculating the checksum at the senderInputs:4 data each consisting of 16-bit (binary)Output: Checksum of 16-bit (binary)Example:http://mathforum.org/library/drmath/view/54379.htmlFor example, suppose we have the following data. I separate thedata into groups of 4 bits only for readability.1000 0110 0101 11101010 1100 0110 00000111 0001 0010 10101000 0001 1011 0101First, we add the 16-bit values 2 at a time:1000 0110 0101 1110 First 16-bit value+ 1010 1100 0110 0000 Second 16-bit value---------------------1 0011 0010 1011 1110 Produced a carry-out, which gets added+ \----------------> 1 back into LSb---------------------0011 0010 1011 1111+ 0111 0001 0010 1010 Third 16-bit value---------------------0 1010 0011 1110 1001 No carry to swing around (**)+ 1000 0001 1011 0101 Fourth 16-bit value---------------------1 0010 0101 1001 1110 Produced a carry-out, which gets added+ \----------------> 1 back into LSb---------------------0010 0101 1001 1111 Our "one's complement sum"(**) Note that we could "swing around" the carry-out of 0, but adding0 back into the LSb has no effect on the sum. (But technically, that'swhat the checksum generator does.)Then we have to take the one's complement of the sum. We do this bysimply inverting all the bits in the final result from above:0010 0101 1001 1111 Our "one's complement sum"1101 1010 0110 0000 The "one's complement"Therefore, the checksum generated from the given data would bePage1of2 