One program of ten instructions runs on a single-cycle core, a multicycle core and a pipelined core. Count the cycles of each, and find the time.
Hardware context: The single-cycle datapath of ap_rv32_sc with a delay behind each block, in levels of gates measured by Yosys on the real blocks, and the logic-depth report of the whole core. Reading a timing report and deciding where to spend effort on speed
A program executes ten instructions: five arithmetic instructions, two loads, one store and two branches. One of the two branches is taken. The table gives the clock period of each core, and how many cycles each kind of instruction takes on the multicycle core. Times are in nanoseconds.
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
| Core | Clock period | Cycles |
|---|---|---|
| Single-cycle | 12 ns | 1 for every instruction |
| Multicycle | 4 ns | arithmetic 4, load 5, store 4, branch 3 |
| Pipelined, five stages | 4 ns | one instruction completes in each cycle, once the pipeline is full |
Enter every value in decimal. Where an entry asks for a core, enter 1 for single-cycle, 2 for multicycle, or 3 for pipelined. A CPI is asked times 10, so that it is a whole number: enter 25 for a CPI of 2.5.
| Entry | Your decision |
|---|---|
| SINGLE_CYCLES | How many cycles does the program take on the single-cycle core? |
| SINGLE_TIME | How many nanoseconds is that? |
| MULTI_CYCLES_LOADS | How many cycles do the two loads take on the multicycle core, together? |
| MULTI_CYCLES | How many cycles does the whole program take on the multicycle core? |
| MULTI_CPI_TIMES_10 | What is the CPI of the multicycle core for this program, times 10? |
| MULTI_TIME | How many nanoseconds does the multicycle core need? |
| PIPE_CYCLES | How many cycles does the program take on the pipelined core? |
| PIPE_CPI_TIMES_10 | What is the CPI of the pipelined core for this program, times 10? |
| PIPE_TIME | How many nanoseconds does the pipelined core need? |
| FASTEST_CORE | Which core finishes first? |
| SLOWEST_CORE | Which core finishes last? |
| MULTI_PERIOD_TO_TIE | With which clock period, in nanoseconds, would the multicycle core tie with the single-cycle core? |
| PIPE_CYCLES_FOR_K | K of the two branches are taken. Give the cycles of the pipelined core, as an expression in K. |
Examples
Example 1
SINGLE CYCLES- Input
How many cycles does the program take on the single-cycle core?
- Output
matches = 1
One for each of the ten instructions.
Example 2
SINGLE TIME- Input
How many nanoseconds is that?
- Output
matches = 1
Ten cycles of 12 ns.
Example 3
MULTI CYCLES LOADS- Input
How many cycles do the two loads take on the multicycle core, together?
- Output
matches = 1
Two loads of 5 cycles each.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For PIPE_CYCLES_FOR_K, enter a constant expression using K. Only this entry changes with the parameter. The supported integer range is 1 through 2, inclusive.
Hints
Hint 1
For each core, count cycles before you think about time.
Hint 2
Time is cycles times the clock period. A short period alone says nothing.
Hint 3
Start from one cycle for each instruction. Then add what is lost: the cycles to fill, and the taken branches.
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 2 problems on this path