Skip to main content
Engineering LibreTexts

1.3.1: Logic Gates

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    A wire in a computer can be in one of two states, which we can think of as being on and
    off. These two states can be naturally associated with the Boolean values T and F. When
    a computer computes, the multitude of wires inside it are turned on and off in patterns
    that are determined by certain rules. The rules involved can be most naturally expressed 2in terms of logic. A simple rule might be: “turn wire C on whenever wire A is on and

    wire B is on”. This rule can be implemented in hardware as an AND gate. An and gate is an electronic component with two input wires and one output wire, whose job is to turn its output on when both of its inputs are on and to turn its output off in any other case. If we associate ‘on’ with T and ‘off’ with F, and if we give the names A and B to the inputs of the gate, then the gate computes the value of the logical expression A B. In effect, A is a proposition with the meaning “the first input is on”, and B is a proposition with the meaning “the second input is on”. The and gate functions to ensure that the output is described by the proposition A B. That is, the output is on if and only if the first input is on and the second input is on.

    As you hopefully know from Computer Organisation, an OR gate is an electronic com- ponent with two inputs and one output which turns its output on if either (or both) of its inputs is on. If the inputs are given names A and B, then the or gate computes the logical value of A B. A NOT gate has one input and one output, and it turns its output off when the input is on and on when the input is off. If the input is named A, then the not gate computes the value of ¬A.

    As I mentioned earlier, other textbooks might use different notations to represent a negation. For instance a bar over the variable x̄ or a ∼ symbol. In digital logic (and thus in your Computer Organisation course) you will also often find the + symbol to represent an ‘or’ and a · (dot) symbol to represent an ‘and’.

    Other types of logic gates are, of course, possible. Gates could be made to computeA B or A B, for example. However, any computation that can be performed by logic gates can be done using only and, or, and not gates, as we will see below. (In practice, however, nand gates and nor gates, which compute the values of ¬(A B) and¬(A B) respectively, are often used because they are easier to build from transistors than and and or gates.)

    1.3.1: Logic Gates is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?