Skip to content

Stuck-at

QEMU, gem5, OVP (Open Virtual Platforms) and hardware. Targets: registers and memory on every backend, control and status registers (CSRs) on OVP, and the gem5 targets whose page lists stuck-at, such as cache data. fault_model: stuck_at_0, stuck_at_1, with fault_persistence: transient or permanent.

A stuck-at fault forces one bit to a fixed value: stuck_at_0 makes it 0 and stuck_at_1 makes it 1. It models a cell that ignores what is written to it, such as a manufacturing defect or a worn-out cell, where a single-bit flip models a one-off upset. An HFIM campaign applies one fault per run and compares the run with a fault-free golden run of the same program, so each fault gets its own verdict.

A stuck-at fault changes nothing when the bit already holds the stuck value. That is the first thing that surprises readers: a row where the value before and after the fault are equal is a correct stuck-at injection, not a failed one.

Stuck-at-1 on bit 0 turns t0 = 0x04 into 0x05, and stuck-at-0 on bit 0 turns t5 = 0x01 into 0x00. When bit 0 of t0 already holds 1, stuck-at-1 leaves 0x01 unchanged. Stuck-at-1 on bit 0 turns t0 = 0x04 into 0x05, and stuck-at-0 on bit 0 turns t5 = 0x01 into 0x00. When bit 0 of t0 already holds 1, stuck-at-1 leaves 0x01 unchanged.

How the bits change

HFIM picks the bit the same way as for a single-bit flip. The campaign seed drives a PRNG (pseudo-random number generator) that draws a bit from 0 to bit_width - 1, so the same seed gives the same bits every time. At the drawn instant, the backend reads the target, applies the operation for bit b and writes the result back:

fault_model Operation The bit afterwards
stuck_at_0 value AND NOT (1 << b) 0, whatever it was
stuck_at_1 value OR (1 << b) 1, whatever it was

Only bit b can change. With multi_bit_count above 1, every drawn bit is forced in the same write; see Multi-bit.

Applied once or held

A stuck cell in real hardware stays stuck: every time the program writes it, the bit snaps back. Whether HFIM imitates that depends on fault_persistence and on the backend.

With fault_persistence: transient, the default, the bit is forced once at the drawn instant. The next time the program writes the target, the new value replaces the fault. With permanent, HFIM forces the bit again after the program writes the target, so the program can never store the other value in that bit.

Stuck-at-1 on bit 0 of t0, then the program writes 2, 4 and 7. A transient fault is overwritten, so t0 holds 2, 4, 7 as in the golden run: masked. A permanent fault is re-applied after each write, so t0 holds 3, 5, 7: sdc. Stuck-at-1 on bit 0 of t0, then the program writes 2, 4 and 7. A transient fault is overwritten, so t0 holds 2, 4, 7 as in the golden run: masked. A permanent fault is re-applied after each write, so t0 holds 3, 5, 7: sdc.

Each backend implements this differently:

Backend transient permanent
QEMU forced once, through GDB (the GNU Debugger) rejected at load
Hardware forced once, through GDB and the board's debug probe rejected at load
gem5 forced once, by the injector compiled into gem5 integer and float registers: forced again after every committed instruction. Every other target: forced once, like transient
OVP forced once, by HFIM's OVP driver registers x1 to x31 and f0 to f31, and memory: forced again after every program write to the target

On OVP, the driver watches the target and stops after each write the program makes to it. HFIM then forces the bit again, or keeps the value when the bit already holds the stuck value. A memory target is watched as the whole word of memory_access_size bytes.

A campaign

This is the QEMU memory campaign of the template's Fibonacci benchmark with only fault_model changed. It forces one bit of result[], the 64-entry array in .bss that the program fills with Fibonacci numbers.

include: fibonacci.yaml

campaign_name: fibonacci-memory

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
injection_mode: icount

timeout: auto
output_dir: results
hfim run campaigns/fibonacci/memory.yaml

To hold the bit for the whole run, move the campaign to gem5 (register targets) or OVP (register or memory targets) and add fault_persistence: permanent. These are the fault keys of the OVP runs below, on a small test program that loads t0 with 1 and then writes 2, 4 and 7 to it, storing each value it reads in res[]. The runs replay a two-row faultlist (faultlist_csv) so that both faults hit t0 at chosen instants:

simulator_backend: ovp
target_types: [register]
target_registers: [t0]
fault_model: stuck_at_1
fault_persistence: permanent      # the control run uses transient

What you see in the results

Each injection is one row of injections.csv. These rows come from that test program on OVP, with stuck_at_1 on bit 0 of t0. The first two are the permanent campaign, the third is row 1 of the transient campaign:

injection_id,timestamp,instruction_count,target_type,target_name,original_value,faulty_value,bit_position,hit_instance,outcome,execution_time,exit_code,timed_out,hang_cutoff,sdc_details,state_match
1,2026-11-27T13:30:49.259228,8,register,t0,0x1,0x1,0,0,sdc,10.041,0,False,False,"res[0]: expected 2, got 3; res[1]: expected 4, got 5",False
2,2026-11-27T13:30:59.313372,12,register,t0,0x4,0x5,0,0,masked,10.043,0,False,False,,True
1,2026-11-27T13:31:09.752675,8,register,t0,0x1,0x1,0,0,masked,10.041,0,False,False,,True

bit_position is the forced bit. original_value and faulty_value are the target just before and just after the fault's first write. In row 1 they are equal, because t0 already held 1 in bit 0. The fault still mattered: the program then wrote 2 and 4, HFIM forced them to 3 and 5, and res[] differs from the golden run, so the outcome is sdc (silent data corruption: the program ends normally with a wrong result). sdc_details names the values that differ.

The same instant with transient gives masked (the result equals the golden run's): the fault changed nothing at its instant, and the program's next write erased it. Row 2 shows the opposite case. The fault changes t0 from 4 to 5, but the program's last write is 7, which already has bit 0 set, so the result is correct and the row is masked.

injections.csv does not record the persistence. On OVP, the evidence file ovp_evidence/injection_0001.json (one per injection, numbered by injection_id) records it as requested.persistence and lists each re-application under observed.rewrites, with the value the program wrote (before), the value HFIM stores (requested) and action: write or keep. How each outcome is decided: Fault classification. Every column: Output files.

The OVP inverted cell

OVP offers a second permanent model that is not a stuck-at: ovp_permanent_model: inverted_cell. The cell inverts whatever is written to it. The fault flips the bit at its instant, and every later program write of a value V is stored as V XOR mask.

simulator_backend: ovp
fault_model: single_bit_flip
fault_persistence: permanent
ovp_permanent_model: inverted_cell

On the same test program, bit 0 of t0 turns 1 into 0 at the fault, then the writes of 2, 4 and 7 are stored as 3, 5 and 6. A stuck-at-1 keeps the 7; the inverted cell does not. requested.persistence in the evidence file reads permanent (inverted cell). On a memory target, all flipped bits must lie in one byte of the word, and only that byte is watched, so a store to another byte of the word does not invert the cell again.

Keys

Key Values Default
fault_model stuck_at_0, stuck_at_1 (or single_bit_flip) required
fault_persistence transient, permanent (gem5, OVP) transient
ovp_permanent_model inverted_cell (OVP, with single_bit_flip and permanent) none
multi_bit_count 1 to the bit width of the target 1
bit_width 8, 16, 32, 64: bounds the bit draw derived from the target

All keys with their backends: Configuration keys.

Limits

  • permanent is rejected on QEMU and hardware before anything runs: 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.
  • gem5 holds register faults only. gem5 accepts permanent with any target, but the injector re-applies only integer and float register faults, so a memory, cache or other stuck-at is written once.
  • gem5 skips a cache stuck-at that changes nothing. When the bit of the cache byte already holds the stuck value, the injector logs ... is a no-op on original=0x.. (masked bits already at the stuck value); injection NOT performed. and does not write.
  • permanent with single_bit_flip on gem5 is not a stuck bit. gem5 applies the XOR again after every committed instruction, so the bit toggles on each instruction. For a held bit, use stuck_at_0 or stuck_at_1.
  • OVP refuses some permanent faults before the first injection: permanent with single_bit_flip unless ovp_permanent_model: inverted_cell is set, a permanent fault on pc or on a CSR, and permanent with num_cores above 1.
  • ovp_permanent_model is read only on OVP. On any other backend the campaign is rejected: ovp_permanent_model is an OVP-native permanent model (inverted_cell); it is read only with simulator_backend: ovp.

See also: OVP backend · Single-bit flip · Registers · Configuration keys