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
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Name | Value |
|---|---|
| AP_UART_STATUS | 0x04 |
| AP_UART_RXDATA | 0x0C |
| AP_UART_STATUS_ROOM | 1 << 0 |
| AP_UART_STATUS_RX_READY | 1 << 1 |
| AP_UART_STATUS_RX_FULL | 1 << 2 |
| AP_GPIO_SET | 0x0C |
| AP_GPIO_STATUS | 0x24 |
| AP_SYSCTL_PINMUX | 0x10 |
| AP_PINMUX_PAD_SHIFT(pad) | 2 * pad |
| AP_PINMUX_PAD_MASK(pad) | 3 << AP_PINMUX_PAD_SHIFT(pad) |
| AP_PINMUX_SERIAL, AP_PINMUX_GPIO | 2, 1 |
| Entry | Your decision |
|---|---|
| GPIO_STATUS_ADDR | Address of AP_GPIO_BASE + AP_GPIO_STATUS. |
| RX_READY_MASK | Value of AP_UART_STATUS_RX_READY. |
| PAD2_MASK | Value of AP_PINMUX_PAD_MASK(2). |
| RXDATA_ADDR | Address of UART0 RXDATA. |
| PINMUX_ADDR | Address of PINMUX. |
| TWO_PADS | Value for PINMUX: serial on pad 1, GPIO on pad 3, pads 0 and 2 released. |
| SET_PIN9 | Value to write to GPIO SET to drive pin 9 high, leaving other pins alone. |
| STATUS_ONE_WAITING | STATUS value when the transmitter is full, one byte waits, and the queue is not full. |
| STATUS_FULL_ROOM | STATUS value when the transmitter has room and the receive queue is full. |
| STRUCT_WORDS | In a struct overlay of ap_sysctl that starts at its base, how many uint32_t members come before pinmux? |
| MUX_VALUE | Value 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