Instructions for Cyclic Encoder/Decoder

About Cyclic Codes

Cyclic encoding is a way of introducing redundancy to data words by multiplying them with an encoder word. This program displays the encoded word, given a data word and an encoder word.

To retrieve the data word, the encoded word is divided by the encoder word. At the division a fault is detected as a non-zero remainder.

This method of coding can detect all single bit errors and all runs of adjacent bit errors up to a length of n-k, where k is the number of data bits and n is the number of bits in the encoded word.

How the Cyclic Encoder part of the program works

Input

The input consists of a data word, which is the information we wish to protect against error, and an encoder word, which is the constant by which we multiply the data word in order to encode it. Both words should be given in binary form.

Calculations

The data word and the code word are multiplied together, using modulo2 addition.

Output

The output provided by the system is an encoded word. The encoded word is given in binary form.

How the Cyclic Decoder part of the program works

Input

The input for the decoder consists of an encoded data word, which contains the information we want to retrieve, and the encoder word, which was used to encode the encoded word. Both words should be given in binary form.

Calculations

The system retrieves the data word by dividing the encoded word by the encoder word, if there is a non-zero remainder a fault is detected.

Output

The output from the decoder is the decoded data word, the remainder from the division that was performed to do the decoding and a message that tells whether the decoding was successful or if a fault was detected. All numbers are given in binary form.

Håkan Selldin