A designer's guide to built-in self-test