UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer chen410
Observer
5,295 Views
Registered: ‎01-24-2014

how to check which input has most high value wires among 4 8-bit inputs

Jump to solution

Hello everyone. Now I want to implement a module, which has four 8-bit inputs, each bit has only two value:1 or 0, and the output shoud be the input which has the most high value wires. So I have to check which input has most bits with value 1. The method I can think up is to add each input's 8 bits, and compare the results to get the biggest one. In this case, 4*(4+2+1)adders and 3 compare needed, as I will connect tens of this module, this method costs too much time and consumes too much resource. So does anyone has a better solution? Thank you very much in advance.

0 Kudos
1 Solution

Accepted Solutions
Visitor doubled
Visitor
8,935 Views
Registered: ‎03-29-2012

Re: how to check which input has most high value wires among 4 8-bit inputs

Jump to solution

Here is a discussion of a similar approach optimized for speed and resources.

 

http://fpgacpu.wordpress.com/2014/09/05/quick-fpga-hacks-population-count/

2 Replies
Visitor doubled
Visitor
8,936 Views
Registered: ‎03-29-2012

Re: how to check which input has most high value wires among 4 8-bit inputs

Jump to solution

Here is a discussion of a similar approach optimized for speed and resources.

 

http://fpgacpu.wordpress.com/2014/09/05/quick-fpga-hacks-population-count/

Observer chen410
Observer
5,251 Views
Registered: ‎01-24-2014

Re: how to check which input has most high value wires among 4 8-bit inputs

Jump to solution

Thank you  very much. This is really a good way to sum the nonzero input wires.

0 Kudos