Design and implementation of flexible FPGA-based LDPC decoders