section 6 - programming Flashcards
Logic Gates
Logic gates are special circuits built into computer chips. They receive binary data, apply a Boolean operation, then output a binary result.
Logic diagrams are often drawn to show logic gates and circuits. Each type of logic gate is shown by a different symbol.
Truth tables
Each type of logic gate also has a corresponding truth table.
Truth tables show all possible input combinations of 1s and 0s, and the corresponding outputs.
Not gate
1) NOT gates take a single input and give a single output.
2) The output is always the opposite value to the input. If 1 is input, it outputs 0. If O is input, it outputs 1.
And gate
1) AND gates take two inputs and give one output.
2) If both inputs are 1, the output is 1, otherwise the output is 0.
Or gate
1) OR gates take two inputs and give one output.
2) If one or more inputs are 1, then the output is 1, otherwise the output is 0.
Multiple logic gates
Multiple logic gates can be added to the same logic circuit to carry out different operations.
You can work out the truth tables by working through each gate in order.
For every input combination, follow them through each gate step-by-step, then write down the output.
By using brackets and the terms AND, OR and NOT, circuits can be written as logical statements, like NOT(A AND B) below. Operations in brackets should be completed first, just like in normal maths.
AND followed by NOT.
OR followed by NOT.
two-level logic circuits
they require the inputs to pass through a maximum of two logic gates to reach the output.
two-level logic circuit with 3 inputs
Using Boolean operators, this circuit can be written as R = (A OR B) AND (NOT C). (This is an example of Boolean algebra).
To cover every input combination, extra rows are needed in the truth table. There are 3 inputs and each can take one of 2 values, so 2 x 2 x 2 = 8 rows are needed.