Use this tag for questions related to the 32 bits version of the MIPS architecture instruction set. See also [tag:MIPS].
Questions tagged [mips32]
632 questions
-1
votes
1 answer
GCD in MIPS assembly
I am having trouble with getting this code to work 100% correctly. If the user enters a larger number as the first number, then the program gives the correct Greatest Common Denominator.
However, If a Smaller number is entered at first, then the…

JustHuman
- 1
- 1
- 3
-1
votes
1 answer
How to create a jump table using a jr instruction?
C++ Program
# include < iostream >
# include
using namespace std;
int main ()
{
int resistance ; // in Ohms
string partNum ; // Part Number
cout << " Enter resistance : " << endl ;
cin >> resistance ;
switch ( resistance )
{
…

user1757759
- 41
- 2
- 5
-2
votes
1 answer
Looking for approaches to optimize a simple byte-at-a-time strcpy in MIPS assembly
I am trying to optimize the following block of mips code and am struggling to find ways to reduce overall instructions or other ways of optimization. Thanks!
.data
Str: .asciiz "ABC"
Strempty: .asciiz " "
.text
.globl…

Jordan RIchard
- 1
- 1
-2
votes
1 answer
What can I do to optimize my MIPS code further?
I am trying to optimize my code for my homework. I need to reduce total energy output by minimum 5 percent. I have included my code below. So far, I have only been able to reduce the energy output by 2 percent. This was achieved by adjusting my sub…

Etlewisg
- 1
- 2
-2
votes
2 answers
How to convert a high level language statement involving arrays into MIPS 32 bit?
Here's the high-level function: J[6] = K[d-e]
d = $t0, e = $t1, J = $s1, K = $s2, final result goes in $s4
So far I have:
lw $t2, 24($s1) #Load J[6] into $t2
sub $t3, $t0, $t1 #Subtract e from d to $t3
What I know I can't do is lw $t4, $t3($s2) but…

cocoakrispies93
- 45
- 1
- 11
-2
votes
1 answer
Converting C into MIPS
I am having some trouble converting C into MIPS.
I am currently having trouble converting this C code into MIPS:
int arraySum(int* array, int arraySize)
{
int result;
if(arraySize == 0)
result = 0;
else
result = *array +…

Ishaan Aggarwal
- 15
- 3
-2
votes
1 answer
Is there a way to convert an integer digits into an array (i.e. 45 -> array[0] = 5 ; array [1] = 4)?
Similar to this problem: convert an integer number into an array but I don't know how this is implemented in MIPS.

dela
- 3
- 1
-2
votes
1 answer
Finding the Nth character in a string and printing it MIPS32 assembler
Ok so i have a simple program where given an integer as input by the user,suppose its X,tries to find the character at X position in a string.Works fine, but there is a little bug.As its easy to see,string length is 26 so if user enters for example…

Aggelos Sfakianos
- 155
- 5
- 17
-2
votes
1 answer
Assembly program in mips. Geometric Progression
Ok in my first uni assignment i got a geometric progression program in mips. Problem is type i have to use is a_{n}=a * r^{n-1} and i have to make a program that show the first 6 numbers of this geometric progression with a1=3 and r=3.Numbers to be…
-2
votes
2 answers
Printing register value in Mips assembly
I have the following code and I am trying to print an int value:
addi $t0, $v0, 0 # add immediate: copy returned value to $t0 by adding 0
li $v0, 1 # syscall 1 (print_int)
sw $t0, 0($a0) # store…

Bato-Bair Tsyrenov
- 1,174
- 3
- 17
- 40
-2
votes
1 answer
How many cycles will it take to execute in Single Cycle datapath
add $s1, $s2, $s3
add $s5, $s2, $s3
sub $s3, $s3, $s2
lw $s2, 100 ($s3)
How many cycles will it take to execute above mips code in single cycle datapath..?

user3326613
- 17
- 3
-2
votes
1 answer
Can someone help me interpret what these lines mean in MIPS?
.data 0x10000000
.align 2
Array: .word 3 6 9 12 15 18 21 24
Size: .word 8
Result: .word 0
So what does ".data" mean exactly and does "Size" correspond to the size of "Array" or is it simply another variable?
Also, what does "Result" mean? Is it an…

June
- 27
- 4
-3
votes
1 answer
What is the address of PC after a branch instruction?
Knowing my PC address is 0x00402000, what is it's value after a:
beq $t0 $t0 64?
How can I calculate this?

miguelcgo
- 1
- 1
-3
votes
1 answer
How do these r-type bit numbers turn into 0,11,12,18,0, and x18? (picture below)
I understand that 6,5,5,5,5,6 represent the number of bits as well, but how do they relate to the numbers 0,11,12,18,0 and x18?

Arnab Das
- 45
- 4
-3
votes
1 answer
MIPS Memoy layout: to whom it is relevant
I have been reading about MIPS Memory layout:
https://www.cs.uaf.edu/2004/fall/cs301/notes/notes/node12.html
As an application programmer, I don't see where the above memory mapping can be relevant to me when i write my application programs.
Is it…

Karlo
- 1