1. From Zero to One
1.1 The Game Plan
Microprocessors have revolutionized our world during the past three decades. A laptop computer today has far capability than a room-sized mainframe of yesteryear. A luxury automobile contains about 50 microprocessors. Advances in microprocessors have made cell phone and the Internet possible, have vastly improved medicine, and have transformed how war is waged. Worldwide semiconductor industry sales have grown from US $21 billion in 1985 to $227 billion in 2005, and microprocessors are a major segment of these sales. I believe that microprocessors are not only technically, economically, and socially important, but are also an intrinsically fascinating human invention. The skills you learn along the way will prepare you to design many other digital systems.
Its assumed that you have a basic familiarity with electricity, some prior programming experience, and a genuine interest in understanding what goes on under the hood of a computer. This guide focuses on the design of digital systems, which operate on 1′ and 0’s. I begin with digital logic gates that accept 1’s and 0’s as inputs and produce 1’s and 0’s as outputs. You then explore how to combine logic gates into more complicated modules such as adders and memories. Then shift gears to programming in assembly language, the native language of the microprocessor. Finally, we put gates together to build a microprocessor that runs these assembly language programs.
A great advantage of digital systems is that the building blocks are quite simple: just 1’s and 0’s. They do not require grungy mathematics or a profound knowledge of physics. Instead, the designer’s challenge is to combine these simple blocks into complicated systems. A microprocessor may be the first systems that you build that is too complex to fit in your head all at once. One of the major themes weaved through this guide is how to manage complexity.
1.2 The Art of Managing Complexity
One of the characteristics that separates and engineer or computer scientist from layperson is a systematic approach to managing complexity. Modern digital systems are built from millions or billions of transistors. No human being could understand these systems by writing equations describing the movement of electrons in each transistor and solving all of the equations simultaneously. You will need to learn to manage complexity to understand how to build a microprocessor without getting mired in a morass of details.
1.2.1 Abstraction
The critical technique for managing complexity is abstraction: hiding details when the are not important. A system can be viewed from any different levels of abstraction. For example: Computer System Abstraction Figure 1.1.
| Application Software | Programs |
| Operating Systems | Device Drivers |
| Architecture | Instructions, Registers |
| Micro-Architecture | Datapaths, Controllers |
| Logic | Adders, Memories |
| Digital Circuits | AND gates, NOT gates |
| Analog Circuits | Amplifiers, Filters |
| Devices | Transistors, Diodes |
| Physics | Electrons |
Figure 1.1 illustrates levels of abstraction for electronic computer system along with typical building blocks at each level. At lowest level of abstraction is the physics, the motion of electrons. The behavior of electrons is described by quantum mechanics and Maxwell’s equations. Our system is constructed from electronic devices such as transistors. These devices have well-defined connection points, called terminals and can be modeled by relationship between voltage and current as measured at each terminal. By abstracting to the level, we can ignore the individual electrons. The next level of abstraction is analog circuits, in which devices are assembled to create components such as amplifiers. Analog circuits input and output restrict the voltages to discrete ranges, which we will use to indicate 0 and 1. In logic design, we build more complex structures, such as address or memories, from digital circuits.
Micro-architecture links the logic and architecture levels of abstraction. The architecture level is abstraction describes a computer from the programmer’s perspective. For example, the Intel IA-32 architecture used by microprocessors in most personal computers (PCs) is defined by a set of instructions and registers (memory form temporarily storing variables) that the programmer is allowed to use. Micro-architecture involves combining logic elements to execute the instructions defined by the architecture. A particular architecture can be implemented by one of many different micro-architectures with different price/performance/power trade-offs. For example, Intel Core 2 Duo, the Intel 80486, and the AMD Athlon all implement IA-32 architecture with different micro-architectures.
Moving into the software realm, the operating system handles low-level details such as accessing a hard drive or managing memory. Finally, the application software uses these facilities provided by the operating system to solve a problem for the user. Thanks to the power of abstraction, your grandma can surf Web without any regard for the quantum physics of computer organization.
The guide focuses on levels of abstraction from digital circuits through computer architecture. Wen you working in one level of abstraction, its good to know something about the levels of abstractions immediately above and blow where you are working. For example, a computer scientist cannot fully optimize code without understanding the architecture for which the program is being written. A device engineer cannot make wise trade-offs in transistor design without understanding the circuits in which the transistors will be used. I hope that by the time you read this guide, you can pick the level of abstraction appropriate to solving your problem and evaluate the impact of your design choices on other levels of abstraction.
1.2.2 Discipline
Discipline is the act of intentionally restricting your design choices so that you can work more productively at a higher level of abstraction. Using interchangeable parts is a familiar application of discipline. One of the first examples of interchangeable parts are rifles manufacturing. Rifles could be assembled and repaired much faster and with less skill. The gunmaker no longer concerned himself with lower level of abstraction such as the specific shape of an individual barrel or gunstock.
In the context of the guide, the digital discipline will be very important. Digital circuits use discrete voltages, whereas analog circuits use continuous voltages. Therefore, digital circuits are a subset of analog circuits and in some sense must be capable of less than the border class of analog circuits. However, digital circuits are much simpler to design. By limiting ourselves to digital circuits, we can easily combine components into sophisticated systems that ultimately outperform those built from analog components in many applications. For example, digital televisions, compact disks (CDs), and cell phones are replacing their analog predecessors.
1.2.3 The three -Y’s
In addition to abstraction and discipline, designers user the three “-y’s” to manage complexity: hierarchy, modularity, and regularity. These principles apply to both software and hardware systems.
-> Hierarchy involves dividing a systems into modules, then further subdividing each of these modules until the pieces are easy to understand.
-> Modularity state that the module have well-defined funcations and interfaces, so that they connect together easily without unanticipated side effects.
-> Regularity seeks uniformity among the modules. Common modules are reused many times, reducing the number of distinct modules that must be designed.
Hierarchy teach to break down system into the components.
Modularity teaches that each component should have a well-defined function and interface.
Regularity teaches that interchangeable parts are good idea.
1.3 Digital Abstraction
Most physical variables are continuous. For example, the voltage on a wire, the frequency of an oscillation, or the position of a mass are all continuous quantities.
