1
\$\begingroup\$

Can anyone suggest me an hardware block (I mean its structure/functional units) that is able to detect if a given number is a multiple of 8?

It seems easy but I haven't been unable to find a way to accomplish this.

Thanks

\$\endgroup\$

1 Answer 1

10
\$\begingroup\$

If you have that number in binary (say, on a parallel bus), it's really easy: A binary number is divisible by 8 if the three least significant bits are 0. So you could simply do NOT((bit0 OR bit 1) OR bit2).

\$\endgroup\$
1
  • \$\begingroup\$ Simple and elegant solution \$\endgroup\$ Jul 4, 2013 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.