Skip to content

Physical registers

gem5 only, with cpu_model: DerivO3CPU. Fault models: single-bit flip, multi-bit, stuck-at. fault: phys_reg.

An out-of-order processor does not keep a program's values in the 32 registers the instruction set names. It renames them: each time an instruction writes a0, the processor gives the result a fresh slot in a larger physical register file, and a rename map remembers which physical register holds the current a0. This target corrupts the value stored in one of those physical registers. As in every HFIM campaign, each run applies one fault, and HFIM compares the result with a fault-free golden run of the same program.

This is the register target to use on gem5's out-of-order CPU model, DerivO3CPU. A plain register fault on that model makes gem5 abort at the commit stage, and HFIM records the run as crash. A phys_reg fault reaches the same values one level lower, where the hardware really stores them.

The rename map sends a0 to physical register p12. HFIM flips bit 3 of p12, so 0x2a becomes 0x22; the later add reads p12 through a0 and writes 0x37 instead of 0x3f to p30. The rename map sends a0 to physical register p12. HFIM flips bit 3 of p12, so 0x2a becomes 0x22; the later add reads p12 through a0 and writes 0x37 instead of 0x3f to p30.

How HFIM applies the fault

The campaign seed draws two things for each run: the instant and the bits. The instant is a committed-instruction count from the golden run. The bits are drawn from 0 to 63, because each physical register holds a 64-bit word (bit_width can narrow the range). With multi_bit_count above 1, the seed draws that many distinct positions, independently, across the same range.

gem5 runs the program until that many instructions have committed. Then HFIM's injector inside gem5 looks at both rename maps of the CPU: the speculative one, which the front of the pipeline uses, and the committed one, which reflects only retired instructions. Every integer physical register that either map names at that instant is a candidate. A free physical register is never chosen, because no instruction would ever read it.

gem5 picks one candidate at random and applies the fault model to its 64-bit value:

fault_model Operation on the chosen register
single_bit_flip value XOR mask
stuck_at_0 value AND NOT mask
stuck_at_1 value OR mask

The mask holds the drawn bit, or all the drawn bits for a multi-bit fault.

HFIM writes the new value straight into the register file. It does not go through gem5's normal register write path, which would flush the pipeline. Nothing in the processor notices the change: the wrong value waits in the register until an instruction reads it. If the program writes the architectural register again before reading it, the rename map moves to a new physical register and the fault is never seen.

The write happens once per run. HFIM tries the injection only at the drawn instant, and does not retry later if no candidate exists.

A campaign

This campaign uses the Fibonacci benchmark of the nezha-c906-gem5 template. It is the template's register.yaml with target_types and target_registers replaced by fault: phys_reg, and cpu_model: DerivO3CPU added. Save it as campaigns/fibonacci/phys_reg.yaml beside fibonacci.yaml.

include: fibonacci.yaml

campaign_name: fibonacci-phys_reg

simulator_backend: gem5
cpu_model: DerivO3CPU

seed: 7
num_injections: 10
num_workers: 1

fault: phys_reg
fault_model: single_bit_flip

timeout: 120
output_dir: results

cpu_model overrides the template board, which builds the in-order MinorCPU. No other key is needed: you do not name a register, because gem5 chooses it at the instant of the fault.

Run it like any other campaign:

hfim run campaigns/fibonacci/phys_reg.yaml

Two log lines show that the target resolved: Creating ultra-injector fault campaign (target=phys_reg), then Faultlist generated: 10 entries.

What you see in the results

Each run adds one row to injections.csv. For this target:

  • target_type and target_name are both phys_reg.
  • instruction_count is the committed-instruction count at which the fault landed.
  • bit_position is the drawn bit, from 0 to 63. A multi-bit campaign also fills bit_positions, separated by ;.
  • original_value and faulty_value are the 64-bit register value before and after the write, as gem5 reported them.

The CSV does not say which physical register gem5 chose. That is in injection_NNNN/injection_report.json, in the target field, written as phys_int_reg[N]. The same file holds the mask and the instant, and HFIM checks both against the CSV row. If they disagree, the run is recorded as infrastructure_failure instead of a hardware outcome.

The outcome comes from the same rules as every other target. The run is masked when the observables match the golden run: the register was rewritten or freed before anything read it, or the flipped bit did not change the result. It is sdc (silent data corruption) when the program finishes with a wrong answer, as in the figure, where an add carries the flip into its own result. It is crash when the wrong value sends the program somewhere it cannot continue, for example a corrupted pointer or return address, and timeout when it does not finish in time. See Fault classification for the full decision order.

Keys

Key Values Default
fault phys_reg required
simulator_backend gem5 qemu
cpu_model DerivO3CPU the board's cpu.model, else AtomicSimpleCPU
fault_model single_bit_flip, stuck_at_0, stuck_at_1 required
multi_bit_count 1 to the bit width 1
bit_width 8, 16, 32, 64 64

Limits

  • DerivO3CPU only. On any other CPU model, gem5 stops at the instant of the fault with phys_reg injection requires DerivO3CPU. No fault is written, so HFIM records the run as infrastructure_failure. The check happens inside gem5, not when the campaign loads.
  • Integer registers only. Floating-point physical registers are never chosen.
  • You cannot choose the register. gem5 picks it with its own random number generator, not with the campaign seed. A faultlist row sets the instant and the bits, not the register.
  • Applied once. fault_persistence: permanent is accepted, but the value is written only once: gem5 holds a permanent fault only for the register target. A later write by the program replaces the faulty value.
  • No candidate, no fault. If gem5 finds no mapped integer physical register at the drawn instant, it logs UltraInjector failed and writes nothing. The run has no injection_report.json and is recorded as infrastructure_failure.

See also: gem5 backend · Rename map · Single-bit flip · Configuration keys