V4.1.2 What a Test's Life Costs

EasyImplement12 minIcarus Verilog · serverReview the topic

Read the milestones of one recorded C test. Work out what each stage of its life costs, on the chip and on the live server.

Hardware context: One C test on ap_soc v1.5, from compile and back-door load to the pass word. Working out what each stage of a test's life costs.

One C test ran on ap_soc v1.5 (firmware built with riscv64-unknown-elf-gcc 14.2.0, SRAM layout). Its retire trace gives these cycles of clk_sys after reset. First fetch 9, main entered 183, first check 351, pass word 499, last cycle 507. Work in whole numbers and round down.

This worksheet uses named constants. The first three entries show how to record your decisions.

Replace each unresolved value of 65535 with your result.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
MeasuredValueSource
Mailbox character (TB_PUTC)13 cyclesRecorded on ap_soc v1.5, a 16-character line
UART character at DIV = 888 cyclesRecorded on ap_soc v1.5, the same line
Live server speed80,000 cycles a secondMeasured at stage E8 (plan 6.2)
C compile and link, live515 msMeasured at stage E8 (facts 27.13)
EntryYour decision
BOOTCycles of start-up code: from the first fetch to main entered.
BODYCycles of main: from main entered to the pass word.
SHAREStart-up as a percentage of the whole run (the last cycle), rounded down.
LIVE_USMicroseconds the whole run takes on the live server.
COMPILE_RATIOHow many times longer the live compile takes than the live run, rounded down.
LOG_CYCLESCycles to print a 40-character log line through the mailbox.
UART_LOG_CYCLESCycles to send the same line out of the UART at DIV = 8.
SHARE_ATStart-up as a percentage of a run whose main takes MAIN_K thousand cycles, rounded down. Start-up is still 174 cycles, with 9 before the first fetch and 8 after the pass word.

Examples

Example 1

BOOT
Input
Cycles of start-up code: from the first fetch to main entered.
Output
matches = 1

183 - 9 = 174.

Example 2

BODY
Input
Cycles of main: from main entered to the pass word.
Output
matches = 1

499 - 183 = 316.

Example 3

SHARE
Input
Start-up as a percentage of the whole run (the last cycle), rounded down.
Output
matches = 1

100 × 174 / 507, rounded down.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For SHARE_AT, enter a constant expression using MAIN_K. Only this entry changes with the parameter. The supported integer range is 1 through 20, inclusive.

Hints

Hint 1

Each stage is the distance between two cycles of the trace.

Hint 2

Cycles divided by the live speed.

Hint 3

A short test is dominated by what happens around it.

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 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

BOOT

Input
Cycles of start-up code: from the first fetch to main entered.
Expected output
matches = 1

183 - 9 = 174.

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

Icarus Verilog · server