Turn windows read from mcycle into scores per MHz and per second. Then decide which build of ap_rv32 is really faster.
Hardware context: An in-house checksum kernel on both builds of ap_rv32, timed between two reads of mcycle. Benchmarking and core selection
This is the checksum kernel of lesson S8.14 with its inner loop unrolled. It has eight copies of the body and no inner branch. Both builds of ap_rv32 ran it. The table gives the window that each read from mcycle. Each window holds the two counter reads as well.
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
| Iterations in the run | Single-cycle window | Five-stage window |
|---|---|---|
| 1 | 44 cycles | 50 cycles |
| 10 | 422 cycles | 446 cycles |
| 20 | 842 cycles | 886 cycles |
| Item | Value |
|---|---|
| Clocks | Single-cycle 65 MHz, five-stage 100 MHz (exercise values, as in S8.14). |
| Instructions for each iteration | 42 on both builds: the same program. |
| Cycles for each iteration | Take two long runs and divide the difference of their windows by the difference of their iterations. |
| Units | A score per MHz is iterations for each million cycles. Enter it in hundreds, cut down: 23,456 is 234. |
Enter CPI and IPC in hundredths, rounded to the nearest: 1.27 is 127. Enter a core as 1 for the single-cycle core and 2 for the five-stage core.
| Entry | Your decision |
|---|---|
| SINGLE_ITER | Cycles for each iteration on the single-cycle core, in a long run. |
| FIVE_ITER | Cycles for each iteration on the five-stage core, in a long run. |
| FIVE_CPI | CPI of the five-stage core in a long run, in hundredths. |
| FIVE_IPC | IPC of the five-stage core in a long run, in hundredths. |
| SINGLE_PER_MHZ | Score per MHz of the single-cycle core, in hundreds. |
| FIVE_PER_MHZ | Score per MHz of the five-stage core, in hundreds. |
| MHZ_WINNER | Which core has the higher score per MHz? |
| SECOND_WINNER | Which core has the higher score for each second, at its own clock? |
| LEAD_PERCENT | By how many percent does that core lead, per second? Cut down to a whole number. |
| CLOCK_NEEDED | The lowest whole clock in MHz at which the single-cycle core would match or pass the five-stage core at 100 MHz. |
| SHORT_PER_MHZ | A careless test runs one iteration on the five-stage core and uses its whole window. What score per MHz does it report, in hundreds? |
| LOST_TO_BRANCH | How many cycles of each iteration does the five-stage core lose to taken branches, in a long run? |
| WINNER_AT_MHZ | The five-stage core stays at 100 MHz. The single-cycle core runs at MHZ. Which one has the higher score for each second? 1 for the single-cycle core, 2 for the five-stage core. |
Examples
Example 1
SINGLE ITER- Input
Cycles for each iteration on the single-cycle core, in a long run.
- Output
matches = 1
842 − 422 = 420 cycles for 10 more iterations.
Example 2
FIVE ITER- Input
Cycles for each iteration on the five-stage core, in a long run.
- Output
matches = 1
886 − 446 = 440 cycles for 10 more iterations.
Example 3
FIVE CPI- Input
CPI of the five-stage core in a long run, in hundredths.
- Output
matches = 1
44 cycles for 42 instructions is 1.048, rounded 1.05.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For WINNER_AT_MHZ, enter a constant expression using MHZ. Only this entry changes with the parameter. The supported integer range is 65 through 120, inclusive.
Hints
Hint 1
Use two long runs, so that the counter reads cancel out.
Hint 2
Per MHz is 1,000,000 divided by the cycles. Per second multiplies by the clock.
Hint 3
A score per MHz says nothing about the clock that a core reaches.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
13 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 1 problem on this path