# Given a shift register- Create a circuit to check whether 4 first bits are equal to the last 4

I hope this is the place to ask such a question.

Given a shift register- within 8 clock pulses 8 bits will enter this register, I need to make a circuit with this register, and other 3 flip-flops such that its exit line would be 1 if the first 4 bits are equal to the last 4.

This is an example of possible solution.

My question for you is: How come that only at the end of the 8th pulse a value would go out to the "equal" line? (or that in this solution- successes consider as output of "1111"?)

• How long is the shift register? 4 bits? 8 bits? something else? With a 4 bit register and all 4 bits available externally, consider using the three FFs as a counter,initialized to 0, that counts clock pulses. The register output is fed back and XORed into the bit going in when the counter high-order bit is 1, so during the first 4 clock cycles, the register fills with x0, x1, x2, x3, while during the next 4, it fills with x4 XOR x0, x5 XOR x1, x6 XOR x2 and x7 XOR x3 = 0000 exactly when bits match. Detect with a 4-input NOR whose output is looked at only when the counter contains 111. – Dilip Sarwate Feb 19 '12 at 18:27
• "How come that only at the end of the 8th pulse a value would go out .." -- how can you tell if the 1st four are the same as the last four until you've seen all 8? With one bit per clock, that's 8 clocks. Just not clear what the question is. – JustJeff Mar 21 '12 at 2:13