protected override VerificationResult CreateResult(
     string asm, 
     string list, 
     Dictionary<int, string> testValues, 
     CpuErrorCode error)
 {
     return new VerificationResult(error == CpuErrorCode.None, list, error);
 }
Example #2
0
 public CpuContext(
     uint instructionAddress,
     uint programCounter,
     InstructionOpcode opcode,
     uint operands,
     bool error,
     CpuErrorCode errorCode)
 {
     InstructionAddress = instructionAddress;
     ProgramCounter = programCounter;
     Opcode = opcode;
     Operands = operands;
     Error = error;
     ErrorCode = errorCode;
 }
        protected override VerificationResult CreateResult(
            string asm, 
            string list, 
            Dictionary<int, string> testValues, 
            CpuErrorCode error)
        {
            var ast = AphidParser.Parse(asm);

            if (testValues.Any(x => x.Value == "x"))
            {
                var r = testValues.Last(x => x.Value == "1");

                var exp = ast[r.Key];

                return new VerificationResult(
                    false,
                    string.Format("Instruction hung: {0}", exp),
                    list,
                    error);
            }

            return new VerificationResult(testValues.All(x => x.Value == "1"), list, error);
        }
Example #4
0
 /// <summary>
 /// Initializes a new <see cref="CpuError"/> instance with the given parameters.
 /// </summary>
 /// <param name="code">The error code.</param>
 /// <param name="message">An optional message describing the error.</param>
 /// <param name="pc">The current program counter.</param>
 public CpuError(CpuErrorCode code, string message, uint pc)
     : base(message, pc)
 {
     this.Code = code;
 }
Example #5
0
 /// <summary>
 /// Initializes a new <see cref="CpuError"/> instance with the given parameters.
 /// </summary>
 /// <param name="code">The error code.</param>
 /// <param name="message">An optional message describing the error.</param>
 public CpuError(CpuErrorCode code, string message)
     : base(message)
 {
     this.Code = code;
 }
Example #6
0
 /// <summary>
 /// Initializes a new <see cref="CpuError"/> instance with the given parameters.
 /// </summary>
 /// <param name="code">The error code.</param>
 /// <param name="pc">The current program counter.</param>
 public CpuError(CpuErrorCode code, uint pc)
     : this(code, null, pc)
 {
 }
Example #7
0
 /// <summary>
 /// Initializes a new <see cref="CpuError"/> instance with the given parameters.
 /// </summary>
 /// <param name="code">The error code.</param>
 public CpuError(CpuErrorCode code)
     : this(code, null)
 {
 }
 protected abstract VerificationResult CreateResult(string asm, string list, Dictionary<int, string> testValues, CpuErrorCode error);