For an excellent logic gate sandbox, see: Logic.ly.
Computers recognize only two states, based on the presence or absence of an electrical signal.
A logic gate is a device that performs a logical operation on one or more binary inputs and produces a single binary output.
The logical connectives that we've learned so far have corresponding logic gates.
The truth table for each gate matches the truth table for the corresponding logical connective.
Let's try out some basic gates in Logic.ly.
We can combine logic gates to create circuits.
These circuits can do things like:
A magnitude comparator is a type of combinational circuit that compares two numbers.
One Bit Magnitude Comparator - Logicly
Assume that A = 1, B = 1.
For each output:
a) Translate the circuit into a boolean expression.
b) Plug the above values into the circuit and solve.
Hint: Remember your truth tables and the fact that 1 = true and 0 = false.
a) ¬A ∧ B
b) 0 ∧ 1 = False
a) A ∧ ¬B
b) 1 ∧ 0 = False
a)
b)
The SR latch is a simple form of flip-flop that can store one bit of information as memory so that it isn't lost when the clock signal changes.
When in the hold state, the outputs remain the same.
They will only change when either the set or reset input is activated.
Circuit:
Scenario:
In this demo, we'll build a system that requires the user to arm a camera before taking a picture.
The camera has three buttons:
Components
Circuit:
In digital circuits, we need to be precise about when information is updated.
The clock is a special signal that is used to synchronize the operations of a computer. For now, we just need to know:
The SR flip-flop extends the SR latch by adding a clock signal.
This signal allows the flip-flop to store information only when the clock signal changes.
Inputs / Outputs:
Truth Table:
Same as above, except now the output can only change on a rising edge (uptick) of the clock signal.
Circuit:
Scenario:
In this demo, we'll build a system that requires the user to hold a button (S) for a full clock cycle before a light turns on.
We will measure the time using the system clock (C). If the button is held for one clock cycle (rise and fall edge), the light will turn on.
There is a reset button (R) that can be used to turn off the light.
Components:
Circuit: