1
\$\begingroup\$

How might a comparator with only logic gates look like? Isit like:

\$\endgroup\$
  • 1
    \$\begingroup\$ What are you comporting for equality or x >y or x < y? \$\endgroup\$ – Dean Nov 13 '11 at 3:02
  • \$\begingroup\$ I comparing for equality here. Isit possible to compare < or > whith only logic gates? Meaning not an ALU subtract? \$\endgroup\$ – Jiew Meng Nov 13 '11 at 3:06
  • 1
    \$\begingroup\$ electronics-tutorials.ws/combination/comb_8.html <- Yes. \$\endgroup\$ – Dean Nov 13 '11 at 3:26
  • \$\begingroup\$ I think you could just post an answer with the link and some quotes from the site then I could just accept it? \$\endgroup\$ – Jiew Meng Nov 13 '11 at 4:00
  • 1
    \$\begingroup\$ @jiewmeng, everything an ALU does is made up of logic gates, everything a computer does on that note, minus the addition of RAM, but flip-flops often form the backbone of the processor itself, at least in my basic level of design classes I took years ago. All math functions are implemented with logic gates, even subtract, add, multiply and division. In lower cost systems the last two are often implemented using the previous two and quite a few clock cycles, but it can be done directly. \$\endgroup\$ – Kortuk Nov 13 '11 at 4:50
2
\$\begingroup\$

Your answer looks fine as is (assuming an XOR is counted as a logic gate (and I can't see why not).

You can reduce gate count by one by using an 8 input NAND or AND at the output. eg 74xx30 8 input NAND.


If your XOR gates were open collector you could connect all their outputs, add one resistor and remove the AND gates. Depends wheher your rules allow a resistor pullup with an open collector gate.

\$\endgroup\$
  • \$\begingroup\$ Hmm I haven’t learnt that I could use a resistor here. But the limitation I am given (in the exam question) was max of 4 fan into gates \$\endgroup\$ – Jiew Meng Nov 13 '11 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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