Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • The NanoSoC Tour
  • Reading Path
  • SoC Glossary10
  • SoC Metrics Reference
  • SoC Cheatsheet
  • What SoC Integration Is12
  • Architecture and Budgets21
  • Memory Maps and Address Decode26
    • Designing the Address Map
    • Implementing Address Decode
    • Decode Errors and Default Slaves
    • Register Maps and Banks
    • Security and Privilege Regions
      • Secure and Non-Secure Regions
      • Where the Filter Lives
      • Testing Access Control
    • The Software View and the Hardware-Software Contract
    • IP-XACT and Automated Assembly
    • Memory-Map Verification
  • Interconnect and Bus Fabrics26
  • Clock and Reset Architecture24
  • Power Architecture21
  • Interrupts, DMA and Peripherals15
  • Memories, Boot and Security21
  • IP Integration and Handoff21
  • Top-Level Verification and Bring-up21
  • Package, Pads and I/O18
  • Chip Signoff and Tapeout18
  • SoC Interview Prep16
  • Capstone: Integrate NanoSoC14
Loading lesson

←Security and Privilege Regions
  1. Topics
  2. SoC Design
  3. Memory Maps and Address Decode
  4. Security and Privilege Regions
  5. Where the Filter Lives
On this page

    Part 3 of 14, lesson 16 of 26Part 3 of 14/Memory Maps and Address Decode/Lesson 16 of 26All levels

    Where the Filter Lives

    Two check placements on NanoSoC, the stream bridge security bit, and the non-secure reset bug walked end to end.

    Why it matters

    An access-control rule is only as good as the block that checks it, and on NanoSoC the check has to live in two different places for a structural reason: the DMA cannot check anything. Its APB port has no protection input, so a rule like RSTPWR is secure-only cannot be enforced by the block itself. Somebody upstream must refuse on its behalf, and forgetting that is how secure peripherals end up reachable by anyone who can reach the bus.

    The core idea

    The first filter sits in the interconnect beside the decode: it sees every AXI address with its AxPROT bit 1, compares against the security column, and steers violations to the fault responder for SLVERR. It has exactly one secure-only target, SRAM1; the ROM, SRAM0 and the whole APB window are open at this level, and the per-slot rule behind the bridge belongs to the second filter. The second filter sits in the APB slot decoder and checks per slot, because slots differ: six are open and one, the reset controller, is secure-only, and the bridge window as a whole cannot express that. The slot decoder therefore receives the caller's security state alongside the address and refuses secure-only slots itself, raising PSLVERR that the bridge converts to SLVERR. Masters carry state into both checks: the CPU from its software's world, and the stream bridge from a register bit, which is where the planted bug lives.

    Diagram
    # not-run: NanoSoC access-control decisions, NanoSoC teaching values
    Caller state comes from AxPROT[1]: 0 = secure, 1 = non-secure.
    Interconnect: SRAM1 + non-secure -> sel_fault -> SLVERR, no data.
    Slot decoder: slot 6 (RSTPWR) + non-secure -> PSLVERR -> bridge SLVERR.
    SBR master state: CTRL[2] NS, reset value 1 = non-secure; reset CTRL = 0x4.
    DMA copy SRAM1 -> SRAM0 with NS = 1: first read beat SLVERR, SBR STATUS.ERR = 1,
    DMA COUNT stays 0 and BUSY stays 1 (no data ever streams).

    That last block is the seventh planted bug in this design, and its shape is worth learning. The SBR resets with NS equal to one so that an unconfigured bridge starts in the less privileged state; secure software is expected to clear the bit deliberately before copying out of SRAM1. When nobody does, the first read beat of the copy returns SLVERR, the bridge records ERR in its STATUS, and the DMA waits forever for data that will never arrive, BUSY high and COUNT stuck at zero. The CPU reading the same SRAM1 works perfectly, which is the clue that separates a filter bug from a memory bug: same destination, different master, different state. The fix is one deliberate write from secure software, plus one line in the map for each master: the security attribute it issues and what that attribute resets to.

    Now the uncomfortable part, because the reset default is not a security control and must not be taught as one. The NS bit lives in the SBR's CTRL register, and the SBR slot is open to non-secure software. Any non-secure program can therefore write NS to zero itself and make the bridge issue secure reads of SRAM1, defeating the filter completely. What the bit actually protects against is accident: an unconfigured or crashed bridge streaming secure memory somewhere unintended. What it does not protect against is a deliberate non-secure caller. A real control would put the bit beyond non-secure reach: move CTRL, or the whole SBR slot, behind the per-slot secure check, or drive the bridge's issued security state from a secure-only register. On NanoSoC as specified, treat the writable NS bit as a known weakness of the teaching design, and make a test of it, as the next lesson does: non-secure software sets NS to zero and the SRAM1 copy succeeds, proving that the SRAM1 filter alone is not a boundary while this register is reachable.

    What the review looks for

    • Every secure-only region is guarded at a named level: interconnect for AXI slaves, slot decoder for APB slots, with the DMA's missing protection port called out as the reason.

    • Every master's issued security state and its reset value appear in the map documentation, next to the slave table it is checked against.

    • Reset defaults are stated with what they do and do not guarantee: the bridge wakes non-secure, which is a safe starting point but not a control, because the register holding that bit is itself writable by non-secure software (see below).

    Verify and debug

    Reproduce bug 7 in simulation before fixing it: program a copy from SRAM1 with NS left at its reset value and confirm ERR rises with COUNT at zero. Then clear NS from secure software and confirm the same copy completes. The pair of runs pins both the filter and the intended software contract. If the first run succeeds, the interconnect is not checking the bridge's state at all, which is a worse bug than the one planted.

    Secure software failing for the mirror-image reason: a bridge reset that leaves a master non-secure, so legitimate copies out of secure memory error on the first beat while CPU accesses pass. Document each master's reset state in the map and test one transfer per master per region class at bring-up.

    If asked why there are two filters, answer with the missing port: APB peripherals cannot see a protection signal, so the slot decoder checks per slot, while the interconnect checks the memory windows itself. Then tell the SBR story as the price of a register-resident master attribute.

    Check yourself The SBR copy from SRAM1 fails but the CPU reads SRAM1 fine. Name the differing input and the one write that fixes the copy.

    The master's security state: the CPU issues secure accesses while the bridge issues non-secure ones because CTRL NS reset to 1. Secure software clears CTRL bit 2 (writing CTRL with NS = 0), after which the bridge's reads pass the filter.

    Related topics

    • Secure and Non-Secure Regions

    • Next: Testing Access Control

    • DECERR Versus SLVERR Versus PSLVERR

    Previous

    54 / 289

    Next: Testing Access Control

    Up next

    Up nextTesting Access Control

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error