
Programming Documentation
Version 1.0
August 2008

© Copyright Sony Computer Entertainment Inc., 2008
” are registered trademarks of Sony Corporation.
Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc. Other company, product and service names may be trademarks or service marks of others.
All information contained in this document is subject to change without notice. The products described in this document are NOT intended for use in applications such as implantation, life support, or other hazardous uses where malfunction could result in death, bodily injury, or catastrophic property damage. The information contained in this document does not affect or change Sony and SCEI product specifications or warranties. Nothing in this document shall operate as an express or implied license or indemnity under the intellectual property rights of Sony and SCEI third parties. All information contained in this document was obtained in specific environments, and is presented as an illustration. The results obtained in other operating environments may vary.
THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN “AS IS” BASIS. In no event will Sony and SCEI be liable for damages arising directly or indirectly from any use of the information contained in this document.
Sony Corporation 1-7-1 Konan, Minato-ku, Tokyo, 108-0075 Japan
Sony Computer Entertainment Inc. 2-6-21 Minami-Aoyama, Minato-ku, Tokyo, 107-0062 Japan
The Sony home page can be found at http://www.sony.net The SCEI home page can be found at http://www.scei.co.jp The Cell Broadband Engine home page can be found at http://cell.scei.co.jp
All Rights Reserved · “SONY” and “ · August 2008

This Guide is designed to help you navigate the programming documentation for the Cell Broadband Engine™ (Cell/B.E.) processor. The documents are available on the public Sony Computer Entertainment website (http://cell.scei.co.jp/e_download.html) and the IBM website (http://www-128.ibm.com/developerworks/power/cell/). The Guide summarizes the documentation, explaining the relevance of each document to particular Cell/B.E. programming roles and objectives. Throughout this Guide and the documentation it summarizes, the Cell/B.E. is variously referred to as the Cell Processor, Cell Broadband Engine™, CBE, Cell BE, or BE.
Figure 1, “Cell/B.E. Block Diagram” and Figure 2, “Storage Domains” define the acronyms used in the Cell/B.E. documentation. For a more complete glossary, see the CBE Programming Handbook.
Figure 1 Cell/B.E. Block Diagram

Figure 2 Storage Domains



© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 3 of 16

The PPE (Figure 1 and Figure 2) is a general-purpose, 64-bit PowerPC RISC processor that runs the operating system(s) for all applications and external interfaces on the Cell/B.E. It operates on scalars or vectors containing 8- to 64-bit fixed-point or single- or double-precision floating-point data types.
Each of the eight SPEs (Figure 1 and Figure 2) is a 128-bit RISC processor that executes the SPU instruction set, which is designed for data-rich single-instruction, multiple data (SIMD) and scalar applications. It operates on scalars or vectors containing 8- to 128-bit fixed-point or single- or double-precision floating-point data types. An SPE consists of two main units – the SPU, which executes instructions, and the MFC, which controls DMA transfers and related functions. In general, the term “SPU” refers to the instruction-execution unit, and the term “SPE” refers to either or both of the SPU and MFC. However, some documents use the terms “SPU” and “SPE” interchangeably.
Figure 3, “Recommended Order of Reading” illustrates the documents described in this guide and the recommended reading order. An appendix lists some public websites for Cell/B.E. and PLAYSTATION®3 (PS3) programmers. Programmers writing code only for the PPE do not need to read the SPE documents, and programmers writing code only for the SPEs do not need to read the PPE documents.
Figure 3 Recommended Order of Reading

Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 4 of 16

The Cell/B.E. documentation set, in general, observes industry-wide conventions with respect to microprocessor documentation. Specifically, document titles have the following content implications:
Architecture – An architecture document is a specification of requirements for a microprocessor or computer
system. It does not specify details of how the microprocessor or computer system must be implemented; instead it provides a template for a family of compatible implementations. The target audience may include application programmers, system programmers, and hardware developers, depending on the actual content of the document. Microarchitecture—A microarchitecture document describes the internal functions of microprocessor
hardware, and it normally illustrates these functions as general block diagrams, Boolean-logic diagrams, and/or circuit diagrams. The target audience may be application and/or system programmers, depending on the actual content of the document. Instruction Set Architecture (ISA) – An ISA document describes a microprocessor model that is seen by
compiled software (machine or object code), including instructions, address and data formats, registers, memory organization, and state variables on which the instructions operate. The target audience is application and system programmers. Application Binary Interface (ABI) – An ABI document describes the interface between compiled software
(machine or object code) and a particular pairing of system software (operating system, library, or other software service) and microprocessor hardware. The target audience is system programmers. Application Programming Interface (API) – An API document describes the interface between uncompiled
software (source code) and an operating system, library, or other software service, independent of any particular microprocessor hardware. The target audience is application and system programmers. Language Specification – A language specification describes a programming language, including grammar,
lexicon, register usage, and related details. The target audience is application and system programmers. Registers – A Registers document describes register addresses and how register contents affect
microprocessor operations. The fields of the registers are illustrated, bit-by-bit, and their functions are described. All registers, including both problem-state (user) and privilege-state (supervisor) registers, are typically described. The target audience is application and system programmers.
Privilege State (Supervisor) – The state in which system software has system-wide control over all other
software processes. Problem State (User) – The state in which application software runs under system software. Intrinsics – C/C++ function calls mapped to one or more Cell/B.E. assembly instructions. SIMD – Single-instruction, multiple-data.
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 5 of 16

C/C++ programmers interested in developing applications or libraries for the Cell/B.E. The document is not intended for programmers developing device drivers, compilers, or operating systems.
A short overview of the Cell/B.E. hardware organization, programming methods, programming examples, and process of writing and debugging programs. The document assumes access to the Cell/B.E.-specific IBM software development kit (SDK), 64-bit Linux
® OS and standard toolset, and Full System Simulator. The examples in the tutorial highlight the general principals required for Cell/B.E. programming, so that a programmer can apply this knowledge to other Cell/B.E. development environments.
This is a beginning tutorial, useful during initial attempts to understand the programming process.
The tutorial has the following sections:
CBE Programming Handbook Programming the Cell Broadband Engine: Examples and Best Practices
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 6 of 16

C/C++ and assembly-language programmers interested in developing applications, libraries, middleware, drivers, compilers, or operating systems for the Cell/B.E.
A general programming user guide and reference for the Cell/B.E., with content for programmers interested in developing almost any kind of application or system software. It describes all of the Cell/B.E. facilities needed to develop such programs. It is system-independent; it makes no assumptions about development-tool or operating- system environments.
Use this document throughout Cell/B.E. software development. Use it together with the CBE Registers document and other PPE and SPE reference documents.
The handbook has the following sections:
Sections 1 to 3 (for application and system programmers): General hardware and programming-environment
overviews of the Cell/B.E., its PPE, and its SPEs. Sections 4 to 16 (primarily for system programmers): Additional hardware and programming topics for the
privilege-state (supervisor) programming environment. There are chapters describing the virtual storage environment, memory and cache management, I/O architecture, resource allocation, PPE interrupts, PPE multithreading, logical partitions and hypervisors, SPE context switching, the time base and decrementers, software objects and executables, SPE loading, power and thermal management, and performance monitoring. Of these, only the decrementers topic is typically needed by application programmers. Sections 17 to 24 and Appendixes (for application and system programmers): More problem-state (user)
programming topics, including SPE channels and related memory-mapped I/O (MMIO) interface, SPE events, DMA transfers and interprocessor communication, shared-storage synchronization, parallel programming, SIMD programming, relationship between PPE vector/SIMD multimedia extension programming and SPE programming, and SPE programming tips. The appendices summarize the PPE instruction set and intrinsics, SPU instruction set and intrinsics, and performance-monitor signals. Glossary: The best available glossary for Cell/B.E. terminology.
IBM Cell Broadband Engine Resource Center Programming the Cell Broadband Engine: Examples and Best Practices (Parts 2, 3, and 5). Several additional references are given throughout the document itself.
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 7 of 16

Assembly-language programmers writing application or system programs.
Hardware and software details of how the problem-state (user) and privilege-state (supervisor) registers operate. The register fields are illustrated, bit-by-bit, and their functions are described. All registers are considered to be memory- mapped I/O (MMIO) registers, whether or not the registers are associated with an I/O device. An MMIO register is any internal or external register that is accessed through the main-storage space with load and/or store instructions.
Use this document throughout software development, together with the CBE Programming Handbook and other PPE and SPE reference documents.
PowerPC Microprocessor Family: The Programming Environments Manual for 64-Bit Microprocessors Cell Broadband Engine Architecture PowerPC Architecture Books I, II, and III
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 8 of 16

C/C++ application and system programmers.
Extensions (intrinsics) to the C and C++ languages that allow software developers to access hardware features not accessible (or not easily accessible) from C or C++. The extensions allow SIMD and other applications to obtain PPE or SPE performance comparable to assembly-language programs. The document also includes function specifications to facilitate communication between SPEs and the PPE, and it lists a minimal set of standard library functions that must be provided as part of a standard SPE programming environment.
Browse during first readings of the CBE Programming Handbook, and refer to it thereafter as needed during coding of applications for the PPE or SPEs.
SIMD Math Library Specification for CBE Architecture
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 9 of 16

C/C++ application programmers interested in developing single-instruction, multiple-data (SIMD) applications.
A math library that takes advantage of the SIMD instructions supported by the PPE and SPEs.
Browse during first readings of the CBE Programming Handbook, and refer to it thereafter as needed during coding of SIMD applications.
CBE Programming Handbook C/C++ Language Extensions for CBE Architecture
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 10 of 16

Assembly-language programmers writing application or system programs for the PPE.
An in-depth description of the 64-bit PowerPC Instruction Set Architecture (ISA), which is implemented by the PPE. The manual describes all of the user-level and supervisor-level instructions and software-visible resources.
Browse after readings of the CBE Programming Handbook and refer to it thereafter as needed during coding of PPE applications.
There are also appendices describing multiple-precision shifts, floating-point models, synchronization programming examples, and simplified mnemonics.
Environments Manual SIMD Math Library Specification for CBE Architecture The PowerPC™ Compiler Writer’s Guide PowerPC Architecture Books I, II, and III
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 11 of 16

™ Microprocessor Family: Vector/SIMD Multimedia Extension Technology Programming Environments Manual
Assembly-language programmers writing application programs for the PPE.
The PowerPC Vector/SIMD Multimedia Extension instruction set architecture (ISA), and how it relates to the 64-bit PowerPC ISA.
Browse after readings of the CBE Programming Handbook and refer to it thereafter as needed during coding of PPE applications.
CBE Programming Handbook PowerPC Microprocessor Family: The Programming Environments Manual for 64-Bit Microprocessors
SIMD Math Library Specification for CBE Architecture
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 12 of 16

Although the title indicates an audience of compiler writers, the document is useful to all assembly-language programmers who wish to optimize performance of application or system programs for the PPE.
This guide describes, mainly by coding examples from IBM’s most experienced compiler developers, the code patterns that perform well on PowerPC processors. It will be particularly helpful to compiler developers and application-code specialists who are already familiar with optimizing compiler technology and are looking for ways to exploit the PowerPC architecture. It will also be helpful to application programmers who need to understand and tune the output of PowerPC compilers. The guide focuses only on a complier’s generation of efficient PowerPC back-end code; it does not attempt to teach how to write an entire compiler or the accompanying library routines.
Browse after browsing the PowerPC Microprocessor Family: The Programming Environments Manual for 64-Bit Microprocessors and refer to it thereafter as needed during coding of PPE software.
There are also appendices describing application binary interface (ABI) considerations, early PowerPC 6xx hardware implementations, PowerPC instruction-usage statistics, and optimal code sequences.
CBE Programming Handbook PowerPC Microprocessor Family: The Programming Environments Manual for 64-Bit Microprocessors PowerPC™ Microprocessor Family: Vector/SIMD Multimedia Extension Technology Programming
PowerPC Architecture Books I, II, and III
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 13 of 16
Environments Manual

Assembly-language programmers writing application or system programs for the SPE.
The instruction set architecture (ISA) implemented by the SPEs, including descriptions of instruction functions, instruction and data formats, interrupts, and storage-access synchronization.
Browse after readings of the CBE Programming Handbook and refer to it thereafter as needed during coding of SPE applications.
CBE Programming Handbook C/C++ Language Extensions for CBE Architecture
SPU Assembly Language Specification
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 14 of 16

Assembly-language programmers writing application or system programs for the SPE.
The grammar, lexicon, register usage, and related details for an SPE assembly language.
Browse after readings of the CBE Programming Handbook and refer to it thereafter as needed during assembly- language coding of SPE applications.
CBE Programming Handbook SPU Instruction Set Architecture
© 2008 Sony Computer Entertainment Inc. All Rights Reserved. Version 1.0, August 2008 Page 15 of 16

This appendix provides links to public websites containing information about programming the Sony Computer Entertainment PLAYSTATION®3 (PS3) platform and the Cell/B.E.:
PLAYSTATION®3 Websites:
− Sony Computer Entertainment (SCE) PLAYSTATION®3 Developer Network: http://www.scedev.net − Game Developers Conference (GDC): http://devevents.scedev.net/gdc − Sony Computer Entertainment Europe (SCEE): http://www.technology.scee.net − Insomniac Games: http://www.insomniacgames.com/tech/techpage.php
Cell/B.E. Websites:
− Sony Computer Entertainment, Inc. (SCEI): http://cell.scei.co.jp/index_e.html − Power.org: http://www.power.org/resources/devcorner/cellcorner − IBM: http://www-128.ibm.com/developerworks/power/cell/ − CellPerformance: http://www.cellperformance.com − Beyond 3D Forum: http://forum.beyond3d.com/forumdisplay.php?f=57
Version 1.0, August 2008 © 2008 Sony Computer Entertainment Inc. All Rights Reserved. Page 16 of 16
Pages referenced in this manual — manufacturer, support and downloads.
Owners and our team usually reply within a day — and your question helps the next person too.
Be the first to ask — other owners or our team will answer.