Shared workspace for multiword operations #
Register zero stores an arithmetic total, register one a carry, register two the half-word radix, and register three a preserved zero. All operand digits lie outside this workspace. Multiplication, transfers, bitwise operations and shifts share this layout.
Main definitions #
Workspace.total,Workspace.carry,Workspace.base,Workspace.zero: the four reserved workspace registers.Workspace.IsDigit: a register outside the four reserved registers.Workspace.Frame: memory and registers outside destinations and arithmetic scratch are kept.Workspace.setup,Workspace.setupResult: initialize the radix and zero in six checked instructions, and the resulting machine state.
Main results #
Workspace.Frame.digit_regs,Workspace.Frame.base_regs,Workspace.Frame.zero_regs,Workspace.Frame.value_eq,Workspace.Frame.value_eq_of_digits,Workspace.Frame.bounded_of_digits: register and digit-list preservation across a routine frame.Workspace.Frame.cons_step,Workspace.Frame.step_cons: composing a single-digit step with a tail routine ond :: dsin low-to-high or high-to-low order.Workspace.exec_setup: exact initialization at every physical width at least two.Workspace.setup_digit: initialization leaves operand digits unchanged.
References #
Arithmetic total and partial-sum workspace.
Carry workspace.
Half-word radix.
A preserved zero, used for padding and shifts.
A routine frame preserves the reconstructed value of any register list disjoint from its
destinations and the total and carry scratch registers.
A routine frame preserves digit bounds on any disjoint list of digit registers.
Composing a single-digit step on d with a tail routine on ds yields a framed, bounded
result on d :: ds while preserving d across the tail and ds across the head step.
Composing a tail routine on ds with a single-digit step on d yields a framed, bounded
result on d :: ds while preserving ds across the final step.
Compute the half-word radix and a preserved zero in six standard instructions.
Initialization executes in exactly six instructions for every width at least two.