Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:09:24+00:00 2026-05-31T17:09:24+00:00

So Im having trouble with a problem. Im givin that a is an array

  • 0

So Im having trouble with a problem. Im givin that a is an array of words and the base address of a is saved in $a0. So for int a[10] find the sum of this array using mips. I really don’t know where to start can someone help me start and I think I should be able to finish it. Thanks a bunch!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:09:25+00:00Added an answer on May 31, 2026 at 5:09 pm

    Since you are given the address of the start of the array, you know that is also your first element. Since this is an array of int, I will assume it means it will use a storage space the size of a word on mips32 which is 4 bytes. Therefore a[1] is located at the address of a[0]+4bytes. A[2] is located at the address of a[0]+8bytes or a[1]+4bytes etc…

    From that it follows that all you have to do is just loop 10 times, loading a word each time and adding the value.

    The basic flow is:

    1. Let count = 0, sum = 0 (sum is your return value, so $v0)
    2. Load a word value from $a0 into a register
    3. Set $a0 = $a0 + 4 (move from a[count] to a[count+1], integer is 4 bytes on mips32)
    4. Set sum = sum + the register you loaded the word value into
    5. count = count + 1
    6. if count < 10? (set less than, branch) go to #2
    7. jump and link (assuming our sum is already in $v0)

    Note: The base address you are given MUST be word-aligned.

    Optimization note: You can optimize the number of instructions executed by setting some register to $a0 + 40 before step 1. This means you can get rid of step 5 and step 6 will be a check if $a0 is less than that register you set before step 1. (The last optimization is moving step 4 to step 6’s delay slot. If you are using a simulator, this might not be supported though)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble solving this problem: Create a function that given a character set
I'm having trouble putting this problem into searchable terms. I'm working on an Android
My problem is that I'm having trouble specifying paths for Lua to look in.
This is a homework problem that I am having difficulty with. The skeleton for
I am having trouble figuring out exactly how to approach this problem and am
This is giving me major headaches! I'm having trouble even describing the problem in
I'm having trouble wording my problem to search for it, so if anyone could
Problem: I am having trouble implementing a recursive image lazy load in all relevant
I'm having trouble coming up with a solution for the following problem and i
I'm having trouble with MySQL or Python and can't seem to isolate the problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.