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

ArticlesPipeline Hazards


January 1994 / State Of The Art / Pipeline Hazards

When an instruction stalls in a pipeline, it is held at a particular stage until an earlier instruction completes an action that will eliminate the stall condition. Hazards that cause stalls come in three classes: structural, data, and control.

Structural hazards occur when the processor doesn't have enough resources to handle a particular combination of instructions. For example, on the M1, Cyrix has included write buffers between the execution units and the cache, and a separate instruction cache between prefetch and the cache, to minimize those instances when simultaneous cache accesses (reads, writes, prefetches, flushes, and fills) overwhelm the two I/O ports the cache possesses. In dealing with structural hazards, a designer must decide whether the frequency of a particular instruction combination merits the extra transistors that would be r equired to handle the hazard condition.

Control hazards can occur when a branch instruction executes. If the branch goes to an address that isn't in the on-chip caches, the execution pipelines will stall for as long as it takes for the proper follow-on instructions to be retrieved from off-chip. The most difficult branches to deal with are conditional ones, where the branch is taken based on the condition of a flag or the value of a memory location or register, which usually isn't calculated until just before the conditional branch instruction executes.

In a data hazard, one instruction is dependent on a preceding instruction. For example, if the first instruction writes its results to register BX, the second instruction can't read from BX until the first finishes the Writeback stage. Because registers are read in Address Calculation 2, this introduces a bubble where the Execute stage is empty for a cycle. This is an example of a RAW (read-after-write) dependency; if the second instruction were to read BX before the first wrote to it, the second instruction would be using an incorrect value, destroying the integrity of the program logic.

Other data hazards are a WAR (write-after-read) and a WAW (write-after-write). A WAR occurs when a follow-on instruction tries to write to a register before a preceding one reads it. A WAW occurs when a follow-on instruction writes to a register before a preceding one.


Up to the State Of The Art section contentsGo to previous article: M1 Challenges PentiumGo to next article: RISC Grows UpSearchSend 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