Skip to content

Latest commit

 

History

History
187 lines (103 loc) · 8.03 KB

File metadata and controls

187 lines (103 loc) · 8.03 KB

SPRIND Abstract Machine Overview

General Purpose Registers

Register Name Uses
sp stack_ptr
x temp, arg(1)
y temp, arg(2)
z temp, arg(3)
w temp, arg(4)
v temp, retval
a saved
b saved

Register Uses and Calling Convention

Usage Name Description
stack_ptr Register serves as the stack pointer.
temp Register may be used to hold temporary values without restriction.
arg(_) Register is used as the Nth argument to a subroutine.
retval A subroutine's return value is passed in this register.
saved A called subroutine must save the content of these registers before using them, but their values persist across subroutine calls.

System Registers

Register Register Name Size Description
$PC Program Counter 16-bits Keeps track of the currently executing instruction.
$RA Return Address 16-bits Saves the program counter for subroutine return.
$TS Test Stack 16-bits Stores boolean values in a stack used by branch instructions.
$CC Condition Codes 16-bits Stores carry and overflow flags.
$GP Global Pointer 16-bits Points to a region of process memory reserved for global variables.
$KR Kernel Return 16-bits Holds the value of the program counter during interrupts.
$MP Multiplication Product 32-bits Holds the accumulating product during a multiplication.

Extension Modules

Extension modules are groups of instructions which add functionality to the processor. They allow the processor to be built up in stages, or can be omitted for a simpler processor.

base

Base

The minimal set of features needed for general computation.

Dependencies

[]

Instructions

lb, lw, sb, sw, call, b, bt, bf, li, szi, lsr, lsl, asr, add, sub, and, or, xor, mov, addcy, subcy, tl, tge, tb, tae, tne, teq, callr, jr, seb, NONEXE0, ret, tov, tcy, clr.cy, set.cy,

globals

Globals

Instructions related to the $GP global variable pointer register and gloal variables.

Dependencies

[base]

Instructions

lgb, lgw, sgb, sgw, rd.gp, wr.gp, prsv.gp, rstr.gp,

bittests

Bit Tests

Instructions related to testing specific bits of a register or memory.

Dependencies

[base]

Instructions

tbit, cbit, sbit, tbitm, cbitm, sbitm,

dbg

Debugging

Instructions which communicate with a debugger.

Dependencies

[base]

Instructions

BREAK, UNIMPL,

imms

Immediates

Instructions contain embedded (immediate) values. Generally duplicates of instructions which operate on registers.

Dependencies

[base]

Instructions

tli, tgei, tbi, taei, tnei, teqi, addi, andi, ori, xori, addicy, subicy, neg,

interrupts

Interrupts

Instructions for handling and operating during hardware/software interrupts.

Dependencies

[base, stack]

Instructions

kret, kcall, prsv.ts, rstr.ts, prsv.ra, rstr.ra, prsv.cc, rstr.cc, sleep,

mul

Multiply

Instructions related to integer multiplication.

Dependencies

[base, stack]

Instructions

mulstep, rd.mp.lo, rd.mp.hi, prsv.mp, rstr.mp,

security

Security

Instructions related to computer security.

Dependencies

[base]

Instructions

vijt,

stack

Stack

Instructions for manipulating the subroutine stack.

Dependencies

[base]

Instructions

pushb, pushw, popb, popw,

tsops

Test-stack Operations

Instructions for manipulating the test-stack ($TS).

Dependencies

[base]

Instructions

tpush0, tpush1, tnot, tand, tor, tdup,