Ten copies of the ap_soc AHB security filter each leave one route open or close one by mistake. Choose at most eight transfers that expose every copy.
Hardware context: ap_soc key vault, APB firewall and AHB security filter. SoC access control and key protection
In front of its AHB subordinates, ap_soc has a filter that decides whether a transfer may reach its target. It reads the address, the direction, the manager and two attributes. HPROT[1] is 1 for privileged (Arm IHI 0033C section 3.9.2). HNONSEC is 1 for Non-secure (section 3.10).
The correct filter is shown below. Ten broken copies differ from it on some transfers each. Your job is the traffic: call try_access once per transfer. A copy is caught when its answer differs from the correct one on at least one of your transfers.
The policy is the ap_soc exercise policy, not a rule of the AHB specification. Addresses come from ap_soc map v1.0; the top 16 KiB of SRAM is a Secure partition for this exercise.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
hidden_bug | 8 | input of each check |
Full specification
// may_pass: 1 when one AHB transfer may reach its target under the S9.5 exercise policy.
// manager: 0 the core, 1 the debug module, 2 the DMA engine. priv is HPROT[1], nonsec is HNONSEC.
function automatic bit may_pass(input logic [31:0] addr, input bit write, input bit priv,
input bit nonsec, input logic [1:0] manager);
bit rom, clint, plic, partition, dma;
rom = addr < 32'h0000_1000;
clint = addr >= 32'h0200_0000 && addr < 32'h0201_0000;
plic = addr >= 32'h0C00_0000 && addr < 32'h0C40_0000;
partition = addr >= 32'h8000_C000 && addr < 32'h8001_0000; // the Secure top 16 KiB of SRAM
dma = manager == 2'd2;
if (rom) return !write && !dma;
if (clint || plic) return priv && !dma;
if (partition) return !nonsec && (priv || !write);
return 1'b1;
endfunction
task automatic stimulus();
try_access(32'h8000_0000, 1'b0, 1'b0, 1'b1, 2'd0); // addr, write, priv, nonsec, manager
endtask
| Argument | Values |
|---|---|
| addr | Any 32-bit address, word aligned |
| write | 1 for a write |
| priv | HPROT[1] |
| nonsec | HNONSEC |
| manager | 0 core, 1 debug module, 2 DMA engine |
Examples
Run samples checks your input rules and any explicitly public sample faults. Submit runs every hidden faulty copy on the server. The worked bug examples below describe Submit results.
Example 1
Your Transfers Follow the Rules- Input
stimulus() makes 8 calls, each with a word-aligned address and manager 0, 1 or 2
- Output
inputs_legal = yes
Row 0 checks only the input rules: the count, the alignment and the manager number.
Example 2
Hidden Copy 1 Is Caught- Input
Your 8 transfers, run on hidden copy 1
- Output
caught = yes
At least one transfer makes this copy answer differently from the correct filter.
Example 3
Hidden Copy 2 Is Caught- Input
Your 8 transfers, run on hidden copy 2
- Output
caught = yes
A different transfer separates this copy. One transfer can catch several copies.
Constraints and Contract
- Call try_access at most 8 times inside stimulus, each with constant arguments. Loops and other statements are refused.
- Addresses must be word aligned and manager must be 0, 1 or 2.
Hints
Hint 1
Each region has edges. A filter that is wrong at an edge is right everywhere else.
Hint 2
Some broken copies are wrong for one attribute value only. Pick the attributes that the correct filter refuses.
Hint 3
One copy refuses something the correct filter passes. Look for an address that only looks like the partition.
What the grader checks: Ten hidden copies of the filter function. The judge compares each copy with the reference on every transfer you choose.
11 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