Power PC Architecture
Power PC Architecture
ARKADIP RAY
Introduction
o PowerPC (Performance Optimization With Enhanced RISC –
Performance Computing) is a RISC architecture created by
(AIM) Apple–IBM–Motorola alliance in 1991.
Instruction Queue
The instruction queue holds as many as eight instructions (a cache
block) and can be filled from the cache during a single cycle.
The upper half of the instruction queue (Q4–Q7) provides buffering
to reduce the frequency of cache accesses.
Integer and branch instructions are dispatched to their respective
execution units from Q0 through Q3. Q0 functions as the initial
decode stage for the IU.
Independent Execution Unit
Branch Processing Unit (BPU)
The BPU performs condition register (CR) look-ahead operations on conditional
branches. The BPU looks through the bottom half of the instruction queue for a
conditional branch instruction and attempts to resolve it early, achieving the effect of
a zero-cycle branch in many cases.
The BPU contains an adder to compute branch target addresses and three special-
purpose, user-control registers—the link register (LR), the count register (CTR),
and the CR.
Memory Unit
The 601’s memory unit contains read and write queues that buffer operations
between the external interface and the cache.
These operations are comprised of operations resulting from load and store
instructions that are cache misses and read and write operations required to maintain
cache coherency, table search, and other operations.
The memory unit also handles address-only operations and cache-inhibited loads and
stores.
System Interface
The 601’s System Interface supports
Burst-read memory operations, followed by burst-write memory operations,
I/O controller interface operations, and single-beat (noncacheable or write-
through) memory read and write operations.
Additionally, address-only operations, variants of the burst and single-beat operations
(global memory operations and atomic memory operations) and address retry
activity.
Memory accesses can occur in single-beat (1–8 bytes) and four-beat burst (32 bytes)
data transfers.
The address and data buses are independent for memory accesses to support
pipelining and split transactions.
The 601 can pipeline as many as two transactions and has limited support for out-of-
order split-bus transactions.
PowerPC Registers
PowerPC's application-level registers are broken into three categories:
general purpose, floating point and special purpose registers.
o General-purpose registers (GPRs) - r0 to r31
flat-scheme of 32 general purpose registers.
Source and destination for all integer operations
address source for all load/store operations.
They also provide access to SPRs.
All GPRs are available for use with one exception: in certain instructions, GPR0 simply means the
value 0, and no lookup is done for GPR0's contents.
o Some of these registers have special tasks assigned to them:
• r0Volatile register which may be modified during function linkage
• r1 Stack frame pointer, always valid
• r2 System-reserved register
• r3-r4Volatile registers used for parameter passing and return values
• r5-r10Volatile registers used for parameter passing
• r11-r12Volatile registers which may be modified during function linkage
• r13 Small data area pointer register
• r14-r30 Registers used for local variables
• r31 Used for local variables or “environment pointers”
Floating Point Registers
o Floating-point registers (FPRs)- fr0 to fr31
32 floating-point registers with 64-bit precision.
source and destination operands of all floating-point operations
can contain 32-bit and 64-bit signed and unsigned integer values, as well as single-
precision and double-precision floating-point values.
FPR’s also provide access to the FPSCR(Floating-Point Status and Control Register)
FPSCR captures status and exceptions resulting from floating-point operations, and
also provides control bits for enabling specific exception types.
Instructions to load and store double precision floating point numbers transfers 64-
bit of data without conversion.
Instructions to load from memory single precision floating point numbers convert to
double precision format before storing them in the register.
• f0Volatile register
• f1 Volatile register used for parameter passing and return values
• f2-f8 Volatile registers used for parameter passing
• f9-f13 Volatile registers
• f14-f31 Registers used for local variables
Special-purpose registers (SPRs)
The Fixed-Point Exception Register (XER)- used for indicating
conditions for integer operations, such as carries and overflows.
The Floating-Point Status and Control Register (FPSCR)- 32-bit
register used to store the status and control of the floating-point
operations.
The Count Register (CTR)- used to hold a loop count that can be
decremented during the execution of branch instructions.
The Condition Register (CR)-32-bit register grouped into eight
fields, where each field is 4 bits that signify the result of an instruction’s
operation: Equal (EQ), Greater Than (GT), Less Than (LT), and
Summary Overflow (SO).
The Link Register (LR) contains the address to return to at the end
of a function call.
Data Types
It can use either little-endian or big-endian style.
Fixed-point data types include:
o Unsigned byte 8–bits
o Unsigned halfword 16-bits
o Signed halfword 16-bits
o Unsigned word 32-bit
o Signed word 32-bit
o Unsigned doubleword 64-bits
o Byte Strings: From 0 – 128 bytes in length
2’s complement is used for negative values
floating-point data formats
o single-precision, 32 bits long (23 + 8 + 1)
o double-precision, 64 bits long (52 + 11 + 1)
characters are stored using 8-bit ASCII codes
Instruction Types
Instruction Format
All instruction encodings are 32 bits in length.
Bit numbering for PowerPC is the opposite of most other definitions: bit 0 is the
most significant bit, and bit 31 is the least significant bit.
Instructions are first decoded by the upper 6 bits in a field, called the primary
opcode. The remaining 26 bits contain fields for operand specifiers, immediate
operands, and extended opcodes, and these may be reserved bits or fields.
Common Instruction formats:
Format 0-5 6-10 11-15 16-20 21-25 26-29 30 31
D-form opcd tgt/src src/tgt immediate
X-form opcd tgt/src src/tgt src extended opcd
A-form opcd tgt/src src/tgt src src extended opcd Rc
BD-form opcd BO BI BD AA LK
I-form opcd LI AA LK
Instruction format
D-form- provides up to two registers as source operands, one immediate source, and up to two
registers as target operands. Some variations of this instruction format use portions of the target and
source register operand specifiers as immediate fields or as extended opcodes.
D-form opcd tgt/src src/tgt immediate
X-form- provides up to two registers as source operands and up to two target operands. Some
variations of this instruction format use portions of the target and source operand specifiers as
immediate fields or as extended opcodes.
X-form opcd tgt/src src/tgt src extended opcd
A-form- provides up to three registers as source operands, and one target operand. Some variations
of this instruction format use portions of the target and source operand specifiers as immediate fields
or as extended opcodes.
A-form opcd tgt/src src/tgt src src extended opcd Rc
BD-form- conditional branch instruction. The BO field specifies the type of condition ; BI field
specifies which CR bit to be used as the condition; BD field is used as the branch displacement. AA bit
specifies whether the branch is an absolute or relative branch. The LK bit specifies whether the
address of the next sequential instruction is saved in the Link Register as a return address for a
subroutine call.
BD-form opcd BO BI BD AA LK
I-form- used by the unconditional branch instruction. Being unconditional, the BO and BI fields of
the BD format are exchanged for additional branch displacement to form the LI instruction field. This
instruction format also supports the AA and LK bits in the same fashion as the BD format.
I-form opcd LI AA LK
PowerPC Addressing Modes
Load/store architecture
Indirect
Instruction includes 16 bit displacement to be added to base register (may be GP
register)
Can replace base register content with new address
Indirect indexed
Instruction references base register and index register (both may be GP)
EA is sum of contents
Branch address Target address calculation
Absolute TA= actual address
Relative TA= current instruction address + displacement {25 bits, signed}
Indirect
Arithmetic
Operands in registers or part of instruction
Floating point is register only
Link Register TA= (LR)
Count Register TA= (CR)
References
http://www.ibm.com/developerworks/linux/library/l-
powarch/
http://en.wikipedia.org/wiki/PowerPC
https://nptel.ac.in/courses/Webcourse-contents/IIT-
KANPUR/microcontrollers/micro/ui/Course_home4_36.htm
https://www.nxp.com/files/product/doc/MPCFPE32B.pdf