1
\$\begingroup\$

I need to (in design) create a 3-bit comparator using an 8-bit multiplexer and/or up to four 4-bit multiplexers. There are plenty of examples of how comparators and multiplexers works on the web. There are several examples of 2-bit comparators based on multiplexers. But nothing over 2 bits. After many hours of pondering and sketching I am beginning to think it is impossible.

Can someone tell me if it is even possible ? Am I beating my head against a concrete wall for no reason at all ? If it's possible can someone just give me a hint?

\$\endgroup\$
  • 2
    \$\begingroup\$ Can you put here some schematics what were your thougths? \$\endgroup\$ – Chupacabras Feb 24 '17 at 7:23
  • 2
    \$\begingroup\$ to clarify, you want to compare two 3-bit numbers for magnitude, using an unrealistically constrained set of logic parts? \$\endgroup\$ – Neil_UK Feb 24 '17 at 7:24
  • \$\begingroup\$ Right ! Exactly ! No other components. Just these multiplexer chips. Compare two 3-bit values resulting in a 2-bit value representing equal, a>b and a<b (assigning any values to these results - the fourth of the 2-bit result is "undefined"). My sketches are on paper so that wont help. I have created a spreadsheet with the truth table sorted four different ways to try to ascertain a pattern, but I guess I'm getting tired because I sure don't see what I need. \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 7:36
  • \$\begingroup\$ I was thinking that I should use one of the values (3-bits) as the select into the 8-bit multiplexer then use the other value on the data pins (as well as "hard-wired" values to arrive at a matching truth table. But it's just not coming to me and I'm beginning to think it's actually not possible. \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 7:38
  • \$\begingroup\$ Oh yeah ! Thanks a bunch for the quick reply !!! REALLY !!! \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 7:39
1
\$\begingroup\$

Given 3 x 74LS153, consider using a 74LS153 (which is really a 2 x 4:1 multiplexers) to generate A > B and A < B given A is a 1 bit value and B is a 1 bit value and that these bits form the least significant bit pair. It can be inferred that if both A > B and A < B are false then A = B. Consider using the next 74LS153 for the next most significant bit pair. However, for this and all other bit pairs, when A = B, pass the A > B & A < B outputs of the previous 74LS153. We can repeat this (pattern) for as many bits pairs as needed. The problem is constrained to 3 pairs. I will leave the exercise of wiring up to you to complete the problem.

Regardless if you are designing combinational logic or writing software. Finding repeating patterns is usually the first step in simplifying the problem.

\$\endgroup\$
  • \$\begingroup\$ I've been trying to use the 8-bit multiplexer without success. After I posted I started trying something like you suggested, but starting at the most significant bits first. My reasoning is that if A2 is "1" and B2 is "0" then I already know which value is larger (or visa-versa). That's how I would write the code anyway. The problem (for me) was how to generate the 2-bit output from the results of 3 multiplexers. I guess that will require another. I haven't got that far just yet. Should I really start at the least significant bit ? Can you tell I'm a software guy - not hardware ? \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 9:03
  • \$\begingroup\$ I've been missing an important fact. The 74LS153 has TWO outputs ! I should have gleaned that from your last message ! \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 9:11
  • \$\begingroup\$ Like I suggested with the string comparison, start with the most significant bits (c.f. the first characters). Only when they're the same do you need to move onto the next most significant bits. \$\endgroup\$ – Finbarr Feb 24 '17 at 9:54
  • \$\begingroup\$ That's the plan. I have three dual 4-bit mux comparing each of the three pairs of bits to generate A=B (00), A>B (01) and B>A (10). (11 is undefined for this project.) I can see if the most significant bits aren't equal I know the result. The problem (again - for me) is translating the result into a 2-bit value. I have one dual 4-bit mux and one (maybe two) 8-bit multiplexer (74LS151). Combining the results of the three mux without any other components than these is stumping me. I'm not sure it can be done. \$\endgroup\$ – DinosaurCoder Feb 24 '17 at 11:54
  • \$\begingroup\$ You're thinking of it like a big pyramid with all your inputs at the bottom and the outputs at the top, but the solution is a bit more sideways than that. And it can be done with just the three dual 4-bit muxes. \$\endgroup\$ – Finbarr Feb 24 '17 at 12:38

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.