Read Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture Online

Authors: jon stokes

Tags: #Computers, #Systems Architecture, #General, #Microprocessors

Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture (82 page)

BOOK: Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture
6.02Mb size Format: txt, pdf, ePub
ads

and results streams have doubled. In order to accommodate the wider data

stream, the sizes of the processor’s registers and the sizes of the internal data paths that feed those registers must also be doubled.

64-Bit Computing and
x
86-64

181

Main Memory

Main Memory

Registers

Registers

ALU

ALU

CPU

CPU

Figure 9-1: 32-bit versus 64-bit computing

Now look at the two programming models illustrated in Figure 9-2—one

for a 32-bit processor and another for a 64-bit processor.

Control Unit

Registers

Control Unit

Registers

PC

A

Program Counter (PC)

A

B

B

IR

C

IR

C

D

D

PSW

E

PSW

E

F

F

G

G

H

H

I/O Unit

I/O Unit

ALU

ALU

32-Bit

64-Bit

Figure 9-2: 32-bit versus 64-bit programming models

The registers in the 64-bit ISA pictured in Figure 9-2 are twice as wide

as those in the 32-bit ISA, but the size of the instruction register (IR) that

holds the currently executing instruction is the same in both processors.

Again, the data stream has doubled in size, but the instruction stream has

not. You might also note that the program counter (PC) has doubled in size.

We’ll talk about the reason for this in the next section.

182

Chapter 9

The discussion up so far about widened instruction and data registers

has laid out the simple answer to the question, “What is 64-bit computing?”

If you take into account the fact that the data stream is made up of multiple

types of data—a fact hinted at in Figure 9-1—the answer gets a bit more

complicated.

For the simple processor pictured in Figure 9-2, the two types of data

that can be processed are integer data and address data. As you’ll recall from

Chapter 1, addresses are really just integers that designate a memory address,

so address data is just a special type of integer data. Hence, both data types

are stored in the GPRs, and both integer and address calculations are done

by the arithmetic logic unit (ALU).

Many modern processors support two additional data types: floating-

point data and vector data. Each of these two data types has its own set of

registers and its own execution unit(s). The following table compares all four

data types in 32-bit and 64-bit processors:

x
86 Width

x
86-64 Width

Data Type

Register Type

Execution Unit

(in Bits)

(in Bits)

Integer

GPR

ALU

32

64

Address

GPR

ALU or AGU

32

64

Floating-point

FPR

FPU

80

80

Vector

VR

VPU

128

128

You can see from this table that the difference the move to 64 bits makes

is in the integer and address hardware. The floating-point and vector hard-

ware stays the same.

Current 64-Bit Applications

Now that you know what 64-bit computing is, let’s look at the benefits of

increased integer and address sizes.

Dynamic Range

The main thing that a wider integer gives you is increased
dynamic range
.

Instead of giving a one-line definition of the term dynamic range, I’ll just

explain how it works.

In the
base-10
number system which you’re all accustomed to, you can

represent a maximum of 10 integers (0 to 9) with a single digit. This is

because base-10 has 10 different symbols with which to represent numbers.

To represent more than 10 integers, you need to add another digit, using a

combination of two symbols chosen from among the set of 10 to represent

any one of 100 integers (00 to 99). The formula you can use to compute

the number of integers (dynamic range, or DR) you can represent with

an
n
-digit base-10 number is

DR = 10n

64-Bit Computing and
x
86-64

183

So a one-digit number gives you 101 = 10 possible integers, a two-digit

number 102 = 100 integers, a three-digit number 103 = 1,000 integers, and

so on.

The base-2, or
binary
, number system that computers use has only two

symbols with which to represent integers: 0 and 1. Thus, a single-digit binary

number allows you to represent only two integers—0 and 1. With a two-digit

(or two-bit) binary, you can represent four integers by combining the two

symbols (0 and 1) in any of the following four ways:

Binary

Base-10

00

0

01

1

10

2

11

3

Similarly, a three-bit binary number gives you eight possible combinations,

which you can use to represent eight different integers. As you increase

the number of bits, you increase the number of integers you can represent.

In general,
n
bits allow you to represent 2
n
integers in binary. So a 4-bit binary number can represent 24 = 16 integers, an 8-bit number gives you

28 = 256 integers, and so on.

In moving from a 32-bit GPR to a 64-bit GPR, the range of integers

that a processor can recognize and perform arithmetic calculations on goes

from 232 = 4.3e9 to 264 = 1.8e19. The dynamic range, then, increases by a

factor of 4.3 billion. Thus a 64-bit integer can represent a much larger range

of numbers than a 32-bit integer.

The Benefits of Increased Dynamic Range, or, How the Existing 64-Bit

Computing Market Uses 64-Bit Integers

Some applications, mostly in the realm of scientific computing and simula-

tions, require 64-bit integers because they work with numbers outside the

dynamic range of 32-bit integers. When the magnitude of the result of a cal-

culation exceeds the range of possible integer values that the machine can

represent, you get a situation called either
overflow
(the result was greater than the highest positive integer) or
underflow
(the result was less than the largest negative integer). When this happens, the number you get in the register

isn’t the right answer. There’s a bit in the
x
86’s processor status word that allows you to check to see if an integer arithmetic result has just exceeded

the processor’s dynamic range, so you know that the result is erroneous.

Such situations are very, very rare in integer applications. I personally have

never run into this problem, although I have run into the somewhat related

problem of floating-point round-off error a few times.

184

Chapter 9

Programmers who run into integer overflow or underflow problems on

a 32-bit platform have the option of using a 64-bit integer construct provided

by a high-level language like C. In such cases, the compiler uses two registers

per integer—one for each half of the integer—to do 64-bit calculations in

32-bit hardware. This has obvious performance drawbacks, making it less

desirable than a true 64-bit integer implementation.

In addition to scientific computing and simulations, there is another

application domain for which 64-bit integers can offer real benefits: cryptog-

raphy. Most popular encryption schemes rely on the multiplication and

factoring of very large integers, and the larger the integers, the more secure

the encryption. AMD and Intel are hoping that the growing demand for

tighter security and more encryption in the mainstream business and

consumer computing markets will make 64-bit processors attractive.

Larger GPRs don’t just make for larger integers, but they make for larger

addresses, as well. In fact, larger addresses are the primary advantage that

64-bit computers have over their 32-bit counterparts.

Virtual Address Space vs. Physical Address Space

Throughout this book, I’ve been referring to three different types of storage—

the caches, the RAM, and the hard disk—without ever explicitly describing

how all three of these types fit together from the point of view of a pro-

grammer. If you’re not familiar with the concept of
virtual memory
, you might be wondering how a programmer makes use of the hard disk for code and

data storage if load and store instructions take memory addresses as source

and destination operands. Though this brief section only scratches the

surface of the concept of virtual memory, it should give you a better idea of

how this important concept works.

Every major component in a computer system must have an address. Just

like having a phone number allows people to communicate with each other

via the phone system, having an address allows a computer’s components to

communicate with each other via the computer’s internal system of buses. If

a component does not have an address, no other component in the system

can communicate with it directly, either for the purpose of reading from it,

writing to it, or controlling it. Video cards, SCSI cards, memory banks, chip-

sets, processors, and so on all have unique addresses. Even more importantly

for our purposes, storage devices such as the hard disk and main memory

also have unique addresses, and because such devices are intended for use as

storage, they actually look to the CPU like a range of addresses that can be

read from or written to.

Like a phone number, each component’s address is a whole number

(i.e., an integer), and as you learned earlier in our discussion of dynamic

range, the width of an address (the number of digits in the address) deter-

mines the range of possible addresses that can be represented.

64-Bit Computing and
x
86-64

185

A range of addresses is called an
address space
, and in a modern 32-bit

desktop computer system, the processor and operating system work together

to provide each running program with the illusion that it has access to a flat

address space of up to 4GB in size. (Remember the 232 = 4.3 billion number?

Those 4.3 billion bytes are 4GB, which is the number of bytes that a 32-bit

computer can address.) One large portion of this
virtual address space
that a running program sees consists of addresses through which it can interact

with the operating system, and through the OS with the other parts of the

system. The other portion of the address space is set aside for the program to

interact with main memory. This main memory portion of the address space

always represents only a part of the total 4GB virtual address space, in many

cases about 2GB.

This 2GB chunk of address space represents a kind of window through

which the program can look at main memory. Note that the program can

see and manipulate only the data it has placed in this special address space,

so on a 32-bit machine, a program can see only about 2GB worth of addresses

at any given time. (There are some ways of getting around this, but those

don’t concern us here.)

The Benefits of a 64-Bit Address

Because addresses are just special-purpose integers, an ALU and register

combination that can handle more possible integer values can also handle

that many more possible addresses. This means that each process’s virtual

address space is greatly increased on a 64-bit machine, allowing each process

to “see” a much larger range of virtual addresses. In theory, each process on

a 64-bit computer could have an 18 million–terabyte address space.

The specifics of microprocessor implementation dictate that there’s a

big difference between the amount of address space that a 64-bit address

value could theoretically yield and the actual sizes of the virtual and physical address spaces that a given 64-bit architecture supports. In the case of
x
86-64, the actual size of the Hammer line’s virtual addresses is 48 bits, which makes

for about 282 terabytes of virtual address space. (I’m tempted to say about

this number what Bill Gates is falsely alleged to have said about 640KB back

in the DOS days: “282 terabytes ought to be enough for anybody.” But don’t

quote me on that in 10 years when Doom 9 takes up three or four hundred

terabytes of hard disk space.)
x
86-64’s physical address space is 40 bits wide, which means that an
x
86-64 system can support about one terabyte of

physical memory (RAM).

So, what can a program do with up to 282 terabytes of virtual address

space and up to a terabyte of RAM? Well, caching a very large database in it is

a start. Back-end servers for mammoth databases are one place where 64 bits

have long been a requirement, so it’s no surprise to see 64-bit offerings billed as capable database platforms.

On the media and content creation side of things, folks who work with

very large 2D image files also appreciate the extra address space. A related

BOOK: Inside the Machine: An Illustrated Introduction to Microprocessors and Computer Architecture
6.02Mb size Format: txt, pdf, ePub
ads

Other books

The Bridesmaid's Baby by Barbara Hannay
The Psychozone by David Lubar
Balto and the Great Race by Elizabeth Cody Kimmel
Undercover Father by Mary Anne Wilson
NFH 04 Truce (Historic) by R.L. Mathewson
The Hunt by Allison Brennan
Vampire King of New York by Susan Hanniford Crowley
Terror Town by Daley, James Roy