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
What is the acronym that helps you remember the order of math operations?
polet [3.4K]
PEMDAS (parenthesis, exponents, multiplication, division, addition, subtraction). 
7 0
3 years ago
Read 2 more answers
)what item is at the front of the list after these statements are executed?
White raven [17]

Answer:

Option (a) : sam

Explanation:

  • In the given program, the queue is defined in the first step.
  • The method addToFront() adds the given element to the front of the queue. After this step is executed the front element in the queue is that element.
  • The method addToBack() adds the given element to the back of the queue. After this step is executed the back element in the queue is that element.
  • After step 1, Jack is added to the front of the queue.
  • After step 2, Rudy is added to the back of the queue.
  • After step 3, Larry is added to the back of the queue.
  • After step 4, sam is added to the front of the queue.
  • After step 5, name contains Larry as the getBack() returns the element present at the back of the queue.
  • After step 6, Adam is added to the back of the queue.
  • After executing all of the steps now the queue contains "sam" as the front element of the queue.
  • So, the correct option is "sam".
3 0
3 years ago
A pizza cutter is a compound machine made up of what simple machines?
levacccp [35]
The correct answer is option A): "A wedge and a wheel and axle" . A compound machine is a machine composed of two or more simple machines.
4 0
3 years ago
Convert 105 decimal to 128 binary form
krok68 [10]

Answer:

1101001 is binary 105

128 in binary is 10000000

6 0
2 years ago
NEED HELP(10 POINTS) PLEASE HELP MATH
DiKsa [7]
78 ft. hope it helped
6 0
3 years ago
Read 2 more answers
Other questions:
  • A technician is troubleshooting a PC with multiple volumes. To verify which are active and assigned drive letters, the technicia
    9·1 answer
  • How do particles move at higher temperatures compared to how they move at lower temperatures?
    10·1 answer
  • Which of the following statements isNOT true about abstract data types (ADTs)?A list is anexample of an ADT.ADTs hide theimpleme
    7·1 answer
  • Anna wants to keep information secure from offenders. Which software should she install on her computer to ensure Internet safet
    13·1 answer
  • Join my disc server "the angels"<br><br> https://dis cord.gg/PYnWArCz<br><br><br> tyyy
    5·1 answer
  • (a) How many copies of the book titled "The Lost Tribe" are owned by the library branch whose name is "Sharpstown"? (b) How many
    10·1 answer
  • Bộ mã I mã hóa được nhiêu kí tự
    12·1 answer
  • Identify and state the value of hardware components​
    12·1 answer
  • What data type is this statement defined as in Python?
    13·1 answer
  • Your task is to design a method int[] allMatches(int[] values, int size, int a, int b) that returns all values between a and b i
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!