S9.5.2 Find the Open Route

HardBreak It30 minIcarus · browser samples / server checks10 hidden designsReview the topic

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

SignalWidthRole
hidden_bug8input of each check
Full specification
The correct filter
// 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
What you write
task automatic stimulus();
  try_access(32'h8000_0000, 1'b0, 1'b0, 1'b1, 2'd0);   // addr, write, priv, nonsec, manager
endtask
ArgumentValues
addrAny 32-bit address, word aligned
write1 for a write
privHPROT[1]
nonsecHNONSEC
manager0 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

Report a problem with this page

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

Your Transfers Follow the Rules

Input
stimulus() makes 8 calls, each with a word-aligned address and manager 0, 1 or 2
Expected output
inputs_legal = yes

Row 0 checks only the input rules: the count, the alignment and the manager number.

Run samples executes all 1 public checks. Check all tests runs 11 checks on the server.

Icarus · browser samples / server checks