예제 #1
0
        MixInstruction(byte opcode, FieldSpec fieldSpec, MetaFieldSpec metaFieldSpec, string mnemonic, int tickCount, Executor executor, Validator validator)
            : base(mnemonic)
        {
            // if the MetaFieldSpec Presence is Forbidden then an instruction fieldspec must be specified. Likewise, if an instruction fieldspec is provided, the MetaFieldSpec Presence must be Forbidden.
            if ((fieldSpec == null && metaFieldSpec.Presence == Instruction.MetaFieldSpec.Presences.Forbidden) || (metaFieldSpec.Presence != Instruction.MetaFieldSpec.Presences.Forbidden && fieldSpec != null))
            {
                throw new ArgumentException("forbidden fieldspec presence makes instruction fieldspec mandatory and vice versa");
            }

            Opcode        = opcode;
            FieldSpec     = fieldSpec;
            MetaFieldSpec = metaFieldSpec;
            TickCount     = tickCount;
            mExecutor     = executor ?? throw new ArgumentNullException(nameof(executor));
            mValidator    = validator;
        }
예제 #2
0
 /// <summary>
 /// Create a MIX instruction with the specified opcode, MetaFieldSpec, mnemonic, tickCount, executor and validator.
 /// </summary>
 public MixInstruction(byte opcode, string mnemonic, MetaFieldSpec metaFieldSpec, int tickCount, Executor executor, Validator validator)
     : this(opcode, null, metaFieldSpec, mnemonic, tickCount, executor, validator)
 {
 }