Write the back door of a chip bench. Put bytes of any size and alignment straight into ROM and SRAM, little-endian, and read any four bytes back. Count every byte that lands in no memory.
Hardware context: The back door of soc_tb into ROM and SRAM, and the front-door boot from the SPI flash. Writing a back-door loader of any size and alignment.
A chip bench loads its test in zero time: it writes the memories' flops directly. That back door must follow the chip's own rules exactly. A byte that lands in the wrong lane gives the firmware a different program than the one you compiled.
Write put and get of image_loader. ap_soc is little-endian: byte n of a 32-bit word is bits 8n + 7 to 8n. ROM covers 0x0000_0000 to 0x0000_0FFF and SRAM 0x8000_0000 to 0x8000_FFFF. A byte outside both is refused and counted; a read of such a byte gives 0.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
scenario | 4 | input of each check |
Full specification
| Address | Memory | Word index | Lane |
|---|---|---|---|
| 0x0000_0000 to 0x0000_0FFF | rom | address bits 11 to 2 | address bits 1 to 0 |
| 0x8000_0000 to 0x8000_FFFF | ram | address bits 15 to 2 | address bits 1 to 0 |
| anything else | none: refused + 1 for each byte |
put writes the low size bytes of value (size 1, 2 or 4) at addr, addr + 1 and so on. The address need not be aligned, and the bytes may cross into the next word. Addresses are 32 bits and wrap after 0xFFFF_FFFF, as the bench's own arithmetic does. The back door may write ROM, which the front door cannot. get returns the four bytes at addr to addr + 3, low byte first.
Examples
Example 1
One Word, Read Back Aligned and One Byte On- Input
put(0x80000100, 0x11223344, 4); get(0x80000100), get(0x80000101)
- Output
first_read = 0x11223344, second_read = 0x112233, refused = 0
The word lands whole. Read one byte on, the four bytes are 22, 11 and two zero bytes: 0x0011_2233.
Example 2
A Word That Crosses into the Next One- Input
put(0x80000105, 0xa1b2c3d4, 4); get(0x80000104), get(0x80000108)
- Output
first_read = 0xb2c3d400, second_read = 0xa1, refused = 0
Byte 0xD4 lands at 0x105, lane 1 of the word at 0x104; 0xA1 spills into lane 0 of the word at 0x108.
Example 3
ROM by the Back Door, Then a Half over It- Input
put(0xffc, 0xcafef00d, 4); put(0xffe, 0xbeef, 2); get(0xffc), get(0xffd)
- Output
first_read = 0xbeeff00d, second_read = 0xbeeff0, refused = 0
The back door writes ROM. The half 0xBEEF replaces the top two bytes only. Reading from 0xFFD, the last byte is 0x1000, which is no memory, so 0.
Constraints and Contract
- Keep the module name, the two arrays, refused, and the signatures of put and get.
- Before each case the bench clears both memories and refused. put and get take no simulation time.
Hints
Hint 1
Do it one byte at a time: find the memory, the word and the lane of each byte.
Hint 2
An indexed part-select, word[8 * lane +: 8], picks one lane.
Hint 3
Count refused bytes, not refused calls.
What the grader checks: Ten scripts of put calls, each followed by two get calls and the refused count. The rules were checked against the real bench's back door. The same writes through tb poke, read by the bus, gave the words this model gives. The bench refused 7 bytes where the model counts 7.
10 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path