K
Kevin Neilson
Guest
I'm trying to design a circuit (Virtex-7) which you might call either a priority encoder or a sorter. This is what it should do:
<i>Given a 16-bit vector with 5 bits set, create a list of 5 4-bit encoded values of each bit set. These needn't be in order.</i>
This turns out to be a lot harder than I thought. Writing the behavioral RTL isn't hard, but Vivado synthesizes it to 16 levels of logic, and when I draw out an optimized version, I still get at least 5 levels (using 6-input LUTs). I'd like to do it with minimal latency, but I can only do about 3 levels of logic at my clock speed. I've tried thinking about how I can use the carry chain muxes but they don't seem to be helpful. I can do a leading-ones detector and encode the leading 1, but I'd probably have to pipeline each stage so that would take 5 cycles.
<i>Given a 16-bit vector with 5 bits set, create a list of 5 4-bit encoded values of each bit set. These needn't be in order.</i>
This turns out to be a lot harder than I thought. Writing the behavioral RTL isn't hard, but Vivado synthesizes it to 16 levels of logic, and when I draw out an optimized version, I still get at least 5 levels (using 6-input LUTs). I'd like to do it with minimal latency, but I can only do about 3 levels of logic at my clock speed. I've tried thinking about how I can use the carry chain muxes but they don't seem to be helpful. I can do a leading-ones detector and encode the leading 1, but I'd probably have to pipeline each stage so that would take 5 cycles.