Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: This homework gives practice in MIPS file I/O and insight into parity. Parity is a means of checking if stored data has been corrupted.

Objective: This homework gives practice in MIPS file I/O and insight into parity. Parity is a means of checking if stored data has been corrupted. Keep in mind that parity checking would really be implemented in circuitry for speed, this is just a simulation and practice in reading files.

Create a MIPS program that fulfills the following specifications:

create a plain text file with the sentence: The quick brown fox jumped over the lazy river. This file must be in the same folder from which you run MARS.

save the name of your file in the data section

use SYSCALLs to open the file, then read it into a buffer in data, then close the file; allocate space for another buffer to contain the text+parity

since the ASCII characters only use 7 bits (6-0), bit 7 is unused; we will use this bit to store parity

even parity bit: set bit 7 to 0 if the ascii code contains an even number of bits; otherwise set to 1

loop through the buffer:

read a byte

set bit 7 for even parity

write the byte to the second buffer

put the code that determines 1 or 0 for the parity bit in a function

then write another function to check the parity

run the program once to check that you get the ok message if the data has not been corrupted

run the program again, set a breakpoint before you jump to the check function and manually corrupt the data as seen in the screen shot below; the first a 1010 was changed to 2 0010 which changed the parity; now the program will print the not ok message

Here are two sample runs:

- the first run is without the breakpoint so the data is ok

- the second where the data was manually corrupted

image text in transcribedimage text in transcribed

data is ok program is finished running -- data has been corrupted program is finished running

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions