EEPROM

RAM disappears when there is no power, but we do want to have memory that we could use when the computer is turned on. There are many kinds of persisted memory and they vary greatly in speed, from music records to NVRAM chips that can rival RAM speed (NVRAM means Non Volatile Random Access Memory).

For our 4-bit computer, we will use AT28C64 EEPROM, which is quite big - it has 64KB of memory, out of which we will just use a few bytes, but it is quite cheap. I wanted to use AT28C16 but couldn't find it in stock.

https://ww1.microchip.com/downloads/en/DeviceDoc/doc0270.pdf

ROM is Read Only Memory. EEPROM stands for Electrically Erasable Programmable Read-Only Memory, meaning you cannot write to it - in EEPROM's case, you need a special process in order to change it.

It is clear why we would want non-volatile memory - we want to store our bits when the computer is off, but the real question is why do you need read-only memory?

And by read-only, I mean really READ ONLY.

https://www.thebattles.net/wang4000/

This is an example of diode ROM - you can configure it by putting diodes on particular bits. If you want to change it you have to get a soldering iron, desolder existing diodes and solder new ones, to configure new bit configuration. Can you imagine? If you make a mistake, and there are hundreds of diodes. You better pay attention.

So again, why would you want memory that you don't want to change? Imagine we want to create a doubling machine: whatever number you enter, we want to double it. You know how to do that now - we can get 1 register, put the number in there, then feed it through the ALU and get the result in another register. This would mean setting the ALU S wires to 1001 so that it knows to do A + B. Now, we can produce everything in the same way, but we can turn that machine into a subtraction machine if we just change the S wires to 0110 in order to do A - B. So having a flexible part of the machine that with minimal change we can make it do something else is very powerful - not only in the production process but also for us to make more generic machines.

You can even see on this Diode ROM that they have changed it many times - you can see the leftover solder in the holes from where the previous bits were set.

PROMs are Programmable ROMs. There are many kinds - some need to be erased with high-energy photons (ultraviolet), some are erased with a chemical process, but EEPROMs are cool because you can erase them with an electric process. So there is a special sequence of operations you need to do in order to reprogram the EEPROM.

We can make an EEPROM programmer using our rPI Pico. But there are also off-the- shelf programmers you can buy.

This is how the EEPROM looks like. Inside of it, it has something called floating gate transistors, and it is an ingenious way to trap electric charge in it. So if we set a cell to 1, we can keep reading 1, but in order to set it, we need to apply higher voltage. We are literally trapping electrons inside.

EEPROMs have limited write cycles, usually between 10,000 and 100,000 times. You can see that in the datasheet of the EEPROM you are using. The reason for the limited write cycles is that there is damage when we have to release the electrons to go free so that we can write a new value.

Modern computers don't use EEPROMs as much, but they use Flash storage. It also uses floating gate transistors, but in more complicated structures, and they have different write cycles and also do not need to be reprogrammed with higher voltage. And some chips like Espressif's ESP32C3 use a Mask ROM, which is more like the Diode ROM - it is built into the chip during manufacturing, and it can not be modified unless they produce a new chip.