Search code examples
boolean-logicboolean-operations

More than operator in Boolean Logic (Logic gates)


Basically I have 2 unsigned 8-bit binary numbers and I need to use Boolean logic to find out which is larger and I can't for the life of me figure out where to start. Using Logic gates...

Obivously I have to analyse each bit and find out which one is larger but how do I bring it all together?

Say I had x and y and wanted to return true if x < y (x and y are 8bit unsigned binary numbers). How would I go about doing this?

I thought about finding which has the most significant bit, but what if they are both the same?

Anyone got any ideas?


Solution

  • I thought about finding which has the most significant bit, but what if they are both the same?

    You proceed from "most significant bit" down to the "least significant bit" until there is a difference. The number with the first bit set to "1" is greatest.

    To implement this, use a "shift register" for each number and a comparator for the bits "out" of the SR.