Authors: jon stokes
Tags: #Computers, #Systems Architecture, #General, #Microprocessors
Vector Processing Improvements ................................................................ 262
Memory Disambiguation: The Results Stream Version of
Speculative Execution ........................................................................ 264
Summary: Core 2 Duo in Historical Context ................................................ 270
BIBLIOGRAPHY AND SUGGESTED READING
x
86 ISA and Ext
ensions ........................................................................................ 273
INDEX
275
xiv
Contents in Detail
P R E F A C E
“The purpose of computing is insight, not numbers.”
—Richard W. Hamming (1915–1998)
When mathematician and computing pioneer Richard
Hamming penned this maxim in 1962, the era of digital
computing was still very much in its infancy. There were
only about 10,000 computers in existence worldwide;
each one was large and expensive, and each required
teams of engineers for maintenance and operation. Getting results out of
these mammoth machines was a matter of laboriously inputting long strings
of numbers, waiting for the machine to perform its calculations, and then
interpreting the resulting mass of ones and zeros. This tedious and painstak-
ing process prompted Hamming to remind his colleagues that the reams of
numbers they worked with on a daily basis were only a means to a much higher
and often non-numerical end: keener insight into the world around them.
In today’s post-Internet age, hundreds of millions of people regularly use
computers not just to gain insight, but to book airline tickets, to play poker,
to assemble photo albums, to find companionship, and to do every other sort
of human activity from the mundane to the sublime. In stark contrast to the
way things were 40 years ago, the experience of using a computer to do math
on large sets of numbers is fairly foreign to many users, who spend only a
very small fraction of their computer time explicitly performing arithmetic
operations. In popular operating systems from Microsoft and Apple, a small
calculator application is tucked away somewhere in a folder and accessed
only infrequently, if at all, by the majority of users. This small, seldom-used
calculator application is the perfect metaphor for the modern computer’s
hidden identity as a shuffler of numbers.
This book is aimed at reintroducing the computer as a calculating device
that performs layer upon layer of miraculous sleights of hand in order to hide
from the user the rapid flow of numbers inside the machine. The first few
chapters introduce basic computing concepts, and subsequent chapters work
through a series of more advanced explanations, rooted in real-world hard-
ware, that show how instructions, data, and numerical results move through
the computers people use every day. In the end,
Inside the Machine
aims to give the reader an intermediate to advanced knowledge of how a variety of
microprocessors function and how they stack up to each other from multiple
design and performance perspectives.
Ultimately, I have tried to write the book that I would have wanted to
read as an undergraduate computer engineering student: a book that puts
the pieces together in a big-picture sort of way, while still containing enough
detailed information to offer a firm grasp of the major design principles
underlying modern microprocessors. It is my hope that
Inside the Machine
’s blend of exposition, history, and architectural “comparative anatomy” will
accomplish that goal.
xvi
Preface
A C K N O W L E D G M E N T S
This book is a distillation and adaptation of over eight
years’ worth of my technical articles and news report-
ing for
Ars Technica
, and as such, it reflects the insights
and information offered to me by the many thousands
of readers who’ve taken the time to contact me with
their feedback. Journalists, professors, students, industry professionals, and,
in many cases, some of the scientists and engineers who’ve worked on the
processors covered in this book have all contributed to the text within these
pages, and I want to thank these correspondents for their corrections, clari-
fications, and patient explanations. In particular, I’d like to thank the folks
at IBM for their help with the articles that provided the material for the part
of the book dealing with the PowerPC 970. I’d also like to thank Intel Corp.,
and George Alfs in particular, for answering my questions about the processors
covered in Chapter 12. (All errors are my own.)
I want to thank Bill Pollock at No Starch Press for agreeing to publish
Inside the Machine
, and for patiently guiding me through my first book.
Other No Starch Press staff for whom thanks are in order include Elizabeth
Campbell (production editor), Sarah Lemaire (copyeditor), Riley Hoffman
(compositor), Stephanie Provines (proofreader), and Megan Dunchak.
I would like to give special thanks to the staff of
Ars Technica
and to the site’s forum participants, many of whom have provided me with the constructive criticism, encouragement, and education without which this book would
not have been possible. Thanks are also in order for my technical prereaders,
especially Lee Harrison and Holger Bettag, both of whom furnished invalu-
able advice and feedback on earlier drafts of this text. Finally, I would like to thank my wife, Christina, for her patience and loving support in helping me
finish this project.
Jon Stokes
Chicago, 2006
xviii
Acknowledgments
I N T R O D U C T I O N
Inside the Machine
is an introduction to computers that
is intended to fill the gap that exists between classic
but more challenging introductions to computer
architecture, like John L. Hennessy’s and David A.
Patterson’s popular textbooks, and the growing mass
of works that are simply too basic for motivated non-specialist readers. Readers with some experience using computers and with even the most minimal
scripting or programming experience should finish
Inside the Machine
with a thorough and advanced understanding of the high-level organization of
modern computers. Should they so choose, such readers would then be well
equipped to tackle more advanced works like the aforementioned classics,
either on their own or as part of formal curriculum.
The book’s comparative approach, described below, introduces new
design features by comparing them with earlier features intended to solve
the same problem(s). Thus, beginning and intermediate readers are
encouraged to read the chapters in order, because each chapter assumes
a familiarity with the concepts and processor designs introduced in the
chapters prior to it.
More advanced readers who are already familiar with some of the
processors covered will find that the individual chapters can stand alone.
The book’s extensive use of headings and subheadings means that it can
also be employed as a general reference for the processors described,
though that is not the purpose for which it was designed.
The first four chapters of
Inside the Machine
are dedicated to laying the conceptual groundwork for later chapters’ studies of real-world microprocessors. These chapters use a simplified example processor, the DLW, to
illustrate basic and intermediate concepts like the instructions/data distinc-
tion, assembly language programming, superscalar execution, pipelining,
the programming model, machine language, and so on.
The middle portion of the book consists of detailed studies of two popular
desktop processor lines: the Pentium line from Intel and the PowerPC line
from IBM and Motorola. These chapters walk the reader through the chrono-
logical development of each processor line, describing the evolution of the
microarchitectures and instruction set architectures under discussion. Along
the way, more advanced concepts like speculative execution, vector processing,
and instruction set translation are introduced and explored via a discussion
of one or more real-world processors.
Throughout the middle part of the book, the overall approach is what
might be called “comparative anatomy,” in which each new processor’s novel
features are explained in terms of how they differ from analogous features
found in predecessors and/or competitors. The comparative part of the book
culminates in Chapters 7 and 8, which consist of detailed comparisons of
two starkly different and very important processors: Intel’s Pentium 4 and
Motorola’s MPC7450 (popularly known as the G4e).
After a brief introduction to 64-bit computing and the 64-bit extensions
to the popular
x
86 instruction set architecture in Chapter 9, the microarchitecture of the first mass-market 64-bit processor, the IBM PowerPC 970, is
treated in Chapter 10. This study of the 970, the majority of which is also
directly applicable to IBM’s POWER4 mainframe processor, concludes the
book’s coverage of PowerPC processors.
Chapter 11 covers the organization and functioning of the memory
hierarchy found in almost all modern computers.
Inside the Machine
’s concluding chapter is given over to an in-depth
examination of the latest generation of processors from Intel: the Pentium
M, Core Duo, and Core 2 Duo. This chapter contains the most detailed
discussion of these processors available online or in print, and it includes
some new information that has not been publicly released prior to the
printing of this book.
xx
Introduction
B A S I C C O M P U T I N G C O N C E P T S
Modern computers come in all shapes and sizes, and
they aid us in a million different types of tasks ranging
from the serious, like air traffic control and cancer
research, to the not-so-serious, like computer gaming
and photograph retouching. But as diverse as computers are in their
outward forms and in the uses to which they’re put, they’re all amazingly
similar in basic function. All of them rely on a limited repertoire of tech-
nologies that enable them do the myriad kinds of miracles we’ve come to
expect from them.
At the heart of the modern computer is the
microprocessor
—also commonly called the
central processing unit (CPU)
—a tiny, square sliver of silicon that’s etched with a microscopic network of gates and channels through which
electricity flows. This network of gates (
transistors
) and channels (
wires
or
lines
) is a very small version of the kind of circuitry that we’ve all seen when cracking open a television remote or an old radio. In short, the microprocessor isn’t just the “heart” of a modern computer—it’s a computer in
and of itself. Once you understand how this tiny computer works, you’ll have
a thorough grasp of the fundamental concepts that underlie all of modern
computing, from the aforementioned air traffic control system to the silicon
brain that controls the brakes on a luxury car.
This chapter will introduce you to the microprocessor, and you’ll begin
to get a feel for just how straightforward computers really are. You need
master only a few fundamental concepts before you explore the micro-
processor technologies detailed in the later chapters of this book.
To that end, this chapter builds the general conceptual framework on
which I’ll hang the technical details covered in the rest of the book. Both
newcomers to the study of computer architecture and more advanced readers
are encouraged to read this chapter all the way through, because its abstrac-
tions and generalizations furnish the large conceptual “boxes” in which I’ll
later place the specifics of particular architectures.
The Calculator Model of Computing
Figure 1-1 is an abstract graphical representation of what a computer does.
In a nutshell, a computer takes a stream of instructions (code) and a stream