On the optimal design of triple modular redundancy logic for SRAM-based FPGAs