Question 3 More registers appears to be a good thing, in terms of reducing the t
ID: 3751574 • Letter: Q
Question
Question 3 More registers appears to be a good thing, in terms of reducing the total number of memory accesses a program might require. Using the arithmetic expression S A+B-(C+D support this statement. Hints: 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 (for example, R1, R2, R3, R4) to hold memory data values.] [6 marks]Explanation / Answer
Memory accessing in MARIE:
load a //loads a into AC
add b //adds b to a and stores in AC
store expr1 //stores sum in expression1
load c //loads c into AC
add d //adds c to d and stores in AC
store expr2 //stores sum in expression2
load expr1 //loads expr1
subt expr2 //subtract expr2 from expr1
store s //finally ,stores the result in s.
###Using registers R1,R2 and R3
add R1 a b //adds a and b then stores the result in R1
add R2 c d //adds c and d then stores the result in R2
sub R3 R1 R2 //subs R2 from R1 then stores in R3
store s R3 //Store final result in s
When using MARIE there are total of 9 memory accesses,whereas using more registers
decreases the memory accesses to 7.When we use more registers definitely the number
of instructions are reduced but the decrease in memory is marginal only.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.