CMSC313, Computer Organization & Assembly Language Programming, Spring 2013

Project 2: An Error-Correcting Code

Due: Tuesday February 26, 2013 11:59pm


Objective

The objective of this programming project is for you to gain some familiarity with the bit manipulation instructions in assembly language programming.


Background

In Project 1, we saw that ISBN codes can detect some simple typographical errors. However, there is not much we can do after we have detected the error. An error-correcting code can fix errors, not just detect them.

In this project, we will use a 31-bit Hamming code that can correct a 1-bit error in each 32-bit codeword. Each 32-bit codeword encodes 3 bytes of the original data. The format of the codeword is on the Project 2 Codeword Format page.


Assignment

Write an assembly language program that encodes the input file using the codeword format described below. Your program should read from standard input and write to standard output. We can use Unix redirection to read from and write to files: ./a.out <ifile >ofile

Some details:

Two programs decode and corrupt are provided in the GL file system in the directory:

/afs/umbc.edu/users/c/h/chang/pub/cs313
Copy these programs to your own directory. They can be used to decode an encoded file and to corrupt an encoded file. You can use these programs to check if your program is working correctly. Both programs use I/O redirection.

Record some sample runs of your program using the Unix script command. You should show that you can encode a file using your program, then decode it and obtain a file that is identical to the original. Use the Unix diff command to compare the original file with the decoded file. You should also show that this works when the file is corrupted. For example:

linux2% ./a.out <test_file >encoded_file linux2% ./decode <encoded_file >decoded_file linux2% diff decoded_file test_file linux2% ./corrupt <encoded_file >corrupted_file linux2% diff encoded_file corrupted_file Binary files encoded_file and corrupted_file differ linux2% ./decode <corrupted_file >decoded_file2 linux2% diff decoded_file2 test_file


Extra Credit

For 10 points extra credit, revise your program so that it reads at least 200 bytes during each system call to READ (if that many bytes are available). Your program must also write at least 200 bytes for each system call to WRITE. (Note: it is advantageous to you if the number of bytes you read is a multiple of 3.) You will need an inner loop to process 3-byte blocks of the input you have read.

As stated previously, the extra credit policy for this class is that extra credit is only given for programs that are mostly correct. A half-hearted attempt at extra credit that doesn't really work will receive 0 extra credit points. (This is to have you concentrate on the regular portion of the assignment.)


Implementation Notes


Turning in your program

Use the UNIX submit command on the GL system to turn in your project. You should submit two files: 1) the assembly language program and 2) the typescript file of sample runs of your program. The class name for submit is cs313. The name of the assignment name is proj2. The UNIX command to do this should look something like:

submit cs313 proj2 encode.asm typescript


Last Modified: 22 Jul 2024 11:28:12 EDT by Richard Chang
to Spring 2013 CMSC 313 Homepage