Skip to content

Multi-bit

QEMU, gem5, OVP (Open Virtual Platforms) and hardware. Targets: registers, memory, and on gem5 the cache targets. multi_bit_count: N, combined with any fault_model.

A multi-bit fault changes several bits of one value at the same instant. In a real chip this is a multiple-cell upset: one particle strike deposits enough charge to upset more than one storage cell. HFIM models it by drawing N different bit positions and changing all of them in a single write. As with every HFIM campaign, each run receives one such fault and is compared with a fault-free golden run of the same program.

The byte at 0x80000240, the low byte of result[12], holds 0x90. With multi_bit_count: 3, HFIM draws bits 0, 3 and 5 independently and flips all three in one write, so the byte becomes 0xb9. The byte at 0x80000240, the low byte of result[12], holds 0x90. With multi_bit_count: 3, HFIM draws bits 0, 3 and 5 independently and flips all three in one write, so the byte becomes 0xb9.

The figure is a real injection from the campaign below. The byte held 0x90. HFIM drew bits 0, 3 and 5, flipped all three together and wrote back 0xb9.

How the bits change

Multi-bit is not a fault model of its own. It is a count, multi_bit_count, that you add to a campaign. The fault model you already set, single_bit_flip, stuck_at_0 or stuck_at_1, still decides what happens to each bit. The count only decides how many bits it happens to.

For each injection, HFIM draws bit positions from the campaign seed until it has N different ones. Each position is drawn on its own, uniformly over the bits the target allows. The bits are not chosen as a block of neighbors, so they are usually spread out, and two of them are next to each other only by chance. HFIM then sorts the positions and builds one mask with a 1 at each of them.

At the injection instant, HFIM reads the target once, applies the fault model to every bit of the mask, and writes the result once. With single_bit_flip this is one XOR:

fault_model Operation, with mask = the N drawn bits Row 2 of the campaign below
single_bit_flip value XOR mask 0x90 XOR 0x29 = 0xb9 (bits 0, 3, 5)
stuck_at_0 value AND NOT mask
stuck_at_1 value OR mask

The bits that can be drawn are the same as for a single-bit fault. They depend on the target, and bit_width narrows them:

Target Bits drawn from So multi_bit_count can be at most
memory, default memory_access_size: 1 0 to 7, one byte 8
memory, memory_access_size: 2, 4 or 8 0 to 8 * memory_access_size - 1 16, 32 or 64
register 0 to 63, or 0 to bit_width - 1 when you set it 64
register on hardware 0 to the register width of the hart (hardware thread) minus 1 32 on a 32-bit (RV32) hart
gem5 cache targets (cache_l1d, cache_l1i, cache_l2, cache_tag, cache_tag_parity) 0 to 7: HFIM caps the draw at 8 bits 8

With the default memory access size, all N bits land in the same byte on every backend.

The positions depend only on the seed, so the same campaign draws the same bits every time you run it. Changing multi_bit_count changes more than the bits, though. The extra positions take extra numbers from the seed's sequence, so the instants and addresses of the later rows change too. Two campaigns with the same seed but different counts do not inject at the same points after the first row.

A campaign

This is the template's memory campaign on the Fibonacci benchmark with one line added, multi_bit_count: 3. The benchmark writes 64 Fibonacci numbers into result[], which is all of .bss, and the included fibonacci.yaml declares result as the output to compare.

# campaigns/fibonacci/multi-bit.yaml
include: fibonacci.yaml

campaign_name: fibonacci-multi-bit

simulator_backend: qemu

seed: 7
num_injections: 20
num_workers: 1

target_types: [memory]
memory_start: .bss
memory_end: .bss
fault_model: single_bit_flip
multi_bit_count: 3
injection_mode: icount

timeout: auto
output_dir: results

Run it from the top folder of the template, the one that holds campaigns/:

hfim run campaigns/fibonacci/multi-bit.yaml

Each injection now flips three bits of one byte of result[] instead of one.

What you see in the results

Each run adds one row to injections.csv. Here are three rows of the run above, campaign fibonacci_20261129_172119_897815, with the columns that matter for this model:

injection_id,instruction_count,target_name,original_value,faulty_value,bit_position,bit_positions,outcome,sdc_details
1,606,0x8000027a,0x0,0x43,0,0;1;6,sdc,"result[19]: expected 4181, got 4395093"
2,1115,0x80000240,0x90,0xb9,0,0;3;5,sdc,"result[12]: expected 144, got 185"
3,313,0x80000238,0x0,0x4a,1,1;3;6,masked,
  • bit_positions lists every drawn bit, separated by ; and sorted from low to high.
  • bit_position repeats the lowest of them. A single-bit campaign leaves bit_positions empty and puts its one bit here.
  • original_value and faulty_value are the byte before and after. Their XOR is exactly the mask of bit_positions: in row 2, 0x90 XOR 0xb9 = 0x29, bits 0, 3 and 5.
  • outcome is the verdict. sdc (silent data corruption) means the program finished normally but result differed from the golden run. masked means the output matched.

Row 2 hit the low byte of result[12] after the program had written it, so 144 became 185. Row 1 hit byte 2 of result[19], a byte that was 0, and added 0x43 << 16 to the number. Row 3 landed in result[11] at instruction 313, before the program had computed that element. The byte was still 0, the program overwrote it with the correct value later, and the fault vanished.

Over the 20 injections the run gave 12 sdc and 8 masked. All eight masked rows found the byte at 0x0, as row 3 did. How each outcome is decided is described in Fault classification.

Keys

Key Values Default
multi_bit_count an integer from 1 to the number of bits the target allows 1
fault_model single_bit_flip, stuck_at_0, stuck_at_1, applied to every drawn bit required
bit_width 8, 16, 32, 64: limits the bits drawn from derived from the target
memory_access_size 1, 2, 4, 8 bytes: the memory word the bits are drawn in 1

multi_bit_count: 1 is an ordinary single-bit fault.

Limits

  • Independent, not adjacent. The model draws each position on its own. It does not model the physical layout of a memory array, interleaving, or a burst of neighboring cells. To study faults that always hit adjacent bits, list them yourself in a fault list (faultlist_csv, with a bit_positions column) and replay it.
  • The count must fit in the target. A count above the drawable width stops the campaign before the first injection, for example on a memory target with the default byte: multi_bit_count=9 exceeds bit_width=8. A count that is not a positive integer stops it with multi_bit_count must be a positive integer. gem5 cache targets allow at most 8, because a gem5 cache data fault writes one byte of the line. For gem5 cache targets and hardware registers, the check runs when HFIM builds the list of faults, with the same message.
  • 32-bit registers. On QEMU, gem5 and OVP the register draw covers 64 bits unless bit_width says otherwise. On a 32-bit (RV32) program, set bit_width: 32 so every drawn bit lies inside the register. The hardware backend narrows the draw to the hart's width by itself.
  • Fewer bits may change than were drawn. With stuck_at_0 or stuck_at_1, a drawn bit that already holds the stuck value does not change. bit_positions still names all N bits. See Stuck-at.
  • OVP inverted cell. With fault_persistence: permanent and ovp_permanent_model: inverted_cell, a memory fault must keep all its bits inside one byte of the word. A mask that spans two bytes is refused with an inverted memory cell flips bits of one byte.
  • Not the DRAM model. dram_multi_bit_count belongs to the gem5 DRAM error model dram_error_model: multi_bit and is a separate key. See DRAM error models.

See also: Single-bit flip · Combined models · Memory · Configuration keys