5

I am currently preparing the next semester of my program at university and I am stuck at a question of the "Digital Circuits" class.

Here is the task:

[...] pump P1 runs when the fill-level of the tank falls below 90% (U=0), however only when the opacity sensor gives output (S1=1) at the same time. If the lower fill-level sensor signals with L=0 that the fill-level is below 50%, pump P1 runs (P1=1) independently of the opacity sensor signals (S1), as long as U=0 at the same time. [...]

The task is first to derive the Boolean equation for the combinational logic of the pump controller (output signal).

I ended up with P1 = U'*(S1+L').

We are then to realize the controller using only NAND2 gates with the hint that if 4 NAND2 gates are not sufficient to realize the circuit, we should consider further simplifying the Boolean equation.

This is where my problem lies:

I can only get to realizing the circuit with 5 NAND2 gates:

P1 = U'*(S1+L') = U'*(S1+L')'' = U'*(S1'*L)'

schematic

simulate this circuit – Schematic created using CircuitLab

I don't see any way how I could possibly simplify it any further. Maybe somebody could give me a hint.

Thanks in advace :)

jesm86
  • 53
  • 4

5 Answers5

9

Unless I have made an error (very likely) I believe this can be done with 3 NAND gates. The truth table must look like this: $$\begin{smallmatrix}\begin{array}{rrr|cc} U & S1 & L & P1 & \text{comments}\\ \hline 0 & 0 & 0 & 1 &\\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & x & \text{can't happen}\\ 1 & 0 & 1 & 0\\ 1 & 1 & 0 & x & \text{can't happen}\\ 1 & 1 & 1 & 0\\ \end{array}\end{smallmatrix}$$ Using a Karnaugh map to find the Boolean expression yields a realization that uses 3 2-input NAND-gates.

Carl
  • 3,646
  • 1
  • 14
  • 33
  • I am not sure the don't care cases are justified based on the question wording...Although they do make sense, as the tank can't be both filled more than 90% and less than 50%. This is probably the right approach. – Eugene Sh. Jul 29 '21 at 18:21
  • @EugeneSh. Well, the case where the fill level is above 90% but below 50% is impossible (can't happen). My basic understanding was that they then could be treated as don't cares. I could be wrong, though. – Carl Jul 29 '21 at 18:24
  • 3
    Yeah, added this to comment too, looks like it is the only way to get less than 5 NANDs. Upvoted – Eugene Sh. Jul 29 '21 at 18:25
  • 2
    Just a thought. Why would the problem statement writer take the time to say that if L=0 the pump runs independent of S1 ***only if U=0, too***? This extra wording has to mean something. Or else why did they bother saying it? It's too *definite* to be an accident. – jonk Jul 29 '21 at 18:56
  • I'd say the whole problem statement is quite awkward. – Eugene Sh. Jul 29 '21 at 18:59
  • @EugeneSh. Perhaps. But that kind of wording doesn't fall out of the mouth by accident. I suspect the problem statement *intends* this. Perhaps the upper sensor has "behaviors" that must be accommodated by the logic for some unstated hypothetical safety reason. Who knows? Regardless, those words don't accidentally get written. (Or, I can't see a good way to argue they were an accident.) Perhaps it is intended that the student identify this conflict? – jonk Jul 29 '21 at 19:03
  • It seems like there are only three ways this problem can be solved: 1) If you're allowed to have a complemented output, 2) it's impossible to have U=1 and L=0 at the same time, or 3) there's an error or omission in the question. We don't have the full text of the question, so I suspect #3, but Carl has the most educational answer so I'm upvoting it. – Adam Haun Jul 29 '21 at 19:04
  • 1
    Thanks for the elaborations, they helped me and confirmed that the way I understood the question, it is not really possible to get below 5 NAND2 gates. I am sorry that I omitted part of the problem text. It states that a running pump means P1=1. It also states U=1 and L=0 is possible, because the 50% sensor may be defect and in this case the pump shall not run (P1=0). (That's why i used paranthesis (U'*S1)+(U'*L') = U'*(S1+L'). I think the wording is unclear, but its a question from last year (cant ask the prof). more important is that, my basic understanding is correct. So thank you all! :) – jesm86 Jul 29 '21 at 23:14
  • @EugeneSh. That kind of problem statement sounds quite good compared to the stuff that I get to work with, so perhaps it is intended as an introduction to "the real world"? – MikeB Jul 30 '21 at 09:20
  • 2
    I'm pretty sure a double-check for U0 when L0 is low is carried over from a real-world requirement not to overflow the tank in case of a failed sensor. So "can't happen" of this answer ignores a safety requirement, which is... let's say, not ideal. Please do not follow the Boeing example. – Eugene Ryabtsev Jul 30 '21 at 09:30
2

Eliminating unnecessary words we get…

pump P1 runs … if U=0 only when S1=1…
pump P1 runs =1 independently of S1 only if U=0
pump P1 runs if L=U=0 and S1=x

  P1 = U’*S1 + L’ = ((U*U)’*S1)’*L)’    
  shows 3 (a*b)‘s meaning 3 NAND’s
Tony Stewart EE75
  • 1
  • 3
  • 54
  • 182
1

Why those parentheses? When L=0, output is independent of any other input, right?

So it is P1 = U'*S1+L' and it can be realized with 4 nands.

Ayhan
  • 1,194
  • 9
  • 17
  • *When L=0, output is independent of any other input, right* - As long as U=0.... Not quite independent – Eugene Sh. Jul 29 '21 at 19:17
  • Yes, but I mean it is dictated by external factors. – Ayhan Jul 29 '21 at 19:19
  • U is an input, not an external factor. – Eugene Sh. Jul 29 '21 at 19:20
  • 1
    When it is under 50%, it is always under %90. So when L=0, U is always 0. External factor is that they being tied by physical reality. – Ayhan Jul 29 '21 at 19:31
  • 1
    This physical reality is reflected by "don't cares" in Carl's answer. I didn't check the equivalence of your final expression to his, maybe they are equivalent. But these steps should be elaborated. – Eugene Sh. Jul 29 '21 at 19:33
0

Try starting with a complemented output to reduce the number of inversions you need:

P1' = U + S1'*L

If you look at the Karnaugh map for P1, you can see that it's easier to simplify P1' than P1.

Adam Haun
  • 21,331
  • 4
  • 50
  • 91
  • 1
    I don't think it helps to reduce the number of NANDs – Eugene Sh. Jul 29 '21 at 17:36
  • @EugeneSh. Changing things so that the pump is ON when the output is 0 does improve things over saying that the pump is ON when the output is 1. So complementing the output does impact the result. – jonk Jul 29 '21 at 19:15
  • @jonk Of course, you can redefine the signals to their complements (not only output but the inputs too). But it is not what the problem is asking to do. – Eugene Sh. Jul 29 '21 at 19:16
  • @EugeneSh. Does the problem statement say *anything* about the output logic value with respect to pump operation? If so, I may have missed it. Otherwise, I'm not sure I understand the *"But it is not what the problem is asking to do."* Could you elaborate? – jonk Jul 29 '21 at 19:18
  • @jonk Actually, you are right. The cited text does not mention the polarity of `P1` – Eugene Sh. Jul 29 '21 at 19:19
  • @EugeneSh. And there's the point. Read carefully! – jonk Jul 29 '21 at 19:20
  • Yep, that could be a way. But this answer should operate in these terms and remove this negation and add the wording "assuming the pump is running when P1=0..." – Eugene Sh. Jul 29 '21 at 19:21
  • @jonk Ok, I just re-read it: *"pump P1 runs (P1=1)"* so no, I have to correct myself again, it is stated explicitly. – Eugene Sh. Jul 29 '21 at 19:23
0

There's an active discussion here about the problem statement and its interpretation. I'm taking the position that:

  1. You reflected the problem statement to us, accurately.
  2. The writer could not possibly have accidentally written the part about the pump ignoring S1 when L=0 only if U=0, as well.

A careful reading of the problem statement suggests that it may not be making an explicit statement about the logic level required for the pump to be ON. It does appear to state that P1 is the pump. Then it also appears to say that P1=1 when the pump is ON. So there is a conflation of two things -- the pump itself is called P1 and also a logic symbol P1 is suggested, too.

But if one either must figure that the content writer accidentally added that indication about U or else is allowing you to make the choice about a logic level distinct from the pump state, I'd go with the latter.

And no, I don't find a lot of shelter in that argument. But I do find at least a little. Also, you noted that the question went on to suggest "simplifying the logic" if you cannot get to four NANDs. I'll take that as an added clue or suggestion, as well.

Therefore, you have your answer. Don't assume that the pump is ON when the output is 1. Instead, plan that the output is 0 when the pump is ON.

jonk
  • 77,059
  • 6
  • 73
  • 185
  • 1
    It appears that it does state the logic level for the pump: "*pump P1 runs (P1=1)*" – Eugene Sh. Jul 29 '21 at 19:24
  • @EugeneSh. You may be right. Let me see if I can develop a counter-argument! Hmm. Okay. Is P1 necessarily the output I must develop just because they say that P1 is 1 when the pump is ON? Maybe P1 is just an abstract variable, not necessarily the logic I must use. I might instead choose to create /P1 (P1'). But yeah. I'm feeling less certain, again. I'll edit to reflect it. – jonk Jul 29 '21 at 19:25
  • I guess if you develop a controller box with predefined interfaces... – Eugene Sh. Jul 29 '21 at 19:27
  • @EugeneSh. I added some comments. One thing about P1 is that it is conflated. They use P1 to label the pump itself. They then use P1 as a logic symbol. A pump is not a logic symbol. These are distinctly different. You cannot set P1=1 if P1 is a pump. ;) I find some (not much) shelter in that. – jonk Jul 29 '21 at 19:31