r/AskComputerScience • u/Heavy-Suggestion3464 • Jul 04 '21
How does a computer's software interact with transistors to use them as switches?
If I type an A on my computer screen, there's a row of transistors somewhere in my computer's system that represents the binary 01000001. What exactly is switching the state on these transistors?
Every time I Google about this, only explanations on how a transistor works come up.
33
Upvotes
4
u/khedoros Jul 04 '21
The states of the transistors that act as inputs to those ones :-P In the case of the keyboard, you closed a switch when you pressed the "A" key, and it set off a cascade of changes through a series of combinatorial and sequential logic circuits.
Computers can be viewed from a lot of levels of abstraction. Near the bottom, quantum physics, near the top, behavior of a software program. Just above the transistor level, we've got logic gates, which are each built out of a handful of transistors. The rest of what I'll say will be at about the level of those gates, and the circuits that they make when combined. The basic gates are "AND", "OR", and "NOT". "AND" outputs 1 if all of its inputs are 1, and 0 otherwise. "OR" outputs 1 if any of its inputs are 1. "NOT" outputs the opposite of its input.
Conceptually, these gates can be combined into more complicated gates, like NAND ("Not-AND", outputs the opposite of what an "AND" gate would), NOR ("Not-OR"), XOR (eXclusive-OR, outputs 1 if a single input is 1, but 0 otherwise). How these are actually implemented in transistors is often not literally "AND gate connected to a NOT gate", which is why I said "conceptually".
There are standard logic circuits, like multiplexers and demultiplexers (which help route data), adders (and implementations of other arithmetic and logical functions), flip-flops (which implement memory in silicon), etc. These are arranged into larger components that might do something like "Wait for input to transition from 0 to 1 on a specific wire, then send the data from these 8 wires to 1 of 4 possible places, depending on the inputs from the first 2 of those 8 wires". Those 4 locations might each have different functions that they perform on the lower 6 bits of data, or something.