Logic Circuits

Teach any GCSE Computer Science class

We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

A logic circuit is a circuit that executes a processing or controlling function in a computer.  This circuit implements logical operations on information to process it.

Logic circuits utilise two values for a given physical quantity (voltage, for example) to denote the Boolean values true and false or 1 and 0 respectively.  Logic circuits have inputs, as well as having outputs which can be dependent on the inputs.  In logic circuit diagrams, connection from one circuit’s output to another circuit’s input is displayed as an arrowhead at the input end.

When it comes to performance, logic circuits are similar to programming language functions.  The inputs are similar to function parameters while the outputs are similar to function returned values.  A logic circuit can accommodate multiple outputs.

Two Types of Logic Circuitry

Combinational circuitry – operates like a simple function. The output is based on the present values of the input.

  • Combinational circuitry is theoretically built from basic logic gates, which are AND gates, OR gates, XOR gates, and inverters.  The outputs of gates in combinational circuitry is never sent directly back to earlier inputs.
  • An AND gate can conceivably have any number of inputs. Its output is true when all of its inputs are true.
  • An AND gate is frequently used to control a signal – that is, to turn it on or off, depending on the value of control signals.
  • An OR gate can conceivably have any number of inputs. Its output is true when any one of its inputs is true.
  • An XOR gate has two inputs. Its output is true when only of its inputs are true. It will return false otherwise.
  • An XOR gate is sometimes used to control a signal – that is, either to invert it or not, depending on the value of a control signal.

Basic logic gates can be combined to form a variety of higher-level units:

  • Routing
    • Multiplexers – these have several data input signals, as well as a control input. The output is identical to one of the inputs.  The value of the control signal determines which input to take into account.
    • Demultiplexers – these gates have one data input signal, a control input, and several output signals. All of the output signals are 0 (false) except for the one selected by the control input.  The selected output is identical to the data input.
  • Computational
    • Full adders – this kind of gate performs a single column of a binary addition. Full adders are the primary building block for multi-bit adders and subtracto
    • Adders and Subtractors – these work to add or subtract two binary or two complement numbers. A subtractor is just an adder with extra circuitry, which allows it to perform a two-complement operation on one of the inputs.  They are typically designed to do either addition or subtraction, as directed by a control signal.
    • Comparators – these compare either two binary or two complement numbers.

State circuitry – this kind of gate performs like an object method. The output is not only based on the input.  It is also based on the historical inputs.  This is made possible by the memory embedded in the circuitry.

  • This is similar to an object method with values depending on the object’s state, or depending on its instance variables.
  • State circuitry contains anything that can recollect bits of information, including memory, registers, and program counters.
  • The basic element of state circuitry is a flip-flop.  A flip-flop stores one bit of data.  Multiple flip-flops can be combined to form a multi-bit state element called a register.  Multiple registers can be combined into a register bank.

These two types of logic circuitry work hand in hand to form a processor datapath.

Processor Datapath

A processor’s datapath is conceptually organized into two parts:

  • Combinational logic determines the state of the processor for the next clock cycle. The ALU is combinational logic.
  • State elements hold information about the state of the processor during the current clock cycle. All registers are state elements.