On-chip error correcting techniques for new-generation flash memories