Questions tagged [mips32]

Use this tag for questions related to the 32 bits version of the MIPS architecture instruction set. See also [tag:MIPS].

632 questions
4
votes
2 answers

MIPS Structural Hazard

I'm trying to learn about MIPS pipe-lining and the hazards associated to them. I'm having trouble picturing what a structural hazard looks like in MIPS instructions. I've read that it is a situation where two (or more) instructions require the use…
4
votes
1 answer

how to run MIPS program without main and call MIPS program from C program

Long question, sorry in advance. Okay, so I'm working with a few unusual constraints which is why I haven't found much help online so far. The main constraint is that I can not use an emulator, and therefore I can not use syscalls. I need to do a…
4
votes
1 answer

How to push and pop addresses on stack in MIPS

I am working on an assignment for my compilers course and I've been staring at the mips (32 bit) code I generate for hours trying to figure out what is wrong with it to no avail. After generating the mips code, I compile it using gcc on a mips VM…
4
votes
2 answers

What is the proper behavior of 'jalr $a0, $a0'?

I came across the instruction jalr $t1, $t2 instruction, which supposedly sets $t1 to the return address and jumps to $t2. However, there seems to be some ambiguity as to which operation happens first. For instance, the following works differently…
Frxstrem
  • 38,761
  • 9
  • 79
  • 119
4
votes
2 answers

access file in mips using mars tool

I'm trying to do some access on file using mips instruction. I want to read file line by line not all of the file at a time so this code(1) does not work. Also I want to write to the file and not overwrite! Can any one help me? Code: Open a…
Sundus Karaja
  • 41
  • 1
  • 2
4
votes
2 answers

Using jump tables in MIPS (how to jump a label in JT array )

I'm tring to do a menu for my work by using a jump table. Everyting looks fine for me but below code does not works. after the "jr $s0" instruction mars gives me an error like: Error in : invalid program counter value: 268501840 I know the decimal…
kotiloli
  • 45
  • 1
  • 4
4
votes
1 answer

How do MIPS exceptions and interrupts work?

I am working on a MIPS32 like CPU and I am wondering how the MIPS32 exception and interrupt handling works exactly. The MIPS32 Privileged Resource Architecture guide doesn't give much information. I am wondering about several things which are: What…
Alex
  • 125
  • 2
  • 7
3
votes
1 answer

What is the purpose of loading a value into a register before putting a right-shifted value into it?

I'm decompiling a PS2 game that was originally coded in C. To do this, I'm reading MIPS assembler and writing the corresponding C statements. There's one reoccurring pattern that I haven't been able to figure out. Consider the following assembly: li…
user16316067
  • 119
  • 5
3
votes
2 answers

Need help in adding more functionality to MIPS Single Cycle Datapath

I am trying to add jal functionality to the following but I am stuck with how does it work. I know that it stores the old PC+4 value in the $ra register and then transfers the control to the function which transfers back the control by return $ra…
user379888
3
votes
4 answers

How does libc work?

I'm writing a MIPS32 emulator and would like to make it possible to use the whole Standard C Library (maybe with the GNU extensions) when compiling C programs with gcc. As I understand at this point, I/O is handled by syscalls on the MIPS32…
Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
3
votes
1 answer

How to program the PIC32 in Assembly?

I'm trying to program a PIC32 MM0064GPL028 in Assembly, to do MIPS32 exercises on a real CPU, instead of the simulator that we use in my course (QtSpim), without any success. The only guide I found on the internet is this, but I get an error when I…
Lugerp
  • 31
  • 2
3
votes
1 answer

Are bits in the structure guaranteed

I have a question related to structure bit fields, please see below as I am a bit clueless on which keywords I should use to best describe my issue: Context: I am writing a disassembler for MIPS R3000A Assembly Instructions, the one that were used…
Antonin GAVREL
  • 9,682
  • 8
  • 54
  • 81
3
votes
1 answer

What does this MIPS assembly code correspond to?

I am learning MIPS assembly language. This is an exercise I am trying to understand. The question is: What does the following code correspond to? Name: move $t0, $zero Loop: add $t1, $t0, $t0 add $t1, $t1, $t1 …
3
votes
1 answer

Bubble Sorting using MIPS

I have made the inner loop which is doing comparison and swapping but i am having a difficulty in implementing outer loop which will run according to the number of elements. .data Arr: .word 5, 4, 3, 2, 1 .text .globl main main: la $a0, Arr …
user3593450
3
votes
1 answer

MARS, MIPS assembler, linking two files together?

I have a quick question. I am using MARS assembler (programming in the MIPS instruction set) and I have two MIPS files. One file contains my main method to be run and it calls a function in the other file. My function has the .globl directive before…
Code Doggo
  • 2,146
  • 6
  • 33
  • 58
1 2
3
42 43