Skip to content

CPU specification

Each memory address is initialized to 0

The BELLE-ISA is a 16 bit ISA, with a CPU that contains 8 General Purpose Registers, an instruction register, program counter, stack pointer, and base pointer. The integer registers are all 16-bits wide, with 4 signed registers and 2 unsigned registers. There are also two floating point registers, which both are 32 bits wide. The BELLE-ISA also has CPU flags, to manage conditional branch and jump instructions.

The BELLE-ISA has 5 addressing modes.

  • Immediate value
  • Register immediate
  • Register indirect (pointer)
  • Memory immediate
  • Memory indirect (pointer)

All memory addresses and registers can be used in indirect addressing modes.

There are no relative addressing modes

Registers

The first four registers (0-3) are signed 16 bit integer registers. This means they can contain negative values, and can store any integer from -32,768 to 32,767.

The next two registers (4-5) are unsigned 16 bit integer registers. This means they can contain only positive values, able to store any integer from 0-65,535.

The last two registers (6-7) are the 32-bit floating point registers.

The stack pointer and program counter can be accessed with r9 and r8, respectively. They can only be used in certain instructions, and can only be changed with POP, and can be read with most instructions, excluding ST and LD.

The BELLE-ISA also has a stack pointer and base pointer, which determine the location of the call stack. These registers cannot be directly accessed with any instruction, but

int 60

Can be used to set the stack pointer to the value in register 4, and

int 61

Can be used to set the base pointer to the value in register 4.

There is also an instruction register, that can be somewhat indirectly altered by using jump instructions, however it is not possible to write or read to or from the instruction register.

Program counter

The program counter (PC) is a vital part of any CPU that allow the machine to determine the location of the next instruction in memory. The program counter contains the memory address of the next instruction.

After each clock cycle, the program counter is changed depending on the current instruction. If the current instruction was a RET or jump instruction, the program counter is altered to point to the location of the jump or return instruction.