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

What to turn in:

after you test your program, upload the .asm file to eLearning

This is what the memory looked like on my sample program:

image text in transcribed

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 transcribed

Data Segment Value (ec Value 1) 06574 0740000:000000000006 Address Value (+4) Value (+8) Value (+14) Value (+18) Value (+1c) 0x10010000 b?4786574 0x7478742e 0x00000000 020656854 0x63697571 0x7262206b 0x206e776f 0x20786166 0x10010020 0x7060756a x61206465 0x20726576 8x20656874 0x797a616c 0x76697220 x002e7265 0x00000000 0x10010060 0x0000000 0x00000000 0x00000000 8x0000000 0x00000000 x00000000 x00000000 0x00000000 0x10010080 0x00000000 0x00000000 0x00000000 x00000000 0x00000000 0x00000000 x00000000 x00000000 0x100100a x0000000 0x00000000 0x00000000 x0000000 0x00000000 x00000000 x0000000 0x00000000 0x100100e x00000000 0x00000000 0x00000000 x00000000 0x00000000 x00000000 x0000000 x00000000 0x10010100 0x00000000 0xe00e000 0x10010120 ex 0x6369t571 0x72e2aeb 8xaBee776f0xa0786166 eedfs6a 0x6fa0e465 0xa0726516 8xa065ce874 0xf9fae16c 0xf66972a 8x002e7265 0x00000000 x00000000 0x00000000 9x2065e8 Data Segment Value (ec Value 1) 06574 0740000:000000000006 Address Value (+4) Value (+8) Value (+14) Value (+18) Value (+1c) 0x10010000 b?4786574 0x7478742e 0x00000000 020656854 0x63697571 0x7262206b 0x206e776f 0x20786166 0x10010020 0x7060756a x61206465 0x20726576 8x20656874 0x797a616c 0x76697220 x002e7265 0x00000000 0x10010060 0x0000000 0x00000000 0x00000000 8x0000000 0x00000000 x00000000 x00000000 0x00000000 0x10010080 0x00000000 0x00000000 0x00000000 x00000000 0x00000000 0x00000000 x00000000 x00000000 0x100100a x0000000 0x00000000 0x00000000 x0000000 0x00000000 x00000000 x0000000 0x00000000 0x100100e x00000000 0x00000000 0x00000000 x00000000 0x00000000 x00000000 x0000000 x00000000 0x10010100 0x00000000 0xe00e000 0x10010120 ex 0x6369t571 0x72e2aeb 8xaBee776f0xa0786166 eedfs6a 0x6fa0e465 0xa0726516 8xa065ce874 0xf9fae16c 0xf66972a 8x002e7265 0x00000000 x00000000 0x00000000 9x2065e8

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_2

Step: 3

blur-text-image_3

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

Neo4j Data Modeling

Authors: Steve Hoberman ,David Fauth

1st Edition

1634621913, 978-1634621915

More Books

Students also viewed these Databases questions