Version: v0.0.0-...-854ac76 Latest Latest

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

Go to latest
Published: Jul 27, 2015 License: MIT Imports: 0 Imported by: 0



Package spec contains constants and utility functions that depend on the spec of the VM's instruction set, architecture, etc.



View Source
const (
	// Word defines word size in bits
	Word = 16

	// NRegs defines the number of registers
	NRegs = 8

	Add  = 0
	Addi = 1
	Nand = 2
	Lui  = 3
	Sw   = 4
	Lw   = 5
	Beq  = 6
	Jalr = 7
	Ext  = 7


This section is empty.


func EncodeOp

func EncodeOp(op uint16) uint16

EncodeOp returns an opcode in instruction format

func EncodeRRI

func EncodeRRI(regA uint16, regB uint16, simm int) uint16

EncodeRRI returns an RRI encoded instruction

func EncodeRRR

func EncodeRRR(regA uint16, regB uint16, regC uint16) uint16

EncodeRRR returns an RRR encoded instruction

func Op

func Op(ins uint16) int

Op decodes opcode from an instruction

func RegA

func RegA(ins uint16) int

RegA decodes regA from an instruction

func RegB

func RegB(ins uint16) int

RegB decodes regB from an instruction

func RegC

func RegC(ins uint16) int

RegC decodes regC from an instruction

func Simm

func Simm(ins uint16) int

Simm decodes signed imm from an instruction


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL