Documentation ¶
Index ¶
- Constants
- Variables
- type ATypeImmInstruction
- type ATypeInstruction
- type BTypeImmInstruction
- type BTypeInstruction
- type ETypeInstruction
- type Instruction
- func EncodeATypeImmInstruction(instruction ATypeImmInstruction) Instruction
- func EncodeATypeInstruction(instruction ATypeInstruction) Instruction
- func EncodeBTypeImmInstruction(instruction BTypeImmInstruction) Instruction
- func EncodeBTypeInstruction(instruction BTypeInstruction) Instruction
- func EncodeETypeInstruction(instruction ETypeInstruction) Instruction
- func EncodeMTypeInstruction(instruction MTypeInstruction) Instruction
- func EncodeOTypeInstruction(instruction OTypeInstruction) Instruction
- func EncodeRTypeInstruction(instruction RTypeInstruction) Instruction
- type InstructionType
- type MTypeInstruction
- type OTypeInstruction
- type Opcode
- type RTypeInstruction
- type RegisterValue
Constants ¶
View Source
const ( None Opcode = 0 ADD = 1 ADDI = 2 SUB = 3 SUBI = 4 AND = 5 OR = 6 XOR = 7 LSL = 8 LSR = 9 LDREG = 20 LDWORD = 21 LDHWRD = 22 LDBYTE = 23 STREG = 24 STWORD = 25 STHWRD = 26 STBYTE = 27 MOVZ = 30 MOVK = 31 B = 32 BREG = 33 BLR = 34 B_EQ = 35 B_NEQ = 36 B_LT = 37 B_LE = 38 B_GT = 39 B_GE = 40 BL = 41 PUSH = 42 POP = 43 SYSCALL = 61 HALT = 62 NOOP = 63 )
View Source
const ( ENO_IO = 1 ENO_BadFileDescriptor = 2 )
Variables ¶
View Source
var (
ByteOrder = binary.LittleEndian
)
Functions ¶
This section is empty.
Types ¶
type ATypeImmInstruction ¶
type ATypeImmInstruction struct { Opcode Opcode RegDest RegisterValue RegA RegisterValue Immediate uint16 }
func DecodeATypeImmInstruction ¶
func DecodeATypeImmInstruction(instruction Instruction, opcode Opcode) ATypeImmInstruction
type ATypeInstruction ¶
type ATypeInstruction struct { Opcode Opcode RegDest RegisterValue RegA RegisterValue RegB RegisterValue }
func DecodeATypeInstruction ¶
func DecodeATypeInstruction(instruction Instruction, opcode Opcode) ATypeInstruction
type BTypeImmInstruction ¶
func DecodeBTypeImmInstruction ¶
func DecodeBTypeImmInstruction(instruction Instruction, opcode Opcode) BTypeImmInstruction
type BTypeInstruction ¶
type BTypeInstruction struct { Opcode Opcode RegA RegisterValue }
func DecodeBTypeInstruction ¶
func DecodeBTypeInstruction(instruction Instruction, opcode Opcode) BTypeInstruction
type ETypeInstruction ¶
type ETypeInstruction struct { Opcode Opcode RegDest RegisterValue Immediate uint16 }
func DecodeETypeInstruction ¶
func DecodeETypeInstruction(instruction Instruction, opcode Opcode) ETypeInstruction
type Instruction ¶
type Instruction = uint32
func EncodeATypeImmInstruction ¶
func EncodeATypeImmInstruction(instruction ATypeImmInstruction) Instruction
func EncodeATypeInstruction ¶
func EncodeATypeInstruction(instruction ATypeInstruction) Instruction
func EncodeBTypeImmInstruction ¶
func EncodeBTypeImmInstruction(instruction BTypeImmInstruction) Instruction
func EncodeBTypeInstruction ¶
func EncodeBTypeInstruction(instruction BTypeInstruction) Instruction
func EncodeETypeInstruction ¶
func EncodeETypeInstruction(instruction ETypeInstruction) Instruction
func EncodeMTypeInstruction ¶
func EncodeMTypeInstruction(instruction MTypeInstruction) Instruction
func EncodeOTypeInstruction ¶
func EncodeOTypeInstruction(instruction OTypeInstruction) Instruction
func EncodeRTypeInstruction ¶
func EncodeRTypeInstruction(instruction RTypeInstruction) Instruction
type InstructionType ¶
type InstructionType uint8
const ( IType_Invalid InstructionType = iota IType_A IType_AI IType_M IType_E IType_B IType_BI IType_R IType_O )
func GetInstructionType ¶
func GetInstructionType(opcode Opcode) InstructionType
type MTypeInstruction ¶
type MTypeInstruction struct { Opcode Opcode RegA RegisterValue RegB RegisterValue Immediate int16 }
func DecodeMTypeInstruction ¶
func DecodeMTypeInstruction(instruction Instruction, opcode Opcode) MTypeInstruction
type OTypeInstruction ¶
type OTypeInstruction struct {
Opcode Opcode
}
func DecodeOTypeInstruction ¶
func DecodeOTypeInstruction(instruction Instruction, opcode Opcode) OTypeInstruction
type RTypeInstruction ¶
type RTypeInstruction struct { Opcode Opcode RegA RegisterValue }
func DecodeRTypeInstruction ¶
func DecodeRTypeInstruction(instruction Instruction, opcode Opcode) RTypeInstruction
type RegisterValue ¶
type RegisterValue = uint8
const ( ZeroRegister RegisterValue = 0 SyscallResultRegister RegisterValue = 7 SyscallErrorRegister RegisterValue = 8 SyscallRegister RegisterValue = 9 StackRegister RegisterValue = 14 ReturnRegister RegisterValue = 15 )
Click to show internal directories.
Click to hide internal directories.