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
0
votes
2 answers
Porting a simple MIPS32 program to MIPS64
I am having some difficulty porting the following MIPS32 assembly program to a 64-bit equivalent.
The main issue that I am facing is the following line:
bgtz $s2, loop ; Branch from "loop" on "$s2" greater than zero.
I am not sure why this line…

Mr. Polywhirl
- 42,981
- 12
- 84
- 132
0
votes
1 answer
basic MIPS code not working as intended
.data
source: .word 3, 1, 4, 1, 5, 9, 0
dest: .word 0, 0, 0, 0, 0, 0, 0
countmsg: .asciiz " values copied. "
.text
main: add $s0, $0, $ra # Save our return address
la $a0, source
la $a1, dest
loop: lw $v1, 0($a0) # read next…

user2706243
- 1
- 3
0
votes
1 answer
Error:` can't resolve `0' {.text section} in MIPS asm program
I am new for mips assembly programming ,currently i am compiling and executing mips assembly programs on android os with ndk-r8, when i compiling the following code on android os for mips core i got the following errors.
Android.mk file
…

user2003619
- 49
- 1
- 4
0
votes
1 answer
MIPS total number of instruction executed
I have this code:
addi $t1, $zero, $zero
LOOP: lw $s1,0($s0)
add $s2, $s2, $s1
addi $s0, $s0, 4
addi $t1, $t1, 1
slti $t2, $t1, 100
bne $t2, $s0, LOOP
The question is what is the total number of instructions…

kousha
- 752
- 2
- 10
- 23
0
votes
1 answer
When calling into C from MIPS do we use JR or JALR?
I'm writing some self-modifying code and I want to call a C function (call it foo) from MIPS.
I've loaded the mem add of foo, &foo into $t1. Now I jr/jalr $t1.
Will C set $ra as my current PC(+8) (before the jump) allowing me to use JR or will I…

C.E.Sally
- 381
- 2
- 14
0
votes
1 answer
Don't use gp register
jmp_gen_exp:
la k0, gen_exp_handler # requires jump indirect
jr k0
nop
the compiler generate the above code to
000019bc: 8f9affc8 lw $26,-56($28) //lw k0,-56(gp)
000019c0: 00000000 nop …

文斌 林
- 1
0
votes
1 answer
Using snprinf() do I need to account for the null bytes at the end of each concatenated string?
char str[33] = "";
snprintf(str, sizeof str, "%s%s%s%s", preg->opbits,preg->rsbits,preg->rtbits,preg->ibits);
char *instruction = &str[0]
I am trying to build a binary string from the different elements of a string representation of a MIPS…

wsmccusker
- 2,631
- 2
- 14
- 8
0
votes
3 answers
possible OR branch mips32?
i'm trying to find a way to do something like bOR $a0, $a1, $a2 else, something like if(a=b||a=c){blablabla}else{blabla} in java, but i don't figure out a way to do it in mips32. Any idea?

qwerty
- 486
- 1
- 11
- 37
0
votes
1 answer
Looking for compiler for 32-bit LSB MIPS architecture
I want to copile a simple c program ("Hello world") for my Xtreamer prodigy. which runs a basic linux kernel:
/host # uname -a
Linux Prodigy 2.6.34-VENUS #30 PREEMPT Tue Feb 28 13:48:27 CST 2012 mips GNU/Linux
(it using chipset Realtek 1186)
I saw…

uriel
- 1,209
- 1
- 16
- 26
0
votes
2 answers
find substring and indices in mips
im trying find out substring and first occurrence indices. but something wrong. im comparing each element of pattern array and each element of string array until pointer reach to '\0'. whats the problem. algorithm is totaly wrong ?
#Note: $v0 is a…

ccc
- 93
- 1
- 3
- 10
0
votes
1 answer
Copying arrays in MIPS32 assembly
I have a segment of C++ code that I need to convert to mips using direct translation. I have most of it done, its a do while loop. I just don't understand this one line in MIPS.
x[i] = y[i];
I don't understand how to convert this into mips and…

Jacob Rhodes
- 89
- 1
- 9
0
votes
2 answers
How to convert C++ program to Mips assembly language in MARs assembler?
C++ program to be converted to mips assembly language
#include
using namespace std;
int main() {
int a = 1;
int b = 1;
int array[a];
while ( a < 10)
{
array[a] = b + a;
cout << array[a] << endl; //…

user1757759
- 41
- 2
- 5
0
votes
1 answer
Stack growth or not?
A C function f1 has a local integer array of 100 elements, and it calls another function f2. After complied into MIPS, which of the following statements is true?
(a) When this function is called, the stack will grow exactly 100 bytes.
(b) When this…

user1752418
- 21
- 4
0
votes
1 answer
What is this MIPS array + loop doing?
New to MIPS and can understand exactly what is going on with the code, but I do not understand the answer/solution provided. Any help would be greatly appreciated.
Please read the following code and write down the content in array A after funct…

user1752418
- 21
- 4
0
votes
1 answer
the set of all bit patterns that can be placed in a desired register using a single instruction
Given the following set of MiniMIPS instructions:
Load upper immediate
Add
Subtract
Set less than
Add immediate
Set less than immediate
Add
OR
XOR
NOR
AND immediate
OR immediate
XOR immediate
Load word
Store word
In MiniMips instructions, It's…

Traveling Salesman
- 2,209
- 11
- 46
- 83