V0.6.1 Symbols, Sections and the Hex File

EasyImplement12 minIcarus Verilog · serverReview the topic

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

SignalWidthRole
question8input 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
main0x80000278
blinks0x8000030c
seen0x80000358
banner0x80000304
EntryYour decision
BLINKS_SECTIONSection of blinks (letter D).
SEEN_SECTIONSection of seen (letter B).
BLINKS_LINELine of the .hex file that holds blinks.
NAMES_FROM_ELSEWHEREHow many names does image.o use without defining them?
MAIN_IN_OBJECTAddress of main in image.o.
MAIN_LINELine of the .hex file that holds main's first instruction.
HEX_LINESLines in the whole .hex file.
SET_DATA_SRAMSRAM layout: does a bench write to blinks survive start-up?
SET_DATA_ROMROM layout: does a bench write to blinks survive start-up?
SET_BSSDoes a bench write to a .bss variable survive start-up?
HEX_LINEA 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

Report a problem with this page

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

BLINKS SECTION

Input
Section of blinks (letter D).
Expected output
matches = 1

D is initialised data: .data.

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

Icarus Verilog · server