Addressing ModesThe Heritage/1 features 16-bits general purpose registers and 20-bits address oriented registers. Such disparity makes transfers between registers of different sizes kind of odd. In order to fix this insanity I've came with RISC-like techniques leading to special immediate addressing modes for 20 bits registers.
Immediate 16 bits
This is the normal immediate addressing mode, common to most computers. It takes two consecutive words in memory: the op. cod. and the 16-bits operand.
Example:
movi a, value
Immediate 20 bits
To load a 20-bis register from memory would take two operands, but this would waste 12 bits from the second operand. The (RISC like) solution is to embed the most significant nibble (MSN) within the op. code. Therefore, an instruction of this kind takes only one operand from memory and can complete in two machine cycles.
Example:
movi sp, value ; Value is 20 bits but it only takes one 16-bits operand.
; the remaining 4 bits (MSN) is embedded in the op code.
Immediate 20 bits nibble high
When transferring data from a 16-bits register to a 20-bits register, only the 16 least significant bits are copied. The upper nibble can then be supplied by the mean of an "Immediate 20 bits nibble high" instruction which will write the 4 most significant bits leaving the rest untouched.
Example:
mov sp, a ; sp <- least significant 16 bits
movih sp, value ; sp <- most signifant 4 bits (value is 4 bits).
Immediate 20 bits nibble high intructions only takes one step (T1) of the Execute Machine Cycle since the operand is embedded within the op code. No bus operation is performed during this cycle.
|