Skip to content

Add MRAMMemory non-volatile peripheral with fault injection#185

Open
neilberkman wants to merge 2 commits intorenode:masterfrom
neilberkman:add-mram-peripheral
Open

Add MRAMMemory non-volatile peripheral with fault injection#185
neilberkman wants to merge 2 commits intorenode:masterfrom
neilberkman:add-mram-peripheral

Conversation

@neilberkman
Copy link
Copy Markdown

@neilberkman neilberkman commented Feb 22, 2026

Related issue

renode/renode#875

Description

New feature: MRAMMemory non-volatile memory peripheral extending ArrayMemory in Antmicro.Renode.Peripherals.Memory.

  • Non-volatile: Reset() preserves storage contents
  • Word-write semantics: configurable WordSize (default 8 bytes) with erase-then-program cycle at word boundaries
  • Fault injection: InjectPartialWrite() simulates power-cut mid-write, InjectFault() for arbitrary corruption, FaultAtWordWrite for automatic injection at Nth write index
  • Configurable: EnforceWordWriteSemantics toggle, EraseFill byte

Usage example

mram: Memory.MRAMMemory @ sysbus 0x10000000
    size: 0x80000
    WordSize: 8
    EnforceWordWriteSemantics: true

Robot tests are in companion PR renode/renode#876.

Additional information

The Tardigrade project uses this peripheral for OTA fault-injection campaigns.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 22, 2026

CLA assistant check
All committers have signed the CLA.

…ction

Non-volatile memory model with configurable word-write semantics and
deterministic fault injection for OTA update resilience testing.

Features:
- Configurable word size (default 8 bytes) for write granularity
- Read-modify-write semantics preserving unaddressed bytes within words
- Deterministic power-loss fault injection at configurable write count
- Partial-program simulation with configurable tear behavior
  (RetainOldDataOnFault: MRAM retains old data, flash erases)
- Bit-level corruption mode modeling partial cell state transitions
- Write trace recording for offline analysis and trace replay
- Sticky fault tracking for multi-write sequences

Signed-off-by: Neil Berkman <neil@xuku.com>
Add one-shot transient read-fault injection to MRAMMemory.  The read
fault corrupts the value returned to the CPU without modifying NVM
contents, modeling bit flips in the MRAM sense-amplifier path.

Features:
- ReadFaultAddress: peripheral-relative address to target
- ReadFaultSkipCount: skip N qualifying reads before firing
- ReadFaultBitFlips: configurable bit flip count (default 1-3)
- ReadFaultSeed: deterministic PRNG seed for reproducibility
- One-shot: auto-disarms after first fire

Also fix Reset() to use `new` instead of `override` since
ArrayMemory.Reset() is not virtual, and re-implement
IBytePeripheral/IWordPeripheral/IDoubleWordPeripheral so bus-dispatched
reads route through the fault-injection interception layer.
@neilberkman neilberkman force-pushed the add-mram-peripheral branch from 9d3d916 to 84c4a2f Compare March 13, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants