Questions tagged [mips]
MIPS is a RISC instruction set architecture (ISA). It is commonly used in embedded devices such as set top boxes and networking gear. Many university-level computer architecture classes use the MIPS ISA due to its relative simplicity. If your question is about MIPS assembly and machine code, also add the assembly tag.
mips
5,901
questions
193
votes
13
answers
263k
views
Error "gnu/stubs-32.h: No such file or directory" while compiling Nachos source code
I am trying to install Nachos on my laptop and I have Ubuntu 11.04 on the laptop.
The code is in C and so to build it I assume I will need cross compiler. This is where my problem is. I downloaded ...
113
votes
10
answers
41k
views
Why is x86 ugly? Why is it considered inferior when compared to others? [closed]
I've been reading some SO archives and encountered statements against the x86 architecture.
Why do we need different CPU architecture for server & mini/mainframe & mixed-core? says
"PC ...
81
votes
6
answers
146k
views
CMake: The C Compiler is not able to compile a simple test program [duplicate]
I am trying to cross-compile the Azure IoT SDK C for a Mips processor. Cross-compiling an older version of the same SDK using an older version of CMake (2.8.12.2) works just fine, so I doubt it's the ...
56
votes
4
answers
89k
views
What is the difference between unconditional branch and unconditional jump (instructions in MIPS)?
You may look into Wikipedia or short summary for students. Everybody says that there are two instructions for the same thing. But nobody tells why?
56
votes
3
answers
23k
views
What is MIPS system image in Android SDK manager?
With each SDK, I have a solution of installing MIPS system image.
What is it? What does it do and when will someone use it? What will happen if I do not install it?
43
votes
1
answer
84k
views
MIPS assembly language - temporary register vs saved registers
So far I have been using registers $s0-$s9 and same way as registers $t0-$t9. I have been told and read countless forum posts and paragraphs here and on Google explaining the difference, but with no ...
39
votes
2
answers
169k
views
Difference between "move" and "li" in MIPS assembly language
I was practicing converting C code into MIPS assembly language, and am having trouble understanding the usage of move and li in variable assignment.
For example, to implement the following C line in ...
38
votes
1
answer
29k
views
Assembly Files: Difference between .a .s .asm
In the MIPS simulator "QTSpim", three types of files are accepted:
.a
.s
.asm
Is there a difference between those filetypes, and if yes, what is the difference?
36
votes
4
answers
137k
views
How to Calculate Jump Target Address and Branch Target Address?
I am new to Assembly language. I was reading about MIPS architecture and I am stuck with Jump Target Address and Branch Target Address and how to calculate each of them.
32
votes
6
answers
23k
views
What's the relative speed of floating point add vs. floating point multiply
A decade or two ago, it was worthwhile to write numerical code to avoid using multiplies and divides and use addition and subtraction instead. A good example is using forward differences to evaluate ...
29
votes
3
answers
105k
views
In MIPS, what are HI and LO
I'm reading about division in MIPS and I've found that div
Divides $s by $t and stores the
quotient in $LO and the remainder in
$HI
https://web.archive.org/web/20201111203150/http://www.mrc.uidaho....
28
votes
14
answers
14k
views
MIPS - Is it important? [closed]
My question: Is the MIPS programming language that beneficial to know?
I'm a CS student and am taking an assembly class which focuses on MIPS. I'm very comfortable writing in high level languages, but ...
28
votes
7
answers
32k
views
MIPS processors : Are they still in use? Which other architecture should I learn? [closed]
I've been programming for x86 & x86-64 in assembly language for few months. Now, I want to move on to some different kind of processors.
MIPS, SPARC, PowerPC, Itanium, ARM of these I found ARM ...
25
votes
5
answers
34k
views
What is the point of delay slots?
So from my understanding of delay slots, they occur when a branch instruction is called and the next instruction following the branch also gets loaded from memory. What is the point of this? Wouldn't ...
25
votes
5
answers
54k
views
Difference between add and addu
I am confused about the difference between add and addu.
The MIPS instruction reference says:
add (with overflow)
add unsigned (no overflow)
My understanding is to use add with signed operands and ...
25
votes
3
answers
60k
views
Different between jump and jump and link
Could someone provide an example of the usefulness of the jal instruction can how it can be used to return to the main body after completing a subroutine?
regards
23
votes
9
answers
32k
views
Is there a way to limit an integer value to a certain range without branching?
Just out of curiosity. If I have something like:
if(x < 0)
x = 0;
if(x > some_maximum)
x = some_maximum;
return x;
Is there a way to not branch? This is c++.
Addendum: I mean no ...
23
votes
2
answers
9k
views
Set all bits in CPU register to 1 efficiently
To clear all bits you often see an exclusive or as in XOR eax, eax. Is there such a trick for the opposite too?
All I can think of is to invert the zeroes with an extra instruction.
22
votes
2
answers
99k
views
MIPS: relevant use for a stack pointer ($sp) and the stack
Currently I'm studying for my computer organization midterm, and I'm trying to fully understand the stack pointer and the stack. I know these following facts that surround the concept:
It follows the ...
22
votes
4
answers
20k
views
What should I know when switching from MIPS to x86 assembly?
At school we have been programming in MIPS assembly language for some time. I'm interested into delving into x86 assembly and I have heard that is somewhat harder (even my MIPS textbook says this).
...
22
votes
2
answers
30k
views
Why do we use .globl main in MIPS assembly language?
.text
.globl main
.ent main
I don't know what .globl and .ent do.
What is the role?
Do I need to use globl. main and .ent main all the time?
21
votes
7
answers
42k
views
Is there a way to use GCC to convert C to MIPS?
I completed a C-to-MIPS conversion for a class, and I want to check it against the assembly. I have heard that there is a way of configuring GCC, so that it can convert C code to the MIPS architecture ...
21
votes
3
answers
146k
views
Greater than, less than equal, greater than equal in MIPS
Given two registers $s0, $s1, how can I convert the following pseudocode into MIPS assembly language using only the slt (set on less than) and beq and bne (branch if equal, branch if not equal) ...
21
votes
3
answers
10k
views
The prefetch instruction
It appears the general logic for prefetch usage is that prefetch can be added, provided the code is busy in processing until the prefetch instruction completes its operation. But, it seems that if too ...
20
votes
4
answers
85k
views
the functions (procedures) in MIPS
I'm new in MIPS language and I don't understand how the functions (procedures) in the MIPS assembly language work. Here are but I will specify my problem :
What does:
jal
jr
$ra
mean in mips ...
20
votes
4
answers
40k
views
Android emulator system images and AMD processor
I use AMD FX X6 6300 type processor. (it supports virtualization and my BIOS setting is ON)
I installed "Intel x86 Emulator Accelerator". When I tried to run Intel accelerator setup, I get that setup ...
20
votes
3
answers
2k
views
Valgrind on MIPS Reports no Heap Usage
I'm using valgrind (v3.10.0) to hunt down a memory leak in a complex application (a heavily modified build of net-snmp) that is being built as part of a bigger software suite. I am sure there is a ...
19
votes
8
answers
27k
views
How can I execute MIPS assembly programs on an x86 linux?
Are there any command line interpreters or any other set of programs around for x86 linux in order to run MIPS assembly programs?
I'd like to be able to write simple MIPS assembly programs and run ...
19
votes
1
answer
177k
views
MIPS: Integer Multiplication and Division
So I'm building a calculator program in MIPS and I'm trying to write the multiply and divide functions.
Currently I read in the integers in a loop like so:
li $v0, 5
syscall
and then eventually ...
19
votes
1
answer
82k
views
What is the difference between la and li in opcodes in MIPS?
For example in this code :
#display message
li $v0, 4
la $a0, Message
#promt user to enter name
li $v0, 8
la $10, username
li $a1, 20
syscall
#display the name
li $v0, 4
la $a0, userName
syscall
I ...
18
votes
2
answers
85k
views
Assembly language (MIPS) difference betweent addi and add
I'm trying to understand the difference between using addi and add, does both do the same thing?
e.g
addi $t0, $0, $a0
add $t0 , $0, $a0
18
votes
3
answers
11k
views
MIPS Decompiler [closed]
I'm looking for a decompiler capable of transforming MIPS machine code into C code. Any suggestions?
17
votes
2
answers
20k
views
MIPS - JAL confusion: $ra = PC+4 or PC+8?
I'm having trouble understanding how the instruction jal works in the MIPS processor.
My two questions are:
a) What is the value stored in R31 after "jal": PC+4 or PC+8?
b) If it's really PC+8, what ...
17
votes
3
answers
10k
views
Android os.arch output for ARM, MIPS, x86?
In order to identify the platform of an Android device, it seems that the java system property "os.arch" will suffice:
Log.i("mytag", "os.arch: " + System.getProperty("os.arch"));
most ARM devices ...
17
votes
5
answers
52k
views
Undefined reference to printf when using GCC cross compiler
I'm trying to get the following simple 'Hello World' program to compile using a cross compiler (GCC 4.9.2) targeting mips:
#include <stdio.h>
int main()
{
int x = 5;
printf("x = %d\n", x);
...
16
votes
3
answers
45k
views
MIPS - How does MIPS allocate memory for arrays in the stack?
I'm quite new to the MIPS assembly language and am currently taking a class on computer architecture which has a large section on MIPS coding. I've studied several other high-level programming ...
16
votes
1
answer
17k
views
Adding two 64 bit numbers in Assembly
So I am learning MIPS using the SPIM simulator and im stuck on this problem.
I want to add two 64 bit numbers which are stored in four 32 bit registers. So I add the LO bytes and then the carry and ...
15
votes
1
answer
29k
views
Clarifications on signed/unsigned load and store instructions (MIPS)
I can't seem to grasp the concept on these stuff, even with the help of Google and a textbook in my hand.
Following the format (opcode, rs, rt, offset)...
Do you sign extend the offset before adding ...
15
votes
2
answers
15k
views
Why do MIPS operations on unsigned numbers give signed results?
When I try working on unsigned integers in MIPS, the result of every operation I do remains signed (that is, the integers are all in 2's complement), even though every operation I perform is an ...
15
votes
2
answers
30k
views
MIPS architecture 'syscall' instruction
What is the role of syscall instruction in MIPS?
15
votes
2
answers
100k
views
Creating (and accessing) an array in MIPS
I'm trying to create an array in MIPS Assembly, and then add all the elements together. However, when I try to assemble the following, it says
Error in read_array line 1 position 7: ".word" ...
15
votes
2
answers
44k
views
How to cross-compile for MIPS?
I have a DVB receiver (set-top box) similar like Dreambox and it has MIPS cpu
It has embedded Linux and I can connect to it with telnet
Question is how to compile simple "Hello World" application in ...
15
votes
6
answers
8k
views
Regular Expressions and Assembly
I know 8086 Assembly and learning MIPS Assembly. Also, I'm learning Regular Expressions, then I want to know:
How can I use Regular Expressions on them?
15
votes
5
answers
6k
views
where can I find a description of *all* MIPS instructions
Does anyone know of a web site where I can find a list of 32-bit MIPS instructions/opcodes, with the following features:
Clearly distinguishes between real opcodes and assembly-language macros (...
15
votes
1
answer
6k
views
Is LLDB compatible with gdbserver (for debugging cross compiled code?)
I'm a CS student that just learned basic mips for class (Patterson & Hennessy + spim), and I'm attempting to find a mips debugging solution that allows arbitrary instruction execution during the ...
15
votes
1
answer
9k
views
Dark theme for Mars 4.5 Mips?
I am using Mars MIPS Assembler and Runtime Simulator 4.5 for an assembly class and i find white background tiring when you stare at a screen for hours.
I want to change the editor's color to a ...
14
votes
2
answers
37k
views
Why doesn't there exists a subi opcode for MIPS?
I am very new to Assembly language. I was reading about MIPS architecture and came to know that you have addi opcode but there is no subi opcode. Why don't we have a subi opcode?
14
votes
5
answers
128k
views
MIPS assembly for a simple for loop
I need to translate this C code to MIPS assembly.
Here is the C code:
int tmp = 0;
for (int j = 0; j < 15; ++j)
tmp = tmp * 2 + 3
This is my MIPS assembly code. Is it a correct ...
13
votes
4
answers
89k
views
MIPS Assembly - lui $t0, 4097?
Can someone explain me how does lui works, what does "4097" stand for, what does adding 8 to $t0 mean?
.data 0x10010000
blank: .asciiz " " # 4097
newline: .asciiz "\n" # 4097 + 2
...
13
votes
3
answers
27k
views
What does rt stands for in MIPS instruction format?
Take MIPS instruction format described here, there are some abbreviations eg rd,rs and rt. What does rt stands for? I know rt is the second source register in R-type instruction, and is the ...