Generate random single instructions
This commit is contained in:
15
gen/instruction.go
Normal file
15
gen/instruction.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package gen
|
||||
|
||||
import "github.com/firestuff/subcoding/vm"
|
||||
|
||||
func randInstruction() *vm.Instruction {
|
||||
instr := &vm.Instruction{
|
||||
OpCode: randOpCode(),
|
||||
}
|
||||
|
||||
for i, t := range vm.OperandsByOpCode[instr.OpCode] {
|
||||
instr.Operands[i] = randOperand(t)
|
||||
}
|
||||
|
||||
return instr
|
||||
}
|
||||
Reference in New Issue
Block a user