CS代考 Write a MIPS assembly program that reads in a string of characters using th

Write a MIPS assembly program that reads in a string of characters using the
SPIM system call and finds how many words
“the” are in the string and prints
it on SPIM Console. For example, there are three

Copyright By PowCoder代写 加微信 powcoder

words in the string
“London is the capital and largest city of the United Kingdom. It stands on the
River Thames.
(The printed result on SPIM console for this example is:
• number of word ‘the’ in the string is: 3
The number of the characters in the string is less than 200.

Using function fibonacci(n), the sequence of numbers 1, 1, 2, 3, 5, 8, 13, 21,.
for values of n equal to 1, 2, 3, 4, 5, 6, 7, 8, … can be generated.
The result for each n is calculated as follows:
fibonacci(1) = 1,
fibonacci(2) = 1,
fibonacci(n) = fibonacci(n-1) + fibonacci(n-2)
(Note that the function is called recursively).
int fibonacci(int n)
else if (n==1|| n =
return (fibonacci(n – 1) + fibonacci(n – 2));
(a) Write the MIPS assembly code for function fibonacci.
(2.5 Marks)
(b) Write the main program, which reads the value of n from keyboard (n < 12) and prints the Fibonacci numbers up to the calculated value for n on SPIM Console. (For example, if n is 10, then the following sequence will be 1, 1, 2, 3, 5, 8, 13, 21, 34, To test your code using SPIM, consider two different values for n (6 and 11). 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com