Write a DMA test as a UVM sequence on the bus-manager seat. Fill the buffer, program the job, poll STATUS with a limit, read the copy back and report. Some runs then add a drill: a second job sent where no region answers.
Hardware context: One layered DMA driver run as firmware, as C on the host through the seat, and as a sequence table. A DMA copy written as a UVM register sequence, with drills that must fault.
With no core in the seat, your virtual sequence plays the firmware of a DMA test. TB_ARG holds this run's job when the run starts; read it through the register model. Fill the buffer through the bus with soc_bus_seq. Then program SRC, DST and LEN, clear DONE and FAULT, and start the job.
Poll STATUS until DONE or FAULT, with a limit and p_sequencer.api.idle between reads. On DONE, read the copy back through the bus. Report a byte that differs with uvm_error. If every byte matches, write ok and a new line to TB_PUTC. On FAULT, write fault and a new line, and do not touch the destination.
In a drill, a second job follows the copy, with the same LEN. Drill 1 moves its SRC to 0x4000_0000 + 4 × k; drill 2 moves its DST to 0x4000_0000 + b. No region answers there, so the job must end in FAULT. A bus access of yours to that address would answer ERROR.
Each run happens twice: on the good chip, which must pass, and on a hidden faulty chip. On that chip your sequence must end in a UVM error. Its DMA still reports DONE and writes LEN bytes.
Each check compiles your classes with the whole chip's UVM environment. On the laptop that took 109.0 s (measured, with other jobs running). On the live server the whole reference took 5.7 minutes with an empty queue (measured once). Allow more when the server is busy. The page shows your place in the queue and the elapsed time.
Full specification
| Bits | Name | Meaning |
|---|---|---|
| 7:0 | LEN | Bytes to copy, 1 to 64 |
| 15:8 | k | The buffer is at 0x8000_1000 + 4 × k |
| 17:16 | b | The destination is 0x8000_2000 + b |
| 19:18 | drill | 0: none. 1: after the copy, a job from SRC = 0x4000_0000 + 4 × k. 2: after the copy, a job to DST = 0x4000_0000 + b |
| 31:24 | s | Byte j of the data is (s + j) mod 256 |
Fill the buffer with whole words, little endian. The word at buffer + 4i holds bytes 4i to 4i + 3 of the data. Fill (LEN + 3) / 4 words, once, before the first job. Write nothing else to SRAM.
| Register | Use |
|---|---|
| dma_src, dma_dst, dma_len | The job: first source byte, first destination byte, bytes |
| dma_status | Fields busy (bit 0), done (bit 1) and fault (bit 2). Write 1 to clear done or fault |
| dma_start | Write 1 last: the job starts |
| sysctl_tb_arg | The job, deposited by the bench after reset |
| sysctl_tb_putc | One character of the console per write |
The DMA moves one byte at a time, a read then a write. A bus error stops the job at that byte and sets FAULT. soc_bus_seq moves one whole word: set write, addr and data, then start it on p_sequencer.bus; after a read, data holds the word. An ERROR answer to it is a UVM error.
The given sequence API lists the register-model calls you may use. Field handles from get_field_by_name, mirror and get_mirrored_value read STATUS by its field names.
When a run ends in a UVM error the page says so in one sentence; it cannot show the UVM message. It does show your console text, so a character written to TB_PUTC is a way to see how far a run got.
On the good chip the grader sees the console, the bytes the DMA wrote (dma_bytes) and the SRAM checksum (sram). The checksum covers the first 16 KiB. The checksum shows where every byte landed. A message that sram is "below" or "above" means the memory differs. On the hidden chip it sees only whether UVM counted an error.
What it cannot see: your poll limit, or which line raised the error on the hidden chip. Skip the read-back, or print a message instead of raising an error, and your sequence passes on the good chip. It is then refused on the hidden one.
Given Files
Read-only files supplied by the bench.
sequence-api.txt
class learner_seq extends chip_vseq;
virtual task body();
// Declare locals, start sequences, and check results here.
endtask
endclass
p_sequencer has bus, uart, gpio, flash and jtag handles. Access the register block through p_sequencer.regs. Use soc_pad_seq (op, a, d, reply) for board agents and soc_bus_seq (write, addr, data) for the bus.
Use uvm_reg and uvm_reg_field handles, get_field_by_name, read, write, mirror, predict, get_mirrored_value, get, set and update. peek reads TB_STATUS, TB_PUTC, TB_EVENT, TB_ARG, PINMUX or UART DIV. poke deposits into TB_ARG, PINMUX or UART DIV.
Declare bit, logic, int, byte and string locals, queues (int q[$]) and associative arrays (int scores[string]). Use push_back/front, pop_back/front, size, exists and delete.
Local uvm_event handles support trigger, wait_trigger and wait_ptrigger. Local uvm_barrier handles support wait_for and set_threshold. Use fork ... join for cooperating threads.
Report checks with `uvm_error and messages with `uvm_info, optionally using $sformatf. Quoted text accepts punctuation. Backslash escapes, backticks and hierarchy format specifiers are unavailable.
An optional submission_test extends learner_test. Its build_phase may configure agent activity or replace soc_pad_seq with soc_uart_byte_seq, then calls super.build_phase(phase).
For UART send use d[7:0]. For GPIO set a to the pad and d to its level. For flash use a as the byte offset and d as the value.
JTAG op selects IDCODE (0), halt (1), resume (2), memory read (3), memory write (4) or register read (5). The sequence returns reply.
Compile times depend on the submitted class.
DMA · register manual
| Offset | Register | Bits | Field | Access | Reset | Held by | Meaning |
|---|---|---|---|---|---|---|---|
0x000 | SRC | 31:0 | address | rw | 0x00000000 | regs | The address of the first byte to read. Byte address. |
0x004 | DST | 31:0 | address | rw | 0x00000000 | regs | The address of the first byte to write. Byte address. |
0x008 | LEN | 31:0 | bytes | rw | 0x00000000 | regs | The number of bytes. Byte count. |
0x00C | START | 0 | start | wo | not stored | Bit 0 = 1 starts the job. Software writes it last. 1 starts the job. | |
0x014 | STATUS | 0 | busy | ro | block | Job state (new in v1.5). A job is running. | |
0x014 | STATUS | 1 | done | w1c | block | The last write of a job has finished. | |
0x014 | STATUS | 2 | fault | w1c | block | A bus error stopped the job. | |
0x018 | IRQ_ENABLE | 0 | done | rw | 0x0 | regs | Which status bits raise interrupt source 5 (new in v1.5). DONE raises the request. |
0x018 | IRQ_ENABLE | 1 | fault | rw | 0x0 | regs | FAULT raises the request. |
## DMA (base 0x1000_6000, interrupt source 5, clk_sys, PD_MAIN) | Offset | Register | Bits | Field | Access | Reset | Held by | Meaning | | --- | --- | --- | --- | --- | --- | --- | --- | | `0x000` | SRC | 31:0 | address | rw | `0x00000000` | regs | The address of the first byte to read. Byte address. | | `0x004` | DST | 31:0 | address | rw | `0x00000000` | regs | The address of the first byte to write. Byte address. | | `0x008` | LEN | 31:0 | bytes | rw | `0x00000000` | regs | The number of bytes. Byte count. | | `0x00C` | START | 0 | start | wo | | not stored | Bit 0 = 1 starts the job. Software writes it last. 1 starts the job. | | `0x014` | STATUS | 0 | busy | ro | | block | Job state (new in v1.5). A job is running. | | `0x014` | STATUS | 1 | done | w1c | | block | The last write of a job has finished. | | `0x014` | STATUS | 2 | fault | w1c | | block | A bus error stopped the job. | | `0x018` | IRQ_ENABLE | 0 | done | rw | `0x0` | regs | Which status bits raise interrupt source 5 (new in v1.5). DONE raises the request. | | `0x018` | IRQ_ENABLE | 1 | fault | rw | `0x0` | regs | FAULT raises the request. |
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
A Word-Aligned Copy- Input
TB_ARG = 0x4100_030C: 12 bytes from 0x8000_100C to 0x8000_2000, data from 0x41
- Output
ok; dma_bytes=12
Three buffer words, twelve DMA reads and twelve writes, then DONE. Every byte read back matches.
Example 2
An Odd Destination- Input
TB_ARG = 0x6103_0507: 7 bytes to 0x8000_2003
- Output
ok; dma_bytes=7
Two buffer words. The copy starts in the top byte of a word, so the read-back must pick each byte out of its word.
Example 3
A Copy, Then a Drill from No Region- Input
TB_ARG = 0x3004_0208: 8 bytes, drill 1
- Output
ok, then fault; dma_bytes=8
The copy ends in DONE and reads back right. The drill's SRC is 0x4000_0008: its first DMA read answers ERROR, FAULT rises and no byte is written.
Constraints and Contract
- Submit learner_seq extends chip_vseq with one body() task, in the class form the given sequence API describes.
- Print one line a job: ok, or fault for a drill's job. Report a wrong byte with a
uvm_errorcall. - Give every wait a limit.
Hints
Hint 1
Read TB_ARG once and take the fields apart with part-selects such as arg[17:16].
Hint 2
A copy of 7 bytes needs two buffer words. How many does (LEN + 3) / 4 give?
Hint 3
When FAULT is set, which address might your read-back reach?
What the grader checks: Seven runs of the pre-built ap_soc v1.5 UVM bench on the bus-manager seat, each with its own TB_ARG. Each runs on the good chip and on one hidden faulty chip. They copy 1 to 64 bytes, aligned and not, and two add a drill. On the good chip each grades the console, the DMA's bytes and the SRAM checksum, with no UVM error. On the hidden chip each needs a UVM error. Writing TB_STATUS yourself changes nothing graded. The grader cannot see your poll limit.
7 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