Header menu logo F# Header menu logo Averest

MoveCode Type

This type defines move code instructions with methods for encoding, decoding, string conversion, and parsing from strings and byte arrays. For the encoding into machine words (byte arrays), see the addresses of PUs and buffers in the SCAD reference sheet. Hence, the general purpose PUs have indices \(2,\ldots,\mathsf{numPU}+1\), and their input and output buffers have addresses \(4,\ldots,2\cdot\mathsf{numPU}+3\). If these numbers are encoded as radix-2 numbers, we need \(\left\lceil{\log_2(2\cdot\mathsf{numPU}+4)}\right\rceil\) bits for the source address and the same number of bits for the target address. Together with the two bits to determine one of the four kinds of move instructions, we finally obtain instructions |mv|srcAdr|tgtAdr| where mv has two bits, and each one of srcAdr and tgtAdr has \(\left\lceil{\log_2(2\cdot\mathsf{numPU}+4)}\right\rceil\) bits. Hence, we get

  • \(\mathsf{numBits(numPU)} := 2+2\cdot \left\lceil{\log_2(2\cdot\mathsf{numPU}+4)}\right\rceil\)
  • \(\mathsf{maxPU(numBits)} := 2^{\frac{\mathsf{numBits}}{2}-2}-2\)
However, we demand that the minimal size of the bitvectors is 16 to ensure a sufficient size for immediate operands, and this number is also sufficient for up to 62 PUs.

Record fields

Record Field Description

src

Full Usage: src

Field type: SrcAdr
Field type: SrcAdr

tgt

Full Usage: tgt

Field type: TgtAdr
Field type: TgtAdr

Instance members

Instance member Description

this.Encode

Full Usage: this.Encode

Returns: byte array

encode move instruction as byte array

Returns: byte array

this.InstrCode

Full Usage: this.InstrCode

Returns: int

determine opcode for machine instruction encoding, i.e., 0 for buffer move, 1 for constant move, 2 for opcode move, and 3 for jump/branches

Returns: int

this.Listing

Full Usage: this.Listing

Returns: string

list move instruction in listings with byte and bitvector representation as well as the readable form in a comment, e.g. Dup -> PU[0].opc // 2A-0A : 0010101-0000010-10

Returns: string

this.isBufMove ()

Full Usage: this.isBufMove ()

Returns: bool
Returns: bool

this.isCstMove ()

Full Usage: this.isCstMove ()

Returns: bool
Returns: bool

this.isJmpMove ()

Full Usage: this.isJmpMove ()

Returns: bool
Returns: bool

this.isOpcLSU ()

Full Usage: this.isOpcLSU ()

Returns: bool
Returns: bool

this.isOpcMove ()

Full Usage: this.isOpcMove ()

Returns: bool
Returns: bool

this.isValid ()

Full Usage: this.isValid ()

Returns: bool

check whether the move code combination is a valid one

Returns: bool

Static members

Static member Description

MoveCode.OfByteArr(byteArr)

Full Usage: MoveCode.OfByteArr(byteArr)

Parameters:
    byteArr : byte array

Returns: MoveCode

decode byte array to a move instruction

byteArr : byte array
Returns: MoveCode

MoveCode.OfString(srcStr, tgtStr)

Full Usage: MoveCode.OfString(srcStr, tgtStr)

Parameters:
    srcStr : string
    tgtStr : string

Returns: MoveCode

parse from string representation

srcStr : string
tgtStr : string
Returns: MoveCode

Type something to start searching.