Forum Discussion
Altera_Forum
Honored Contributor
15 years agoSorting in FPGA
Does anyone have any experience with doing sorting on FPGAs? Anything else to consider other than a simple bubble sort? Im going to need to sort up to 25 values (fixed at 10 or 25) to find th...
Altera_Forum
Honored Contributor
15 years agoIf the calculation time is not a priority, then I would go for brute force simplicity;
1. Create a design containing; - median value register - median count register - current value register - current count register 2. Create a control FSM that; a) Loads the 'current value' register with the first value in RAM b) Loops over all RAM locations, incrementing the 'current count' register when the RAM value matches the 'current value' register c) At the end of RAM, compare the 'current count' with the 'median count', and if 'current count' is greater, load the median registers from the current registers. d) Repeat for all RAM locations. At the end of this loop, the median registers will contain the median value and the number of times it occurs. Cheers, Dave