J
Joel Kolstad
petrus bitbyter said:The question is clear enough but I miss the background. I cannot believe
this to be a serious design problem. Anyone who has some basic knowledge of
digital design should be able to answer immediately. A practical solution
depends on the background I'm missing. You can use a bunch of logic gates,
an EPROM or a PLD to name a few.
He's probably looking for a 'clever,' in this case meaning 'low gate count' or
'fast' solution. There are plenty of digital design problems out there that
are entirely straightforward to just 'code up' a solution to in, e.g., VHDL or
TTL logic, but can be an order of magnitude slower or larger than more clever
solutions.
Counting the number of consecutive zero bits is one of these problems.
This sort of problem comes up somewhat more frequently in software, where
people stuck with, e.g., 1MHz CPUs really do need every last CPU cycle they
can spare... solutions are found all over, e.g.,
http://graphics.stanford.edu/~seander/bithacks.html .