V6.4.2 Repair a Broken Register Sequence

MediumFix25 minap_soc v1.5 · UVM sequence · serverReview the topic

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
The doors of the registers this script may name
The bench's back door is a task that names a flop. It names six registers for a read (also TB_STATUS and TB_PUTC) and three for a deposit.
RegisterAddressFront doorBack door readBack door depositMoves by itself
sysctl_pinmux0x1000_4010read and writeyesyesno
sysctl_tb_event0x1000_4028read and writeyesnono
sysctl_tb_arg0x1000_402Cread and writeyesyesthe bench writes it
uart_txdata0x1000_0000write onlynonono
uart_status0x1000_0004read onlynonoyes
uart_irq_enable0x1000_0008read and writenonono
uart_rxdata0x1000_000Cread onlynonoyes
uart_div0x1000_0010read and writeyesyesno
UART0 STATUS
BitFieldSet by
0room: the transmitter can take a bytethe transmitter, as it sends
1rx_ready: a received byte is waitingthe board's bytes on IO1
2rx_full: two received bytes are waitingthe 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
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000TXDATA7:0datawonot storedThe low byte is the next byte to send. Byte to send.
0x004STATUS0roomroblockTransmit room and receive queue state. The transmitter can take a byte.
0x004STATUS1rx_readyroblockAt least one received byte waits.
0x004STATUS2rx_fullroblockThe receive queue is full.
0x008IRQ_ENABLE0roomrw0x0regsWhich status bits raise interrupt source 1. ROOM raises the request.
0x008IRQ_ENABLE1rx_readyrw0x0regsRX_READY raises the request (new in v1.5).
0x00CRXDATA7:0dataroblockThe oldest received byte. The read removes it from the queue. Received byte.
0x010DIV15:0cyclesrw0x0010regsBit time in clk_sys cycles (new in v1.5). clk_sys cycles a bit.
ap_sysctl · register manual
OffsetRegisterBitsFieldAccessResetHeld byMeaning
0x000CHIP_ID31:0valuero0x2A5310C5constThe chip's identity: the IDCODE of the TAP. Fixed number.
0x004RESET_CAUSE0power_onroblockSticky record of reset sources since power-on. Power-on reset.
0x004RESET_CAUSE1pinroblockReset pin.
0x004RESET_CAUSE2watchdogroblockWatchdog.
0x004RESET_CAUSE3softwareroblockSoftware request.
0x004RESET_CAUSE4debugroblockDebug request.
0x008SOFT_RESET0timerwonot storedReset requests from software. 1 arms one restart of the timer.
0x008SOFT_RESET1chipwonot stored1 requests the software reset (new in v1.5).
0x00CSTRAPS0bootroblockStraps as sampled at power-up (new in v1.5). 0: start in the boot ROM. 1: start in SRAM.
0x010PINMUX31:0selectrw0x00000000regsTwo bits for each of sixteen pads: 0 released, 1 GPIO, 2 serial, 3 auxiliary. Pad n uses bits 2n+1 and 2n.
0x014CLK_GATE0uart0rw0x1regs1 lets that block's clock run (new in v1.5). UART0.
0x014CLK_GATE1gpiorw0x1regsGPIO.
0x014CLK_GATE2timerrw0x1regsTimer and PWM.
0x014CLK_GATE3spirw0x1regsSPI.
0x014CLK_GATE4dmarw0x1regsDMA.
0x018LOCK0pinmuxw1s0x0regsWrite-once locks. Only a reset clears one (new in v1.5). 1: PINMUX ignores writes.
0x018LOCK1clk_gatew1s0x0regs1: CLK_GATE ignores writes.
0x018LOCK2debugw1s0x0regs1: the debug lock is closed.
0x020TB_STATUS31:0valuerw0x00000000regs (power-on reset only)Scratch word 0. The firmware kit reports progress, pass and fail here. Plain storage.
0x024TB_PUTC31:0valuerw0x00000000regs (power-on reset only)Scratch word 1. The firmware kit writes one character here. Plain storage.
0x028TB_EVENT31:0valuerw0x00000000regs (power-on reset only)Scratch word 2. The firmware kit writes an event number here. Plain storage.
0x02CTB_ARG31:0valuerw0x00000000regs (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

Report a problem with this page

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

The Repaired Sequence, Quiet Receive Pad

Input
board at 6 cycles a bit; nothing on IO1
Expected 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.

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

ap_soc v1.5 · UVM sequence · server