Neural Spike Sorting In Hardware: From Theory To Practice