A register sequence for the bus-manager seat routes UART0, sets its bit time by the back door and sends five bytes. On the good chip it ends in UVM errors. Three lines use a door the register does not have, or check bits that move by themselves. Repair them.
Hardware context: TB_ARG, SRAM and the UVM register model of ap_soc v1.5, reached through the bus and through the bench's back door. Repairing the doors of a UVM register sequence.
The core is out of its seat. A bus manager drives the chip, and this sequence script is the whole test. It routes UART0 to pads IO0 and IO1 through the front door. It deposits a bit time of 6 cycles into DIV through the back door. Then it sends door and a new line. On the good chip it ends in UVM errors.
Three lines are wrong, and each is a door mistake. A back door exists only where the bench can name the flop. A register whose bits move by themselves has no one value to check under a full mask. Repair the three lines so that every check still says something true about the chip.
The board listens on IO0 at 6 cycles a bit. In some runs it also sends bytes of its own on the receive pad IO1, as a busy board would.
Each run happens twice. On the good chip it must pass. On a hidden faulty chip your sequence must end in a UVM error. That chip sends the bytes right, so only your own checks can catch it.
Each check compiles your sequence and links it to the pre-built chip. That took 4.2 s on the laptop (measured). On the live server expect 14 to 15 s: an estimate, from the factor of 3.3 to 3.6 measured for this bench.
Full specification
| Register | Address | Front door | Back door read | Back door deposit | Moves by itself |
|---|---|---|---|---|---|
| sysctl_pinmux | 0x1000_4010 | read and write | yes | yes | no |
| sysctl_tb_event | 0x1000_4028 | read and write | yes | no | no |
| sysctl_tb_arg | 0x1000_402C | read and write | yes | yes | the bench writes it |
| uart_txdata | 0x1000_0000 | write only | no | no | no |
| uart_status | 0x1000_0004 | read only | no | no | yes |
| uart_irq_enable | 0x1000_0008 | read and write | no | no | no |
| uart_rxdata | 0x1000_000C | read only | no | no | yes |
| uart_div | 0x1000_0010 | read and write | yes | yes | no |
| Bit | Field | Set by |
|---|---|---|
| 0 | room: the transmitter can take a byte | the transmitter, as it sends |
| 1 | rx_ready: a received byte is waiting | the board's bytes on IO1 |
| 2 | rx_full: two received bytes are waiting | the board's bytes on IO1 |
A back-door access to a register the bench does not name answers NOT_OK. put and expect_read then raise a UVM error, and the run fails. expect_read(reg, mask, value) compares the masked read with the masked value.
PINMUX 0x5AAA gives IO0 to UART0's transmitter and IO1 to its receiver. A frame is 10 bits, so 60 cycles at 6 cycles a bit; each put waits 80.
When a run ends in a UVM error the page says so, but it cannot show which line raised it. Read each line against the door table.
What the grader sees on the good chip: the bytes on IO0 (uart_bytes and uart_hash), and that UVM counted no error. That includes the environment's UART scoreboard. On the hidden chip it sees only whether UVM counted an error.
What it cannot see: which door a line used, and which of your checks caught the hidden chip. A sequence with no read check left passes on that chip and is refused. But one with a check deleted and others kept still passes, as well as a repaired one. A reviewer would ask why the check went.
Given Files
Read-only files supplied by the bench.
sequence-api.txt
class learner_seq extends chip_vseq;
virtual task body();
// One call per line
endtask
endclass
put(register, value [, UVM_BACKDOOR]);
expect_read(register, mask, expected [, UVM_BACKDOOR]);
p_sequencer.api.idle(cycles);
await_event(event_id);
Use p_sequencer.regs.<register>. The register model supplies the front door by default.
Every mapped register supports front-door transfers, including sysctl_reset_cause and plic_priority_1 through plic_priority_16. For UVM_BACKDOOR, reads support uart_div, sysctl_pinmux and sysctl_tb_status/putc/event/arg. Writes support uart_div, sysctl_pinmux and sysctl_tb_arg.
Use unsigned decimal or 32-bit hexadecimal literals. The harness creates and starts the virtual sequence.
UART0 · register manual
| Offset | Register | Bits | Field | Access | Reset | Held by | Meaning |
|---|---|---|---|---|---|---|---|
0x000 | TXDATA | 7:0 | data | wo | not stored | The low byte is the next byte to send. Byte to send. | |
0x004 | STATUS | 0 | room | ro | block | Transmit room and receive queue state. The transmitter can take a byte. | |
0x004 | STATUS | 1 | rx_ready | ro | block | At least one received byte waits. | |
0x004 | STATUS | 2 | rx_full | ro | block | The receive queue is full. | |
0x008 | IRQ_ENABLE | 0 | room | rw | 0x0 | regs | Which status bits raise interrupt source 1. ROOM raises the request. |
0x008 | IRQ_ENABLE | 1 | rx_ready | rw | 0x0 | regs | RX_READY raises the request (new in v1.5). |
0x00C | RXDATA | 7:0 | data | ro | block | The oldest received byte. The read removes it from the queue. Received byte. | |
0x010 | DIV | 15:0 | cycles | rw | 0x0010 | regs | Bit time in clk_sys cycles (new in v1.5). clk_sys cycles a bit. |
## UART0 (base 0x1000_0000, interrupt source 1, clk_sys, PD_MAIN) | Offset | Register | Bits | Field | Access | Reset | Held by | Meaning | | --- | --- | --- | --- | --- | --- | --- | --- | | `0x000` | TXDATA | 7:0 | data | wo | | not stored | The low byte is the next byte to send. Byte to send. | | `0x004` | STATUS | 0 | room | ro | | block | Transmit room and receive queue state. The transmitter can take a byte. | | `0x004` | STATUS | 1 | rx_ready | ro | | block | At least one received byte waits. | | `0x004` | STATUS | 2 | rx_full | ro | | block | The receive queue is full. | | `0x008` | IRQ_ENABLE | 0 | room | rw | `0x0` | regs | Which status bits raise interrupt source 1. ROOM raises the request. | | `0x008` | IRQ_ENABLE | 1 | rx_ready | rw | `0x0` | regs | RX_READY raises the request (new in v1.5). | | `0x00C` | RXDATA | 7:0 | data | ro | | block | The oldest received byte. The read removes it from the queue. Received byte. | | `0x010` | DIV | 15:0 | cycles | rw | `0x0010` | regs | Bit time in clk_sys cycles (new in v1.5). clk_sys cycles a bit. |
ap_sysctl · register manual
| Offset | Register | Bits | Field | Access | Reset | Held by | Meaning |
|---|---|---|---|---|---|---|---|
0x000 | CHIP_ID | 31:0 | value | ro | 0x2A5310C5 | const | The chip's identity: the IDCODE of the TAP. Fixed number. |
0x004 | RESET_CAUSE | 0 | power_on | ro | block | Sticky record of reset sources since power-on. Power-on reset. | |
0x004 | RESET_CAUSE | 1 | pin | ro | block | Reset pin. | |
0x004 | RESET_CAUSE | 2 | watchdog | ro | block | Watchdog. | |
0x004 | RESET_CAUSE | 3 | software | ro | block | Software request. | |
0x004 | RESET_CAUSE | 4 | debug | ro | block | Debug request. | |
0x008 | SOFT_RESET | 0 | timer | wo | not stored | Reset requests from software. 1 arms one restart of the timer. | |
0x008 | SOFT_RESET | 1 | chip | wo | not stored | 1 requests the software reset (new in v1.5). | |
0x00C | STRAPS | 0 | boot | ro | block | Straps as sampled at power-up (new in v1.5). 0: start in the boot ROM. 1: start in SRAM. | |
0x010 | PINMUX | 31:0 | select | rw | 0x00000000 | regs | Two bits for each of sixteen pads: 0 released, 1 GPIO, 2 serial, 3 auxiliary. Pad n uses bits 2n+1 and 2n. |
0x014 | CLK_GATE | 0 | uart0 | rw | 0x1 | regs | 1 lets that block's clock run (new in v1.5). UART0. |
0x014 | CLK_GATE | 1 | gpio | rw | 0x1 | regs | GPIO. |
0x014 | CLK_GATE | 2 | timer | rw | 0x1 | regs | Timer and PWM. |
0x014 | CLK_GATE | 3 | spi | rw | 0x1 | regs | SPI. |
0x014 | CLK_GATE | 4 | dma | rw | 0x1 | regs | DMA. |
0x018 | LOCK | 0 | pinmux | w1s | 0x0 | regs | Write-once locks. Only a reset clears one (new in v1.5). 1: PINMUX ignores writes. |
0x018 | LOCK | 1 | clk_gate | w1s | 0x0 | regs | 1: CLK_GATE ignores writes. |
0x018 | LOCK | 2 | debug | w1s | 0x0 | regs | 1: the debug lock is closed. |
0x020 | TB_STATUS | 31:0 | value | rw | 0x00000000 | regs (power-on reset only) | Scratch word 0. The firmware kit reports progress, pass and fail here. Plain storage. |
0x024 | TB_PUTC | 31:0 | value | rw | 0x00000000 | regs (power-on reset only) | Scratch word 1. The firmware kit writes one character here. Plain storage. |
0x028 | TB_EVENT | 31:0 | value | rw | 0x00000000 | regs (power-on reset only) | Scratch word 2. The firmware kit writes an event number here. Plain storage. |
0x02C | TB_ARG | 31:0 | value | rw | 0x00000000 | regs (power-on reset only) | Scratch word 3. A bench leaves a word for the firmware here. Plain storage. |
## ap_sysctl (base 0x1000_4000, clk_sys, PD_MAIN) | Offset | Register | Bits | Field | Access | Reset | Held by | Meaning | | --- | --- | --- | --- | --- | --- | --- | --- | | `0x000` | CHIP_ID | 31:0 | value | ro | `0x2A5310C5` | const | The chip's identity: the IDCODE of the TAP. Fixed number. | | `0x004` | RESET_CAUSE | 0 | power_on | ro | | block | Sticky record of reset sources since power-on. Power-on reset. | | `0x004` | RESET_CAUSE | 1 | pin | ro | | block | Reset pin. | | `0x004` | RESET_CAUSE | 2 | watchdog | ro | | block | Watchdog. | | `0x004` | RESET_CAUSE | 3 | software | ro | | block | Software request. | | `0x004` | RESET_CAUSE | 4 | debug | ro | | block | Debug request. | | `0x008` | SOFT_RESET | 0 | timer | wo | | not stored | Reset requests from software. 1 arms one restart of the timer. | | `0x008` | SOFT_RESET | 1 | chip | wo | | not stored | 1 requests the software reset (new in v1.5). | | `0x00C` | STRAPS | 0 | boot | ro | | block | Straps as sampled at power-up (new in v1.5). 0: start in the boot ROM. 1: start in SRAM. | | `0x010` | PINMUX | 31:0 | select | rw | `0x00000000` | regs | Two bits for each of sixteen pads: 0 released, 1 GPIO, 2 serial, 3 auxiliary. Pad n uses bits 2n+1 and 2n. | | `0x014` | CLK_GATE | 0 | uart0 | rw | `0x1` | regs | 1 lets that block's clock run (new in v1.5). UART0. | | `0x014` | CLK_GATE | 1 | gpio | rw | `0x1` | regs | GPIO. | | `0x014` | CLK_GATE | 2 | timer | rw | `0x1` | regs | Timer and PWM. | | `0x014` | CLK_GATE | 3 | spi | rw | `0x1` | regs | SPI. | | `0x014` | CLK_GATE | 4 | dma | rw | `0x1` | regs | DMA. | | `0x018` | LOCK | 0 | pinmux | w1s | `0x0` | regs | Write-once locks. Only a reset clears one (new in v1.5). 1: PINMUX ignores writes. | | `0x018` | LOCK | 1 | clk_gate | w1s | `0x0` | regs | 1: CLK_GATE ignores writes. | | `0x018` | LOCK | 2 | debug | w1s | `0x0` | regs | 1: the debug lock is closed. | | `0x020` | TB_STATUS | 31:0 | value | rw | `0x00000000` | regs (power-on reset only) | Scratch word 0. The firmware kit reports progress, pass and fail here. Plain storage. | | `0x024` | TB_PUTC | 31:0 | value | rw | `0x00000000` | regs (power-on reset only) | Scratch word 1. The firmware kit writes one character here. Plain storage. | | `0x028` | TB_EVENT | 31:0 | value | rw | `0x00000000` | regs (power-on reset only) | Scratch word 2. The firmware kit writes an event number here. Plain storage. | | `0x02C` | TB_ARG | 31:0 | value | rw | `0x00000000` | regs (power-on reset only) | Scratch word 3. A bench leaves a word for the firmware here. Plain storage. |
Examples
Example 1
The Repaired Sequence, Quiet Receive Pad- Input
board at 6 cycles a bit; nothing on IO1
- Output
uart_bytes=5, uart_hash=98cf4c19
The bytes 64 6f 6f 72 0a reach IO0 in order. The scoreboard matched each one with the TXDATA write that sent it.
Example 2
The Board's Own Bytes on IO1- Input
board traffic on the receive pad
- Output
uart_bytes=5, uart_hash=98cf4c19
The bytes on IO0 do not change, but STATUS does: rx_ready follows the board. A full-mask check of STATUS fails here, while a check of bit 0 passes.
Example 3
A Deposit of 5 into DIV- Input
the repaired sequence with DIV = 5
- Output
refused
A bit time of 5 against a board that listens at 6 garbles every frame. The scoreboard and the pad hash both see it.
Constraints and Contract
- Keep the class and body() lines and one call per line: put, expect_read, p_sequencer.api.idle or await_event.
- Send the same five bytes in the same order, with UART0 at 6 cycles a bit on pads IO0 and IO1.
- Repair a check rather than delete it, unless it can never be true.
Hints
Hint 1
The bench names six flops for its back door. Is TXDATA among them? Is STATUS?
Hint 2
A byte written through a back door never enters the transmitter. What does the board see then?
Hint 3
Which bits of STATUS belong to your sequence, and which to the board's receive pad?
What the grader checks: Three runs of the pre-built ap_soc v1.5 UVM bench on the bus-manager seat. Each runs on the good chip and on one hidden faulty chip. One has a quiet receive pad; two have the board's own traffic on IO1. On the good chip each run grades the bytes on IO0 and that UVM counted no error. On the hidden chip it needs a UVM error. The grader cannot see which door a line used. It refuses a sequence with no read check left. But it cannot tell a repaired check from a deleted one while other checks remain.
3 checks on ap_soc v1.5 · UVM sequence · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your text only; the chip, the bench and the hidden checks stay on the server. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path