Skip to content

Reorder buffer

gem5 only, with cpu_model: DerivO3CPU. Fault models: none apply; the injector always inverts all eight bits of one counter. fault: rob.

An HFIM campaign runs your benchmark many times, with one fault per run, and compares each run with a fault-free golden run. This page covers the rob target, which corrupts the bookkeeping of one instruction in flight inside an out-of-order core.

An out-of-order core fetches instructions in program order, executes them when their operands are available, and retires them in program order again. The reorder buffer (ROB) is the queue that holds every instruction between dispatch and retirement, so the core can put results back in order. In gem5's out-of-order CPU model, DerivO3CPU, each instruction in the ROB also carries a small counter of how many of its source operands are ready. The instruction may issue to an execution unit only when that counter reaches the number of its sources.

The rob target corrupts that counter in one ROB entry. It does not touch the instruction's opcode, its operands or its destination register.

Entry 1 of the reorder buffer, lw a3, 0(a0), waits for one source and its ready counter holds 0. HFIM inverts the counter to 0xff. When div writes a0 the counter wraps to 0x00 instead of reaching 1, so lw never issues, nothing after it commits, and the run ends in a timeout. Entry 1 of the reorder buffer, lw a3, 0(a0), waits for one source and its ready counter holds 0. HFIM inverts the counter to 0xff. When div writes a0 the counter wraps to 0x00 instead of reaching 1, so lw never issues, nothing after it commits, and the run ends in a timeout.

How HFIM applies the fault

At the injection instant, a committed-instruction count drawn from the campaign seed, HFIM's injector inside gem5 looks at the ROB of thread 0. It picks one entry at random with gem5's own random generator, so the faultlist does not choose the entry. It then replaces that instruction's ready-operand counter, an 8-bit value gem5 calls readyRegs, with its bitwise inverse: every one of the eight bits flips. A count of 1 becomes 254 (0xfe), and a count of 0 becomes 255 (0xff).

What happens next depends on where the instruction is in its life. gem5 reads the counter in one place only: each time a source operand becomes ready, it adds one to the counter and compares the result with the number of sources. When they match, the instruction is marked ready to issue.

State of the chosen instruction Effect of the inverted counter
already marked ready to issue, or already executed none: gem5 never reads the counter again
has no source operands, or is a non-speculative instruction that gem5 releases when it reaches the head of the ROB none: gem5 marks these ready without the counter
still waiting for one or more operands the counter can never reach the number of sources, so the instruction never becomes ready to issue
squashed later, for example behind a mispredicted branch none: gem5 discards the instruction and its counter

The arithmetic never works out. Inverting a count c gives 255 - c. Only the operands still missing can arrive, one increment each, and the 8-bit counter wraps from 255 to 0, so for an instruction with n sources the counter ends at n - 1 - 2c (modulo 256), never at n. In the figure, lw waits for one operand: its counter goes from 0xff to 0x00 and stays one short. The fault therefore never makes an instruction issue early. It can only stop a waiting instruction from issuing at all. When that instruction reaches the head of the ROB, nothing behind it can retire, and the core stops committing.

The chosen entry must write a register. If it has no destination register, such as a store or a branch, the injector writes no fault and the run goes on without one. HFIM makes one attempt per run and does not pick a second entry.

A campaign

The gem5 template has no rob campaign of its own. This one is the template's campaigns/fibonacci/cache_tag.yaml with the target and the CPU model changed. It runs the Fibonacci benchmark, whose 64-number result array is the output HFIM compares:

include: fibonacci.yaml

campaign_name: fibonacci-rob

simulator_backend: gem5
cpu_model: DerivO3CPU

seed: 7
num_injections: 10
num_workers: 1

target_types: [rob]
fault_model: single_bit_flip

timeout: 120
output_dir: results

Save it as campaigns/fibonacci/rob.yaml and run it from the template folder:

hfim run campaigns/fibonacci/rob.yaml

cpu_model: DerivO3CPU is required: the template's board uses MinorCPU, an in-order model with no ROB. HFIM starts gem5 with --cpu-type=DerivO3CPU, so the core is gem5's default out-of-order configuration, with 192 ROB entries. The pipeline sizes in the board file are not applied. fault_model must still be set, because every campaign needs one, but the rob injector ignores it.

What you see in the results

Each run writes one row of injections.csv, the comma-separated values (CSV) file of the campaign, and one folder, injection_NNNN/. In the row, target_type and target_name both read rob. original_value and faulty_value hold the ready-operand counter before and after the inversion, so in every row where the fault was written the two add up to 0xff. The bit_position column holds the bit the faultlist drew, which the rob injector does not use.

The entry that was hit is in the run's injection_report.json, in its target field: rob_readybits[tid=T,idx=I/N], where T is the thread, I the position of the entry in the ROB and N the number of entries in flight at that instant. An index near 0 is an old instruction close to retirement; an index near N is a young one, dispatched shortly before the fault.

The outcomes follow from the table above. Read from the gem5 code, without a measured campaign behind them:

  • masked means the observed result matches the golden run. This is the outcome when the chosen instruction had already issued, needed no counter, or was squashed.
  • timeout means the run did not finish within the time limit. This is the outcome when the chosen instruction was still waiting: the core stops committing, and the run waits until timeout ends it. A limit on instructions, hang_icount_factor, does not help here, because the committed-instruction count stops growing.
  • infrastructure_failure means no fault was written: the chosen entry had no destination register, or the ROB was empty. These rows are left out of the outcome rates.

The fault corrupts timing state, not data, so sdc (silent data corruption, a wrong result with no error reported) and detected are not expected from this target. Every outcome and the order HFIM decides them in: Fault classification.

Keys

Key Values Default
fault or target_types rob required
simulator_backend gem5 qemu
cpu_model DerivO3CPU the board's cpu.model
fault_model single_bit_flip, stuck_at_0 or stuck_at_1; it has no effect on rob required
timeout seconds per injection, or auto; ends the runs this target stalls required

Every key: Configuration keys.

Limits

  • The target exists only in DerivO3CPU. On another CPU model, gem5 stops at the injection instant with rob injection requires DerivO3CPU. No fault is written, so the row is infrastructure_failure. HFIM does not refuse the campaign before it starts.
  • The injector always inverts all eight bits of the counter. fault_model, multi_bit_count, fault_mask and the faultlist's bit_position do not change what it does.
  • The entry is drawn by gem5, not from the campaign seed, and it is not stored in the faultlist. A faultlist replay sets the instant, not the entry. The entry that was hit is recorded only in injection_report.json.
  • Only thread 0's ROB is a candidate.
  • An entry with no destination register is not retried. gem5 prints UltraInjector failed: Selected ROB entry has no dest regs, the run ends without a fault, and the row is infrastructure_failure. With an empty ROB the message ends in ROB instList is empty.
  • The fault cannot make an instruction read operands that are not ready yet. gem5 keeps a count of ready operands, not one ready bit per operand, so inverting it can only delay issue.

See also: gem5 backend · Physical registers · Rename map · Configuration keys