Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 Write a MIPS program (which must be named as hw4_prob1.s) that will read in a base (as an integer) and a value (nonnegative

Problem 1 Write a MIPS program (which must be named as hw4_prob1.s) that will read in a base (as an integer) and a value (nonnegative integer but as an ASCII string) in that base and print out the decimal value; you must implement a function (which accepts a base and an address for a string as parameters, and returns the value) and call the function from the main program. The base will be given in decimal and will be between 2 and 36, and the digits for the values will be in set [09, az]. You can assume that no overflow will occur and the value is valid in the given base. An example run will be: Enter a base (between 2 and 36 in decimal): 2 Enter a number in base 2: 110 The value in decimal is: 6 Then you need to test program using the above case and the following cases and include the results in the pdf file you need to submit. Enter a base (between 2 and 36 in decimal): 10 Enter a number in base 10: 13579 The value in decimal is: 13579 Enter a base (between 2 and 36 in decimal): 16 Enter a number in base 16: abcdef0 The value in decimal is: 180150000 Hint: The input and output can be done using syscalls in MIPS that are given on p. A-44.

Problem 2 (60 points) Write a MIPS program (which must be named as hw4_prob2.s) that will 1) read in an image name (gray level image in binary format), the number of rows and the number of columns, 2) read in the image (must be implemented using a function), 3) compute its histogram (must be implemented using a function), and 4) then output the histogram (must be implemented using a function). You can use the provided program (test_histogram.s on the class web site) for 1) and 2). You can assume the image size is no larger than 500x500. Then you need to test your program using three different cases and include the results in the pdf file you need to submit. You can use the three images that can be found on the class web site at http://www.cs.fsu.edu/~liux/courses/cda3100/assignments/seminoles_tiny.bin, http://www.cs.fsu.edu/~liux/courses/cda3100/assignments/seminoles.bin, and http://www.cs.fsu.edu/~liux/courses/cda3100/assignments/lena.bin. Additional information: The histogram of an image is widely used to characterize the image in content-based retrieval and other applications. It counts the number of occurrences of all the pixel values (0 255 in this case). The following C/C++ function computes the histogram of the input image.

image text in transcribed

/* Here image is the starting address of image. which has nrow rows and ncol column h is the histogram of the image. s. int histogram (unsigned char Himage, int nrow, int ncol, int *h) int i. j. k: unsigned char *p: for (i:0; i ? 256; i++) p image ; for (i:0; i ? nrow; i++) { j++) for (j=0; j ? ncol; { return k; /* Here image is the starting address of image. which has nrow rows and ncol column h is the histogram of the image. s. int histogram (unsigned char Himage, int nrow, int ncol, int *h) int i. j. k: unsigned char *p: for (i:0; i ? 256; i++) p image ; for (i:0; i ? nrow; i++) { j++) for (j=0; j ? ncol; { return k

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions