Transistors, Circuits, and Logic Gates.

Chapter 3: Digital Logic Structures

Transistors, Circuits, and Logic Gates.

The Transistor #

Transistors are semiconductor devices that can amplify or toggle (switch) electrical signals and are the basic units in any modern Computing System.

There are two types of transistors that are commonly in used:

  1. Bipolar Junction Transistor (BJT)
  2. Field-Effect Transistor (FET)

Some of their main differences are:

BJT FET
Electrical current is controlled with current. Electrical current is controlled with voltage.
Affected by temperature quickly. Affected by temperature less.
Breaks quickly. Durable.
Suitable for hobby electronic devices. Suitable for commercial products.
Low switching speed. High switching speed.

In both cases these transistors have three terminals that have the same characteristics:

BJT FET Terminal Description
Base Gate Control terminal; controls the current of electrical signal.
Emitter Source Input terminal; supplies the transistor with electrical current.
Collector Drain Output terminal; the electrical current going out of the transistor.

Both transistors also contain N-Type or P-Type semiconductors that changes the behaviour of the current flowing to the transistor based on the configuration:

BJT FET Current Flow Description
NPN N-Channel Current flows from the output terminal to the input terminal
PNP P-Channel Current flows from the input terminal to the output terminal

Terminal differences between BJT and FET

In general, N-Type and P-Type transistors are complimentary of each other:

  • N-Type transistors allows the flow of electrical current if voltage is given.
  • P-Type transistors stops the flow of electrical current if voltage is given.

A common circuit design that takes advantage of these properties of transistors is called the CMOS (Complimentary Metal-Oxide Semiconductor) circuit and is the basis for most Logic Gates.

Logic Gates #

Logical operators built from transistors; digital logic circuits.

The ff. are schematic symbols of digital logical operators:

Logic Gates

Combinational Logic Circuits #

A combinational (or combinatorial) logic circuit is a type of digital logic whose operations are pure ie. it doesn't have state or use memory and only generates outputs based from its inputs.

Decoder #

A decoder is a combinational logic circuit that contains 2n2^n outputs where nn is the number of inputs.

Each output terminal in a decoder corresponds to the bit permutation of the input terminals.

Decoder Schematic

Decoder truth table:

a b s0 s1 s2 s3
00 00 11 00 00 00
00 11 00 11 00 00
11 00 00 00 11 00
11 11 00 00 00 11

Multiplexer (Mux) #

A multiplexer (or mux) is a combinational logic circuit that contains 2n2^n inputs, nn select terminals, and 11 output terminal.

A multiplexer's output is determined by the permutation of the select signals from given input signals.

Multiplexer Schematic

Multiplexer truth table:

s0 C
00 aa
11 bb

Here, whenever s0s0 is 00 the output of the multiplexer is whatever value aa has, and whenever s0s0 is 11 the output of the multiplexer is whatever value bb has.

Conversely there is also the demultiplexer which contains a single input, 2n2^n outputs, and nn select terminals.

Full-Adder #

A full-adder (or 1-bit adder) is a combinational logic circuit that contains:

  1. Three (3) input terminals: two (2) of which are the operands for the sum operation and the other is the carry bit.
  2. Two (2) output terminals: one (1) for the carry-over bit and the other the sum bit.

Full-Adder Schematic

Full-adder truth table:

aa bb CC SS CrCr
00 00 00 00 00
00 00 11 11 00
00 11 00 11 00
00 11 11 00 11
11 00 00 11 00
11 00 11 00 11
11 11 00 00 11
11 11 11 11 11

There is also the notion of a half-adder which is essentially a full-adder but without a carry input terminal.

Basic Storage Elements #

The ff. are digital logic structures that can store/persist values which are building blocks for memory devices.

SR Latch #

The SR (set/reset) Latch is a digital logic structure that persists a single bit of information.

One of the most common way to implement SR Latches in a digital circuit is to use two (2) NAND gates whose output of each is one of the inputs of the other.

SR Latch Schematic

In an SR Latch, the SS or set input sets the state of the latch (in this case the output aa) to a 11, whereas the RR or reset input resets or clears the state of the latch to a 00.

Assuming that the initial state of a circuit like this is the ff.:

  • S=0S = 0
  • R=0R = 0
  • a=1a = 1
  • b=0b = 0

In this case:

  • aa will remain with a value of 11 regardless of what the value of SS is iff. RR is 00.
  • aa will remain with a value of 00 regardless of what the value of RR is iff. SS is 00.

To build a basic intuition about how this works we can imagine an OR gate whose output feeds into one of its input:

OR Gate Persistence

Recall that the truth table of the OR logical operator is as follows:

aa bb CC
00 00 00
00 11 11
11 00 11
11 11 11

For the OR gate in this case: if the input terminal aa is given a high input signal (a value of 1), then the output CC will equal to 11 as ab=10=1a \lor b = 1 \lor 0 = 1 which consequently will set b=1b = 1.

Once at this state, CC will always be 11 regardless of the value of aa.

NOTE: Please see Ben Eater: SR Latch for a video demonstration of this and a more indepth discussion on the SR Latch.

D-Latch #

The D-Latch (or Data Latch) is a digital logic structure that is an extension of the SR Latch.

The D-Latch uses a single input to toggle the state of the SR latch with an auxiliary input called the write-enable (WE) input.

The D-Latch can only change the state of the latch if the WE input is on.

D-Latch Schematic

NOTE: Please see Ben Eater: D-Latch on youtube for more information about the D-Latch digital logic circuit.

The Concept of Memory #

Computer memory is made up of (a large) number of locations that are each uniquely identifiable and can store a number of bits of information.

Address Cell, Address, and Addressability #

An address cell is a single unit or item within a memory device.

A memory address or just address is a location of an address cell in the memory.

The address size or addressability of a memory is the number of bits of information that can be stored in an address cell.

So for example, a computer that is advertised to have 2 GB of memory may mean that it has 2 billion addresses to uniquely identify each cell where each can store a byte of information.

Address Space #

The address space refers to the total number of addresses that can uniquely identify an address cell in a memory device.

Given nn bits, we can uniquely identify 2n2^n address cells ie. 1010 bits can be used to uniquely identify 210=10242^{10} = 1024 address cells.

Addressability #

As mentioned earlier, addressability refers to the number of bits that can be stored in each memory address.

A byte-addressable memory is a device that contains 8-bits or a byte in each address cell.

A word-addressable memory is a device that contains the same word-length as the CPU in each address cell.

A word is a size that is dependent on each CPU design/implementation.

A Memory Diagram #

The ff. is a memory diagram depicting the different parts of an abstract memory device.

The diagram contains sections for the address cell, an nn-length address space, and the address size or addressability of each address cell.

Memory Diagram