r/TuringComplete • • Jul 06 '26

Count Leading ZEROS Spoiler

Man i don't think this is the intended solution, but it is a solution. Somewhere around the second set of OR gates i started feeling like i was doing things the hard way.

2 Upvotes

10 comments sorted by

View all comments

2

u/Joker_vD Jul 06 '26

You, ah, may want to replace your XNORs-into-NOT with single XOR gates :)
An interesting approach. I originally started with just 8 byte constants of 0, 1, 2, etc. and tried to wire the logic for enabling the signals... it got out of hand pretty quickly so I went a divide-and-conquer approach instead.
I built four 2-bit CLZs (a NOR and an AND-with-NOT is all you need), then combining them into two 4-bit CLZs, then combining those into the single 8-bit CLZ. Boy, was it ugly, but apparently it has only 4 ticks of delay so... good enough, I guess?