Code_ The Hidden Language of Computer Hardware and Software - Charles Petzold [70]
64 megabytes = 67,108,864 bytes = 226 bytes
128 megabytes = 134,217,728 bytes = 227 bytes
256 megabytes = 268,435,456 bytes = 228 bytes
512 megabytes = 536,870,912 bytes = 229 bytes
1,024 megabytes = 1,073,741,824 bytes = 230 bytes ≈ 109 bytes
The Greek work gigas means giant, so 1024 megabytes are called a gigabyte, which is abbreviated GB.
Similarly, a terabyte (teras means monster) equals 240 bytes (approximately 1012) or 1,099,511,627,776 bytes. Terabyte is abbreviated TB.
A kilobyte is approximately a thousand bytes, a megabyte is approximately a million bytes, a gigabyte is approximately a billion bytes, and a terabyte is approximately a trillion bytes.
Ascending into regions that few have traveled, a petabyte equals 250 bytes or 1,125,899,906,842,624 bytes, which is approximately 1015 or a quadrillion. An exabyte equals 260 bytes or 1,152,921,504,606,846,976 bytes, approximately 1018 or a quintillion.
Just to provide you with a little grounding here, home computers purchased at the time this book was written (1999) commonly have 32 MB or 64 MB or sometimes 128 MB of random access memory. (And don't get too confused just yet—I haven't mentioned anything about hard drives; I'm talking only about RAM.) That's 33,554,432 bytes or 67,108,864 bytes or 134,217,728 bytes.
People, of course, speak in shorthand. Somebody who has 65,536 bytes of memory will say, "I have 64K (and I'm a visitor from the year 1980)." Somebody who has 33,554,432 bytes will say, "I have 32 megs." That rare person who has 1,073,741,824 bytes of memory will say, "I've got a gig (and I'm not talking music)."
Sometimes people will refer to kilobits or megabits (notice bits rather than bytes), but this is rare. Almost always when people talk about memory, they're talking number of bytes, not bits. (Of course, to convert bytes to bits, multiply by 8.) Usually when kilobits or megabits come up in conversation, it will be in connection with data being transmitted over a wire and will occur in such phrases as "kilobits per second" or "megabits per second." For example, a 56K modem refers to 56 kilobits per second, not kilobytes.
Now that we know how to construct RAM in any array size we want, let's not get too out of control. For now, let's simply assume that we have assembled 65,536 bytes of memory:
Why 64 KB? Why not 32 KB or 128 KB? Because 65,536 is a nice round number. It's 216. This RAM array has a 16-bit address. In other words, the address is 2 bytes exactly. In hexadecimal, the address ranges from 0000h through FFFFh.
As I implied earlier, 64 KB was a common amount of memory in personal computers purchased around 1980, although it wasn't constructed from telegraph relays. But could you really build such a thing using relays? I trust you won't consider it. Our design requires nine relays for each bit of memory, so the total 64K x 8 RAM array requires almost 5 million of them!
It will be advantageous for us to have a control panel that lets us manage all this memory—to write values into memory or examine them. Such a control panel has 16 switches to indicate an address, 8 switches to define an 8-bit value that we want to write into memory, another switch for the Write signal itself, and 8 lightbulbs to display a particular 8-bit value, as shown on the following page.
All the switches are shown in their off (0) positions. I've also included a switch labeled Takeover. The purpose of this switch is to let other circuits use the same memory that the control panel is connected to. When the switch is set to 0 (as shown), the rest of the switches on the control panel don't do anything. When the switch is set to 1, however, the control panel has exclusive control over the memory.
This is a job for a bunch of 2-to-1 Selectors. In fact, we need 25 of them—16 for the Address signals, 8 for the Data input switches, and another for the Write switch. Here's the circuit:
When the Takeover switch is open (as shown), the Address, Data input, and Write inputs to the 64K x 8 RAM array come from external signals shown at the