askvity

How to Calculate MIPS?

Published in Processor Performance Calculation 3 mins read

To calculate MIPS (Million Instructions Per Second), you divide the clock frequency of a processor by the average number of clock cycles an instruction takes on that processor, and then divide the result by one million.

Understanding MIPS

MIPS, or Million Instructions Per Second, is a unit of measurement used to gauge a processor's speed. As stated in a TI E2E forum discussion, it represents "the number of instructions a CPU can execute in one second." It provides a simple way to compare the raw processing power of different CPUs or MCUs (Microcontroller Units).

The MIPS Calculation Formula

The precise method for calculating MIPS, as outlined in the provided reference, involves the following formula:

MIPS = (Clock Frequency / Average Clock Cycles Per Instruction) / 1,000,000

Where:

  • Clock Frequency (Hz): This is the speed at which the processor's internal clock operates, typically measured in Hertz (Hz), Megahertz (MHz), or Gigahertz (GHz). It represents the number of clock cycles per second.
  • Average Clock Cycles Per Instruction (CPI): This value represents the average number of clock cycles required for the processor to complete a single instruction. Different instructions can take varying numbers of clock cycles, so an average is often used for general MIPS calculations. A lower CPI indicates a more efficient processor design.
  • 1,000,000: This divisor converts the result from "Instructions Per Second" to "Million Instructions Per Second."

Step-by-Step Calculation

Here’s how to calculate MIPS:

  1. Determine the Clock Frequency: Find the operating clock frequency of your CPU or MCU. Ensure it is in Hertz (Hz). If it's in MHz, multiply by 1,000,000; if in GHz, multiply by 1,000,000,000.
  2. Ascertain the Average CPI: Identify the average number of clock cycles required for one instruction. This is often provided in the processor's datasheet or architecture documentation.
  3. Calculate Instructions Per Second (IPS): Divide the Clock Frequency by the Average Clock Cycles Per Instruction.
    • IPS = Clock Frequency / Average CPI
  4. Convert to MIPS: Divide the Instructions Per Second (IPS) result by 1,000,000.
    • MIPS = IPS / 1,000,000

Example Calculation

Let's illustrate with a hypothetical example:

Imagine a microcontroller (MCU) with the following specifications:

  • Clock Frequency: 16 MHz (Megahertz)
  • Average Clock Cycles Per Instruction (CPI): 2 cycles/instruction

Step 1: Convert Clock Frequency to Hz
16 MHz = 16 * 1,000,000 Hz = 16,000,000 Hz

Step 2: Calculate Instructions Per Second (IPS)
IPS = 16,000,000 Hz / 2 cycles/instruction = 8,000,000 instructions/second

Step 3: Convert to MIPS
MIPS = 8,000,000 instructions/second / 1,000,000 = 8 MIPS

So, this hypothetical MCU would be rated at 8 MIPS.

Key Terms Summary

Understanding these terms is crucial for accurate MIPS calculation:

Term Abbreviation Description Unit
Million Instructions Per Second MIPS A measure of a processor's speed, representing millions of instructions executed per second. MIPS
Clock Frequency F_clock The rate at which the processor's internal clock operates. Hz (Hertz)
Clock Cycles Per Instruction CPI The average number of clock cycles required for the processor to complete a single instruction. Cycles/Instruction

MIPS provides a quick, general estimate of processor performance, especially useful for comparing similar architectures.

Related Articles