# Logic: Output a 1 when a = 1 and b = 0

I'm a hobbyist just discovering logic gates and would like to know, is there a logic gate that will only output a 1 when a is a 1 and b is a 0?

Truth Table

a | b | y
---------
0 | 0 | 0
0 | 1 | 0
1 | 0 | 1
1 | 1 | 0


Here is a schematic I made, that I think should work in theory, but would like it in one package.

Are chips like this readily available or is everything made up of individual gates?

OFF TOPIC EDIT: IMGUR is currently not working with SE for me or for people in the comments so the way I got around that was to go imgur.com and uploaded the picture manually. Then right click the picture > Copy image address and then paste it here like so:

![logic](https://i.sstatic.net/bsoGB.jpg)

• You can delete AND1, and replace NOR1 with an inverter. I doubt if such a gate is made as a standard product - but look at XOR gates - they do something similar. Commented Aug 7, 2018 at 15:29
• @MCG Why do you think so? Commented Aug 7, 2018 at 15:37
• I tried to draw a schematic using two NOR gates (one used as inverter for A) as that allows you to implement the circuit with "one package" but three times the system refuses me to upload. Commented Aug 7, 2018 at 15:44
• It's not you. @Oldfart It gave me similar faults. IMJUR is in twilight zone Commented Aug 7, 2018 at 15:50
• @MCG How come? Look at the truth table and the schematic. There clearly is a dependency on both A and B. Commented Aug 7, 2018 at 15:55

I'm pretty sure half a 7402 is all you need: use one gate to invert A and the other to NOR it with B:

simulate this circuit – Schematic created using CircuitLab

 A   A'  B  |  Y
------------+----
0   1   0  |  0
0   1   1  |  0
1   0   0  |  1
1   0   1  |  0


This can be implemented with an AND gate with one inverted input, or with a NOR gate with one inverted input.

Devices that implement this logic are the (SN)74xx1G58, (SN)74xx1G97, and (SN)74xx1G98.

You could simply use a buffer chip with an active low enable.

Something like an SN74LV1T125 might work.

Hook A to A, B to OE, Y is your output.

Since the output tri-states, you will need a resistor to ground on the output.

• Since that is using the tri-state enable, add a resistor. Commented Aug 7, 2018 at 15:54
• Yes, you will need a resistor to ground on the output. I was trying to show that in a schematic, but I am having trouble getting it to work. I keep getting a "Failed to upload the schematic image". Commented Aug 7, 2018 at 17:30

You could implement the logic with a single 7437 logic chip using only 3 of the 4 gates in the package.

There are many chips which have both enable Hi and Lo for other features like One-Shots but not specifically this.

You can also use INV + NOR gate and swap inputs.

If all you want is to get the function in one package, you can do it with a multiplexer: half of a 74x153, for example. Connect A and B to the address pins and make all but one of the inputs low, while the AB' pin is high.