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
Fill in the blank to complete the sentence. -------------------- is used to store and process data over the Internet using compu
Trava [24]

Answer:cloud computing

Explanation:

6 0
2 years ago
You have a manager who makes decisions without getting input from anyone. They are unwilling to change anything once a decision
saw5 [17]

Answer:

autocratic

Explanation:

taking no account of other peoples wishes or opinions; domineering

3 0
2 years ago
Z-Wave and Zigbe use a _______________ networking topology to facilitate communication in homes, yet both also have hubs that ac
Nina [5.8K]

Answer: Mesh

Explanation:

Mesh network is network topology in which network nodes are directly connected with infrastructure nodes in active manner without following any hierarchy. This interconnection is made for continuous transmission of data through the network path.It can work even if any particular connection or node faces fault.

  • Z-wave commonly uses mesh topology for connecting the nodes to facilitate the home devices in wireless manner along with hub.
  • Zigbee also uses mesh topology for proving services at low cost to homes and other areas in wireless form also having router or hub as the linking device.
4 0
2 years ago
Please help me with this! I’m using Python 3
IgorLugansk [536]

Something like this?

h1 = int(input())

m1 = int(input())

s1 = int(input())

h2 = int(input())

m2 = int(input())

s2 = int(input())

s = h2*3600 + m2*60 + s2 - (h1*3600 + m1*60 + s1)

print(s)

3 0
2 years ago
If I have 103.5% in my grade and if I got a 0/100 on a test, what do I have now in my grade?
kirill115 [55]
It might be an 81 because if you fail 0/100 yo grade is going DOWN
3 0
3 years ago
Read 2 more answers
Other questions:
  • Ipv6 includes a native information security framework (ipsec) that provides both data and control packets. true false
    15·1 answer
  • Hello, please help write code in C++. Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go nort
    12·1 answer
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • You have repaired a broken LCD panel in a laptop computer. However, when you disabled the laptop, you bent the hinge on the lid
    15·1 answer
  • Front wheel drive vehicles typically use​
    5·1 answer
  • i set up an account and paid the yearly fee, now it's asking me to join. i've tried to log in and brainly isn't accepting my ema
    8·1 answer
  • Create a class called Fraction. Provide a constructor that takes 2 integers. Provide methods for:
    8·1 answer
  • Can someone solve this for me please? It’s part of an escape room.
    13·2 answers
  • What property must be set on a menu item to have the user activate that option by pressing Ctrl C on the keyboard
    11·1 answer
  • What are some other ways to program a robot to navigate a complicated environment other than straight paths and right angle (90
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!