rj32

package
v0.0.0-...-ecbd380 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgRegs = []Reg{A0, A1, A2}
View Source
var SavedRegs = []Reg{S0, S1, S2, S3, T5}
View Source
var TempRegs = []Reg{T0, T1, T2, T3, T4}

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 Opcode

type Opcode int
const (
	// Natively implemented instructions
	Nop Opcode = iota
	Rets
	Error
	Halt
	Rcsr
	Wcsr
	Move
	Loadc
	Jump
	Imm
	Call
	Imm2
	Load
	Store
	Loadb
	Storeb
	Add
	Sub
	Addc
	Subc
	Xor
	And
	Or
	Shl
	Shr
	Asr
	IfEq
	IfNe
	IfLt
	IfGe
	IfUlt
	IfUge

	// Psuedoinstructions
	Not
	Neg
	Sxt
	Swap
	IfGt
	IfLe
	IfUgt
	IfUle
	Return

	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) ClobbersArg

func (op Opcode) ClobbersArg() bool

func (Opcode) IsAOpcode

func (i Opcode) IsAOpcode() bool

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

func (Opcode) IsBranch

func (op Opcode) IsBranch() bool

func (Opcode) IsCall

func (op Opcode) IsCall() bool

func (Opcode) IsCommutative

func (op Opcode) IsCommutative() bool

func (Opcode) IsCompare

func (op Opcode) IsCompare() bool

func (Opcode) IsCopy

func (op Opcode) IsCopy() bool

func (Opcode) IsMove

func (op Opcode) IsMove() bool

func (Opcode) IsReturn

func (op Opcode) IsReturn() bool

func (Opcode) IsSink

func (op Opcode) IsSink() bool

func (Opcode) String

func (i Opcode) String() string

type Reg

type Reg uint
const (
	RA Reg = iota
	A0
	A1
	A2

	S0
	S1
	S2
	S3

	T0
	T1
	T2
	T3

	T4
	T5
	GP
	SP
)

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