A programmable BIST approach for the diagnosis of embedded memory cores