An engineer compares two CPU designs using a program that executes 120 million instructions. In both designs, 50% of the executed instructions are arithmetic instructions, 30% are loads and 20% are branches.
The cycles per instruction (CPI) value measures the average number of clock cycles used per executed instruction. Use the following class costs as complete cycle accounting, including any stalls; ignore startup and shutdown costs.
Instruction class
Original CPI
Redesigned CPI
Arithmetic
1
Load
4
2
Branch
3
The original CPU runs at 2.40 GHz; the redesigned CPU runs at 2.00 GHz. The instruction count and instruction mix remain unchanged.
Calculate the original execution time and redesigned execution time in milliseconds, each to one decimal place. Also calculate the speedup, defined as original time divided by redesigned time, to three decimal places.
Unlock full course notes by signing up
Register transfers for a LOAD instruction
In a simple accumulator machine, a LOAD instruction copies the value stored at a memory address, given in the instruction itself, into the accumulator. Arrange the register transfers in order, from the start of the instruction fetch to the end of execution. The program counter increment, which overlaps the fetch, is not listed.
Separating carry from signed overflow
An embedded controller has an 8-bit arithmetic unit. Its carry flag is set when an unsigned addition produces a ninth bit. Its overflow flag is set when the exact signed sum falls outside the representable range of −128 through 127.
The operands below are written as unsigned decimal values identifying their 8-bit patterns. For the signed check, interpret those same patterns using two's complement.
Complete each classification using exactly one of these words: carry, overflow, both, neither. Each addition is independent.
Bits left for an immediate field
A processor uses fixed-length 32-bit instructions. One instruction format contains an opcode field, two register fields and an immediate field. The processor has 64 general-purpose registers, and the instruction set defines 120 distinct opcodes. If the opcode field and each register field use the fewest bits that can encode every possibility, how many bits remain for the immediate field? Answer as a whole number of bits.
Scheduling dependent instructions through a CPU pipeline
A CPU executes instructions in order through a five-stage pipeline, allowing different instructions to occupy different stages during the same clock cycle. The stages are instruction fetch (IF), decode and register read (ID), execute (EX), memory access (MEM), and register write-back (WB). Each stage takes one cycle.
Starting with an empty pipeline, the CPU fetches the first of these instructions in cycle 1:
LOAD R1, [R2] reads a memory value into R1, using the address in R2.