Code morphing with Crusoe -

Code morphing with Crusoe

Transmeta's Crusoe is a processor of mystery. It economizes power, emulates x86 code, and hides its actual architecture and instruction sets.

Heresy! How can an embedded processor be PC compatible? The very concept of an embedded processor practically means “anything except an x86 chip.” Yet Transmeta's Crusoe processor may be just the ticket for your next high-end embedded design.

It wasn't always this way. The Crusoe chip was intended for PCs and laptops, and for a few years it did okay in that market. Transmeta launched its chip amid much (perhaps too much) fanfare in 1999, promising to take the PC world by storm and give Intel and AMD a run for their money. But Intel and AMD have a lot of money, and Transmeta had to do all the running. For various reasons, Transmeta's promises turned out to be extravagant, and PC makers have slowly backed away from the #4 PC processor maker. Now that Transmeta has its new Efficeon processor, the company is ready to take on the big guys once again—and the original Crusoe chip is now an embedded processor by default.

There are plenty of good reasons to use an x86 chip, and plenty of good reasons not to. But lately the argument has been moot because there haven't been many x86 chips to choose from. There's been a big gap between low-end 186-class embedded chips and the big PC processors like Pentium 4 and Athlon. If you wanted something in that vast middle range, like a good 486- or Pentium II”class processor, you were out of luck.

Why the drought? Intel and AMD used to make Pentiums and Athlons available as embedded processors, and 386 and 486 chips before that. But both companies have callously turned off life support for the embedded variants of their one-time PC processors. It's simply not economically interesting for them to keep producing last year's PC processor. The profits on PC processors are so huge—and the profits on embedded processors so small—that it's pretty clear which chips will be first against the wall when the company goes gunning for cost savings.

Success is fleeting
PC-compatible, or x86, processors aren't the most popular family of 32-bit CPUs but they aren't dead last either. Most of those units are normal PC processors like Pentium III or Athlon XP that are being pressed into service as embedded chips. So they're not really embedded processors, just processors being used in embedded systems.The problem with this is longevity. PC processors have notoriously short life spans, usually on the order of 18 to 24 months. After that—poof!—your processor is gone, replaced by a newer, better, faster one. That's great if you're making (or buying) PCs but it sucks if you're developing embedded systems with an expected life span of more than a few years. Intel's latest may or may not use the same socket, bus interface, power supply voltage, package type, or pin-out. The upgrade treadmill is a way of life for PC makers; for embedded designers it can feel life threatening.

No matter how successful your embedded system becomes, you'll never buy enough chips to get Intel's attention. Even the biggest embedded x86 design win pales in comparison to what Dell, IBM, or Gateway buys every week. Get on your knees; beg and plead all you want—you won't affect Intel's or AMD's business plans. That means the next Athlon or Pentium will go quietly into that long dark night right on schedule, no matter how much we rage against the machine.

Apart from gnat-like life spans, the other reason more embedded designers don't use PC processors is power—and this is where Crusoe comes in. PC chips use a lot of electricity compared to other 32-bit processors. Notwithstanding brochure-speak like the “Ultra Low Power” Pentium ULP, your basic PC processor burns at least twice as many watts as your average MIPS-, ARM-, or PowerPC-based device. There's a reason the battery is the heaviest part of many laptop PCs.

Crusoe's claim to fame is its (relatively) low power. The TM5800SE, the official part number for Crusoe, burns about 2W at 900MHz, the fastest the chip will run. That's a lot less power than the AMD or Intel equivalent chips, back when those chips were still in production. And that's part of the trick: neither Intel nor AMD make anything that's as slow as Crusoe. They've moved on to faster, more profitable processors.

Power consumption is a squishy thing, dependant on software, workload, and the phase of the moon, seemingly. It's squishier still for Crusoe because of Transmeta's “code morphing” technology. And here's where real-time embedded designers may want to cover their eyes.

Switch on the transmogrifier
Crusoe has a bizarre internal hardware architecture that was designed not to run x86 code, but to emulate it. Transmeta has never documented Crusoe's real instruction set except to say that it's a 128-bit, four-issue, VLIW machine. Nobody outside of Transmeta knows what Crusoe's native assembly language looks like. For all intents and purposes, Crusoe digests x86 opcodes and produces x86-style results. What goes on under the hood is anybody's guess. To be fair, current Athlon, Opteron, and Pentium 4 chips do internal translation as well, so “real” x86 chips may be a thing of the past.

Crusoe's translation has odd effects on performance, though. Unlike mainstream PC processors, Crusoe's mysterious internal engine learns over time. It doesn't simply replace x86 opcodes with VLIW opcodes, one for one. It parses and analyzes code fragments at run time and changes its translation behavior on the fly. Crusoe also caches fragments of code internally when it thinks those sections will be reused. Again, all processors have caches but they don't cache partially translated code in the same way. The bottom line is, Crusoe's internal behavior is totally unpredictable.

This caused some problems in Transmeta's early days. The first Crusoe chips didn't perform well on standard PC benchmarks. Opening and running popular word processors and spreadsheets made Crusoe look bad because those aren't repetitive tasks. Crusoe struggled to analyze and translate Word or Excel on the first pass; although subsequent passes would have performed better, the benchmarks didn't measure that. Like every microprocessor maker everywhere, Transmeta whined that the benchmarks weren't fair.

In reality, Crusoe's architecture just wasn't well suited to the way most people use PCs; it still isn't. On repetitious tasks where Crusoe can improve its performance through iteration, it does just fine. But one-shot execution of random, branch-laden code is not Crusoe's strong suit. Consequently, Transmeta usually steers the conversation toward performance on DES algorithms or MPEG loops, tasks that play into Crusoe's (and Efficeon's) strengths.

If you're in charge of deterministic real-time code, steer clear of Crusoe. Predicting the cycle-by-cycle behavior of any chip is tricky; with Crusoe, it's positively impossible. Pentium, Athlon, and even the older 486 and 386 had some wiggle room in their cycle counts. Integer multiplication, for example, takes varying amounts of time depending on the magnitude of the operands and even their order. (A x B may equal B x A but one of them is a lot faster than the other to calculate.) With Crusoe, you get the added enhancement of its code-morphing training cycle. And with no visibility into Crusoe's internal instruction set or architecture, that's a permanent mystery.

Still, the attraction of x86 processors is undeniable. “Nobody ever lost their job for choosing IBM,” and similar logic might apply to PC-compatible processors. Older PC chips might seem like the mainstream choice to the average manager or marketing director. “Coat tailing” on the PC business—with all its software, support logic, and cheap hardware—also seems like an attractive deal. But it's often a false economy. As we saw before, PC processors themselves usually aren't around for more than a few quarters. The other hardware is no more durable. Core-logic chip sets, graphics chips, north- and south-bridge chips, PCI controllers, and all the rest of the PC camp followers pick up and move every few months as well.

Come, join the dark side
Basing your system on the PC structure of today guarantees a forced redesign tomorrow. If you're willing to stay on that treadmill, the rewards can be real. Software certainly is plentiful. Compilers, middleware, drivers, and anything else you'd want are all available for free or nearly so, with high-quality commercial alternatives as well. Programmers with PC experience are a dime a dozen. Support logic is also cheap and plentiful—it's just not the same support logic from month to month.

Paradoxically, software is more durable than hardware. The internals of the PC change all the time, yet the x86 software remains. We'd rather change our computers every 18 months than change the programs we've used for 18 years. The binary x86 instruction set has become just an accepted delivery mechanism; how the hardware translates and executes that meta-language doesn't interest us any more. Just so long as we don't have to change our old code.

Jim Turley is an independent analyst, columnist, and speaker specializing in microprocessors and semiconductor intellectual property. He was past editor of Microprocessor Report and Embedded Processor Watch . For a good time, write to .

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.