A fault grading methodology for software-based self-test programs in systems-on-chip