mips

Problem with mips assembly

I have aproblem with my mips port....Whenever i try to compile a C program with a printf statement it gives a warning saying it is not recognized and in the generated assemble file there is no .asciiz directive...The string is not there....can anyone please tell me why?? And also what is the difference in between building a bare metal c...

Bare metal cross compilers input...

Hi, What are the input limitations of a bare metal cross compiler...as in does it not compile programs with pointers or mallocs......or anything that would require more than the underlying hardware....also how can 1 find these limitations.. I also wanted to ask...I built a cross compiler for target mips..i need to create a mips executa...

help with my MARS MIPS Simulator Code

hey, i need help. I have written this code in MARS. It is supposed to receive an integer from the user, and convert it to HEX. I've been going over it for hours and as far as i can see, it should work fine. I have only included the loop and output part of the program as this is the only part that is not working. Can someone PLEASE point ...

MIPS: How do parse out digits of a number? Basic question but yet hard.

I am currently learing MIPS for a class and wrote the below sample code. # UNTITLED PROGRAM .data # Data declaration section .text main: # Start of code section li $t1, 72 move $a0, $t1 li $v0,1 exit: li $v0, 10 syscall # END OF PROGRAM As show...

towers of hanoi recursively in mips/assembly

has anyone done towers of hanoi problem in mips recursively. can you please share your program. would be greatly appreciated. thanks ...

MIPS: The Equivalent of la instruction without using pseudo codes?

The reference says the pseudo code for la (load address) is translated to: Pseudo : la $1, Label lui $1, Label[31:16] ori $1,$1, label[15:0] but when I try to assemble the code in MARS I get the error: "Invalid language element: 16] and if I remove the [31:16] part I get "Label": operand is of incorrect type Any idea? ...

How do you allocate an array so it starts at certain place in memory?

How do you allocate an array so it starts at certain place in memory? For example .data array: .space 400 would make an array with 100 words, but I wish to let array start at, for example, 5000 in the memory. How can I do this? ( I remember in intel asm it being really easy) edit: I am using spim in linux. btw does this rea...

In MIPS, how do I divide register contents by two?

Let's say I have $t0, and I'd like to divide its integer contents by two, and store it in $t1. My gut says: srl $t1, $t0, 2 ... but wouldn't that be a problem if... say... the right-most bit was 1? Or does it all come out in the wash because the right-most bit (if positive) makes $t0 an odd number, which becomes even when divided? Tea...

mips assembly question

does anyone know how the CPU determines which register should receive the result produced by an instruction? anyone??? ...

[MIPS] How is lw represented in C or C++?

So, for example, what would something like this: lw $t1, 0($t0) or lw $t2, 8($t0) Translate to in C or C++? I mean I'm loading a word from the address into a register, I get that. Is an array a similar concept, or, what? Thanks in advance. ...

convert c to mips assembly language

I am trying to convert some instruction to MIPS code. But have no idea how to do that.. i know c language so i can decode it to C but dont know how to convert it to MIPS. I need to write a main create an array of 10 integers Declare a variable make a loop to check if it is odd or even print a string saying "it is odd or it is even crea...

MIPS Syscalls and $t registers

MIPS registers have a convention - $s registers are to be preserved across subroutine calls, so if your subroutine modifies them, it should save them to the stack, while $t registers are not preserved. Now, can a syscall potentially modify a $t register? In a simulator I have, it doesn't, but could a real machine have the $t registers c...

How to move the value of a floating point register to a general-purpose register in MIPS?

I have the following bit of MIPS assembly, run on the MARS simulator, given below: .data x: .space 4 # 4 bytes = 32 bits li $v0, 6 syscall At this point, the floating point value I need is in $f0, but I need to move the value to x. If I could transfer the contents of the floating point register $f0 to $t0, I would be able to do this...

Efficient Way to Print MIPS Int Array

I'm working on a homework assignment translating a C program we wrote to MIPS. My question is about general MIPS coding and not project specific issues though. I've run into an issue with printing my output. I have an array and output string declared as such: array: .word 7, 2, 5, -3, 3, 6, -4, 1 output1: .asciiz "Array: \0" I'm tryin...

How do I compile mips gnu?

Hi, I am not even sure my thread title is correct or not. Here is my story. I visited western digital website to check for a new firmware of wdtv live. I found source code of wdtv live OS is available to download. I downloaded "WDTV GPL Code" on http://support.wdc.com/product/download.asp?groupid=1003&lang=en. I extracted it and...c...

Branching to labels

I'm writing a MIPS code for a simple calculator, and was wondering how you branch to the corresponding function according to the user input. For example, if the user wishes to add two numbers, how would you make sure the calculator jumps to the add label, instead of perhaps the multiply or subtract? ...

Integer Problem in MIPS assembly

Using MIPS assembly if I prompt a user to input an integer how can I then take that integer and break it up into it's requisite parts? Example: # User inputs a number li $v0, 5 # read value of n syscall I then store the value in $v0 in a temporary register, say $t0, and need to break it up into each part that...

MIPS program! need help- i m not sure if i m doing it right.

i m trying to write a MIPS program that will examine set of ten single digit numbers (positive, zero,or negative) that can be inputted from the terminal. After examining the numbers, only the negative numbers (with appropriate sign) along with their count needs to be outputted to the terminal. BELOW IS MY MIPS PROGRAM .data pr...

MIPS Assembly assignment HELP!!

My closest friend is going through an EE course (I'm his last hope : /), I have knowledge of Java from about 7 years ago, but his (outline) latest EE programming assignment is to use the MIPS Assembly to do the following: Write a program that takes two positive integers (m and n) and computes: x= (m^n) - (1+2+3+…+n) * min(m,n)! Both...

C++ CPU Register Usage

In C++, local variables are always allocated on the stack. The stack is a part of the allowed memory that your application can occupy. That memory is kept in your RAM (if not swapped out to disk). Now, does a C++ compiler always create assembler code that stores local variables on the stack? Take, for example, the following simple code:...