Program #2Design and implement an assembly program that uses Hamming's Algorithm to detect and correct errors in a byte stream. 1. LogisticsProgram #2 is worth 100 points, or 10% of your final grade.
This program flexes your muscles in the following areas:
2. DescriptionYou should write two programs that use Hamming's algorithm:
Hamming's algorithmHamming's algorithm is described in our text on pages 61-64. In short, the Hamming algorithm is one method for creating an error-correcting code. Data is encoded with error-correcting information and then decoded. During the decoding process, any single-bit errors in the original data can be detected and corrected using the algorithm. The steps for encoding are:
The steps for decoding are:
Some detailsFor Program #2, let's some parameters:
If you're ambitious you can increase your data word size to 16 bytes (128 bits). This is the maximum data word size that can be handled with 8 check bits using the Hamming algorithm. It's some extra work though. Note that the overhead in this case (128 bits of data) is only 6% (8/128). 3. ImplementationIn Program #1, we almost exclusively dealt with 4 byte integers. Now, you have to be very aware of byte size. Including:
Reading & writing bytes of dataYou can use two C functions to read and write data 1 byte at a time. They are:
Notice that getchar() and putchar() deal with 4 byte quantities. The 1 byte read or written will be found in the lower byte of the 4 bytes. For more information and examples, try "help" on Microsoft Visual-whatever or google "getchar +visual". Organizing the code wordIn my implementation, I found it easier to separate the check bits and the data word when creating my code word. Instead of the organization shown in the example above, I used the following setup:
Please note this choice is not required. I just found it easier to design the program this way. Lecture topicsI will lecture on the following topics:
Is this section a reminder for you or me? 4. GradingThis is an individual project. If you need help, please see me. My standard office hours remain: MW 5:00-6:30pm & 8:30-10:00pm or email to setup an better time. Please place your solution in a folder named "prog2" (or something similar) in your k: drive folder for our class. In this folder, you should include:
Always recompile and run your code here, on the k: drive, to exorcise any potential system-specific demons. You will be graded on whether your solution works. You will also be graded on your ability to show you understand the code you turn in. You do this by:
A program that works, without meeting these other criteria will lose (significant) points. 5. Hints, etcI will provide a couple test cases of my own later this week. A fairly detailed example of Hamming's algorithm at work: Program #2 example |