S2.6.1 Which Core Finishes First

MediumImplement22 minIcarus Verilog · serverReview the topic

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

SignalWidthRole
question8input of each check
Full specification
The three cores
The pipelined core needs 4 cycles to fill at the start. It loses 2 cycles at each taken branch.
CoreClock periodCycles
Single-cycle12 ns1 for every instruction
Multicycle4 nsarithmetic 4, load 5, store 4, branch 3
Pipelined, five stages4 nsone 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.

EntryYour decision
SINGLE_CYCLESHow many cycles does the program take on the single-cycle core?
SINGLE_TIMEHow many nanoseconds is that?
MULTI_CYCLES_LOADSHow many cycles do the two loads take on the multicycle core, together?
MULTI_CYCLESHow many cycles does the whole program take on the multicycle core?
MULTI_CPI_TIMES_10What is the CPI of the multicycle core for this program, times 10?
MULTI_TIMEHow many nanoseconds does the multicycle core need?
PIPE_CYCLESHow many cycles does the program take on the pipelined core?
PIPE_CPI_TIMES_10What is the CPI of the pipelined core for this program, times 10?
PIPE_TIMEHow many nanoseconds does the pipelined core need?
FASTEST_COREWhich core finishes first?
SLOWEST_COREWhich core finishes last?
MULTI_PERIOD_TO_TIEWith which clock period, in nanoseconds, would the multicycle core tie with the single-cycle core?
PIPE_CYCLES_FOR_KK 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

SINGLE CYCLES

Input
How many cycles does the program take on the single-cycle core?
Expected output
matches = 1

One for each of the ten instructions.

Run samples executes all 3 public checks. Check all tests runs 13 checks on the server.

Icarus Verilog · server