Question
Can use C, C++, Java or Python 3. You are to implement three programs that implement an error-detection mechanism using the standard CRC (Cycle Redundancy
Can use C, C++, Java or Python 3.
You are to implement three programs that implement an error-detection mechanism using the standard CRC (Cycle Redundancy Check) algorithm. The first program, named generator, reads from the standard input a line of ASCII text containing an n-bit message consisting of a string of 0s and 1s with optional spaces (blanks) at arbitrary positions. The second line is the k-bit polynomial, also in ASCII. The generator program writes two lines to the standard output. The first line is the n + k 0s and 1s representing the message to be transmitted. The second line of output is the polynomial, just as it was read (with the possible exception of optional spaces).
The second program, named verifier, reads the output of the generator program and displays a message indicating whether it is correct or not.
The final program, named alter, reads the output from the generator program (that is, two lines of 1s and 0s), and inverts one bit on the first line depending on its command-line argument, which is the bit number to be changed. The leftmost bit on the first line is numbered 1. All other bits in the input are copied, without change, to the standard output. If you type ./generator < inputfile | ./verifier you should receive a message indicating that the message is correct. But if you type ./generator < inputfile | ./alter 1 | ./verifier you will get an appropriate error indication. These commands assume that inputfile is the name of a file containing the two appropriate input lines.
Details
The longest message and polynomial your program will need to process will contain 128 bits. Of course there can certainly be smaller messages and polynomials used in evaluating your work. You may assume all the input used with your programs will be syntactically correct. That is, there will be no illegal characters in the input, or more than 128 1s and 0s in a message or generator polynomial. Of course, the message with the suffixed cyclical redundancy check can be longer than 128 bits, as indicated in the problem statement. You may write your programs using C, C++, Java or Python 3. In all cases, a single file for each program, appropriately named, will be expected as your solution. If your solution requires something Computer Science 3550 Programming Assignment 1 Spring 2018 other than a single command for compilation and/or execution (that is, cc, c++, javac/java, or python3), then you must provide appropriate details. As noted, a Java program (for example, generator.java) will be compiled using the command javac generator.java and executed using the command java generator < inputfile. A python3 program (for example generator.py) will be executed using the command python3 generator.py < inputfile.
Example of how it works.
G = 1011 M = 11010011101100
G has 4 bits, so we will add three 0 bits to the end of M. M has 14 bits, so there will be 14 division steps.
Generator: 1011 Message: 11010011101100 bits in G = 4, bits in M = 17 bits in CRC = 3, # division steps = 14
Division step 1: numerator: 1101 generator: 1011 quotient: 1 remainder: 110 Division step 2: numerator: 1100 generator: 1011 quotient: 1 remainder: 111 Division step 3: numerator: 1110 generator: 1011 quotient: 1 remainder: 101 Division step 4: numerator: 1011 generator: 1011 quotient: 1 remainder: 000 Division step 5: numerator: 0001 <-- note the leftmost bit is 0 generator: 1011 quotient: 0 <-- so the quotient is 0 remainder: 001 <-- and the XOR isn't done Division step 6: numerator: 0011 <-- as before, the leftmost bit is 0 generator: 1011 quotient: 0 <-- so the quotient is 0 remainder: 011 <-- and the XOR isn't done Division step 7: numerator: 0110 <-- same as the two preceding steps generator: 1011 quotient: 0 remainder: 110 Division step 8: numerator: 1101 <-- now we've got a leftmost 1 bit generator: 1011 quotient: 1 <-- so we do the XOR remainder: 110 <-- and get this result Division step 9: numerator: 1101 generator: 1011 quotient: 1 remainder: 110 Division step 10: numerator: 1100 generator: 1011 quotient: 1 remainder: 111 Division step 11: numerator: 1110 generator: 1011 quotient: 1 remainder: 101 Division step 12: numerator: 1010 generator: 1011 quotient: 1 remainder: 001 Division step 13: numerator: 0010 generator: 1011 quotient: 0 remainder: 010 Division step 14: numerator: 0100 generator: 1011 quotient: 0 remainder: 100 Generator: 1011 Message: 11010011101100 CRC: 100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started