Work out CPU time from the instruction count, the cycles for each instruction and the clock period.
Hardware context: A job in two parts, one of them a slow unit that can be made faster. Architecture trade-off studies
Every entry uses one equation. CPU time is the instruction count, times the CPI, times the clock period. CPI is the average number of clock cycles for one instruction.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
Times are in nanoseconds (ns). A clock of 1000 MHz has a period of 1 ns. A clock of 100 MHz has a period of 10 ns.
| Entry | Your decision |
|---|---|
| PERIOD | The clock is 100 MHz. What is the period in ns? |
| CYCLES | A program runs 20 instructions with a CPI of 2. How many clock cycles? |
| TIME | Those 40 cycles run with a period of 5 ns. CPU time in ns? |
| TIME_A | Design A: 10 instructions, CPI 2, period 10 ns. CPU time in ns? |
| TIME_B | Design B halves the period to 5 ns, and its CPI rises to 3. The same 10 instructions. CPU time in ns? |
| WINNER | Which design finishes the program sooner? Enter 1 for A or 2 for B. |
| CPI_TIMES_10 | A program of 30 instructions took 45 cycles. What is the CPI, times 10? |
| FASTER_CLOCK | A run takes 240 ns with a period of 10 ns. The period becomes 8 ns and nothing else changes. New time in ns? |
| FEWER | A rewritten program needs a quarter fewer than 40 instructions. The CPI is 2 and the period is 3 ns. CPU time in ns? |
| FREQUENCY | The period is 20 ns. What is the clock frequency in MHz? |
| TIME_C | A program runs 12 instructions with a CPI of 3 and a period of 4 ns. CPU time in ns? |
| TIME_AT_CPI | A program runs 25 instructions with a clock period of 1 ns. Each instruction takes CPI clock cycles. CPU time in ns? |
Examples
Example 1
PERIOD- Input
The clock is 100 MHz. What is the period in ns?
- Output
matches = 1
One thousand divided by 100 gives 10 ns.
Example 2
CYCLES- Input
A program runs 20 instructions with a CPI of 2. How many clock cycles?
- Output
matches = 1
Twenty instructions, two cycles each.
Example 3
TIME- Input
Those 40 cycles run with a period of 5 ns. CPU time in ns?
- Output
matches = 1
Forty cycles of 5 ns each.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For TIME_AT_CPI, enter a constant expression using CPI. Only this entry changes with the parameter. The supported integer range is 1 through 8, inclusive.
Hints
Hint 1
Instruction count, CPI and period. Find any that is missing first.
Hint 2
Count times CPI gives cycles. Cycles times period gives time.
Hint 3
A faster clock can lose to a lower CPI, and the other way round.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
12 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 3 problems on this path