IncrementAssertionResult() public method

public IncrementAssertionResult ( bool passed ) : void
passed bool
return void
Ejemplo n.º 1
0
        public override void Execute(TestBench test, ProcessorState state)
        {
            Match m = assertionOperation.Match(Parameters);

            if (m.Success)
            {
                string a      = m.Groups["a"].Value.Trim();
                string b      = m.Groups["b"].Value.Trim();
                string op     = m.Groups["op"].Value.Trim();
                bool   passed = false;

                if (string.Compare(op, "==", true) == 0)
                {
                    if (GetValueForString(a, state) == GetValueForString(b, state))
                    {
                        passed = true;
                    }
                }
                else if (string.Compare(op, "!=", true) == 0)
                {
                    if (GetValueForString(a, state) != GetValueForString(b, state))
                    {
                        passed = true;
                    }
                }

                if (!passed)
                {
                    Logger.Instance.WriteError("Assertion failed 0x{0:X4}@{1}, '{2}' <> '{3} {4} {5}'",
                                               Address * 2, CyclesAfterEvent, Parameters,
                                               GetValueForString(a, state), op, GetValueForString(b, state));
                }

                test.IncrementAssertionResult(passed);
                return;
            }

            Console.WriteLine("Malformed assertion! '{0}'", Parameters);
        }
Ejemplo n.º 2
0
        public override void Execute(TestBench test, ProcessorState state)
        {
            Match m = assertionOperation.Match(Parameters);
            if (m.Success)
            {
                string a = m.Groups["a"].Value.Trim();
                string b = m.Groups["b"].Value.Trim();
                string op = m.Groups["op"].Value.Trim();
                bool passed = false;

                if (string.Compare(op, "==", true) == 0)
                {
                    if (GetValueForString(a, state) == GetValueForString(b, state))
                    {
                        passed = true;
                    }
                }
                else if (string.Compare(op, "!=", true) == 0)
                {
                    if (GetValueForString(a, state) != GetValueForString(b, state))
                    {
                        passed = true;
                    }
                }

                if (!passed)
                {
                    Logger.Instance.WriteError("Assertion failed 0x{0:X4}@{1}, '{2}' <> '{3} {4} {5}'",
                        Address * 2, CyclesAfterEvent, Parameters,
                        GetValueForString(a, state), op, GetValueForString(b, state));
                }

                test.IncrementAssertionResult(passed);
                return;
            }

            Console.WriteLine("Malformed assertion! '{0}'", Parameters);
        }