Microprocessor Anatomy and Gazetteer

Without becoming a computer scientist or microprocessor engineer, it's useful to know some of the terms for various parts of a microprocessor chip. Don't feel you need to memorize these; use them as reference if you get cornered at a party.

Figure 6.3 shows a simplified block diagram of a microprocessor. This could be anything from a simple 4-bit processor to a big 64-bit machine; the fundamentals are the same for all processor chips.

Figure 6.3. This simplified diagram of a microprocessor shows how instructions come into the chip, are decoded, and then dispatched to one of three (in this example) execution units. The execution units take data from the microprocessor's registers, work some function on it, and store the result back into the registers. Results might also be stored in the data cache or sent to other chips over the data bus.


Decoder

Instructions come into the chip from the top of the diagram. Each microprocessor understands a different set of binary patterns called its instruction set. Like people, different processors speak different languages, and even though all languages express the same concepts and ideas, they use different words.

No matter what instruction set the microprocessor “speaks,” those instructions need to be decoded. The instruction decoder decides what the instruction is telling the microprocessor to do. It might be instructing the microprocessor to add two numbers together, subtract one number from another, compare two numbers to see which is larger, or any of a hundred or so other instructions. Most microprocessors understand 100 to 200 different instructions. Any unintelligible instructions are either ignored or cause the microprocessor chip to enter a failsafe mode until it's given good instructions.

In our example microprocessor, the decoder decides that the current instruction should be handled by one of the three execution units. Some microprocessors have only one execution unit; others have a dozen or more.

Execution Unit

Execution unit is a grisly-sounding term that simply means that all the instructions are executed, or carried out, in this part of the processor. It's the part of the chip where all the heavy lifting takes place. There might be more than one execution unit in a microprocessor chip (our example in Figure 6.3 has three). Having more execution units is like adding more hamsters to the wheel: It goes faster, but you also have to feed it more (instructions) to make it go.

If there are multiple execution units in a microprocessor, they're probably designed to specialize on certain instructions. One execution unit might be built to perform arithmetic (adding, subtracting, multiplying, and dividing numbers) whereas another makes logical comparisons (is this number bigger than that number?).

Some execution units are big and some are small because some instructions are harder to execute than others. Multiplication, for example, is harder than addition (just like it is for people), so the multiplier unit will have more transistors than the adder unit. It will take up more space on the microprocessor's silicon chip and use more electricity when it runs. In the early days, engineers could actually get a microprocessor chip to melt by giving it just the “right” combination of math problems to figure out.

Floating-Point Unit

A floating-point unit (FPU) is just one of many different kinds of execution units. Microprocessors have no trouble working with numbers, as long as they're round numbers. Like a typical third-grade student, microprocessors get a headache from fractions.

Numbers with fractions or decimal values are called floating-point numbers. Don't worry about where this term came from; just treat it as nerd-speak for fractions. Fractions are so hard for microprocessors to deal with that some chips don't do it at all. They completely avoid fractions or decimal values and treat everything as an integer (a counting number with no fractions). Unfortunately for computer programmers, the world is full of fractions, so this presents a problem.

One approach is to round all numbers off and drop the fractions. A few bank robbery movies have been based on this premise. Another approach is to multiply all numbers by, say, 1 million, and shift the decimal point to the right six places. The third, and best, approach is to use a chip that can actually handle floating-point numbers.

An FPU takes up a large amount of silicon space on the chip because it requires a lot of electronic circuitry. It's also often the slowest part of the chip, sometimes to the point of slowing down the rest of the microprocessor. Like a typical adventure story, the egghead in the white lab coat is often the slowest person in the party. Finally, FPUs are complicated to design and complex to manufacture. This makes them error-prone, as Intel discovered to its everlasting misery when its famous Pentium processor was discovered to have a bug in its FPU.

Registers

Each microprocessor contains little cubbyholes for it to store numbers as it works on them. These are called registers (after the electrical circuit used to build them) and there might be anywhere from 4 to 500 registers, depending on the particular microprocessor. Registers are small and they take up almost no space on the microprocessor's silicon chip.

Execution units take data from the registers to do their work. When they're done, the execution units store their results back into the registers. Registers are like a busy executive's desk: a place to store a few often-needed items close at hand. Like desk space, the number of registers is limited, so computer programmers prefer microprocessors with lots of registers. It's like having a big desk to work on.

Cache

Like Robinson Crusoe, a secret cache can help get a microprocessor through lean times. A cache is a memory, pure and simple, but a memory that's built onto the microprocessor chip instead of being outside in another chip. Caches speed up the processor by keeping often-used bits of data close by. If registers are the programmer's desktop, caches are the programmer's file drawer: close, but not quite as close as the registers. Without a cache (or sometimes even multiple caches), the microprocessor might have to go looking for data it needs, slowing down the program.

Caches started appearing on microprocessor chips in the late 1980s when engineers noticed that microprocessor chips were speeding up faster than memory chips were. (This is still going on, and the gap is getting wider.) Making the microprocessor wait for comparatively slow memory chips is like making a highly paid chef wait around for the grocery-delivery boy to show up on his bicycle.

In the kitchen we alleviate this problem by keeping a cache, or store, of food in the cupboards and refrigerator. Occasional trips to the grocery store replenish this local cache. Without them, we'd be making trips to the grocery store (or worse, the farm) for every meal. Caches work by keeping some data physically close to the processor's execution units so it doesn't have to go “shopping” for data quite so often.

There's some serious magic involved in designing caches so they hold the most useful data. A cache isn't big enough to hold everything, so it's important to make the best use of the limited space. That sort of design magic is beyond our scope here, but it's an area of microprocessor design that's closely watched by insiders.

Bus

Sometimes an execution unit won't store the result of a calculation in a register; instead, it will be instructed to send the result to another chip. In that case, the data will be sent off the microprocessor over a set of wires called the data bus. In our example microprocessor, the data bus is at the bottom of Figure 6.3, on the far side of the data cache. This means that any time our microprocessor sends data to another chip over the data bus, it also stores a copy of that data in its local data cache. If our processor ever needs to refer to that data again, it'll have a local copy close at hand. It's much faster to refer to the cache than to request the data from another chip.

The data bus connects the microprocessor chip to all the other chips that need to share data with it. At a minimum, that would include a few memory chips and maybe a communications chip or a graphics chip. The microprocessor might also be connected to other microprocessors so they can share the workload. There could be several chips attached to the same set of bus wires, or only a few.

Because these chips all need to communicate with each other over the same set of wires, some standards need to be established. Like cars sharing the same streets, there need to be some rules of the road that all participants can agree to. In the electronics business, there are several such bus standards, each one incompatible with the others. Engineers therefore need to choose their chips carefully, making sure that all the chips are designed to adhere to the same bus standards. Otherwise, they won't be able to communicate with each other.

Tech Talk

One Little, Two Little Endians

Suppose someone wrote a very big number on a piece of paper to mail it to you. However, the paper is too big to fit in an envelope, so your friend cuts the paper in half and sends the pieces in two different envelopes. When the two envelopes arrive, how do you know which way the papers go back together? If you tape them together backwards, you'll get the wrong number.

Computers solve this problem by sending large numbers either “big end first” or “little end first.” Big end first, or big-endian, means the first envelope to arrive holds the big end of the number (first or leftmost part) and that subsequent parts should be pasted on after (to the right of) that one. Little-endian computers work just the opposite way.

There's no advantage or disadvantage to either method. Unfortunately, most microprocessors (and therefore, most computers) are permanently fixed one way or the other. One of the original challenges of creating the Internet was getting different computers to exchange data without endian problems.

Before you ask, the words for big- and little-endian come from Gulliver's Travels, the book by Jonathan Swift in which the fictional hero encounters the folk of Brobdingnag, who are warring over whether to break open their hard-boiled eggs from the big end or the little end.


Pipeline

Although Figure 6.3 doesn't explicitly show it, every microprocessor has a pipeline. Each individual step that a microprocessor performs, such as decoding, accessing registers, and executing instructions, is one stage of the pipeline. Three stages make a very simple pipeline. Complex microprocessors have pipelines that are more than a dozen stages long. Longer pipelines allow a microprocessor to break up its work into smaller stages. The smaller stages, in turn, allow the microprocessor to run faster.

Pipelines are like assembly lines. If it takes four hours to assemble a television, and the assembly line is broken up into four one-hour tasks, then four different workers can be working on four different TVs at once. A new TV rolls off the assembly line every hour, even though it still takes four hours to make each TV. In the same way, a microprocessor with a four-stage pipeline will have four different instructions in various stages of completion at once. The chip only finishes one instruction at a time, but the next three instructions will be ready right behind it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.249.210