Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type Assign
- func (p *Assign) Clone() Code
- func (p *Assign) MicroExecute(state io.State) (uint, uint)
- func (p *Assign) RegistersRead() []io.RegisterId
- func (p *Assign) RegistersWritten() []io.RegisterId
- func (p *Assign) Split(mapping register.LimbsMap, env agnostic.RegisterAllocator) []Code
- func (p *Assign) String(fn register.Map) string
- func (p *Assign) Validate(fieldWidth uint, fn register.Map) error
- type Cast
- func (p *Cast) Clone() Code
- func (p *Cast) MicroExecute(state io.State) (uint, uint)
- func (p *Cast) RegistersRead() []io.RegisterId
- func (p *Cast) RegistersWritten() []io.RegisterId
- func (p *Cast) Split(mapping register.LimbsMap, _ agnostic.RegisterAllocator) []Code
- func (p *Cast) String(fn register.Map) string
- func (p *Cast) Validate(fieldWidth uint, fn register.Map) error
- type Code
- type Division
- func (p *Division) Clone() Code
- func (p *Division) MicroExecute(state io.State) (uint, uint)
- func (p *Division) RegistersRead() []io.RegisterId
- func (p *Division) RegistersWritten() []io.RegisterId
- func (p *Division) Split(mapping register.LimbsMap, _ agnostic.RegisterAllocator) []Code
- func (p *Division) String(fn register.Map) string
- func (p *Division) Validate(fieldWidth uint, fn register.Map) error
- type Expr
- type Fail
- func (p *Fail) Clone() Code
- func (p *Fail) MicroExecute(state io.State) (uint, uint)
- func (p *Fail) RegistersRead() []io.RegisterId
- func (p *Fail) RegistersWritten() []io.RegisterId
- func (p *Fail) Split(mapping register.LimbsMap, env agnostic.RegisterAllocator) []Code
- func (p *Fail) String(fn register.Map) string
- func (p *Fail) Validate(fieldWidth uint, fn register.Map) error
- type InOut
- func (p *InOut) Bus() io.Bus
- func (p *InOut) Clone() Code
- func (p *InOut) MicroExecute(state io.State) (uint, uint)
- func (p *InOut) RegistersRead() []io.RegisterId
- func (p *InOut) RegistersWritten() []io.RegisterId
- func (p *InOut) Split(mapping register.LimbsMap, _ agnostic.RegisterAllocator) []Code
- func (p *InOut) String(fn register.Map) string
- func (p *InOut) Validate(fieldWidth uint, fn register.Map) error
- type Instruction
- func (p Instruction) BranchTable() dfa.Result[dfa.Branch]
- func (p Instruction) Execute(state io.State) uint
- func (p Instruction) JumpTargets() []uint
- func (p Instruction) LastJump(n uint) (uint, bool)
- func (p Instruction) Registers() []io.RegisterId
- func (p Instruction) RegistersRead() []io.RegisterId
- func (p Instruction) RegistersWritten() []io.RegisterId
- func (p Instruction) SplitRegisters(mapping register.LimbsMap, env agnostic.RegisterAllocator) Instruction
- func (p Instruction) String(fn register.Map) string
- func (p Instruction) Terminal() bool
- func (p Instruction) Validate(fieldWidth uint, fn register.Map) error
- func (p Instruction) Writes() dfa.Result[dfa.Writes]
- type Jmp
- func (p *Jmp) Clone() Code
- func (p *Jmp) MicroExecute(state io.State) (uint, uint)
- func (p *Jmp) RegistersRead() []io.RegisterId
- func (p *Jmp) RegistersWritten() []io.RegisterId
- func (p *Jmp) Split(register.LimbsMap, agnostic.RegisterAllocator) []Code
- func (p *Jmp) String(fn register.Map) string
- func (p *Jmp) Validate(fieldWidth uint, fn register.Map) error
- type Polynomial
- type Ret
- func (p *Ret) Clone() Code
- func (p *Ret) MicroExecute(state io.State) (uint, uint)
- func (p *Ret) RegistersRead() []io.RegisterId
- func (p *Ret) RegistersWritten() []io.RegisterId
- func (p *Ret) Split(register.LimbsMap, agnostic.RegisterAllocator) []Code
- func (p *Ret) String(fn register.Map) string
- func (p *Ret) Validate(fieldWidth uint, fn register.Map) error
- type Skip
- func (p *Skip) Clone() Code
- func (p *Skip) MicroExecute(state io.State) (uint, uint)
- func (p *Skip) RegistersRead() []io.RegisterId
- func (p *Skip) RegistersWritten() []io.RegisterId
- func (p *Skip) Split(mapping register.LimbsMap, _ agnostic.RegisterAllocator) []Code
- func (p *Skip) String(fn register.Map) string
- func (p *Skip) Validate(fieldWidth uint, fn register.Map) error
- type SkipIf
- func (p *SkipIf) Clone() Code
- func (p *SkipIf) MicroExecute(state io.State) (uint, uint)
- func (p *SkipIf) RegistersRead() []io.RegisterId
- func (p *SkipIf) RegistersWritten() []io.RegisterId
- func (p *SkipIf) Split(mapping register.LimbsMap, _ agnostic.RegisterAllocator) []Code
- func (p *SkipIf) String(fn register.Map) string
- func (p *SkipIf) Validate(fieldWidth uint, fn register.Map) error
- type VecExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assign ¶
type Assign struct {
// Target registers for addition where the least significant come first.
Targets []io.RegisterId
// Source register for addition
Source Polynomial
}
Assign represents a generic assignment of the following form:
tn, .., t0 := M0 + ... + Mm
Here, t0 .. tn are the *target registers*, of which tn is the *most significant*. These must be disjoint as we cannot assign simultaneously to the same register. In contrast, the right hand side represent a polynomial (i.e. the sum of m monomials). Observe that bitwidths represented by the left- and right-hand sides must match. For example, consider this case:
c, r0 := r1 + 1
Suppose that r0 and r1 are 16bit registers, whilst c is a 1bit register. The result of r1 + 1 occupies 17bits, of which the first 16 are written to r0 with the most significant (i.e. 16th) bit written to c. Thus, in this particular example, c represents a carry flag.
func (*Assign) MicroExecute ¶
MicroExecute a given micro-code, using a given state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*Assign) RegistersRead ¶
func (p *Assign) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*Assign) RegistersWritten ¶
func (p *Assign) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
func (*Assign) Split ¶
Split this micro code using registers of arbirary width into one or more micro codes using registers of a fixed maximum width. Here, the environment maps registers in this instruction to their "limbs" (that is, registers after the split). For example, consider (where x,y,z are 16bit registers and b a 1 bit register):
> b, x := y + z + 1
Then, splitting to a maximum register width of 8bits yields the following:
> b,x1,x0 := (256*y1+y0) + (256*z1+z0) + 1
This is then factored as such:
> b,x1,x0 := 256*(y1+z1) + (y0+z0+1)
Thus, y0+z0+1 define all of the bits for x0 and some of the bits for x1.
type Cast ¶
type Cast struct {
CastWidth uint
// Target registers for cast
Targets []io.RegisterId
// Source register for cast
Source io.RegisterId
}
Cast provides a construct for (safely) casting a register into a narrower set of registers. For example, assignment a 16bit register into an 8bit register. The cast is safe in the sense that it will cause an exception if the value assigned does not fit.
func (*Cast) MicroExecute ¶
MicroExecute implementation for Code interface.
func (*Cast) RegistersRead ¶
func (p *Cast) RegistersRead() []io.RegisterId
RegistersRead implementation for Instruction interface.
func (*Cast) RegistersWritten ¶
func (p *Cast) RegistersWritten() []io.RegisterId
RegistersWritten implementation for Instruction interface.
type Code ¶
type Code interface {
// Clone this instruction
Clone() Code
// Execute a given micro-code, using a given local state. This may update
// the register values, and returns either the number of micro-codes to
// "skip over" when executing the enclosing instruction or, if skip==0, a
// destination program counter (which can signal return of enclosing
// function).
MicroExecute(state io.State) (skip uint, pc uint)
// Registers returns the set of registers read this micro instruction.
RegistersRead() []io.RegisterId
// Registers returns the set of registers written by this micro instruction.
RegistersWritten() []io.RegisterId
// Produce a suitable string representation of this instruction. This is
// primarily used for debugging.
String(register.Map) string
// Split this micro code using registers of arbirary width into one or more
// micro codes using registers of a fixed maximum width.
Split(mapping register.LimbsMap, env agnostic.RegisterAllocator) []Code
// Validate that this instruction is well-formed. For example, that it is
// balanced, that there are no conflicting writes, that all temporaries have
// been allocated, etc. The maximum bit capacity of the underlying field is
// needed for this calculation, so as to allow an instruction to check it
// does not overflow the underlying field.
Validate(fieldWidth uint, fn register.Map) error
}
Code provides an abstract notion of an atomic "machine operation", where a single instruction is comprised of multiple such microcodes. To ensure efficiency, we want to pack as many microcodes into each instruction as we can. However, there are restrictions here meaning we cannot pack arbitrarily many microcodes into a single instruction. For example, we cannot pack two microcodes together which have conflicting writes (i.e. both write to the same register).
type Division ¶
type Division struct {
// Target registers (grouped into limbs)
Quotient, Remainder, Witness register.Vector
// Dividend and right comparisons
Dividend, Divisor VecExpr
}
Division operator divides either a register (or constant) by another register (or constant) producing a quotient and a remainder.
func (*Division) MicroExecute ¶
MicroExecute implementation for Code interface.
func (*Division) RegistersRead ¶
func (p *Division) RegistersRead() []io.RegisterId
RegistersRead implementation for Code interface.
func (*Division) RegistersWritten ¶
func (p *Division) RegistersWritten() []io.RegisterId
RegistersWritten implementation for Code interface.
type Expr ¶
Expr represents an expression at the micro level, which is either a register access or a constant.
func NewConstant ¶
NewConstant constructs an expression representing a constant.
func NewConstant64 ¶
NewConstant64 constructs an expression representing a constant.
func NewRegister ¶
func NewRegister(r io.RegisterId) Expr
NewRegister constructs an expression representing a register access
func (Expr) Bitwidth ¶
Bitwidth returns the minimum number of bits required to store any evaluation of this expression.
type Fail ¶
type Fail struct {
// contains filtered or unexported fields
}
Fail signals a return from the enclosing function.
func (*Fail) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*Fail) RegistersRead ¶
func (p *Fail) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*Fail) RegistersWritten ¶
func (p *Fail) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type InOut ¶
type InOut struct {
// contains filtered or unexported fields
}
InOut captures input / output instructions for reading / writing to a bus.
func NewIoWrite ¶
NewIoWrite constructs an instruction responsible for writing data to a given bus.
func (*InOut) Bus ¶
Bus returns information about the bus. Observe that prior to Link being called, this will return an unlinked bus.
func (*InOut) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*InOut) RegistersRead ¶
func (p *InOut) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*InOut) RegistersWritten ¶
func (p *InOut) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type Instruction ¶
type Instruction struct {
Codes []Code
}
Instruction represents the composition of one or more micro instructions which are to be executed "in parallel". This roughly following the ideas of vector machines and vectorisation. In order to ensure parallel execution is safe, there are restrictions on how microcodes can be combined. For example, two microcodes writing to the same register are said to be "conflicting" and, hence, this is not permitted. Likewise, it is not possible to branch into the middle of a microinstruction.
func NewInstruction ¶
func NewInstruction(codes ...Code) Instruction
NewInstruction constructs a new instruction from a given set of micro-codes.
func (Instruction) BranchTable ¶
func (p Instruction) BranchTable() dfa.Result[dfa.Branch]
BranchTable constructs a per-micro-code slice giving, for each constituent micro-code, the condition under which control reaches it. The condition is expressed in terms of the values of registers as observed _on entry to the vector instruction_: it is a disjunction (over execution paths) of conjunctions (the SkipIf comparisons taken — or not taken — along the path). The entry micro-code therefore always has condition TRUE, while later micro-codes accumulate the SkipIf guards of the path that reaches them.
The table is built by a forward data-flow analysis over the micro-codes. Unconditional terminators (Fail, Ret, Jmp) propagate nothing; an unconditional Skip propagates the incoming condition to its target; SkipIf splits into the "skip taken" condition (joined into the skip target) and the "skip not taken" condition (joined into the following micro-code). Where multiple paths converge on the same micro-code, their conditions are or-joined.
The pre-computed write map is needed because the conditions reference registers which may have been freshly written earlier in the same vector; each BranchGroupId records whether forwarding is in effect for that reference, which is determined by consulting the write state at the SkipIf's offset.
func (Instruction) Execute ¶
func (p Instruction) Execute(state io.State) uint
Execute this instruction with the given local and global state. The next program counter position is returned, or io.RETURN if the enclosing function has terminated (i.e. because a return instruction was encountered).
func (Instruction) JumpTargets ¶
func (p Instruction) JumpTargets() []uint
JumpTargets returns the set of all jump targets used within this instruction. This is relatively easy to determine simply by looking for jmp codes.
func (Instruction) LastJump ¶
func (p Instruction) LastJump(n uint) (uint, bool)
LastJump returns the index of the right-most jmp instruction (or false if none exists). This is relatively easy to determine simply by looking for jmp codes.
func (Instruction) Registers ¶
func (p Instruction) Registers() []io.RegisterId
Registers returns the set of registers read/written by this instruction.
func (Instruction) RegistersRead ¶
func (p Instruction) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (Instruction) RegistersWritten ¶
func (p Instruction) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
func (Instruction) SplitRegisters ¶
func (p Instruction) SplitRegisters(mapping register.LimbsMap, env agnostic.RegisterAllocator) Instruction
SplitRegisters implementation for the SplittableInstruction interface. A key challenge for this method is the correct handling of skip instructions. Specifically, the targets for a skip change as the number of instructions increase.
func (Instruction) Terminal ¶
func (p Instruction) Terminal() bool
Terminal checks whether or not this instruction can result in a return from the enclosing function. That is, whether or not this instruction contains a "ret" micro-code.
type Jmp ¶
type Jmp struct {
Target uint
}
Jmp provides an unconditional branching instruction to a given instructon.
func (*Jmp) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*Jmp) RegistersRead ¶
func (p *Jmp) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*Jmp) RegistersWritten ¶
func (p *Jmp) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type Polynomial ¶
type Polynomial = agnostic.StaticPolynomial
Polynomial provides a useful alias which captures the fact that all polynomials in assembly are static. That is, we never consider the possibility that registers can be "shifted".
func LimbPolynomial ¶
func LimbPolynomial(limbs []register.Id, env register.LimbsMap) Polynomial
LimbPolynomial constructs a polynomial from the given limbs which represents the value of the original register. For example, suppose x is a u16 register which splits into two u8 limbs x'0 and x'1. Then, the constructed "limb polynomial" is simply x'0 + 256*x'1 (recall that x'0 is the last significant limb).
func SplitMonomial ¶
func SplitMonomial(p agnostic.StaticMonomial, env register.LimbsMap) Polynomial
SplitMonomial splits a given monomial (e.g. 2*x*y) according to a given register-to-limb mapping. For example, suppose x is u16 and maps to x'0 and x'1 (both u8), whilst y maps to itself. Then, the resulting polynomial is:
2*(x'0 + 256*x'1)*y --> (2*x'0*y) + (512*x'1*y)
Of course, things get more involved when more than one register is being split, but the basic idea above applies.
func SplitPolynomial ¶
func SplitPolynomial(p Polynomial, env register.LimbsMap) Polynomial
SplitPolynomial splits the registers in a given polynomial into their limbs, producing an equivalent (but not necessarily identical) polynomial. For example, suppose that X and Y split into limbs X'1, X'0 and Y'1, Y'0. Then the polynomial 2*X + Y splits into 512*X'1 + 2*X'0 + 256*Y'1 + Y'0.
type Ret ¶
type Ret struct {
// contains filtered or unexported fields
}
Ret signals a return from the enclosing function.
func (*Ret) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*Ret) RegistersRead ¶
func (p *Ret) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*Ret) RegistersWritten ¶
func (p *Ret) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type Skip ¶
type Skip struct {
// Skip
Skip uint
}
Skip microcode performs an unconditional skip over a given number of codes.
func (*Skip) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*Skip) RegistersRead ¶
func (p *Skip) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*Skip) RegistersWritten ¶
func (p *Skip) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type SkipIf ¶
type SkipIf struct {
// Left and right comparisons
Left register.Vector
//
Right VecExpr
// Skip
Skip uint
}
SkipIf microcode performs a conditional skip over a given number of codes. The condition is either that two registers are equal, or that they are not equal. This has two variants: register-register; and, register-constant. The latter is indiciated when the right register is marked as UNUSED.
func (*SkipIf) MicroExecute ¶
MicroExecute a given micro-code, using a given local state. This may update the register values, and returns either the number of micro-codes to "skip over" when executing the enclosing instruction or, if skip==0, a destination program counter (which can signal return of enclosing function).
func (*SkipIf) RegistersRead ¶
func (p *SkipIf) RegistersRead() []io.RegisterId
RegistersRead returns the set of registers read by this instruction.
func (*SkipIf) RegistersWritten ¶
func (p *SkipIf) RegistersWritten() []io.RegisterId
RegistersWritten returns the set of registers written by this instruction.
type VecExpr ¶
VecExpr represents an vectorizeable expression at the micro level, which is either a vector of register accesses or a constant.
func ConstVecExpr ¶
ConstVecExpr constructs an vectorizable expression from a constant.
func NewVecExpr ¶
NewVecExpr constructs an vectorizable expression from a register vector.
func (VecExpr) Bitwidth ¶
Bitwidth returns the minimum number of bits required to store any evaluation of this expression.
func (VecExpr) Eval ¶
Eval evaluates a set of zero or more expressions producing a set of zero or more values.