V0.3.2 Read the Generated Header

EasyImplement12 minIcarus Verilog · serverReview the topic

Use ap_soc_regs.h to compute register addresses, field masks and values to write, and see why struct overlays need reserved words.

Hardware context: A host-native model of the UART0 receive queue of ap_soc, reached through the generated header. Turning a register header into addresses and values during bring-up.

Work from the header names of lesson V0.3: AP_UART0_BASE = 0x1000_0000, AP_GPIO_BASE = 0x1000_1000, AP_SYSCTL_BASE = 0x1000_4000, and the offsets and masks it defines. Enter each answer as a number.

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
NameValue
AP_UART_STATUS0x04
AP_UART_RXDATA0x0C
AP_UART_STATUS_ROOM1 << 0
AP_UART_STATUS_RX_READY1 << 1
AP_UART_STATUS_RX_FULL1 << 2
AP_GPIO_SET0x0C
AP_GPIO_STATUS0x24
AP_SYSCTL_PINMUX0x10
AP_PINMUX_PAD_SHIFT(pad)2 * pad
AP_PINMUX_PAD_MASK(pad)3 << AP_PINMUX_PAD_SHIFT(pad)
AP_PINMUX_SERIAL, AP_PINMUX_GPIO2, 1
EntryYour decision
GPIO_STATUS_ADDRAddress of AP_GPIO_BASE + AP_GPIO_STATUS.
RX_READY_MASKValue of AP_UART_STATUS_RX_READY.
PAD2_MASKValue of AP_PINMUX_PAD_MASK(2).
RXDATA_ADDRAddress of UART0 RXDATA.
PINMUX_ADDRAddress of PINMUX.
TWO_PADSValue for PINMUX: serial on pad 1, GPIO on pad 3, pads 0 and 2 released.
SET_PIN9Value to write to GPIO SET to drive pin 9 high, leaving other pins alone.
STATUS_ONE_WAITINGSTATUS value when the transmitter is full, one byte waits, and the queue is not full.
STATUS_FULL_ROOMSTATUS value when the transmitter has room and the receive queue is full.
STRUCT_WORDSIn a struct overlay of ap_sysctl that starts at its base, how many uint32_t members come before pinmux?
MUX_VALUEValue for PINMUX that gives pad T / 4 the function T % 4 and releases every other pad.

Examples

Example 1

GPIO STATUS ADDR
Input
Address of AP_GPIO_BASE + AP_GPIO_STATUS.
Output
matches = 1

0x1000_1000 + 0x24.

Example 2

RX READY MASK
Input
Value of AP_UART_STATUS_RX_READY.
Output
matches = 1

1 shifted left by 1.

Example 3

PAD2 MASK
Input
Value of AP_PINMUX_PAD_MASK(2).
Output
matches = 1

3 shifted left by 4.

Constraints and Contract

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

Hints

Hint 1

Every address is a block base plus a register offset.

Hint 2

A field mask is its width in ones, shifted to its first bit.

Hint 3

A struct member sits after all members before it, so every unlisted register needs a reserved 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

GPIO STATUS ADDR

Input
Address of AP_GPIO_BASE + AP_GPIO_STATUS.
Expected output
matches = 1

0x1000_1000 + 0x24.

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

Icarus Verilog · server