#### madushan

##### Newbie level 4

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