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

  • Home
  • SEARCH
  • 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 6672637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:31:54+00:00 2026-05-26T03:31:54+00:00

I am studying the MIPS assembly language and came across this example in the

  • 0

I am studying the MIPS assembly language and came across this example in the book and to me it seems incorrect. If it is it wouldn’t be the first mistake I found in this book.

The variables f and g are assigned registers $s0 and $s1 respectively, the base addresses for the arrays A and B are $s6 and $s7 respectively.

The c code example is:

f = g - A[B[4]];

And the corresponding MIPS assembly provided is:

lw  $t0, 16($s7)
lw  $s0, 0($t0)
sub $s0, $s1, $s0

From my understanding the above MIPS code would load some random data from memory at the address provided by $t0 and then subtract it from $s1 and not access the index $t0 of the array denoted in $s6.

The correct MIPS assembly from my understanding would be along the lines of:

lw  $t0, 4($s7)
add $t0, $t0, $s6
sll $t0, $t0, 2
lw  $s0, 0($t0)
sub $s0, $s1, $s0

I am correct that this is an error in the book or am I misunderstanding something.


Edit: Fixed an error in the corrected mips code as pointed out by Chris Dodd

  • 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-26T03:31:55+00:00Added an answer on May 26, 2026 at 3:31 am

    As pointed out my many there was an error in the book. Since discovering this error I found several such errors.

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

Sidebar

Related Questions

I was studying method overriding in Java when ai came across the this keyword.
I'm studying this book (Addison Wesley Windows System Programming 4th Edition) and I think
After studying the docs for a while, I came up with my first jQuery
While studying the book Introduction to Algorithms by Cormen, I found a strange thing.
studying some sample code from an iOS programming course (cs193p fall2010) i came across
Studying C#, my books are showing me classes for readin files. I've found 2
In studying actionscript 3's graphics class, I've come across the undocumented drawRoundRectComplex() method. It's
In my adventures studying the boost libraries, I've come across function signatures that have
So, we're studying MIPS architecture at school and we're implementing a MIPS32 architecture. I
While studying different programming languages, I recently hit upon Icon programming language . It

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.