Running time: operands in memory versus registers
Hi, I'm trying to compare the running time for operands in memory versus operands in registers. The specs are below:
- number of instructions: n
- 2-addresses per instruction
- 10 times longer to access memory versus register
- each instruction has at least 1 memory reference due to fetch operation in fetch/execute cycle
This is my what I did---please correct me if I'm wrong:
Instruction with operands in registers:
10 units of measurement for memory reference in fetch operation + 1 unit for register 1 + 1 unit for register 2 = 12 units
Instruction with operans in memory:
10 units (fetch operation) + 10 units for memory address 1 + 10 units for memory address 2 = 30 units
30/12 = 2.5
2.5 times longer for operands in memory versus in registers
Thanks!