View the step-by-step solution to:

Question

(a) More registers appear to be a good thing, in terms of reducing the total number of memory accesses a program

might require. Given an arithmetic example, Sum=(A+B)-(C+D), support this statement. First, determine the number of memory accesses necessary using MARIE and the two registers for holding memory data values (AC and MBR). Then perform the same arithmetic computation for a processor that has more than three registers to hold memory data values. [8 marks]


(b) How to write a MARIE program to calculate some basic statistics on a list of positive numbers. The program will ask users to input the numbers one by one. Assume that all numbers will be in the range 1 to 1000. To terminate the data entry, the user will input any negative number. Once the data entry is complete, the program will show four statistics about the list of numbers:

(i) Count, (ii) Minimum value, and (iii) Sum of the numbers.


As an example, if the user enters the following decimal numbers as input (one after the other)

23, 6, 78, 36, 3, 250, 127, 210, -5

the program would output the following values as the count, minimum and sum respectively:

8

3

733

Assume that the user will always provide valid numbers as input, that is, do not worry about dealing with invalid input data.

Write comments within your program so that a reader can understand it easily. [12 marks]


Top Answer

Answer a) For the statement:- Sum = (A + B) - (C + D) In MARIE Assembly: Load A Add B Store Temp1 Load C Add D Store Temp2... View the full answer

c2.PNG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question