a32

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpcodeStrings

func OpcodeStrings() []string

OpcodeStrings returns a slice of all String values of the enum

func RegStrings

func RegStrings() []string

RegStrings returns a slice of all String values of the enum

Types

type Fmt

type Fmt int
const (
	BadFmt Fmt = iota
	LoadFmt
	StoreFmt
	MoveFmt
	CompareFmt
	BinaryFmt
	UnaryFmt
	CallFmt
	NoFmt
)

func (Fmt) Template

func (f Fmt) Template() string

func (Fmt) Vars

func (f Fmt) Vars(val *ir.Value) []*asm.Var

type Opcode

type Opcode int
const (
	// Natively implemented instructions
	NOP Opcode = iota
	BRK
	HLT
	ERR

	ADD
	SUB
	ADDC
	SUBB
	AND
	OR
	XOR
	SHL
	ASR
	LSR

	LD
	ST
	LD8
	ST8
	LD16
	ST16

	BR_EQ
	BR_NEQ
	BR_U_L
	BR_U_LE
	BR_U_GE
	BR_U_G
	BR_S_L
	BR_S_LE
	BR_S_GE
	BR_S_G
	BRA

	CALL
	RET
	JMP

	CMP
	NEG
	NEGB
	NOT

	MOV
	LDI
	SWP

	NumOps
)

func OpcodeString

func OpcodeString(s string) (Opcode, error)

OpcodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func OpcodeValues

func OpcodeValues() []Opcode

OpcodeValues returns all values of the enum

func (Opcode) Asm

func (op Opcode) Asm() string

func (Opcode) Fmt

func (op Opcode) Fmt() asm.Fmt

func (Opcode) IsAOpcode

func (i Opcode) IsAOpcode() bool

IsAOpcode returns "true" if the value is listed in the enum definition. "false" otherwise

func (Opcode) IsCall

func (op Opcode) IsCall() bool

func (Opcode) IsMove

func (op Opcode) IsMove() bool

func (Opcode) String

func (i Opcode) String() string

type Reg

type Reg uint
const (
	Zero Reg = iota

	RA // R1
	BP // R2
	SP // R3

	A0 // R4
	A1 // R5
	A2 // R6
	A3 // R7
	A4 // R8
	A5 // R9
	A6 // R10
	A7 // R11

	T0 // R12
	T1 // R13
	T2 // R14
	T3 // R15
	T4 // R16
	T5 // R17
	T6 // R18
	T7 // R19
	T8 // R20
	T9 // R21

	S0 // R22
	S1 // R23
	S2 // R24
	S3 // R25
	S4 // R26
	S5 // R27
	S6 // R28
	S7 // R29
	S8 // R30
	S9 // R31
)

func RegString

func RegString(s string) (Reg, error)

RegString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func RegValues

func RegValues() []Reg

RegValues returns all values of the enum

func (Reg) IsAReg

func (i Reg) IsAReg() bool

IsAReg returns "true" if the value is listed in the enum definition. "false" otherwise

func (Reg) String

func (i Reg) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL