Read an object file and a symbol table, and place variables in the hex file the bench loads. Then decide which bench writes survive start-up.
Hardware context: A firmware image of ap_soc v1.5: object file, linked image, hex file and symbol table. Running many tests from one image.
The lab program of lesson V0.6 (riscv64-unknown-elf-gcc (14.2.0+19) 14.2.0). Section codes: 1 .text, 2 .data, 3 .bss. Yes is 1, no is 0. The .hex file has 8 header words, 1,024 ROM words, then SRAM words from 0x8000_0000, one a line, counted from 1.
This worksheet uses named constants. The first three entries show how to record your decisions.
Replace each unresolved value of 4294967295 with your result.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| nm image.o |
|---|
| 00000000 R banner |
| 00000000 D blinks |
| 00000000 T main |
| 00000000 B seen |
| U tb_put_hex |
| U tb_putc |
| U tb_puts |
| Symbol (linked, SRAM layout) | Address |
|---|---|
| main | 0x80000278 |
| blinks | 0x8000030c |
| seen | 0x80000358 |
| banner | 0x80000304 |
| Entry | Your decision |
|---|---|
| BLINKS_SECTION | Section of blinks (letter D). |
| SEEN_SECTION | Section of seen (letter B). |
| BLINKS_LINE | Line of the .hex file that holds blinks. |
| NAMES_FROM_ELSEWHERE | How many names does image.o use without defining them? |
| MAIN_IN_OBJECT | Address of main in image.o. |
| MAIN_LINE | Line of the .hex file that holds main's first instruction. |
| HEX_LINES | Lines in the whole .hex file. |
| SET_DATA_SRAM | SRAM layout: does a bench write to blinks survive start-up? |
| SET_DATA_ROM | ROM layout: does a bench write to blinks survive start-up? |
| SET_BSS | Does a bench write to a .bss variable survive start-up? |
| HEX_LINE | A variable sits at 0x8000_0000 + 4 x W. Which line of the .hex file holds it? |
Examples
Example 1
BLINKS SECTION- Input
Section of blinks (letter D).
- Output
matches = 1
D is initialised data: .data.
Example 2
SEEN SECTION- Input
Section of seen (letter B).
- Output
matches = 1
B starts at 0: .bss.
Example 3
BLINKS LINE- Input
Line of the .hex file that holds blinks.
- Output
matches = 1
(0x30C / 4) = 195; 8 + 1,024 + 195 + 1 = 1,228.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For HEX_LINE, enter a constant expression using W. Only this entry changes with the parameter. The supported integer range is 0 through 2047, inclusive.
Hints
Hint 1
T code, D data with a value, B data at 0, R read-only, U defined elsewhere.
Hint 2
Subtract the SRAM base, divide by 4, add 8 and 1,024 and 1.
Hint 3
A bench write before reset survives only if start-up code never writes that word.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
15 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