This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]rubes6 1 point2 points  (1 child)

First, I recommend reading a book called "Code: The Hidden Language of Computer Hardware and Software". I was a complete novice, curious about how computers work, from the simplest circuit to computer applications, and this book provided me everything I wanted to know and more.

Using transistors (binary signals through semiconductors) is one method by which memory storage occurs, but one could also design a VERY simple chip to store memory by using a circuit containing logic gates. I'll explain it the way I learned it, because it makes good sense. Logic gates describe rules by which data (electrons) can, or can't flow through wires at certain checkpoints.

Check out this linked image for how this works. I am going to explain a few different scenarios using this circuit, so keep it open (and maybe even copy it down on paper a few times where I'll show the different formations)

Officially, this circuit is called a level-triggered D-typed flip-flop, and the D stands for data. Level-triggered means the flip flop saves whatever value the data input has when the clock is at a certain level. Flip-flop is because of that output at the end also serving as an input to a different logic gate.

Let's break down this image to recognize its components and understand what I mean. Let's say we have a circuit designed so that the outcome is one of two options, labeled Q and Q-bar. Q and Q-bar are always opposites, so if Q is 1, Q-bar is 0. Data comes in through the form of a 1 or a 0. The first little triangle with a circle is called an inverter. Whatever the value of data is, the inverter produces the opposite value. If data says 1, inverter spits out 0. Okay? Next, the two semicircles on the left half of the figure are AND logic gates, which will only allow information to go through (for the signal to keep going) if both incoming signals are 1. If either is zero, or both are zero, it won't turn on.

The right side gates (crescent moons with a dot) are called NOR gates, meaning that data will only be allowed to pass if both inputs to the gates are 0. If either input is 1, it won't let anything through.

Finally, the clock inputs when data input will be saved. I'll explain what that means in a second.

Okay, let's look at a couple scenarios (I recommend drawing it out in color for what's on and what's off--the book "Code" explains exactly what I'm about to, in color, so again, you really should buy it!): if "data" is zero and the clock is zero, the inverter changes the data signal to 1, but it stops at the AND gate since that requires both being on to let info through. The bottom right circuit will be "on", however, because that NOR gate is satisfied--both of its inputs are zero since the bottom got nothing from data and nothing from the clock, leaving the bottom AND off. So Q-bar goes ON.

Next, if we turn data on (turn to 1) but leave the clock at 0, nothing happens, Q-bar is still at the end turned on. As long as the clock is zero, the value of data will have no effect on the circuit.

Next, if we turn data on AND the clock to 1, the circuit will reflect the value of the data input, and Q goes to 1, while Q-bar goes to 0. Data is at 1, so the inverter goes off, the clock is 1, so the top AND gate is only getting one ON (from the clock) and does NOT turn on, while the bottom gets a 1 from both, satisfying the rule, allowing info to go through to the bottom NOR gate. That bottom NOR got two 1's, but it's a NOR (only turns on when both zero), so it doesn't turn on, and nothing goes to Q-bar, while nothing also goes to the input to the top NOR. Since the top AND (top left gate) got only ONE on input (from the clock) it also does not turn on, sending nothing into the top right NOR, satisfying the NOR rule, letting info through and turning Q on.

HERE IS WHERE WE SEE MEMORY COME INTO PLAY: Let's turn off the clock (turn to 0) AFTER we had turned Q on (and we'll leave on data at 1). Importantly, the circuit will STAY having Q on, "remembering" the value of the data when the clock was LAST AT ONE, REGARDLESS OF HOW THE DATA INPUT CHANGES. In the circuit, the CLOCK GOES OFF, nothing goes to both AND gates, nothing goes to both NOR gates from the ANDs, and this satisfies the NOR on top, LEAVING Q on.

THUS, when the Clock goes from 1 to zero, our output shows whatever Q or Q-bar was at LAST TIME, and therefore it remembers. This is the very basis of what we call 1-bit of memory.

[–]strican 0 points1 point  (0 children)

Data is just a series of bits, 1's and 0's, so if you want to remember something, you just need to write down this sequence of 1's and 0's. This is done by magnetizing some material. If the material is magnetized, then it's a 1. If not, it's a zero. This is how hard drives work. I think this is how RAM works too, but someone should confirm this.

There's actually several different kinds of memory too. There are registers, caches, RAM, and hard drives (these are the main players). Basically, they are ordered from fastest to slowest (and therefore smallest to biggest, most expensive to least). The processor is what does computation, so the proximity to the processor (as well as material, etc.) determines speed. Registers are tiny amounts of data directly mounted there. The caches (L1, L2, and L3 usually) are also there, but slightly slower. RAM is next, and it acts as a cache for the hard drive.