Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Errors can be introduced when a block of data is transmitted or stored. Checksum is a general term for a value that is calculated from

Errors can be introduced when a block of data is transmitted or stored. Checksum is a general term for a value that is calculated from the original block of data, and which can be used to determine whether an error exists after the data is transmitted or stored. There are many different types of checksums, with different error detection properties. Checksums are related to hash functions, error correcting codes, and cryptographic hash functions.

If the checksum is transmitted/stored with the block of data, then it can be compared with a recalculated checksum to determine whether an error has occurred.

In this lab you will take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".".

The syscall to read a string (sycall code 8) adds a newline to the string (before the null byte) if the string is shorter than the maximum length specified. If there is a newline in the string that you read, replace it with a null byte Do not use the newline when calculating the checksum.

To calculate our checksum, add up the ASCII codes for the characters in the string, then find the remainder after dividing by 64. Finally, add the ASCII code for blank to the remainder. This give you the checksum.

Hints

Use the lbu instruction to load one character of the string into a register. The lbu instruction loads one byte into the low order byte of the register and sets all the other bits to 0.

Remember that what is stored in memory for a character is the ASCII code for that character.

Look up the ASCII codes for blank, newline (also called line feed), and dot/period. The null byte is 0x0.

Remember your comments should reflect the purpose of the statements. Write comments like "add char to checksum" not comments like "$f7 = $f7 + $f4".

Don't be stubborn and wait to put in your comments till the end. And remember it's very important to comment your register usage.

Sample Execution-

Enter a string (. to end): Error Correction!

The checksum is: C

Enter a string (. to end): Java C C++

The checksum is: >

Enter a string (. to end): UNIX Linux

The checksum is: T

Enter a string (. to end): macOS 10.12.2

The checksum is: %

Enter a string (. to end): .

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

develop ideas for a research project;

Answered: 1 week ago