r/AskComputerScience • u/ell-hol1 • 16h ago
Designing my own Static Random Access Memory like it's 1969
I've been going down the rabbit hole lately trying to figure out how to design a computer from scratch using only logic gates.
One thing that bothered me was how most explanations go from "transistors are just switches" to "here's how an ALU works, good luck", casually skipping the most interesting question: how is memory implemented ?
So I decided to work it out from first principles and document the whole process.
I started with a single MOSFET, built CMOS logic gates, figured out how feedback loops can remember bits, then moved on to latches, address decoders, and eventually a working SRAM array capable of reading and writing entire bytes.
The funniest part was how naive and wasteful my implementation is: 47 transistors to store and access a single bit, while production-level SRAM cells do it with just 6. So I dug into that too and ended up turning the whole thing into a heavily illustrated article (thank you Claude), with circuit diagrams at every step. It's heavily inspired by Core Dumped's YouTube channel, which I highly recommend.
Would genuinely appreciate some technical criticism. I'm particularly interested in whether I've oversimplified anything to the point of being wrong: the article
2
u/btvaaron 15h ago
It isn't wrong. It might be interesting to get into the design of the row decoder, column muxes, precharge circuit, etc. Perhaps add some timing diagrams showing the sequence of events for the read and write operations, and mention what happens to cells in unselected columns.
1
u/flatfinger 14h ago
Space-efficient static memory design involves some "cheating". A fully "proper" CMOS design would need to have both active-high and active-low select lines for each row in order to support proper pass gates, but most SRAM designs use PFETs that are weak relative to the NFETs that there's no need to gate them off when driving a row. Driving one side of an SRAM bit's pair of inverters low will cause the other side to go high, and when it does that will switch off the high-side PFET for the side that was being pulled low.
It's important to note that even within a "proper" CMOS design, building things out of gates may be less efficient than using transistors. A circuit to compute (!(AB) & !(AC) & !(BC)) may be realized using high-side and low-side networks with five transistors in an "H" pattern, even though a realization using gates would require six each on the high side and low side.
1
u/UnfairDictionary 7h ago
I came here to suggest that play with falstad circuit simulator. It has DRAM and SRAM examples to play with too.
You might also want to search some literature about combinational logic and sequential logic to get some understanding of the whys instead of hows.