reg[7:0] register; (Verilog)
The register contains data like
[0 0 0 1 0 1 0 1]
And I want to know the number of the zeros before the first 1
(in this example is 3 zeros).
Cannot undersand what are you exactly trying to do!! You can put 7 LED if its a parallel output register.....if its serial you need to convert it into parallel first.
haha is it an interview problem? i had it as a homework in my old logic class, except our assignment was find the number of zeros before the first one. i think your teacher just inverted my old homework.
shift the register contents and xor the previous output with the present one.
count the number of clock pulses elapsed till the output of xor is 1.
the number of clock pulses id ur answer.