MIPS Number of Instructions Executed and Memory Accessed

In summary, the static instruction count for the given code is 6 and the dynamic instruction count is 299. The code accesses the instruction memory 299 times and the data memory 99 times. Assuming a single-cycle processor running at 100 KHz, the execution time for this code is 2.99 x 10-3 milliseconds. This is based on the equation Execution Time = (CPI * IC) / Clock Rate, where CPI is 1, IC is 299, and the clock rate is converted from 100 KHz to Hz.
  • #1
thchao
2
0

Homework Statement


The number of instructions a program has is the static instruction count. The number of instructions actually executed (e.g. due to some instructions being repeated, as in a loop) is called the dynamic instruction count. Consider the following code:
li $t0, 99
li $t1, 44
loop: addi $t0, $t0, -1
lw $t1, 0($t1)
bne $t0, $zero, loop
add $v0, $t0, $zero

a. What is the static instruction count of this code? What is the dynamic instruction count? (Assume any pseudoinstructions are counted as 1 instruction).
b. How many times is the instruction memory accessed? How many times is the data memory accessed?
c. Assuming this runs on a single cycle processor (with CPI = 1) running at 100 KHz, how long will the code take to execute?

Homework Equations


[/B]
Execution Time = (CPI * IC) / Clock Rate

The Attempt at a Solution



a. Static Instruction Count: 6 (Since there are only 6 instructions in the code.)
Dynamic Instruction Count: (99 * 3) - 1 + 3 = 299 (The two li instructions and the add instruction only executed once. The loop itself executes 99 times but bne instructions executes only 98 times since at the 99th iteration, $t0 = 0 and bne instruction won't executed.)

b. Instruction Memory Accessed: 299 (Number of times program counter updated)
Data Memory Accessed: 99 (Number of times lw or load instruction was executed)

c. Given CPI = 1, IC = 299 (from part a), Clock Rate = 100000 (Converted KHz to Hz)
Execution Time = (1 * 299) / 100000 = 2.99 x 10-3 milliseconds

I am not sure if I calculated the Dynamic Instruction Count correctly and if the Instruction Memory Accessed is correct or not. Any input would greatly appreicated.
 
Last edited:
Physics news on Phys.org
  • #2
thchao said:
... but bne instructions executes only 98 times since at the 99th iteration, $t0 = 0 and bne instruction won't executed.)
BNE executes every time. The duration may vary, but I think here you are not asked to consider that.

Perhaps you could say what processor this is, so that we can look up details.
 
  • #3
It's the MIPS processor.
 

1. What is a MIPS number of instructions executed?

A MIPS (Million Instructions Per Second) number of instructions executed refers to the number of instructions that a processor can execute in a second. It is a measure of the processor's speed and performance.

2. How is the MIPS number of instructions executed calculated?

The MIPS number of instructions executed is calculated by dividing the total number of instructions executed by the processor in a second by one million. This gives us a measure of the processor's speed in millions of instructions per second.

3. What is the significance of a higher MIPS number of instructions executed?

A higher MIPS number of instructions executed indicates that the processor is capable of executing more instructions in a shorter amount of time. This can result in faster processing and better overall performance of the system.

4. How does memory access affect the MIPS number of instructions executed?

Memory access refers to the process of retrieving data from the memory. It is an essential part of instruction execution. The speed and efficiency of memory access can have a significant impact on the MIPS number of instructions executed, as it can affect the overall speed and performance of the system.

5. Why is the MIPS number of instructions executed important?

The MIPS number of instructions executed is an important measure of a processor's speed and performance. It can help determine the efficiency of a system and can be used to compare different processors. A higher MIPS number indicates a more powerful processor, which is crucial in applications that require high-speed processing, such as scientific calculations and video rendering.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
9K
Back
Top