# 6.4 - Logic Gates

- a boolean variable X has 2 outcomes (True/False) or (1/0)

## Truth Tables

### OR

\[Q = X + Y\]

X |
Y |
Q |

0 |
0 |
0 |

0 |
1 |
1 |

1 |
0 |
1 |

1 |
1 |
1 |

### AND

\[Q=XY\]

X |
Y |
Q |

0 |
0 |
0 |

0 |
1 |
0 |

1 |
0 |
0 |

1 |
1 |
1 |

### NOT

\[Q = \overline{X}\]

### NAND

\[Q=\overline{XY}\]

X |
Y |
Q |

0 |
0 |
1 |

0 |
1 |
1 |

1 |
0 |
1 |

1 |
1 |
0 |

### NOR

\[Q=\overline{X+Y}\]

X |
Y |
Q |

0 |
0 |
1 |

0 |
1 |
0 |

1 |
0 |
0 |

1 |
1 |
0 |

### XOR

\[Q=X\overline{Y}+\overline{X}Y\]
\[Q=X\otimes{Y}\]

X |
Y |
Q |

0 |
0 |
0 |

0 |
1 |
1 |

1 |
0 |
1 |

1 |
1 |
0 |

### Half-Adder

A |
B |
A+B |
C (carry) |

0 |
0 |
0 |
0 |

0 |
1 |
1 |
0 |

1 |
0 |
1 |
0 |

1 |
1 |
0 |
1 |

NB:

\[A + B = A \otimes{B}\]
\[C=AB\]