# CS152 Lecture 1: Intro Early Machines ### Section 1: Abstraction Layers, Compatibility, and the Role of Computer Architecture An electronic application—such as a compass app on a smartphone—ultimately relies on physical phenomena like electron transport in silicon transistors and magnetic fields measured by a sensor. Bridging the gap directly from high-level software to raw physics in a single design step is impossible for any system of real complexity. Only the simplest fixed-function artifacts, such as a magnetized needle floating in a physical compass, map an application directly onto physics. Computer architecture exists to solve this complexity problem. In its broadest definition, **computer architecture is the design of the abstraction layers that allow us to implement information processing applications efficiently using available manufacturing technologies**. Rather than reasoning about billions of transistors every time we write a function, or reasoning about user interfaces every time we fabricate a silicon wafer, we organize modern computing systems into a vertical stack of ten abstraction layers: * **Application** (the problem the user wants to solve) * **Algorithm** (the step-by-step mathematical procedure) * **Programming Language** (human-readable syntax expressing the algorithm) * **Operating System / Virtual Machines** (resource management, scheduling, and isolation) * **Instruction Set Architecture (ISA)** (the formal interface specifying registers, memory, and machine instructions) * **Microarchitecture** (the hardware organization—control and datapath—that implements the ISA) * **Gates / Register-Transfer Level (RTL)** (Boolean logic gates, flip-flops, and data movement per clock cycle) * **Circuits** (transistor-level analog and digital networks—recall your circuit analysis of RC delays and CMOS inverters) * **Devices** (individual transistors, capacitors, and interconnects) * **Physics** (semiconductor bandgaps, electrostatics, and quantum mechanics) Our focus sits directly at the boundary where hardware meets software: the **ISA** and **Microarchitecture** layers, along with how they map down to **Gates/RTL**—where a hardware description written at the RTL level is compiled either into **FPGA emulation** bitstreams for fast hardware prototyping or through **ASIC synthesis tools** into a **GDS layout** for fabricating real silicon. This abstraction stack is constantly evolving because **applications** and **technology** form a closed feedback loop. Applications suggest how to improve technology and generate the revenue to fund hardware development; in turn, improved technologies make entirely new applications possible. However, this cycle is constrained by a heavy counterweight: **compatibility**. Because developing software is enormously expensive, users and companies refuse to rewrite their software every time a faster chip appears. Compatibility forces the ISA boundary to remain stable even as the underlying microarchitecture and transistor physics transform completely. You might think that once engineers know how to compile RTL down to silicon, making faster computers is simply a matter of shrinking transistors and turning up the clock. That assumption breaks down as soon as we examine the physical and economic limits governing modern silicon. *[Editor Note: removed course logistics, grading/staff details, Chisel/Chipyard lab tooling flow, Hinton/Patterson DNN quotes, and book-recommendation asides.]* #### ✎ Check Your Understanding 1. **Fill in the blank:** In the computing abstraction stack, the two layers that sit directly at the boundary where hardware meets software are the ________ and the ________. **Answer:** Instruction Set Architecture (ISA) and Microarchitecture. The ISA defines the software-visible contract, while the microarchitecture is the hardware organization implementing that contract. 2. **What would happen if** every new processor generation changed its Instruction Set Architecture (ISA) to match new transistor physics? **Answer:** Software compatibility would break, forcing programmers to rewrite or recompile existing software at prohibitive cost, which acts as a major barrier in the market. --- ### Section 2: Technology Scaling, Moore's Law, and the Modern Architectural Upheaval Why did hardware get exponentially faster for over a century, and why has that trend recently fractured? Plotting computing capability on a logarithmic vertical axis of *Calculations per Second per $1,000* from $10^{-6}$ in 1900 to $10^{10}$ in 2000 reveals five distinct technology generations marching upward along a nearly smooth curve: **Electromechanical** calculators, **Relays**, **Vacuum Tubes**, discrete **Transistors** (Bipolar), and **Integrated Circuits** (progressing through pMOS, nMOS, and **CMOS**). Each time an older switch technology hit its physical or economic ceiling, a new physical substrate replaced it. During the integrated circuit era, this progression became famous as **Moore's Law**, and at its core, Moore's Law was driven by manufacturing economics, not physics alone. Consider two classic plots from Gordon Moore's original paper: * The first graphs **Relative Manufacturing Cost per Component** (log scale) against **Number of Components per Integrated Circuit** (log scale) for 1962, 1965, and 1970. Each year forms a U-shaped curve: putting too few transistors on a chip wastes fixed wafer and packaging overhead, while putting too many causes manufacturing defects to destroy yield, driving cost per working component back up. Better lithography shifted the minimum of that U-shaped valley down and to the right—making far denser chips cheaper per transistor. * The second graphs $\log_2(\text{Number of Components per Integrated Function})$ versus **Year** from 1959 to 1975. Because the vertical axis is base-2 logarithmic, the straight line represents exponential doubling (roughly every 18–24 months). For fifty years, this transistor scaling gave software developers a "free lunch": without rewriting sequential code, shrinking transistors yielded faster clock speeds and richer single-core microarchitectures. Yet a plot of **40 Years of Single-Thread Processor Performance** (relative to the 1978 VAX-11/780 on a log scale from $1$ to $100,000$) shows growth fracturing into five regimes: * **1978–1986:** ~22% per year * **1986–2003:** ~52% per year (the golden age of CMOS scaling and single-core microarchitecture) * **2003–2010:** ~23% per year * **2010–2015:** ~9.3% per year * **2015 onward:** ~2.5% per year (near stagnation) A companion plot tracking five processor metrics from 1970 to 2020 exposes the exact causal chain behind this slowdown: * **Transistors (in thousands)** kept climbing exponentially past $10^7$ (tens of billions). * **Typical Power (Watts)** climbed until ~2005, then hit a flat ceiling near $100\text{ W}$ imposed by air-cooling limits. * **Frequency (MHz)** climbed exponentially until ~2005, then flattened permanently around $3\text{–}4\text{ GHz}$. * **Number of Logical Cores** stayed flat at $1$ until ~2005, then bent sharply upward as architects placed multiple cores on one die. * **Single-Thread Performance ($\text{SpecINT} \times 10^3$)** tracked frequency until ~2005, then bent downward into slow saturation. You might think shrinking transistors should let us keep raising clock frequency without raising power. That used to hold under **Dennard scaling**, where halving transistor dimensions allowed supply voltage $V_{DD}$ to drop proportionally, keeping power density constant. Around 2005, however, $V_{DD}$ hit a floor because lowering voltage further causes subthreshold leakage current to explode. Recall that dynamic CMOS switching power scales as: $$P = \alpha C V_{DD}^2 f$$ Here $\alpha$ is the switching activity factor, $C$ is switched capacitance, $V_{DD}$ is supply voltage, and $f$ is clock frequency. With $V_{DD}$ stuck and total chip power capped near $100\text{ W}$, raising frequency $f$ became thermally impossible. At the same time, **Amdahl's Law** caps how much adding identical cores can speed up workloads with sequential bottlenecks, **Moore's Law** (in terms of falling cost per transistor) is slowing down with no competitive CMOS replacement before ~2035, and **energy efficiency constrains everything**. Consequently, there is no more "free lunch." Modern systems must rely on **parallel systems**, **heterogeneous systems** (combining general-purpose CPUs with specialized accelerators), and **domain-specific architectures** across three major markets: * **Mobile** ($>1\text{ billion}$ units/year): ARM-based general-purpose cores inside a **System-on-a-Chip (SoC)** surrounded by custom accelerators for radio, image, video, graphics, audio, and security. * **Warehouse-Scale Computers (WSCs)** ($100,000$'s of cores per facility): x86 servers running cloud VMs and apps alongside GPUs, FPGAs, and custom hardware accelerators. * **Embedded computing**: networking infrastructure, automotive systems, consumer devices, and IoT. Because software and system value dominate, **end-system companies** (such as Apple, Google, and Tesla) increasingly follow a **vertical semiconductor business model**: rather than buying standard off-the-shelf chips, they spend well over $\$100\text{M}$ per chip to build custom SoCs and microarchitectures tailored to their products, expanding demand for architects from $O(1)$ chip vendors to $O(N)$ product companies. Comparing a year-2000 Pentium 4 die (dominated by one massive single-thread CPU core) against an Apple M3 SoC (2023) (packing 4 P-cores, 4 E-cores, 10 GPU cores, an NPU, matrix engines, caches, and I/O controllers, where a simple textbook 5-stage pipeline is just a microscopic speck) illustrates this shift visually. To understand how we design even one of those CPU cores—and why ISA design choices matter so deeply—we must trace how computing evolved from mechanical calculators to stored-program machines. *[Editor Note: removed duplicate die-shot comparison slides, blank "Good? Bad?" slide, and extended company lists.]* #### ✎ Check Your Understanding 1. **Causal reasoning:** Around 2005, transistor counts kept doubling, yet single-core clock frequency and typical chip power both flattened out. Explain why using Dennard scaling and the dynamic power equation. **Answer:** Dennard (voltage) scaling ended because $V_{DD}$ could no longer be reduced without excessive leakage current. Because $P = \alpha C V_{DD}^2 f$ and total power hit a thermal ceiling (~100 W), frequency $f$ could no longer increase. 2. **Yes or No:** Under the vertical semiconductor business model, do system companies design their own chips because chip engineering has become inexpensive? Justify your answer. **Answer:** No. Developing an advanced chip still costs well over $\$100\text{M}$, but the high profit and differentiation of the final product justify custom SoC design. --- ### Section 3: From Calculators to Stored-Program Digital Computers Core architectural ideas rarely appear out of nowhere; they evolve incrementally under physical constraints. Four historical themes govern this evolution: 1. **Core operations (Calculators $\rightarrow$ General-purpose computers):** Adding **branches** and **memory access** to pure **arithmetic**. 2. **Fixed function $\rightarrow$ Programmable $\rightarrow$ Stored program:** Moving from hardwired machines, to machines driven by external plugboards or tapes, to machines where **program and data are stored identically in memory**. 3. **Abstraction:** Hiding hardware details behind processor idioms (`PC`, instructions, data) and an ISA. 4. **Technology-influenced design choices:** Physical media dictating number bases and hardware operators. We also distinguish **analog** from **digital** computers. An **analog computer** encodes problem variables as continuous physical quantities—such as gear angles in the 100 BC Antikythera astronomical mechanism, airflow in a wind tunnel, or capacitor voltage—and uses scaled physical laws to compute (even resurfacing today for matrix multiplication via Ohm's law, $V = IR$). By contrast, **digital computers** encode numbers using **discrete steps**, providing **noise immunity**, **exact deterministic repeatability**, and freedom from being limited to physically realizable analog laws. #### Babbage's Engines and Turing's Foundation Modern digital computing begins with **Charles Babbage**, who designed two landmark mechanical machines: In 1822, Babbage designed the **Difference Engine**—the first **algorithm-hardware co-design**. Continuous functions can be approximated by polynomials, and polynomials can be evaluated via finite difference tables using **only a single adder**, avoiding expensive mechanical multipliers. Let us work through Babbage's example for the quadratic polynomial: $$f(n) = n^2 + n + 41$$ Define the first difference $d_1(n) = f(n) - f(n-1) = 2n$ and second difference $d_2(n) = d_1(n) - d_1(n-1) = 2$. Because $d_2(n) = 2$ is constant, we step forward using addition alone: $d_1(n) = d_1(n-1) + d_2(n)$ and $f(n) = f(n-1) + d_1(n)$. Starting from $f(0) = 41$, $d_1(1) = 2$, and $d_2(n) = 2$: * **$n = 1$:** $f(1) = 41 + 2 = 43$. * **$n = 2$:** $d_1(2) = 2 + 2 = 4$, then $f(2) = 43 + 4 = 47$. * **$n = 3$:** $d_1(3) = 4 + 2 = 6$, then $f(3) = 47 + 6 = 53$. * **$n = 4$:** $d_1(4) = 6 + 2 = 8$, then $f(4) = 53 + 8 = 61$. Direct check: $4^2 + 4 + 41 = 61$. Every value was generated solely by addition! (Later recreations of Babbage's improved Difference Engine No. 2 proved the design works with 19th-century technology.) In 1837, Babbage conceived the **Analytical Engine**, the **first general-purpose digital computer**. It contained every major block of a modern machine: * The **"Store"** (main memory: 1,000 40-digit decimal words, $>133$ bits of precision to avoid overflow without floating-point hardware). * The **"Mill"** (arithmetic unit for $+, \times, \div$). * **Conditional branching**, looping, overflow exceptions, and a mechanical form of microcode called the **"Barrel."** * **3-address punched cards** (inspired by the 1804 **Jacquard loom**) specifying two sources and one destination in the Store, with mechanical gear tricks like **"locking"** (mechanical gain to restore noisy motion, analogous to digital logic gain) and a fast **"anticipating" carry** (analogous to CMOS carry-propagate adders). Working from Babbage's designs, **Ada Lovelace** wrote the **first computer program** (to calculate Bernoulli numbers) and foresaw computers manipulating general symbolic patterns beyond arithmetic. In 1937, **Alan Turing** established the mathematical theory of computation with the **Turing machine** (tape, head, registers, and state transition table). Crucially, his **Universal Turing Machine** read both a machine description and input data from the same tape, introducing the **stored-program concept** and defining **Turing completeness**. #### Early Calculators vs. Stored-Program Electronic Computers During the late 1930s and 1940s, engineers built several digital machines, though it is vital not to confuse early programmable *calculators* with true general-purpose *computers*: * **Early Programmable Calculators (No Conditional Branch):** The **Atanasoff-Berry Solver (1939)** (fixed-function linear equation solver with vacuum tubes and rotating capacitor-drum dynamic memory), the **Zuse Z3 (1941)** (relay-based, normalized floating-point with $\pm\infty$/undefined handling, 2-stage pipeline, tape-programmed), and the **Harvard Mark I (1944)** (electromechanical, 2-address paper tape, loops formed by gluing tape into physical loops). Because *none* of these had conditional branching, all three were actually **less programmable than Babbage's 1837 Analytical Engine**! * **ENIAC (1946):** Built by Eckert and Mauchly, ENIAC was the **first electronic general-purpose computer**—purely electronic fetch/execution plus **conditional branching**. Its fatal bottleneck was **plugboard programming**: rewiring cables to change a program could take days. * **The Stored-Program Breakthrough (1948–1951):** To eliminate plugboard rewiring, the ENIAC team (written up by John von Neumann for **EDVAC**) proposed storing instructions inside memory alongside data. Three pioneering machines brought stored-program computing to life: * **Manchester SSEM "Baby" (1948):** Used **Williams-Kilburn CRT tubes** (the first random-access electronic storage) and ran the world's first stored program in June 1948; its successor **Mark-1** introduced **index registers**. * **Cambridge EDSAC (1949):** Built simply and reliably by Maurice Wilkes using mercury delay-line memory, two's-complement arithmetic, and **subroutines** ("Wheeler jump"), using **self-modifying code** to step through arrays. Wilkes later built **EDSAC-II (1958)** with the first **microprogrammed control unit**. * **EDVAC (1951)** and commercial successors **BINAC (1949)** and **UNIVAC (1951)** (the first widely publicized commercial computer). Once stored-program electronic machines worked reliably, designers faced a new architectural problem: how should instructions and registers be exposed to software? *[Editor Note: removed machine weights/floor-area/tube counts, patent-lawsuit history, Goldstine draft-circulation details, Lovelace biographical asides, and granular Z3/Mark I/EDSAC bit-width trivia.]* #### ✎ Check Your Understanding 1. **Quick computation:** Using Babbage's Difference Engine method for $f(n) = n^2 + n + 41$ where $d_2(n) = 2$, given $d_1(4) = 8$ and $f(4) = 61$, compute $f(5)$ using only additions. **Answer:** $d_1(5) = d_1(4) + d_2(5) = 8 + 2 = 10$, and $f(5) = f(4) + d_1(5) = 61 + 10 = 71$. 2. **Yes or No:** Were the Zuse Z3 (1941) and Harvard Mark I (1944) more programmable than Babbage's 1837 Analytical Engine? Justify your answer. **Answer:** No. Although both read sequential instructions from paper tape, neither supported conditional branching, making them less programmable than the Analytical Engine. --- ### Section 4: The Evolution of Instruction Sets and the Separation of ISA from Microarchitecture In the early 1950s, high-speed vacuum-tube circuitry was expensive, so early ISAs copied calculators: **single-address accumulator-style machines** where **ISAs were 1:1 with each individual machine** (upgrading hardware meant rewriting software). * The **IBM 701 (1952)** used Williams-Tube memory and an accumulator plus multiplier/quotient register. * The **IBM 650 (1953)**—the first mass-produced computer—kept costs low with a **magnetic drum** ($1,000$ or $2,000$ 10-digit decimal words) and a **digit-serial ALU** (a single one-digit adder feeding a 20-digit accumulator). Hardware timing bled directly into its ISA: every instruction encoded a 2-digit opcode, a 4-digit data address, and a **4-digit next instruction address**, forcing programmers to scatter instructions around the rotating drum to minimize rotational latency! Exposing drum latency and requiring self-modifying code for array indexing became unsustainable. Adding **index registers** (from the Manchester Mark-1) eliminated self-modifying array loops, and expanding index registers eventually led to **General-Purpose Registers (GPRs)**. Before GPRs dominated, Robert Barton's **Burroughs B5000 (1960)** championed **Stack Architecture**, hiding the machine behind ALGOL and using an evaluation stack for expressions and recursive calls. Let us trace `(a + b * c) / (a + d * c - e)` in **Reverse Polish (postfix) notation**: `a b c * + a d c * + e - /` * `push a`, `push b`, `push c` $\rightarrow$ Stack: `[a, b, c]` * `multiply` (`*`) pops `c` and `b`, pushes `b * c` $\rightarrow$ Stack: `[a, b * c]` * `add` (`+`) pops `b * c` and `a`, pushes `a + b * c` $\rightarrow$ Stack: `[a + b * c]` * Continuing with `push a, push d, push c, *, +, push e, -, /` completes the evaluation using zero explicit register names. #### IBM 360: Decoupling ISA from Microarchitecture By the early 1960s, IBM sold four incompatible computer families ($701 \rightarrow 7094$, $650 \rightarrow 7074$, $702 \rightarrow 7080$, $1401 \rightarrow 7010$). In 1964, Gene Amdahl, Gerrit Blaauw, and Fred Brooks unified them under **IBM System/360**. They explicitly evaluated **Stack versus GPR Organization** and chose **GPRs** for six reasons: 1. Any speed gain in a stack machine comes from **fast on-chip registers**, not from the stack discipline itself. 2. Roughly 50% of stack instructions are wasted "surfacing" buried constants and common subexpressions. 3. Short register specifiers match the instruction density of implicit stack addressing. 4. Managing finite hardware stack overflow adds complexity. 5. Recursive subroutines still require an independent addressing stack in memory. 6. Packing variable-length stack fields into fixed-width memory words is awkward. IBM 360 defined a clean **GPR architectural state**: $16$ general-purpose 32-bit registers (usable as base/index registers, with Register 0 special), $4$ floating-point 64-bit registers, a Program Status Word (PSW: PC, condition codes, flags), 24-bit computed addresses (so no instruction holds a full 24-bit address), and **8-bit bytes**, 16-bit half-words, 32-bit words, and 64-bit double-words. *(IBM 360 is the reason a byte is 8 bits today!)* Most fundamentally, IBM 360 was the **first architecture to decouple ISA from microarchitecture**: * **ISA** $\sim$ *architectural state / semantics*: the software–hardware contract (programmer-visible registers, `PC`, memory, and instruction semantics). * **Microarchitecture** $\sim$ *physical implementation of an ISA*. Because of this decoupling, IBM shipped the entry-level **Model 30** (8-bit datapath, main-store registers, microcoded read-only control store) and the high-end **Model 70** (64-bit datapath, transistor registers, hardwired control) running the exact same binary programs—a family lineage that still runs today on modern IBM z15 mainframes. *[Editor Note: removed Watson "five computers" misquote, duplicate IBM 360 slides, IBM z15 internal microarchitecture jargon, and clone anecdotes.]* #### ✎ Check Your Understanding 1. **Quick stack trace:** Starting with `[a + b * c]` on the evaluation stack, trace the stack state for the remaining Reverse Polish tokens `a d c * + e - /`. **Answer:** Pushing `a, d, c` gives `[a+b*c, a, d, c]`; `*` gives `[a+b*c, a, d*c]`; `+` gives `[a+b*c, a+d*c]`; pushing `e` gives `[a+b*c, a+d*c, e]`; `-` gives `[a+b*c, a+d*c-e]`; `/` leaves `[(a+b*c)/(a+d*c-e)]`. 2. **Fill in the blank:** IBM System/360 was the first architecture to separate ________ (registers, PC, memory, and instruction semantics) from ________ (the physical hardware implementation). **Answer:** ISA (Instruction Set Architecture) and microarchitecture.