Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TRANSLATE C CODE TO MIPS In this assignment, a palette of eight such values are created and stored in memory. The intensity of a pixel

TRANSLATE C CODE TO MIPS

In this assignment, a palette of eight such values are created and stored in memory. The intensity of a pixel is defined as: I = (R+G+B) /3

Objective: For this assignment, you will write two programs, one in C and one in MIPS. There are three key tasks each color matching program needs to be able to do: 1. Unpack a color by pulling the individual unsigned 8-bit red, green, and blue component values from the lower 24 bits of a 32-bit integer. Hint: in C, the shift (>) and mask 2. (&) operators may be useful; in MIPS, the load byte instructions may be helpful. Note that the Misasim memory implementation is little endian (the least significant byte is located at the word address). 2. Compute the difference in intensity between two given unpacked colors using the defini-tion of intensity given above. 3. Use nested loops and conditionals to orchestrate the comparison of all pair

# Intensity Matcher # # Your Name: # Date: Jan 31, 2020 # # This program finds the two colors with the closest intensity # in an eight color palette. # # required output register usage: # $10: MinDelta, $11: Color A address, $12: Color B address # .data Array: .alloc 8 # allocate static space for packed color data

.text IMatch: addi $1, $0, Array # set memory base. Acts as C ode Nums aray swi 589 # create color palette and update memory addi $10, $0, 42 # TEMP: report MinDelta REPLACE THIS addi $11, $1, 4 # TEMP: report an address REPLACE THIS addi $12, $1, 12 # TEMP: report an address REPLACE THIS swi 581 jr $31 # return to caller

image text in transcribed

1/ HW1-1 // TRANSLATE C CODE TO MIPS CODE for (int i=0; i > 16) OxFF; // retrieved R value int aG = (a >> 8) & OxFF; // retreives G value int aB = (a >> 0) & 0xFF; // retrieves B value int intenA = (a + ab + aG) /3; // calculates intensity for (int j = i + 1; j 16) & 0xFF; // retrieved R value int bG = (b >> 8) & 0xFF; // retreives G value int bB = (b >> 0) & 0xFF; // retrieves B value int intenB = (bR + bB + bG) /3; // calculates intensity int diff = abs(intenA - intenB); if (diff > 16) OxFF; // retrieved R value int aG = (a >> 8) & OxFF; // retreives G value int aB = (a >> 0) & 0xFF; // retrieves B value int intenA = (a + ab + aG) /3; // calculates intensity for (int j = i + 1; j 16) & 0xFF; // retrieved R value int bG = (b >> 8) & 0xFF; // retreives G value int bB = (b >> 0) & 0xFF; // retrieves B value int intenB = (bR + bB + bG) /3; // calculates intensity int diff = abs(intenA - intenB); if (diff

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

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

What steps should be taken to address any undesirable phenomena?

Answered: 1 week ago