Powerpc Core Tutorial Introduction
Total Page:16
File Type:pdf, Size:1020Kb
PowerPC Core Tutorial Introduction PURPOSE - To explain the features and functions of the PowerPC Core OBJECTIVES: - Identify the main components of the PowerPC Core. - Describe the PowerPC Core programming model. - Identify the different PowerPC Core instruction types. - Describe the PowerPC conditional branching logic. - Describe the PowerPC addressing capabilities. - Identify the features and functions of PowerPC memory management unit. - Describe PowerPC cache operations. - Describe PowerPC exception handling. CONTENTS: - 56 pages - 10 question LEARNING TIME: - 115 minutes PREREQUISITE: - NetComm Roadmap tutorial Welcome to this tutorial on the PowerPC Core. This tutorial describes the features and functions of the PowerPC Core, which is the central control for all MPC860 functions. Upon completion of this tutorial, you’ll be able to identify the main components of the PowerPC Core and describe its programming model. You’ll be able to identify the different instruction types, including conditional branching. You’ll also be able to describe the important features of the PowerPC, including addressing modes, memory management, cache operations, and exception handling. It’s assumed that you have a basic understanding of the MPC860 and the other NetComm products. Click the Forward arrow when you are ready begin the tutorial. Page 1 MPC860 Components 4K System Interface I Cache Unit I Memory Controller MMU Core U-bus 4K BIU D Cache D System Functions MMU Real Time clock TM PowerPC PCMCIA Interface 4 Parallel I/O Internal Interrupt General 16 Memory Baud Rate Controller Purpose Serial Space Generators Timers DMAs; 2 Virtual Parallel 32-Bit RISC µController IDMA Interface and Program ROM Port Internal Timers Peripheral Bus SCC1 SCC2 SCC3 SCC4 SMC1 SMC2 SPI1 I2C Communications Processor Serial Interface Time Slot Assigner Module Let’s begin this tutorial with an overview of the MPC860 communications processor. The three main functional blocks are the Embedded PowerPC, the System Interface Unit, and the Communications Processor Module. The Embedded PowerPC (EPPC) is the main processor unit including caches and memory management units (MMUs). The System Interface Unit (SIU) provides access to the external data bus and the sub-blocks shown. The Communication Processor Module (CPM) sends and receives data over eight different controllers, both multiplexed or non-multiplexed. A 32-bit RISC controls the transfer of data. This section of the NetComm training module describes the EPPC portion of the MPC8xx family of devices. Page 2 EPPC Main Components I-cache/I-MMU interface D-cache/D-MMU interface Core L-Addr L-Data Sequencer Next address Branch Instruction generation unit queue control bus write back bus (2 slots/clock) Special GPR GPR IMUL/ ALU/ LDST LDST Regs (32 X 32) history IDIV BFU address fix data source busses (4 slots/clock) EPPC Main Components, part 1 Next, let’s take a look at the main components of the EPPC. The sequencer provides centralized control of instruction flow to the execution units. The sequencer includes an instruction address generator, a branch unit, and an instruction queue. The instruction address generator determines the address of the next instruction based on information from the sequential fetcher and the branch unit. The branch unit extracts branch instructions from the fetcher and uses static branch prediction on unresolved conditional branches to allow the instruction unit to fetch instructions. The instruction queue holds and distributes the next instructions to be executed. The special purpose register file contains the registers for control, status, and exception handling information. The general purpose register file, or GPR file, contains the registers for normal integer and pointer operations. The GPR history file holds the results from instructions that have been dispatched but not yet retired. Page 3 EPPC Main Components I-cache/I-MMU interface D-cache/D-MMU interface Core L-Addr L-Data Sequencer Next address Branch Instruction generation unit queue control bus write back bus (2 slots/clock) Special GPR GPR IMUL/ ALU/ LDST LDST Regs (32 X 32) history IDIV BFU address fix data source busses (4 slots/clock) EPPC Main Components, part 2 The integer multiply/divide unit executes all integer multiply and divide instructions. The arithmetic logic and bit field unit executes all other integer and bit instructions. The EPPC includes two queues for loading and storing addresses. The load/store address queue is a two-entry queue shared by all load/store instructions. The load/store fixed point data queue is a two-entry, 32-bit wide queue that holds integer data, also known as fixed-point data. Page 4 EPPC Programming Model Overview • EPPC computations are performed register to register. • No stacking mechanism. • Supervisor mode: - Operating system runs in this mode. - Entire model is available. - Changes for different EPPC implementations. • User mode: - Doesn’t contain system functions. - Used for applications. - Same for all EPPC implementations. In the EPPC, all computations are performed register to register. Information is saved to registers and restored from registers. There is no dedicated stack pointer or automatic stacking mechanism. These functions must be provided using software. The EPPC programming model includes two modes, supervisor mode and user mode. Supervisor mode is the highest privilege and is the mode that the operating system runs in. In supervisor mode, the entire programming model is available to the CPU. Note that supervisor mode is different for different EPPC implementations. In the user mode, or problem mode, the resources that have system-wide impact are not available. Unknown programs, such as applications and untested programs, run in this mode. Applications can run on any EPPC implementation because they all have the same user programming model. The user programming model is essentially a subset of the supervisor model. Let’s take a detailed look at these two models. Page 5 EPPC Programming Model 031 031 GPR0 General Special XER LR GPR1 Purpose Purpose ... Registers Registers CTR ... TB GPR30 TBU GPR31 User Programming Model Instruction Pointer Condition Register (same for all EPPC implementations) 031Supervisor Programming Model Machine State Register contains: MSR ( changes for different EPPC implementations) •State info •Exception enables •MMU enables Standard SPRs Additional SPRs DSISR SPRG1 SPR80-82: SPR560-570: bit manipulation DAR SPRG2 Icache & Dcache of MSR[RI&EE] control/status DEC SPRG3 SRR0 TB(R/W) SPR144-630: SPR784-826: Debug & MMU SRR1 TBU(R/W) development programming support model SPRG0 PVR EPPC Programming Model, Part 1 The user programming model includes thirty-two general-purpose registers, where each register is 32 bits wide. All of these registers operate operate the same way except for some special cases for GPR0. EPPC computations are performed register to register. Information is saved to, and restored from, registers. Another register included in the user programming model is the condition register, CR, consisting of eight, 4-bit fields. We’ll discuss this register in more detail later in the tutorial. The user programming model includes five special purpose registers. SPR1 is the integer exception register, XER, which is used for multi-precision arithmetic. This register includes bits to record overflow, carry, and summary overflow. The link register, LR, stores the return address when a call to a subroutine is invoked. The counter register, CTR, is commonly used as a counter register in loop programs, or as a pointer for some branch instructions. The other two special purpose registers, TB and TBU, are used for the Time Base, which is part of the PowerPC architecture. This is a 64-bit periodically increasing value that can be used as a time stamp. You can access the Time Base through these registers on a read-only basis. Note that the Time Base registers are read-write in Supervisor mode but read-only in User mode. These registers also have different SPR numbers in the two modes. In the supervisor programming model, there is the machine state register, MSR, which contains information about the machine state, such as enabling exceptions or interrupts. There is also a set of standard special purpose registers. The first two standard SPRs are the data storage interrupt source register (DSISR) and the data address register (DAR). These two registers store information when certain exceptions occur, especially error exceptions. The decrementer register, DEC, also functions as part of the PowerPC architecture. The value in this register constantly decrements, and it’s possible to generate an interrupt when the decrementer value reaches zero. Page 6 EPPC Programming Model 031 031 GPR0 General Special XER LR GPR1 Purpose Purpose ... Registers Registers CTR ... TB GPR30 TBU GPR31 User Programming Model Instruction Pointer Condition Register (same for all EPPC implementations) 031Supervisor Programming Model Machine State Register contains: MSR ( changes for different EPPC implementations) •State info •Exception enables •MMU enables Standard SPRs Additional SPRs DSIR SPRG1 SPR80-82: SPR560-570: bit manipulation DAR SPRG2 Icache & Dcache of MSR[RI&EE] control/status DEC SPRG3 SRR0 TB(R/W) SPR144-630: SPR784-826: Debug & MMU SRR1 TBU(R/W) development programming support model SPRG0 PVR EPPC Programming Model, Part 2 The next two registers, the save and restore registers (SRR0 and SRR1), are always used in exception processing. The processor’s exception