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
Complete the sentence
prisoha [69]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is: Online community technologies.

So, we can fill this question with the correct option as below:

<u>Online community technologies</u> are technologies that support virtual communities and the sharing of content with friends and family.

As we know that online community technologies are those technologies where people of the same group or interest make community virtually online. Where they can share their contents such as pictures, videos, thaught, ideas, etc with the group or family members.

There are different technologies that support virtual communities to share content with friends and family.

Such as Zoom meetings, Sk ype, Face book, Insta gram etc.

8 0
2 years ago
Read 2 more answers
I will give brainyest
Trava [24]

Answer:

Power down your Chromebook by doing a hard reset.

Explanation:

The first thing to check for when your Chromebook won't turn on is a dead battery. Plug the unit in via AC charger and let it charge for at least 30 min to an hour and try turning it on again.

3 0
1 year ago
Read 2 more answers
An information system is the entire set of __________, people, procedures, and networks that enable the use of information resou
eduard

There 4 options for this question:

a. software

b. hardware

c. data

d. All of the above

Explanation:

The correct answer, in this case, is d. All of the above, because if we want to make complete system information we must have software, hardware, and data, for example:

Social media is a software, and we must have cellphones (hardware) even behind the app there are servers and other kinds of hardware to manage the social media, the data complement all of this, it could be user information, videos, images, etc.

6 0
3 years ago
In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
MrMuchimi

Hexadecimal numbers are just a convenient representation of binary data. When entered as text, they consist of ASCII characters 0-9 and a-f. The numbers will then have to be converted to binary. This is accomplished by converting to uppercase, subtracting the ASCII offset (48 for 0-9 or 55 for A-F), so that the result is a number between 0 and 15 (inclusive). This can be stored in computer memory to represent 4 bits.

Hexadecimal numbers represent binary numbers in the following way:

hex | binary

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

a = 1010

b = 1011

c = 1100

d = 1101

e = 1110

f = 1111

As you can see, no other 4 bit combination exists.



5 0
3 years ago
Date
IRISSAK [1]

Answer:

computer is an electronic machine that accept raw data ,process and then give result. it's uses:

It is used for storing data and information.

5 0
2 years ago
Other questions:
  • What event in the 1970s contributed to the current
    6·2 answers
  • Select all the items that determine your preference for a concert ticket. a) band that is playing b) date of the concert c) pric
    7·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such tha
    11·1 answer
  • Random Access Memory is tempory computer memory that stores works in progress
    7·1 answer
  • Which option represents the location of the Goal Seek function?
    8·2 answers
  • Brainly not working for me not showing any ads or answers
    5·2 answers
  • How to automatically forward text messages to another phone iphone.
    10·1 answer
  • One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
    12·1 answer
  • For computer forensics, ____________ is the task of collecting digital evidence from electronic media.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!