1

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

cidadao
  • 999
  • 2
  • 12
  • 20

1 Answers1

10

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).

us2012
  • 733
  • 7
  • 11