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
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Measured | Value | Source |
|---|---|---|
| Mailbox character (TB_PUTC) | 13 cycles | Recorded on ap_soc v1.5, a 16-character line |
| UART character at DIV = 8 | 88 cycles | Recorded on ap_soc v1.5, the same line |
| Live server speed | 80,000 cycles a second | Measured at stage E8 (plan 6.2) |
| C compile and link, live | 515 ms | Measured at stage E8 (facts 27.13) |
| Entry | Your decision |
|---|---|
| BOOT | Cycles of start-up code: from the first fetch to main entered. |
| BODY | Cycles of main: from main entered to the pass word. |
| SHARE | Start-up as a percentage of the whole run (the last cycle), rounded down. |
| LIVE_US | Microseconds the whole run takes on the live server. |
| COMPILE_RATIO | How many times longer the live compile takes than the live run, rounded down. |
| LOG_CYCLES | Cycles to print a 40-character log line through the mailbox. |
| UART_LOG_CYCLES | Cycles to send the same line out of the UART at DIV = 8. |
| SHARE_AT | Start-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