I'm trying to make a 7 to 3 priority encoder for a circuit diagram for a class. The problem is that we have to take in a 7 bit number and output a 3 bit answer representing the maximum number of consecutive ones in the input.
0011100 = 011 (3) 1111111 = 111 (7) 0000000 = 000 (0)
The issue at the moment is that regardless of the input, it is always outputting 111 (7).
I have circuits for handling every possible combination of consecutive ones in the input, and am then piping that into a 7 to 3 priority encoder, but for some reason the encoder is not working the way it should. What am I doing wrong? Or is there a better way that I should be doing this?
Original Circuit diagram: