Combined fault models¶
QEMU, gem5, OVP (Open Virtual Platforms) and hardware. Targets: registers, memory, gem5 caches. Keys: fault_model, multi_bit_count, fault_persistence.
A fault model in HFIM is set by three keys. fault_model says what happens to each chosen bit, multi_bit_count says how many bits are chosen, and fault_persistence says whether the change is written once or held. Each campaign runs the benchmark many times, one fault per run, and compares every run with a fault-free golden run.
This page covers what you get when you set more than one of the three keys: several stuck bits in one word, a stuck bit that stays stuck, or a flipped cell that stays flipped. The keys combine freely, but each backend accepts only some of the combinations, and one accepted combination on gem5 does something you may not expect.
How the bits change¶
Start with one byte of the Fibonacci benchmark's result[] array. result[10] holds 55, so its lowest byte is 0x37 (0011 0111). Say the campaign seed draws bits 1 and 3. Each fault model applies its operation to both bits in a single write:
fault_model |
Operation on each drawn bit b |
0x37 with bits 1 and 3 |
Bits that change |
|---|---|---|---|
single_bit_flip |
value XOR (1 << b) |
0x3d (0011 1101) |
1 and 3 |
stuck_at_0 |
value AND NOT (1 << b) |
0x35 (0011 0101) |
1 only |
stuck_at_1 |
value OR (1 << b) |
0x3f (0011 1111) |
3 only |
These values come from HFIM's own fault functions applied to 0x37, not from a campaign run.
The stuck-at rows show the first thing that surprises people. A stuck-at fault on a bit that already holds the stuck value changes nothing. Bit 1 of 0x37 is already 1, so stuck_at_1 leaves it alone and only bit 3 changes. With two drawn bits, a stuck-at fault can change two bits, one bit or none.
The seed picks the bits. With multi_bit_count: N, HFIM draws N distinct bit positions across the whole width of the target and sorts them. The positions are independent of each other: they are not adjacent bits unless the draw happens to make them so. The same seed draws the same bits on every rerun.
fault_persistence then decides how long the change lasts. With transient, the default, HFIM writes the faulty value once at the injection instant, and the program may overwrite it later. With permanent, the backend applies the operation again during the rest of the run:
| Backend | When a permanent fault is applied again |
|---|---|
| gem5 | after every committed instruction, on register targets |
| OVP | after every program write to the faulted register or memory word |
| QEMU, hardware | not supported: rejected when the campaign loads |
Combinations and what each one models¶
Each row is a combination HFIM accepts, the physical event it stands for, and where it runs.
| Goal | fault_model |
multi_bit_count |
fault_persistence |
Backends |
|---|---|---|---|---|
| single event upset (SEU), one bit flipped once | single_bit_flip |
1 |
transient |
all |
| multiple-cell upset (MCU), several bits of one word flipped once | single_bit_flip |
2 or more |
transient |
all |
| one or more bits forced once | stuck_at_0 or stuck_at_1 |
1 or more |
transient |
all |
| one or more bits held for the rest of the run | stuck_at_0 or stuck_at_1 |
1 or more |
permanent |
gem5 (registers), OVP |
| a cell that inverts every value written to it | single_bit_flip |
1 or more |
permanent, plus ovp_permanent_model: inverted_cell |
OVP |
A one-shot stuck-at (transient) differs from a flip only on bits that already hold the stuck value: there it does nothing. Choose it when you want to compare against a flip campaign with the same seed and see how many faults land on a bit that is already 0 or 1.
A held stuck-at (permanent) models a manufacturing defect or a worn-out cell: whatever the program writes, the bit reads back as the stuck value.
The inverted cell is OVP's model of a permanent flip. Each value V the program writes to the faulted register or memory word is stored as V XOR mask, so the cell always holds the opposite of what was written on the faulted bits.
A campaign¶
This is the QEMU template's memory campaign (campaigns/fibonacci/memory.yaml) with only the name and the fault keys changed. Each injection draws two bits of one byte of result[] and forces both to 1, once. Save it as campaigns/fibonacci/memory-stuck2.yaml beside the original:
include: fibonacci.yaml
campaign_name: fibonacci-memory-stuck2
simulator_backend: qemu
seed: 7
num_injections: 20
num_workers: 1
target_types: [memory]
memory_start: .bss
memory_end: .bss
fault_model: stuck_at_1
multi_bit_count: 2
injection_mode: icount
timeout: auto
output_dir: results
hfim run campaigns/fibonacci/memory-stuck2.yaml
To hold the bits for the whole run, move to gem5 and a register target, since gem5 applies a permanent fault again only on registers. This is the gem5 template's register campaign (campaigns/fibonacci/register.yaml) with the name and the fault keys changed. Save it as campaigns/fibonacci/register-held.yaml:
include: fibonacci.yaml
campaign_name: fibonacci-register-held
simulator_backend: gem5
seed: 7
num_injections: 10
num_workers: 1
target_types: [register]
target_registers: [x10, x11, x12, x13, x14, x15]
fault_model: stuck_at_1
multi_bit_count: 2
fault_persistence: permanent
timeout: 120
output_dir: results
hfim run campaigns/fibonacci/register-held.yaml
What you see in the results¶
Each injection is one row of injections.csv in the campaign's results directory. Three columns show the combination:
bit_positionslists every drawn bit, separated by;, for example1;3. It is empty in a single-bit campaign.bit_positionholds the first, lowest, of the drawn bits.original_valueandfaulty_valuehold the target before and after the write.
For the byte in the table above (worked out by hand, not copied from a run), a stuck_at_1 row would read bit_positions 1;3, original_value 0x37 and faulty_value 0x3f. bit_positions names both drawn bits even though only bit 3 changed. To find the bits that really changed, XOR the two values: 0x37 XOR 0x3f is 0x08, bit 3. When original_value equals faulty_value, every drawn bit already held the stuck value and the fault changed nothing.
Two outcomes are common for these combinations. A run whose output matches the golden run is masked: the program never read the faulted bits, overwrote them, or the stuck value was already there. A run that finishes with a wrong result[] and no error is sdc (silent data corruption). A held (permanent) fault closes one of the ways a fault is masked: the program cannot overwrite it, because the backend applies it again. The decision rules for every outcome are on Fault classification.
Keys¶
| Key | Values | Default |
|---|---|---|
fault_model |
single_bit_flip, stuck_at_0, stuck_at_1 |
required |
multi_bit_count |
1 up to the bit width of the target |
1 |
fault_persistence |
transient, permanent |
transient |
ovp_permanent_model |
inverted_cell (OVP only) |
none |
Limits¶
multi_bit_count cannot exceed the number of bits the target can flip. A memory target with the default memory_access_size: 1 has 8 bits, so multi_bit_count: 9 is rejected with multi_bit_count=9 exceeds bit_width=8. gem5 cache targets are also 8 bits wide, one byte of the cache line, whatever the line size.
fault_persistence: permanent loads only on gem5 and OVP. On QEMU and hardware the campaign stops at load with fault_persistence: permanent is only implemented on gem5 and OVP; the QEMU backend writes the fault once (transient). Those backends write the fault once, so a permanent campaign there would measure a transient fault.
On gem5, a permanent fault is applied again only on integer and float register targets. A memory or cache target with fault_persistence: permanent is accepted but written once, exactly as transient.
On gem5, single_bit_flip with fault_persistence: permanent is accepted, but it does not hold a flipped bit. gem5 applies the XOR again after every committed instruction, so the faulted bits invert at every instruction and the register alternates between two values. To hold a bit, use stuck_at_0 or stuck_at_1. For a permanent flip with a defined meaning, use OVP's inverted cell.
On OVP, fault_persistence: permanent needs a stuck-at model or ovp_permanent_model: inverted_cell; single_bit_flip alone is refused. A permanent fault is refused on a CSR (control and status register) target and on a campaign with more than one hart (hardware thread, num_cores above 1). An inverted memory cell must keep all drawn bits in one byte of the word.
On a gem5 cache target, a stuck-at fault whose drawn bits all hold the stuck value already is not written: gem5 logs injection NOT performed for that run.
DRAM error models (dram_error_model) count their bits with their own key, dram_multi_bit_count. See DRAM error models.
See also: Multi-bit · Stuck-at · gem5 backend · Configuration keys