Compiling signed RAM programs to the unsigned word RAM #
Each source instruction occupies sixty-four target instruction slots. The live prefix uses the proved data/test blocks, followed by relocated control flow; the remaining slots are unreachable padding on successful source runs. Target control labels are natural instruction indices and need not fit a word. Source data occupies the register bank and encoded memory.
All instructions of GenericRAM.Signed.model (including all five signed arithmetic operations)
are compiled. The compiler transfers successful runs; it does not promise to reproduce source
faults.
Main definitions #
ToWordRAM.entry,ToWordRAM.rawBlock,ToWordRAM.block,ToWordRAM.compileFrom: fixed-size instruction blocks with relocated branches and jumps.
Main results #
ToWordRAM.runs_compile: run-prefix simulation preserving registers and memory.ToWordRAM.executes_compile: whole-run forward simulation with two extra bits.
References #
The fixed-block organization follows the library's WordRAM.ToRAM compiler. The target
translation and the signed representation are new; no alternative source machine is defined.
Native instruction address of source instruction pc, with code placed after base.
Instances For
The live prefix of an instruction block, including its terminal control instruction(s).
Instances For
A full sixty-four-slot block; successful runs never execute the padding.
Instances For
Compile a suffix whose first source instruction has index pc.
Instances For
Every live prefix fits in its fixed-size block.
Every source instruction occupies exactly sixty-four target slots.
Code size is linear in source instruction-list length.
The compiler places every live instruction prefix at its relocated address.
Every successful source run prefix preserves the represented register file and memory
at the translated instruction boundary, within thirty-two target instructions per step.
Execution of the supplied prefix pre is not included.
Every successful source run of a signed RAM program transfers to the compiled
unsigned program at width w + 2 in at most thirty-two target instructions per source
instruction, including the final halt. Execution of pre is not charged here; the target
starts at the translated source instruction with already represented data.