Difference between revisions of "Logic Composition"

From Coder Merlin
Line 72: Line 72:
     |}
     |}


== Experiment ==
== First Steps ==
This exercise relies on an external website which will enable you to easily experiment with logic gates and form various compositions with the components.  The links on this wiki page will preload the relevant gates currently under discussion.  For best results, open the links in a separate window so that you can continue to read the wiki while you experiment.
This exercise relies on an external website which will enable you to easily experiment with logic gates and form various compositions with the components.  The links on this wiki page will preload the relevant gates currently under discussion.  For best results, open the links in a separate window so that you can continue to read the wiki while you experiment.
* The "L" indicates a '''L'''ow voltage which usually represents '''zero''' or '''false'''
* The "L" indicates a '''L'''ow voltage which usually represents '''zero''' or '''false'''
Line 105: Line 105:
# Click several more times on the inputs until you're able to consistently predict the output.
# Click several more times on the inputs until you're able to consistently predict the output.
|}
|}
== Experiment ==

Revision as of 16:22, 28 July 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Prerequisites[edit]

Introduction[edit]

Logic gates can be composed in the same way that Boolean functions can be composed, allowing the construction of a physical model of all of Boolean logic. Combining multiple gates enables us to build complex functionality from simpler building blocks.

Three-Input And Gate[edit]

Three Input AND Gate

Consider this three input AND gate internally constructed of two, two-input AND gates. Logically, this gate has three inputs and one output, regardless of how the gate is constructed internally. The truth table for this composition is:

Inputs Outputs
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
Hint.pngHelpful Hint
Take the time to recreate this table (and those that follow) on your own

Implication Gate[edit]

IMPLY gate

Consider this IMPLY gate internally constructed of a NOT gate and an OR gate. Logically, this gate has two inputs and one output, regardless of how the gate is constructed internally. The truth table for this composition is:

Inputs Outputs
0 0 1
0 1 1
1 0 0
1 1 1

Implication is formally indicated by a forward arrow, i.e. , meaning, if p is true, then q is also true. As an example, consider the implication, "if it's raining then I'll carry my umbrella". There are four cases, only one of which yields false:

Raining Equipped with Umbrella Evaluation of Statement Explanation
No No true It's not raining, so it doesn't matter if I'm carrying an umbrella or not.
No Yes true It's not raining, so it doesn't matter if I'm carrying an umbrella or not.
Yes No false It is raining, and I am not carrying an umbrella. This contradicts the implication.
Yes Yes true It is raining, and I am carrying my umbrella.

First Steps[edit]

This exercise relies on an external website which will enable you to easily experiment with logic gates and form various compositions with the components. The links on this wiki page will preload the relevant gates currently under discussion. For best results, open the links in a separate window so that you can continue to read the wiki while you experiment.

  • The "L" indicates a Low voltage which usually represents zero or false
  • The "H" indicates a High voltage which usually represents one or true
  • The layout flows from left to right.
  • Inputs will be leftmost and output will be rightmost.
  • Clicking on an input will toggle the input from Low to High or from High to Low
  • When an input is changed, the result will instantly impact the rest of the digram.

Input, Output, and an Inverter[edit]

Click on the image ("Wire and Inverter") and open the link in a different window, then return to the wiki:
Wire and Inverter
  1. Click on the leftmost (input) H in the top diagram which simply represents a wire.
    1. What happens to the H?
    2. Does the color of the wire change?
    3. How is the output impacted?
  2. Click on the leftmost (input) H in the bottom diagram which represents an inverter.
    1. What happens to the H?
    2. Does the color of the wire change?
    3. How is the output impacted?

AND Gate[edit]

Click on the image ("AND Gate") and open the link in a different window, then return to the wiki:
AND Gate
  1. Click on the top L input.
    1. What happens to the top L?
    2. What happens to the output?
  2. Click on the bottom L input.
    1. What happens to the bottom L?
    2. What happens to the output?
  3. Click several more times on the inputs until you're able to consistently predict the output.

Experiment[edit]