Okay, you may be feeling a little disillusioned so far. So far we have started to get to a point where we can design functions, and even design circuits and actually build devices, that will tell you when some conditions are true or false. But you may think that this is not terribly interested in so far. We haven't even made a computer that will add anything.
Quite true. So, I'm going to tell you how to get a computer to add something.
The thing is, before we do that, I have to teach you binary arithmetic. I probably have to teach you that, because you probably weren't paying attention when they taught you, back in grade 5, how to do arithmetic in base 7, or base 8.
Now you do know how to do arithmetic in base 10. That's because we do all of our arithmetic, and mathematics involving numbers, in base 10. All of our numbers are written in base 10. Your house address is written in base 10, your numbered streets in the city are written in base 10, the bill for your groceries, or your lunch at a fast food place, or a bill from a big box store that sells you all kinds of junk, are all written in base 10.
So you know that the digit that is farthest to the right on a number is the number of ones that you have. And the second closest to the right is the number of tens. And the third closest to the right is the number of hundreds.
The thing is, computers don't know anything, yet, about tens or hundreds or any of those bigger numbers. All that computers know, to begin with, is ones and zeros. So, we have to start structuring our numbers so that the computers can do something with them.
That means we have to do it in base 2, where everything is just a one or a zero.
It's hard to cover all of these topics about how computers actually work without jumping from one topic to another, so I'm going to have to briefly talk about structuring data. (Don't worry, this is going to require memory, but I'm going to request I'm going to talk about memory in a bit.)
You've heard about bits and bytes. A bit is the smallest unit of memory. It is either a one or a zero. A byte is a group of eight bits. Now there are other groups of other numbers of bits, but let's just deal with bytes for now. So if we have a byte, a group of eight bits, and we are going to put a number into it, we can put a number up to a total of 255 (in terms of decimal notation, that is our normal base 10), into that bite. And we can do it like this.
binary arithmetic
128s 64s 32s 16s 8s 4s 2s 1splace place place place place place place place place0 0 0 0 0 0 0 1 0 = 20 0 0 0 0 0 1 0 1 = 50 0 0 0 1 0 1 0 0 = 200 0 1 0 1 0 0 0 1 = 8100000010 = 200000101 = 500010100 = 2001010001 - 81
So now we can start storing numbers.
But, in order to figure out how we can do arithmetic with them, we're going to have to go back to bits. Our inputs, to individual gates or circuits, are going to be single bits. So we can learn how to add one and one, at this point, with our logic gates, and then we are going to have to extend the circuitry that we have in order to make functions that will add larger numbers.
So, let's start by adding one and one. Or 0 and 0. Or 1 and 0.
This illustration is well known to those who design computer circuitry. It is so well known that it has its own name. It is called a two-bit adder.
First of all, it has two input bits. Each of the two inputs can each be either a one or a zero. It also has two output bits. You will notice, at the top right, that there is an output from the XOR gate. You will also notice, lower on the right, that there is an output labeled C. We'll get to the C input and output a little bit later.
Now, first of all, you will notice that we have two exclusive OR gates. (I told you that they would come in handy.) We have two inputs. Each of those inputs can be either a one, or a zero. Therefore, if both inputs are one, then the result is going to be two. One plus one equals two. But, in binary arithmetic, two is going to be written 10. So the output that we want, from the circuit, in the ones place, if we are adding 1 + 1, is going to be a zero. And, from our discussion of what the different gates do, an XOR gate is going to give us that result.
So, at this point, you should be able to trace through this circuit, and see what happens when the inputs are both zero, or that one, or the other, is one, or if both of them are one. And you should be able to see that the circuits match up with the logic that we want for giving the proper arithmetic result for adding two inputs.
You should also be able, without too much trouble, to figure out what is happening with the AND gates, and with the one OR gate. Notice that some of the outputs, of some of the gates, become inputs to other gates. Again, it shouldn't be too difficult to figure out what is going on with this circuit, in terms of addition.
Now, one of the inputs, and one of the outputs, are labeled C. It should be reasonably obvious that these are "carry" bits. Let's deal with the output carry bit first. If we are adding one plus one, and getting the result two, we have already seen that the one exclusive OR gate will give us a result zero, if both the inputs are 0, and the result one, if one or other of the two inputs are one, or a zero, if both of the inputs are one. We want to get a result of two, or, in binary notation, 10. So, just like carrying when we are adding decimal numbers, we will carry a one into the twos column. And we can trace through the circuitry here, to see that one of the AND gates takes the two inputs, and if they are both one then the result, in the output carry bit, is going to be a one.
So why do we have an input carry bit? Well, as I say, this is a very standard setup for doing arithmetic and addition. But we won't always just be adding one and one. If we are going to be adding larger numbers, then we will want to have multiple adders. With this basic two-bit adder, we can place a number of these circuits side by side, and, connecting the proper carry bits in the circuits, we get an adder that will allow us to add two numbers, up to a total of 255.
OK, on to memory.
This circuit is the simplest, and also the most broadly useful, form of memory. Despite its simplicity, it is still, you can see, fairly complex. It is also not necessarily something that is used in all situations, although mostly it can be. We'll go into different types of memory in a minute.
This circuit stores one bit of information, either a one or a zero. It is known as a flip-flop, since you can flip it from one state to the other.
As I say, this is the simplest and most basic form, and, as you can see, it holds one bit of information, and so, in order to store vast amounts of information, we have to put a whole bunch of them together, and then we have to figure out which one we want to read, in order to use the information.
So, then we have to come up with addressable memory, and that makes the whole thing a bit more complex. This next diagram shows you some addressable memory. There are a number of bits involved, but there are also a number of circuits which we just used to address the memory and see which bit we want to read.
Now I want to talk about some additional types of memory. The thing is, that I'm going to have to break my promise to tell you how computers actually work. As you can see from the addressable memory, things start to get really complicated at this point. That addressable memory really only holds twelve bits of information. That's not very much, particularly when the computers that we use (or carry around in our pockets, when you're talking about cell phones), hold more than a billion times that amount of memory.
And then there's the fact that the flip flop circuit, and the addressable memory circuit, that I showed you in the illustrations, only hold information as long as the circuit is powered. As long as the computer that it is a part of is turned on. What happens when we want to store information, even when the computer is turned off?
Well, the simplest way to deal with that, is ROM. That's Read Only Memory. This is made up of electronic circuitry, but, at its most basic form, it's very simple. It's simply an addressable grid of wires, and, at each address, there is a wire that connects that point to ground. So that is a connected circuit. It's on. Therefore it's a one, or true. So, what do we do, if we want to store a zero, or a false correct, or an off?
Well, we address that particular junction in the grid (using circuitry pretty much like that in our addressable memory, above), and then we pass a higher voltage through it. That burns out the wire that is connected to the ground. That means that, once the wire is burned out, the circuit is not connected, and therefore we have a zero, or a false, or an off.
ROM used to be used to start up computers. To provide some programming, and possibly data, that would allow the computer to start up. Usually it would then have enough information to connect to external, or secondary, memory, such as a disk drive or a tape drive. This type of ROM isn't used as widely anymore. As a matter of fact, now, it's pretty rare. Other forms of static, or unchanging when powered off, memory now exist, and they are, generally speaking, more useful. So the old traditional ROM memory is probably as much of a relic of the past as old core memory.
(If you want to know about core memory, again, you can plug that into a search engine and find out more about it. It's lovely stuff, and has a really great specialty function, but you will almost never encounter it, so I'm not going to cover it in detail here.)
The next step along the memory journey is PROM. PROM is Programmable Read Only Memory. Instead of having a grid, and blowing out the circuits that we don't want, you could actually program the read-only memory that you needed to start up a computer. It had a different technology, and wasn't simply blowing out wires, but, in functional terms, there wasn't much difference between ROM and PROM.
Then we got to EPROM. EPROM was Erasable Programmable Read Only Memory. EPROM chips were chips you could visually identify as distinct from PROM chips, since they had a clear window, usually circular, through which you could actually see the memory chip inside. This was because the erasable part was done by ultraviolet light. People could use EPROM, and then, if they wanted to change it, they could expose it to ultraviolet light, sometimes by shining a bright ultraviolet light through the window for a few minutes, or sometimes simply by putting it on the window sill, and leaving it in the sun for hours or days, and then doing the new programming.
(EPROM was discovered by accident. It was initially thought to be something you had to guard against when you were designing and making chips. Generally you make integrated circuits on chips by putting down layers of silicon which have different types of contaminants in them, which is known as doping. It was found that certain combinations of layers on a chip, when you passed a slightly higher than normal voltage through them, would trap electrons, and change the threshold voltage for their operation. As I say, initially they thought that this was a problem to be avoided, but then it was realised that this change could be made to store information. Ultraviolet light erases the change, because UV photons create channels that will release the trapped electrons.)
(Sometimes you wouldn't see the round window on the chip, but a round sticker. The sticker was there to make sure that no additional light accidentally erased the programming. The inside of a computer is generally pretty dark, but there are gaps and openings for fans and vents, so they just wanted to make sure make extra sure that no ultraviolet light could get in and kill your programming.)
But that was still too difficult for hardcore programmers, who wanted everything, absolutely everything, done via the computer, and didn't like this business of having to shine ultraviolet light into windows on the chip. That's why they were happy for the invention of EEPROM. EEPROM is Electrically Erasable Programmable Read Only Memory. This is probably what is in use today for read only memory. You can program, and reprogram, your read-only memory, directly at the computer. You don't need to physically take the ROM chip out and do anything to it.
Unfortunately, this takes away some of the safety of computers. One of the things that you do not want anyone to be able to do, is to reprogram your read-only memory, and reprogram it with some kind of malicious software. With ROM, you simply couldn't do that. Even with EPROM, you couldn't do it without physically taking the chip out of the computer, and erasing the programming, and then reprogramming it. However, with EEPROM, the bad guys can, in fact, trick you into running something on your computer, which then means that, every time you turn your computer on, it's reporting to them, and they can, if they wish, take control of your computer.
But all of that is simply forms of read-only memory. You have at least two forms of memory in your computer. One is ROM. The other is RAM. That acronym stands for Random Access Memory. Random access memory is the actual working memory in your computer. Random access means that we can put information into, and take information out of, any location within your memory. This is the fast form of memory, and it is what computers use to actually do the work that they need to do. Store the programs. Store the data. Do the processing of the data. This is the working memory.
There are two types of RAM. There is static RAM. Static RAM holds the information, as long as the computer is turned on. Static RAM is, generally, made up of circuits like the flip flop and the addressable memory that we showed you in the illustrations earlier.
There is another type of RAM, known as dynamic RAM. This type of RAM uses slightly different electrical circuitry. It is faster to access, and it is a lot cheaper to produce. So, when you want a lot of working memory, you usually use dynamic RAM. The thing is that dynamic RAM is slightly unstable. Well, in fact, more than slightly unstable. Dynamic RAM will only hold information in memory for about a thousandth of a second. However, there are two fortunate facts to help us out here. The first is that dynamic RAM can be refreshed if, within that thousandth of a second, you read the memory. And a thousandth of a second, in a modern computer, is, relatively speaking, forever. It's easy enough to make sure that you can read it and refresh it well within that thousandth of a second limit regularly, particularly since dynamic RAM can be read in large chunks at a time.
But all of the foregoing is in regard to the working, or primary, memory in the computer. An awful lot of the information that we want to have on a computer, we are willing to have relatively accessible, but not necessarily immediately in the working memory of the computer at all times. For this we use what is known as secondary, or external, memory or storage. For this we use magnetic tape, or discs which have the same type of magnetic coating on them, or plastic discs which have a thin layer of foil in the middle, which we can dimple, or angle, or burn, or fold in such a way that we can read it as a one or a zero. Sometimes we also have different types of memory, which, by using slightly different circuitry and technology, will hold the information even when they're off. Those we tend to refer to as solid state drives or solid state devices: SSDs. Much of the memory in your cell phone is probably of the SSD type. The jump drives, or thumb drives, that you used to transfer information between computers or carry around in your pocket, use similar types of SSD circuitry to hold that information, even when they're not connected to anything.
Introduction and ToC: https://fibrecookery.blogspot.com/2025/12/how-computers-work-from-ground-up.html
Next: TBA


