Welcome back to the Digilent Blog!
Computers have several difference ways of keeping track of the information that it is given. Most people in the world, which included myself until recently, might think there are only two kinds of memory: the “random access memory” (RAM) that computers have, and the flash memory that you can put on a thumb drive and carry around in your backpack without an issue. However, despite knowing that these two types of memory are not the whole picture, it was my personal experience that trying to learn more usually resulted in my eyes instantly glazing over; this is rather unhelpful in terms of actually learning something. Keeping this in mind, we’re going to do a broad overview of the different types of RAM, hopefully without the glazing over effect.
The idea behind RAM is that you can access some part of the memory in the same amount of time that it takes you to access a different location in the memory. Thus, you can access all of the memory in a random order and not observe a slower overall access time than getting the memory in a different order. What we will be focusing on are the two main types of RAM: dynamic random access memory (DRAM) and static random access memory (SRAM).
Both of these types of memory are volatile. This means that if they are disconnected from a power source, whatever information that they had in storage will eventually be lost. For SRAM this memory loss happens more or less instantaneously and for DRAM the memory will be lost within a few seconds. The source of the difference in memory loss for these two types, as well as all of the other difference between them, is because of how they are internally structured.
Most memory today is available in a Gigabyte (GiB) form. This means that in 16 GiB of RAM there are over 16 billion bytes, with each byte broken up into 8 individual bits. It is these individual bits where the memory is stored inside a small circuit. For DRAM, each of these circuits consist of just one transistor and one capacitor. The charge that is stored inside the capacitor is what determines if that bit of memory is a ‘0’ or ‘1’ in binary. These capacitors are what make this RAM dynamic.
By nature, capacitors are always slowly losing some of their charge. Because it would be incredibly awkward to lose information simply because it (literally) leaked out, a timer circuit incorporated into the chip refreshes the DRAM every so often, using external resources to bring the each of the capacitors back to their fully charged (or not charged if they didn’t have any before) state. It is this property of the capacitors holding charge and slowly leaking that allows any information that they were storing to still potentially be available for a few seconds after the power to the memory bank shuts off.
On the other hand, each of the circuits that make up an individual bit for SRAM never need to be refreshed. The circuits in a bit of SRAM consisting of 6 MOSFETs arranged in what is called a flip-flop, which will easily maintain the correct charged or uncharged state for the entire time that the memory chip is connected to a source of power. With the fact that SRAM does not need to be refreshed, and thus is available for access all of the time, it is also generally faster than DRAM.
Unfortunately, there is a drawback to SRAM and the reason why the RAM in your computer is DRAM instead of SRAM. SRAM simply costs more with its 6 required components as opposed to DRAM’s 2 required components. It even costs enough more that, at least as far as I am aware, there are no commercially available computers that use SRAM instead of DRAM as their “RAM”; manufacturers simply don’t make them.
But let’s bring this focus to Digilent boards. System boards like the Basys™ 3 only use flash memory, which is slower than RAM, but for all practical purposes will never lose the information stored in it (yay flash drives!). Other Digilent boards make use of multiple types of memory. For example, chipKIT™ boards use both flash memory and SRAM. The ZYBO board uses both flash and DDR3 memory whereas the Nexys™ 4 utilizes flash and CellularRAM®. This brings up an important question: what is CellularRAM® and DDR3?
CellularRAM® is a type of pseudo-static RAM (PSRAM) developed by Micron®. While technically still DRAM, CellularRAM® incorporates both the timer and refresh circuitry into DRAM so that it is able to refresh the charges on its capacitors by itself without any external circuitry (although as RAM it still needs a source of power). However, this internal refresh allows the main processor to treat this RAM as pseudo-SRAM because as far as the processor is concerned, CellularRAM is always available to read or write to.
DDR3 on the other hand, is the third generation of double-date rate synchronous DRAM (DDR SDRAM). Switching back to plain English, this means it is a type of DRAM that uses a clock signal (the synchronous part of the name) to control the rate at which information is read from (or written to) the memory chip. The special thing about DDR is how it transfers data with the I/O clock signal from the system board. With most components, such as shift registers, data is only transferred on one of the clock edges: the rising or the falling edge. DDR uses a type of technology called “double pumping”. This means that it transfers data on both the rising edge and the falling edge of a clock signal, allowing for twice the amount of data to be transferred at a certain rate than something that only transfers data on a single clock edge. The third generation of DDR has a larger “pre-fetch buffer” allowing it collect more data from memory before transferring it to the main computer, effectively increasing the data transfer to 8 times that of single word transfer per clock cycle.
With this much capacity for data transfer, along with the advent of DDR4 which is able to transfer 8 chunks of data at even a faster rate than DDR3, SDRAM is able to transfer data at rates comparable to that of static RAM. So why use SRAM at all if DRAM is cheaper and nearly as fast? That reason comes from the power consumption of the two types of RAM. Because DRAM needs to be constantly refreshing the charge on its capacitors, it will draw a lot of power just to keep itself working, whereas if you’re using SRAM which never needs to refresh, its power draw can be almost next to nothing. For boards like the chipKIT™ boards which are only rated to use approximately 1A, SRAM with it’s low power consumption is almost necessary over DRAM.
Please feel free to give us a comment if you have any questions!
I think the important difference between SRAM and DRAM slightly mentioned in this post is random access time. SRAM responds immediately after providing address to any location (in the next cycle). SDRAM not necessarily. For the first data a couple of cycles pass before transfer, hence burst mode is provided which allows that the next data in order, if need, are transferred without latency.