Hi guys,
Can anyone please help me to design the following circuit
let's say that there's an array of 4 bits (the width of this array should be parameterizable)
I need to find the index of the first occurrence of a '1' in this array when searched from the least significant bit
So
if array is 0100 module should return index 2
if array is 1100 module should return index 2
if array is 1110 module should return index 1
if array is 1111 module should return index 0
I need to do this in combinational manner
please help
Thanks
oh sorry,
if the all the bits are 0s, index should be 0
so this changes to
if array is 0100 module should return index 3
if array is 1100 module should return index 3
if array is 1110 module should return index 2
if array is 1111 module should return index 1
This might be helpful if x is locally generated (the -x infers an adder which is a local structure and may cause routing bottlenecks in some cases). If you don't need an encoded version, this may work well.