# All Questions

Tagged with floating-point mips

32
questions with no upvoted or accepted answers

5votes

0answers

123views

### C (MIPS) - How to tell compiler load single-precision floats immidiates with GPRs?

Recently, I am trying to write some utilities for n64 with gcc and have some problems with it's optimization strategy.
Please consider following example:
// cctest.c
extern struct {
float x;
...

2votes

0answers

198views

### GCC porting to new target using software floating point library

I am currently trying to porting GCC-9.2.0 compiler for new architecture "SPIM" which is similar to MIPS architecture, using floating point arithmetic operation by GCC internal: 4.2 Routines ...

1vote

0answers

95views

### MIPS ASSEMBLY, printing out values, sudden breaks

I have to make a program where I input 3 decimal values, and it returns floats of those decimal values. It then is supposed to compute and print the max for the first two values, and print out the sum ...

1vote

0answers

204views

### MARS MIPS Floating Point Exception Custom Handler Does Not Work - No Handler Works

I'm attempting to cause floating point exceptions (divide by zero, odd-register, etc.) and handle them in custom handlers. If I include handlers and step into the kernel code, (cause) and (epc) are ...

1vote

1answer

720views

### In MIPS assembly language, how does one round a floating point value to the nearest .01?

If I had the floating point (saved in some $f register) 1684.714 how could I round that to 1684.71? If I had the floating point 1684.716, how could I round that to 1684.72?

1vote

0answers

708views

### Finding the exponent of a binary number written in scientific notation in MIPS

Say I have the number 12 in decimal. This would be equal to 1100 in binary.
I know that this can be written as 1.100 * 2^3
How in MIPS can I get the exponent value 3 and store it in a register?

1vote

0answers

726views

### Modulus a double precision floating point in MIPS?

OK, so basically I am having trouble getting one part of an RSA encryption program to work correctly. I am writing the program in MIPS and am trying to take the modulus of a number raised to another ...

1vote

1answer

2kviews

### Storing floating points in a stack

I'm trying to store floating point numbers into a stack from register $f1 using the stack pointer. I always get errors that the address is out of range. After I do that I want to pop the words out ...

1vote

0answers

433views

### Parse Floating point number Assembly

Hi im trying to make a custom procedure in MIPS for parsing a float (32-bit) from a string in ieee-754. Im following the steps frm Wikipedia.
The problem is that i can't handle the fact that the ...

0votes

0answers

107views

### MIPS Floating Point Squaring Resulting in 0

I'm working on an assignment where the first task set is to calculate the frobeneous norm (sum of squares) of the difference of two matrices. I'm trying to do this with single precision floating ...

0votes

0answers

36views

### Unable to determine why floating point comparison is giving syntax error

Code is meant to loop, calculating fibonacci sequence based on user input(n).
In PCSpim im receiving:
(parser) syntax error on line 71 of file.
c.ep.d $f0, $f8
s.d $f2, 0.0 #f0 - These two house ...

0votes

1answer

1kviews

### MIPS Floating Point fahrenheit to celsius

.text
.globl main
main:
la $a0,prompt # print prompt on terminal
li $v0,4
syscall
li $v0,5 # syscall 5 reads an integer
syscall
mul $...

0votes

0answers

187views

### How to write a sequence of MIPS instructions to divide the floating number at X by (-4), without using any floating-point instruction.

I didn't understand how it is possible to load floating point into integer later diving with -4 without using any floating-point instruction.We assume that there is no overflow.I'am asking this ...

0votes

0answers

302views

### MIPS assembly language programming

Hello I am currently learning MIPS assembly language programming. I am trying to print the answer truncated to only one decimal place. For example 127.0 instead of 127.000000 but it is still printing ...

0votes

0answers

363views

### How can I perform a floating point multiplication in assembly without using mul

I'm trying to perform a floating point number multiplication in assembly code but without using a mul instruction. Based on the concept of multiplication, A*B is A added B number of times but I don't ...

0votes

0answers

152views

### MIPS float register stores value but prints zero

Ive been writing a program to take various integer inputs and find the min, max, mean and variance. Mean is to be a decimal and I dont undertstand why it prints 0.00000000 for the mean, even though ...

0votes

1answer

99views

### MIPS : floating point

Let's say I have a float number 15.75 ... in $f0 register.
How can I cut the decimal part, and have the number 15?
I tried the below :
round.w.s $f0, $f0
mfc1 $a0, $f0 # moving the integer ...

0votes

0answers

420views

### MIPS program won't print out correct floating point numbers

I'm doing a homework assignment where I have to prompt the user to enter a certain amount of floating point numbers, store them in an array and print out the first number that contains duplicates. ...

0votes

0answers

26views

### MIPS32 Determining Length of Input when Adding IEEE 754 Double Precision Numbers

I am currently working on an assignment to add and multiply IEEE 754 double precision FP numbers in MIPS.
I was able to translate the numbers from IEEE to binary decimal numbers, and then normalize ...

0votes

0answers

261views

### Detect if floating point number is too big (overflow)

I'm starting with MIPS and have been assigned a homework in which I have to find the hypotenuse of a triangle given its legs (all of them are single precision floating point numbers). However, in ...

0votes

0answers

124views

### What is the FLOPs performance of MIPS64 architecture CPUs

I've been digging for quite some time and always hit a brick wall, when I try to estimate the FLOPs of a MIPS64 CPU series, that I'm evaluating for an embedded design. Moreover I can't seem to find ...

0votes

0answers

2kviews

### Converting float to binary in MIPS

I'm writing a code for an assignment and I need to convert a decimal number to its IEEE754 representation. For example: input "8.855" and output "0 10000010 00011011010111000010100".
I store the ...

0votes

0answers

1kviews

### MIPS Input and output help Floating point

Could someone help me get the odds of my lottery program to output the answer. my program is supposed to take two inputs: one being the amount of balls in the basket (i.e. 59 balls) and two being the ...

0votes

1answer

3kviews

### MIPS Floating Point Multiplication

I am new to programming in MIPS and am having trouble understanding how I can multiply two floats after reading them in from the user. How do I get the argument into a single precision floating point ...

0votes

0answers

732views

### Assembly storing float to memory

I'm working on a mini-compiler. I want to store a float number to the memory, but I want to store it in the following way:
First, I want to reserve a space for 2 variables.
Then, I want to put ...

0votes

0answers

433views

### Mips single to double floating point percision

I have this program in mips and I wasn't to change it to double precision. It looks like single and double precision floating instructions have the same instructions but instead of .s it is .d If ...

0votes

0answers

2kviews

### MIPS program for area of a square

I need to write a program to find the area of a square (in floating point decimal) where all calculations are done through function calls. I've executed the program step by step and loaded into the ...

0votes

0answers

1kviews

### Compiling/ Linking SoftFloat library using mips-linux-gnu-gcc

I am trying to compile and link a small C benchmark with floating-point operations for a MIPS target. The floating-point emulation library used with the benchmark is the SoftFloat. http://www.jhauser....

0votes

0answers

249views

### How do you conceptually add floating point/decimal numbers in assembly?

In my assembly class (MIPS), I'm presented with the question:
Add 2.85x10^3 to 7.88x10^4 using the following assumptions:
Assume that you have only 3 sig figs, with guard (2 digits) and round ...

0votes

1answer

1kviews

### MIPS: arrays are not printing correctly

So, I'm inputting two arrays and printing one of them (for now), but when I go to print one of the arrays, it prints some values of one and some values of the other array. I have no idea why this ...

0votes

1answer

474views

### C++ code into MIPS, the code in MIPS runs without error messages, but does not display results

The assignment asked us to complete a code in MIPS. The initial MIPS code needed a function we had to translate from a C++ code. I translated the function from C++ to MIPS as required.
The code in ...

0votes

1answer

2kviews

### MIPS loat float without li.s

I am trying to load a floating point integer in MIPS without a pseudocode instruction such as li.s does anyone know how I would go about doing that for an example like 2.0