A Software-based self-test methodology for system peripherals