Translating signed RAM data operations and tests #
All five operations of GenericRAM.Signed.Arithmetic (addition, subtraction, multiplication,
Euclidean division and Euclidean remainder), together with constants, copies, memory operations
and signed comparisons, are translated to unsigned word-RAM code. The existing source
interpreter, including its signed range and address checks, determines successful source
steps. The target blocks operate on the separate register bank and encode every memory value.
Main definitions #
ToWordRAM.arithmeticCode,ToWordRAM.compileOp: unsigned instruction blocks.ToWordRAM.compileCond: comparison returning a Boolean word and a constant one.
Main results #
ToWordRAM.exec_compileOp: successful source data operations transfer within twenty-three steps.ToWordRAM.exec_compileCond: signed comparisons transfer with a preserved source state.
References #
The translation is an original implementation using the existing signed RAM semantics.
Unsigned instruction block implementing each of the five signed arithmetic operations.
Instances For
Decode a nonnegative signed address into scratch register left.
Instances For
Copy both operands to scratch before updating any source register.
Instances For
Translate one data operation, retaining source memory addresses.
Instances For
Translate equality or signed ordering. result holds zero or one and two holds one.
Instances For
Nonnegative signed addresses are decoded in two instructions without changing source data.
Copy the operands to the arithmetic workspace without changing represented source data.
Every successful source data operation has an unsigned implementation in at most
twenty-three instructions at width w + 2. Aliased source/destination registers are allowed.
Every successful source test is implemented within fourteen instructions, returning its
Boolean result and preserving the source data. Scratch register two is set to one.