Electric Dreams and Coffee - Part 1


Ever wondered how 0s and 1s transition to Netflix ? That’s cliche intro but the article is all about starting from scratch , and when i say scratch i mean from the dark corners of logic gates all the way through CPUs and modern GPUs just to end up talking about why we have not reached full potential even though all your dating apps load in a flash together ( multi-sourcing , am i right ? ) and Red Dead Redemption is super fast without overheating your device.
This article is an beginner version of the "From the Transistor to the Web" and "Nand2Tetris" courses. I will do my best to explain the concepts in detail but without getting too complex and have demo and source codes linked through every step of the journey.
The cover image for the article is an EUV Lithography machine, one of the most advanced tools ever created. It can manipulate small wavelengths of light into precise points for printing silicon chips with incredibly tiny details at the nanoscale. It's amazing to think that we started with the Analytical Engine and now have systems like this.
Technology has progressed so far and any development that happens is on top of what our predecessors have defined for us. Business, Governments and Individuals are driven to continuously push the borders of what we can achieve and strive towards success.
In a world where software is being pushed to maximum optimization and development of AI is moving close to metal and where conversations revolve around the gallons of water required or kilowatts generated for training and inference , the need to understand the transition and interconnection from bare-metal to softwares is important and that is the goal of this article.
While most people today work at a higher, more abstract level —(e.g., Python, neural networks, web development), studying from the basics gives you
1. Basic Computer Fundamentals of How Things Work
2. Control Over Hardware and learning where optimisation is required.
It’s like learning scales of a guitar. You can play songs without knowing scales and you can write code without knowing how internally everything works.
But if you do learn the fundamentals, you gain real control and creative freedom , plus it’s fun.
Transistors
We started off with vacuum tubes for amplifying and acting as electronic switches. Wait..What ?
Initially for long range radio communications, vacuum tubes were used to amplify signals but engineers soon realized: the ability to control electron flow with a small voltage (on the control grid) could also be used to turn current fully ON or OFF.
Transistors do the same by fixing all the flaws of vacuum tubes which was large , fragile and hot. Fun fact! ENIAC ( world’s first general purpose computer ) had technicians changing the vacuum tubes daily as several tubes burned out almost every day, leaving ENIAC nonfunctional about half the time. Wikipedia states the longest operational time was 116 hours without failure. Imagine if Instagram fails every 5 days as they had to replace vacuum tubes?
Transistors serve two key roles: as switches that direct signals along different paths, and as amplifiers that boost weak signals into stronger ones. These functions are fundamental to making your devices work. The easiest example of an amplifier is the electric guitar’s amp which takes in these small vibrations and amplifies it to loud rock concerts.
To know about transistors, you need to learn about some materials.
Imagine two materials, a positive (p-type) and a negative (n-type), and when they are together, they form a border (p-n junction) that controls the flow of electricity. If you connect a battery the right way, electricity flows (forward bias), and if you connect it the wrong way (reverse bias), it won't flow.
How does this happen?
To know that we need to know about these materials. To develop these materials ( I promise , i will not bring up the periodic table to explain ) , we take pure silicon and add Phosphorus or Boron .
Phosphorous has extra 1 electron compared to silicon and is free to move and makes the material negatively charged ( n-doped) and Boron does the opposite with 1 less electron where electrons from nearby silicon try to jump in to fill the hole ( p-doped ).
When n-doped and p-doped materials meet, electrons and holes cancel each other out and no charge flows unless we mess with it using voltage.
When we connect positive side of our battery to p-side and negative to n-side, the depletion layer shrinks , allowing electrons to flow , and if you flip the charges, then the depletion layer widens and electrons cannot move.
A BJT Transistor is like a sandwich of N and P types or called NPN.
N = Negative stuff (extra electrons)
P = Positive stuff (holes)
N = More Negative stuff
So you have:
[N-layer] — [P-layer] — [N-layer]
These three layers are called:
Emitter (E) → first N
Base (B) → the thin P in the middle
Collector (C) → second N
How does the flow work?
A small current is passed to the base, turning on a larger current between the other two pins.
Connect positive to the Collector (C) and negative to the Emitter (E).
Add a small current to the Base (P) to forward bias the P-N from Base to Emitter.
The base is thin, so electrons do not stay and flow to the Collector.
This creates a larger P-N current flow from Emitter to Collector.
With a small signal, a large current flow occurs.
In computers , PMOS and NMOS transistors are used, both function to form logic gates, which are the basic blocks of computers.
We will deep dive into logic gates , integrated circuits , FPGAs and LUTs in the next session while trying to get our hands on hardware simulators and have some experiments.
Subscribe to my newsletter
Read articles from Abhishek A.B. directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by