Diagnosis and Reliable Design of Digital Systems