1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
damaskus [11]
3 years ago
10

Write a MIPS assembly language program that prompts for a user to enter a series of floating point numbers and calls read_float

to read in numbers and store them in an array only if the same number is not stored in the array yet. Then the program should display the array content on the console window.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. Here is one instruction that you might use:
c.eq.s $f2, $f4
bc1t Label1
Here if the value in the register $f2 is equals to the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT equals to the value in $f4, then it should be:
c.eq.s $f2, $f4
bc1f Label1
To load a single precision floating point number (instead of lw for an integer), you might use:
l.s $f12, 0($t0)
To store a single precision floating point number (instead of sw for an integer), you might use:
s.s $f12, 0($t0)
To assign a constant floating point number (instead of li for an integer), you might use:
li.s $f12, 123.45
To copy a floating point number from one register to another (instead of move for an integer), you might use:
mov.s $f10, $f12
The following shows the syscall numbers needed for this assignment.
System Call System Call System Call
Number Operation Description
2 print_float $v0 = 2, $f12 = float number to be printed
4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string
6 read_float $v0 = 6; user types a float number at keyboard; value is store in $f0
8 read_string $v0 = 8; user types string at keybd; addr of beginning of string is store in $a0; len in $a1
------------------------------------------
C program will ask a user to enter numbers and store them in an array
only if the same number is not in the array yet.
Then it prints out the result array content.
You need to write MIPS assembly code based on the following C code.
-------------------------------------------
void main( )
{
int arraysize = 10;
float array[arraysize];
int i, j, alreadyStored;
float num;
i = 0;
while (i < arraysize)
{
printf("Enter a number:\n");
//read an integer from a user input and store it in num1
scanf("%f", &num);
//check if the number is already stored in the array
alreadyStored = 0;
for (j = 0; j < i; j++)
{
if (array[j] == num)
{
alreadyStored = 1;
}
}
//Only if the same number is not in the array yet
if (alreadyStored == 0)
{
array[i] = num;
i++;
}
}
printf("The array contains the following:\n");
i = 0;
while (i < arraysize)
{
printf("%f\n", array[i]);
i++;
}
return;
}
Here are sample outputs (user input is in bold): -- note that you might get some rounding errors
Enter a number:
3
Enter a number:
54.4
Enter a number:
2
Enter a number:
5
Enter a number:
2
Enter a number:
-4
Enter a number:
5
Enter a number:
76
Enter a number:
-23
Enter a number:
43.53
Enter a number:
-43.53
Enter a number:
43.53
Enter a number:
65.43
The array contains the following:
3.00000000
54.40000153
2.00000000
5.00000000
-4.00000000
76.00000000
-23.00000000
43.52999878
-43.52999878
65.43000031
Computers and Technology
1 answer:
LenaWriter [7]3 years ago
4 0

Explanation:

Here if the value in the register $f2 is equals to the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT equals to the value in $f4, then it should be

You might be interested in
How can you prevent the flash from going off no matter how much light there is iready
Goshia [24]
There is a setting.
8 0
3 years ago
Which of the following types of software is most applicable to the promotion of new products through advertising?
LenaWriter [7]

It cannot be database programs because database programs can not

store and organize data.

create graphics.

communicate data.

alleviate information overload.

It cannot be spreadsheets because a spreadsheet or worksheet is a file made of rows and columns that help sort data, arrange data easily, and calculate numerical data. What makes a spreadsheet software program unique is its ability to calculate values using mathematical formulas and the data in cells.

It cannot be word processing tools because a word processor is software or a device that allows users to create, edit, and print documents. It enables you to write text, store it electronically, display it on a screen, modify it by entering commands and characters from the keyboard, and print it.

Therefore the answer is C. Web design programs.

Hope this helps.

8 0
4 years ago
Read 2 more answers
Please help <br>if I clear data on play services framework, will it delete all files on phone​
asambeis [7]

Answer:

Hey there!

Explanation:

Hope this helps :)

5 0
3 years ago
Why is compression a "hard problem" for computers? Draw on your own experience compressing text with the text compression widget
forsale [732]

Answer:

Compression is hard since we usually find it difficult to determine the best compression rate .

When using the text compression widget we make a key that represent every work we have repeated in order to decrease the stored data.

When you have extends you compression beyond what it should be it is easy to notice since there will be no algorithm and that makes it hard hence we end up making assumptions on what ratio we will use for compression by using a thorough key.

5 0
4 years ago
3 ways to get home safe if there's drugs in your system
almond37 [142]
Dont drive so ask a friend to drive you home
3 0
3 years ago
Other questions:
  • Which of the following is NOT a logical operator (logical connective)?
    5·1 answer
  • 5.11 Of these two types of programs:a. I/O-boundb. CPU-boundwhich is more likely to have voluntary context switches, and which i
    9·1 answer
  • Decide what activity is most appropriate based on the temperature. If the temperature is greater than 80 degrees, then display t
    13·1 answer
  • When you're working with a word processing document and you press the del key, what happens?
    6·2 answers
  • A quarter of adults have a tablet and half of them own a smartphone.<br> a. True<br> b. False
    7·2 answers
  • What may happen if a large number of computer users are attempting to access a Web site at the same time that you are?
    5·2 answers
  • In which type of modulation is a 1 distinguished from a 0 by shifting the direction in whichthe wave begins?
    14·1 answer
  • 45 points!!
    15·2 answers
  • To keep files organized, related documents are often stored in ____ (also called directories) located on the storage medium.
    11·1 answer
  • What would the theoretical variance (square of the standard deviation) of the following random values be? rand(Normal(80, 10), 2
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!