| Author |
Message |
megastar007
Joined: 20 Feb 2007 Posts: 82 Helped: 5 Location: Munich
|
25 Aug 2008 16:22 How to find number of one's in a vector in single clock |
|
|
|
| can any one tell me the circuit for finding number of 1's in a vector ..say 8 bit vector in a Single clock cycle. output should be 4 bits(bcos all 8 bits can be one)
|
|
| Back to top |
|
 |
Nir Dahan
Joined: 19 May 2008 Posts: 65 Helped: 6 Location: Munich, Germany
|
|
| Back to top |
|
 |
penrico
Joined: 28 Aug 2001 Posts: 225 Helped: 8 Location: Argentina
|
25 Aug 2008 18:10 Re: How to find number of one's in a vector in single clock |
|
|
|
An easy way is use a parallel eeprom. You can use the address as input data, and then data will be the result. You must program the eeprom with some like this:
This is an example to count just 4 bits, but for more bits is the same
Address Data
A3 A2 A1 A0 D2 D1 D0
0 0 0 0---->0 0 0
0 0 0 1---->0 0 1
0 0 1 0---->0 0 1
0 0 1 1---->0 1 0
0 1 0 0---->0 0 1
0 1 0 1---->0 1 0
0 1 1 0---->0 1 0
0 1 1 1---->0 1 1
1 0 0 0---->0 0 1
1 0 0 1---->0 1 0
1 0 1 0---->0 1 0
1 0 1 1---->0 1 1
1 1 0 0---->0 1 0
1 1 0 1---->0 1 1
1 1 1 0---->0 1 1
1 1 1 1---->1 0 0
|
|
| Back to top |
|
 |
avimit
Joined: 16 Nov 2005 Posts: 415 Helped: 68 Location: Fleet, UK
|
26 Aug 2008 9:54 Re: How to find number of one's in a vector in single clock |
|
|
|
Add them all.
Kr,
Avi
|
|
| Back to top |
|
 |
wkong_zhu
Joined: 13 Nov 2004 Posts: 163 Helped: 2
|
27 Aug 2008 4:52 How to find number of one's in a vector in single clock |
|
|
|
| tree adder.
|
|
| Back to top |
|
 |
jbeniston
Joined: 05 May 2005 Posts: 85 Helped: 8
|
27 Aug 2008 12:57 How to find number of one's in a vector in single clock |
|
|
|
| Adder or LUT if the number of bits in the vector is small.
|
|
| Back to top |
|
 |