Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesWhat the Heck Is Millicode?


December 1995 / Core Technologies / Two Turbocharged PowerPCs / What the Heck Is Millicode?

Microcode, nanocode, and now millicode. What are these things?

Microcode is an on-chip program that decodes various processor instructions and operates the appropriate portions of the processor's logic to implement the requested action. Ergo, microcode is a sort of program embedded inside the processor. In very complex processors, separate programs -- nanocode -- operate sections of the processor, such as the floating-point unit or the integer unit.

Millicode, as its name implies, operates at a level outside the processor. It implements highly efficient routines for frequently called functions. Normally, when a program calls a fun ction on a PowerPC system, it uses a set of rules that organize the target function's temporary storage into a region of memory known as a stack frame . ( See the figure. ) This stack frame serves as a container that preserves any non-scratchpad registers, the function's local storage, a parameter (or argument area), and a linkage area. One such rule places a number of the function's arguments into processor registers. Additional arguments (if any) spill over into the stack frame's argument area. Another rule adjusts the link register (LR) to point to the target function's address, while the LR's original contents get stored into the link area of the stack frame. Once the program sets up the stack frame, it executes a branch to the function, based on the address in the LR. When the function exits, it restores the LR (which effectively creates the return address) and executes another LR-based branch.

To reduce overhead, millicode doesn't follow these conventions. Instead, yo u place arguments in specific registers and use a branch absolute then link instruction ( bla ) to jump to the function. This convention reduces the function-call overhead to several register loads plus a single bla instruction. A register-based branch (using the LR) returns execution to your program when the function exits. Such unconditional branches typically take zero cycles to execute because the processor's branch unit can resolve them well in advance. Previous 603, 603e, and 604 processors used millicode to resolve little-endian addressing. As efficient as millicode is, it can add substantial overhead if the routine gets called frequently. The 166-MHz 603e and the 166-MHz 604e now handle these addressing issues in hardware, thus boosting the efficiency of the load/store instructions, which in turn increases the speed of the processor.


PowerPC Stack After a Function Call

illustration_link (9 Kbytes)

A typical PowerPC function stores temporary data in a structure called a stack frame. Millicode function calls don't use a stack frame.


Up to the Core Technologies section contentsGo to previous article: Two Turbocharged PowerPCsGo to next article: How to Build an Internet AppSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network