Towards the Optimal Design and FPGA Implementation of Spiking Neural Networks