Ejemplo n.º 1
0
            public bool Execute(ModuleBase module)
            {
                if (Validate() != null)
                {
                    throw new ArgumentException("instance not valid for instruction");
                }

                return(MixInstruction.mExecutor(module, this));
            }
Ejemplo n.º 2
0
            public Instance(MixInstruction instruction, IFullWord instructionWord)
            {
                // check if this instruction word is actually encoding the instruction it is provided with...
                if (instructionWord[OpcodeByte] != instruction.Opcode)
                {
                    throw new ArgumentException("opcode in word doesn't match instruction opcode", nameof(instructionWord));
                }

                // ... and include the instruction fieldspec if there is one
                if (instruction.FieldSpec != null && instructionWord[FieldSpecByte] != instruction.FieldSpec.MixByteValue)
                {
                    throw new ArgumentException("fieldspec in word doesn't match instruction fieldspec", nameof(instructionWord));
                }

                MixInstruction  = instruction;
                InstructionWord = instructionWord;
            }
Ejemplo n.º 3
0
 public InstanceValidationError[] Validate() => MixInstruction.mValidator == null ? null : MixInstruction.mValidator(this);