Lesson 1. The transistor that remembers

In pictures

An ordinary transistor does what its gate tells it: apply 1 — it opens, apply 0 — it closes. This kit brings in a new transistor — one with memory. It hides one bit inside. While the bit = 0, it is an ordinary transistor. If the bit = 1, it is closed for good, whatever comes to the gate. Thousands of such transistors make up ROMs, the flash memory in your phone and the GAL22V10 chip that we will build in this kit: the bits decide which wires inside are connected and which are not.


1.1. How a transistor remembers

In an ordinary MOS transistor the gate is separated from the channel by a thin layer of glass. The voltage on the gate pulls charges into the channel, and the channel starts to conduct.

A memory transistor has a second gate between the gate and the channel — a small piece of conductor surrounded by glass on all sides. It is not connected to anything, so it is called floating. If you push electrons onto it (a higher voltage is applied to the transistor for this), they have no way back out — they stay there for years. These electrons shield the channel from the ordinary gate, and the transistor no longer opens.

  • no electrons — bit 0, the transistor works as an ordinary one;
  • electrons present — bit 1, the transistor is closed for good.
siliconsourcedraingatefloating gatebit 0: the gate opens the channelsiliconsourcedraingatee⁻bit 1: electrons trapped — no channel
A memory transistor in cross-section. The floating gate is surrounded by glass. While it holds no electrons, the transistor is ordinary; electrons on it shield the channel — and the transistor is closed for good.

To erase the bit means to drive the electrons back out.

1.2. A bit of history

  • 1967 — Dawon Kahng and Simon Sze at Bell Labs came up with the idea of the floating gate.
  • 1971 — Dov Frohman at Intel makes the 1702, the first ROM that can be erased and written again (EPROM): 2048 bits on such transistors. Its transistors are P-channel. It was erased with ultraviolet light: the package had a quartz window, and the chip was put under a lamp for 20 minutes.
  • 1978 — the first programmable PAL arrays. Their fuses were burnt out with current, so such a chip could be programmed only once.
  • 1985 — Lattice releases the GAL: the same array, but instead of burnable fuses — floating-gate transistors that are erased electrically. Made a mistake in the firmware — erase it and program it again, right in the programmer.

1.3. The memory transistor in the simulator

In the palette it sits on the same button as the ordinary transistor. Alt-click (or ⌘-click) on a transistor cycles through the variants:

  • N — ordinary N-channel,
  • P — ordinary P-channel,
  • MN — N-channel with memory,
  • MP — P-channel with memory (as in the Intel 1702).

The bit is shown right on the body. A double click on MN or MP programs the bit (0 → 1) or erases it (1 → 0).

NGordinary NPGordinary PMNG0#14MN, bit 0: worksMNG1#15MN, bit 1: closedMPG0#16MP, bit 0: worksMPG1#17MP, bit 1: closed
This is how transistors look on the canvas. Alt-click cycles N → P → MN → MP. A memory transistor shows its bit at the bottom right (green 0, red 1) and its fuse number at the top right; with bit 1 it is crossed out: it never conducts. A double click changes the bit.

1.4. The experiment

Let's build the same thing as for an ordinary transistor: a resistor pulls a point up to VCC, the transistor pulls it down to ground, and a lamp sits on the point. The transistor has three legs: the left leg — the gate, the top leg and the bottom leg.

PartWires
Power→ label VCC
Ground→ label GND
Resistortop leg → label VCC
bottom leg → top leg of MN
MNbottom leg → label GND
Input→ left leg of MN (gate)
LED→ bottom leg of the resistor
VCCRlampMNGNDswitchgate
The lesson 1 experiment: the resistor pulls the point up to VCC, the memory transistor pulls it down to ground. With bit 0 the switch turns the lamp off, with bit 1 the lamp is always on.

Place an ordinary transistor and turn it into MN with an Alt-click. The body shows bit 0.

1.5. Check

  1. Bit 0. The switch is off — the lamp is on: the transistor is closed, the resistor holds the point at 1. Turn the switch on — the lamp goes out: the transistor opened and pulled the point down to ground. An ordinary transistor.
  2. Double-click the MN — the body shows bit 1. Flip the switch — the lamp is always on. The transistor has "forgotten" that it is a transistor: the gate no longer decides anything.
  3. Double-click once more — bit 0, everything as in step 1. The bit is erased.
BitSwitchLamp
00on
01off
10on
11on

1.6. The fuse number

When a circuit has hundreds of such transistors, each one needs its own number — that is how the firmware file knows which bit goes where. The number is set by itself when you fold the circuit into a chip (Ctrl+G): by position, row after row. You can also set your own number by hand: select the transistor, Cmd+E, type the number.

A chip that has memory transistors inside gets a ⚙ on its body. It shows the whole map of bits, and you can load it from a .jed firmware file or save it to a file. We will do that from the next lesson on.

Stuck? Something doesn't work →