Close

Address Arithmetic

A project log for Instruction Set for ECM-16/TTL homebrew cpu

All the instructions laid out in systematic manner

pavelPavel 10/24/2022 at 07:450 Comments

There are 3 Address Arithmetic / Pointer Arithmetic instructions that make use of Address Adder to modify values in Memory Pointers, without accessing memory. This is akin to reduced form of Calculating Core operations, where values in General Purpose Registers are modified using Main ALU.

With this group of instructions one can add signed 24-bit value to the value stored in Memory Pointer register pair.

These instructions make use of hardware for indirect memory accesses.

Instruction bits meaning:

bits F, E, D, C, B: opcode for address arithmetic instructions

bits A, 9: Memory Pointer pair index, PC = 00, SP = 01, FP = 10, BP = 11

bit 8: 0 = use 16-bit offset

          1 = use 8-bit offset from instruction, in this case bits 7..0 are bits of constant value

bits 7, 6, 5: address of GPR, where offset value is stored

bit 4: 0 = use offset value from GPR

          1 = use immediate offset value

bits 3, 2, 1, 0: "don't care"

Instruction layouts:

1) loading / storing at address in MP, without offset:

                Instruction words:
                bits of word #1      bits of word #2
Mnemonic:       FEDC BA98 7654 3210  FEDC BA98 7654 3210
ADDp MP rX      0000 1pp0 rrrx xxxx                        add signed 16-bit value from GPR to MP
ADDpi MP 0xFFFF 0000 1pp1 oooo oooo  oooo oooo oooo oooo   add immediate signed 24-bit value to MP

p - bits of Memory Pointer pair index, PC = 00, SP = 01, FP = 10, BP = 11
r - bits of register address (X) where offset value is stored
o - bits of immediate offset value
x - "don't care" bits - have no effect on result
rX - General Purpose Register #X
MP - Memory Pointer pair (either of PC, SP, FP and BP)

General layout of instruction types

Discussions