473,320 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

are there any MIPS programmers that can help me with this problem

1
do you think you could tell me what i'm doing wrong? the code runs without errors but i think the values are getting lost somewhere.
Expand|Select|Wrap|Line Numbers
  1. # for i = 0 to R-1
  2. #   C[i] = 0
  3. # end for
  4.  
  5. # for i = 0 to n-1
  6. #   C[A[i]] = 1
  7. # end for
  8.  
  9. # i = 0
  10. # for j = 0 to R-1
  11. #   if (C[j] == 1) then
  12. #     B[i] = j
  13. #     i = i + 1
  14. #   end if
  15. # end for
  16.  
  17. bucket:
  18.           li $t0, 0        #set to 0
  19.  
  20. loop:     ble $s0, 0, bail #for loop
  21.           sw $t0, ($a2)    #store i in C[ ] 
  22.           addu $a2, $a2, 4 #add 4 to C
  23.           subu $s0, $s0, 1 #sub 1 from R
  24.           j loop
  25. bail:
  26.           jr $ra
  27.       ble $t0,0,bail
  28.  
  29.  
  30.       li $t0, 0       #set i to 0
  31.       li $t3, 1        #set to 1        
  32. loop1:      ble $a3, 0, Break #for loop
  33.           sw $t0, ($a0)    #store i in A[ ]
  34.           sw $a0, ($a2)    #store A[i] in C[ ]
  35.           addu $a0, $a0,4  #add  to A
  36.           subu $a3, $a3, 1 #sub l from N
  37.           j loop1
  38. Break:    jr $ra
  39.           ble $t3, 1,Break
  40.  
  41. loop2:    li $t0, 0     #set i to 0
  42.           li $t1, 0     #set j to 0
  43.           li $t4, 1     #set to 1
  44.           sw $t1, ($a2) #store j in c[ ]
  45.  
  46.           addi $t0, $t0, 1 #add 1 to i
  47.           sw $t0, ($a1) #store j in b[ ]
  48.           beq $a2, $t4,loop3  #if loop
  49. loop3:    sw $t0, ($a1) #store i in b[ ]
Mar 28 '13 #1
0 1396

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: wonder | last post by:
Hi, The CRM application said that need to add an option "REGISTER_GLOBALS=On" to the php.ini file, so I did what it told. But I still can't get rid off the following error: The PHP variable...
0
by: Marc Robitaille | last post by:
Hello all, For a certain amount of time, I have a rather odd problem with my Visual Studio 2003. I do not know where it is come from i.e. if it is my code or the intellisense from the VB.NET...
11
by: Aing | last post by:
Anyone knows what can be cause of this problem? //////////////////////////////////////////////////////////// typedef struct _date_struct { int date,month,year; }date_struct; Class Date {...
1
by: Wade Beasley | last post by:
I am still struggling with this problem of getting my 2 list boxes to show the initials items as being selected on the first time that I go to the Tab with the boxes on them. I am reading from my...
0
by: CroDude | last post by:
Hi all! I've just realized that Panel class doesn't provide KeyDown/KeyUp events. Does anyone know how to remedy this problem. I really need for the panel to catch keyboard events. Thanks in...
0
by: Eric | last post by:
Visual C++ 2005 Express MVP's and experience programmer's only please!... I need to get the number of lines in a textbox so I can insert them into a listview. The text comes from my database...
16
by: Hooyoo | last post by:
Following are similar codes of my project: At first I define two classes in two files: //ClassA.h #pragma once #include "ClassB.h" class ClassA { public: ClassA(void){};
2
by: Piojolopez | last post by:
Hello guys, I have a problem with this code, the program is the resolution of Sudoku grid, the grid in my program is a vector of STL,and i use a list of STL for the right solution for each cell, to...
1
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
4
by: muddy22 | last post by:
I'm only having a problem with a small part, i'm fairly new to computer programming and the program i'm using is Dev-C++. The part that i'm having a problem with is this: int WINAPI WinMain...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.