Page 1
MIPS R4000 Microprocessor User’s Manual Second Edition Joe Heinrich...
Page 2
Unpublished rights reserved under the Copyright Laws of the United States. Contractor/manufacturer is MIPS Technologies, Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. RISCompiler, RISC/os, R2000, R6000, R4000, and R4400 are trademarks of MIPS Technologies, Inc. MIPS and R3000 are registered trademarks of MIPS Technologies, Inc.
Page 3
R4000 processor synchronization support; Paul Ries, for confirming the accuracy of sections describing the memory management and the caches; John Mashey, for verifying the R4000 processor actually does employ the 64-bit architecture; Dave Ditzel, for raising the issue in the first place; and Mike Gupta, for substantiating various aspects of the errata.
Page 5
On the production side, thanks to Kay Maitz, Beth Fraker, Molly Castor, Lynnea Humphries, and Claudia Lohnes for their assistance at the center of the hurricane. Joe Heinrich joeh@sgi.com April 1, 1994 Mt. View, California MIPS R4000 Microprocessor User's Manual...
Page 7
Preface This book describes the MIPS R4000 and R4400 family of RISC microprocessors (also referred to in this book as processor). Overview of the Contents Chapter 1 is a discussion (including the historical context) of RISC development in general, and the R4000 microprocessor in particular.
Page 8
Chapter 9 describes in more detail the Initialization interface, which includes the boot modes for the processor, as well as system resets. Chapter 10 describes the clocks used in the R4000 processor, as well as the processor status reporting mechanism.
Page 9
Preface Appendix A describes the R4000 CPU instructions, in both 32- and 64- bit modes. The instruction list is given in alphabetical order. Appendix B describes the R4000 FPU instructions, listed alphabetically. Appendix C describes sub-block ordering, a nonsequential method of retrieving data.
Page 11
Do this by typing: cd <directory_you_want_file_to_be_in> Access the MIPS document server, sgigate, through FTP by typing: ftp sgigate.sgi.com The server tells you when you are connected for FTP by responding: Connected to sgigate.sgi.com. MIPS R4000 Microprocessor User's Manual...
Page 12
You can take a look at the contents of the doc directory by listing them: ftp> ls You will find several R4000-related subdirectories, such as R4200, R4400, and R4600. When you find the subdirectory you want, cd into that subdirectory and retrieve the file you want by typing: get <filename>...
Page 13
Table of Contents Preface Overview of the Contents ................... vii A Note on Style ....................ix Preface to the Second Edition Changes From the First Edition ................. xi Getting MIPS Documents On-Line..............xi MIPS R4000 Microprocessor User's Manual xiii...
Advanced Semiconductor Technologies ............3 Optimizing Compilers..................4 MIPS RISCompiler Language Suite ..............5 Compatibility ......................6 Processor General Features..................6 R4000 Processor Configurations ................7 R4400 Processor Enhancements ................7 R4000 Processor ......................9 64-bit Architecture ....................9 Superpipeline Architecture ................11 System Interface ....................
Page 15
Backing Up the Pipeline ................. 54 Aborting an Instruction Subsequent to an Interlock ........55 Pipelining the Exception Handling ..............56 Special Cases......................58 Performance Considerations................58 Correctness Considerations................58 R4400 Processor Uncached Store Buffer ............... 59 MIPS R4000 Microprocessor User's Manual...
Page 21
Connecting Clocks to a Phase-Locked System............. 234 Connecting Clocks to a System without Phase Locking........235 Connecting to a Gate-Array Device ..............235 Connecting to a CMOS Logic System ............... 238 Processor Status Outputs ..................241 MIPS R4000 Microprocessor User's Manual...
Page 22
An Example of Strong Ordering..............267 Testing for Strong Ordering................267 Restarting the Processor ................. 268 Maintaining Coherency on Loads and Stores ............269 Manipulation of the Cache by an External Agent ..........270 Invalidate....................... 270 Update ........................270 xxii MIPS R4000 Microprocessor User's Manual...
Page 28
Summary of ECC Operations................426 R4400 Master/Checker Mode................. 430 Connecting a System in Lock Step ..............431 Master-Listener Configuration ................432 Cross-Coupled Checking Configuration ............433 Fault Detection ..................... 435 Reset Operation ....................436 Fault History......................436 xxviii MIPS R4000 Microprocessor User's Manual...
Page 29
Subblock Ordering ....................C-2 Output Buffer i/ t Control Mechanism Mode Bits........................D-1 Delay Times....................... D-2 PLL Passive Components Coprocessor 0 Hazards R4000 Pinouts Pinout of R4000PC....................G-2 Pinout of R4000MC/SC Package Pinout .............. G-5 Index MIPS R4000 Microprocessor User's Manual xxix...
Page 30
Table of Contents MIPS R4000 Microprocessor User's Manual...
Page 31
And at that time it seemed self-evident to designers that architectures should continue to become more and more complex as technological advances made such VLSI designs possible. MIPS R4000 Microprocessor User's Manual...
Since the simplicity of a RISC processor allows it to be implemented in fewer transistors than its CISC counterpart, the first computers capable of exploiting these new VLSI technologies have been using and will continue to use RISC architecture. MIPS R4000 Microprocessor User's Manual...
Thus, a natural match exists between RISC architectures and efficient, optimizing compilers. This match makes it easier for compilers to generate the most effective sequences of machine instructions to accomplish tasks defined by the high-level language. MIPS R4000 Microprocessor User's Manual...
The common back-end also exports optimizing and code-generating improvements immediately throughout the language suite, thereby reducing maintenance. MIPS R4000 Microprocessor User's Manual...
MIPS hardware implementation. 1.3 Processor General Features This section briefly describes the programming model, the memory management unit (MMU), and the caches in the R4000 processor. A more detailed description is given in succeeding sections. • Full 32-bit and 64-bit Operations. The R4000 processor contains 32 general purpose 64-bit registers.
EW, added to the CacheErr register (described in Chapter 5). † Features of the R4400 processor that differ from the R4000 processor are noted throughout this book; for instance, R4400 processor enhancements are listed in the next section.
(described in more detail in Chapters 4 and 11). The Secondary Cache interface is detailed in Chapter 13. 64-bit Architecture The natural mode of operation for the R4000 processor is as a 64-bit microprocessor; however, 32-bit applications maintain compatibility even when the processor operates as a 64-bit processor.
Under normal circumstances, two instructions are issued each cycle. The internal pipeline of the R4000 processor operates at twice the frequency of the master clock, as discussed in Chapter 3. The processor...
2 registers that hold the results of integer multiply and divide operations (HI and LO). Floating-point unit (FPU) registers are described in Chapter 6. CPU registers can be either 32 bits or 64 bits wide, depending on the R4000 processor mode of operation. Figure 1-2 shows the CPU registers.
Page 43
(in LO) and remainder (in HI) of integer divide operations The R4000 processor has no Program Status Word (PSW) register as such; this is covered by the Status and Cause registers incorporated within the System Control Coprocessor (CP0). CP0 registers are described later in this chapter.
Instruction decoding is greatly simplified by limiting the number of formats to these three. This limitation means that the more complicated (and less frequently used) operations and addressing modes can be synthesized by the compiler, using sequences of these same simple instructions. MIPS R4000 Microprocessor User's Manual...
Page 45
R-type (both the operands and the result are registers) and I-type (one operand is a 16-bit immediate value) formats. Chapter 2 provides a more detailed summary and Appendix A gives a complete description of each instruction. MIPS R4000 Microprocessor User's Manual...
Page 46
Table 1-3 CPU Instruction Set: Arithmetic Instructions (ALU Immediate) OpCode Description ADDI Add Immediate ADDIU Add Immediate Unsigned SLTI Set on Less Than Immediate SLTIU Set on Less Than Immediate Unsigned ANDI AND Immediate OR Immediate XORI Exclusive OR Immediate Load Upper Immediate MIPS R4000 Microprocessor User's Manual...
Page 47
Table 1-5 CPU Instruction Set: Multiply and Divide Instructions OpCode Description MULT Multiply MULTU Multiply Unsigned Divide DIVU Divide Unsigned MFHI Move From HI MTHI Move To HI MFLO Move From LO MTLO Move To LO MIPS R4000 Microprocessor User's Manual...
Page 48
Branch on Greater Than or Equal to Zero And Link Table 1-7 CPU Instruction Set: Shift Instructions OpCode Description Shift Left Logical Shift Right Logical Shift Right Arithmetic SLLV Shift Left Logical Variable SRLV Shift Right Logical Variable SRAV Shift Right Arithmetic Variable MIPS R4000 Microprocessor User's Manual...
Page 49
Move Control From Coprocessor z COPz Coprocessor Operation z BCzT Branch on Coprocessor z True BCzF Branch on Coprocessor z False Table 1-9 CPU Instruction Set: Special Instructions OpCode Description SYSCALL System Call BREAK Break MIPS R4000 Microprocessor User's Manual...
Page 51
Branch on Coprocessor z True Likely BCzFL Branch on Coprocessor z False Likely Table 1-14 Extensions to the ISA: Arithmetic Instructions (3-operand, R-type) OpCode Description DADD Doubleword Add DADDU Doubleword Add Unsigned DSUB Doubleword Subtract DSUBU Doubleword Subtract Unsigned MIPS R4000 Microprocessor User's Manual...
Page 52
Trap if Greater Than or Equal Immediate Trap if Greater Than or Equal Immediate TGEIU Unsigned TLTI Trap if Less Than Immediate TLTIU Trap if Less Than Immediate Unsigned TEQI Trap if Equal Immediate TNEI Trap if Not Equal Immediate MIPS R4000 Microprocessor User's Manual...
When the R4000 processor is configured as a big-endian system, byte 0 is the most-significant (leftmost) byte, thereby providing compatibility with MC 68000 and IBM 370 conventions. Figure 1-4 shows this configuration.
Page 55
56 55 48 47 40 39 24 23 16 15 Bit # Byte # Byte Halfword 7 6 5 4 3 2 1 Bit # Bits in a Byte Figure 1-7 Big-Endian Data in a Doubleword MIPS R4000 Microprocessor User's Manual...
Page 56
Figures 1-8 and 1-9 show the access of a misaligned word that has byte address 3. Higher Address Bit # 24 23 16 15 Lower Address Figure 1-8 Big-Endian Misaligned Word Addressing Higher Bit # Address 24 23 16 15 Lower Address Figure 1-9 Little-Endian Misaligned Word Addressing MIPS R4000 Microprocessor User's Manual...
CP0 also controls the cache subsystem, as well as providing diagnostic control and error recovery facilities. The CP0 registers shown in Figure 1-10 and described in Table 1-19 manipulate the memory management and exception handling capabilities of the CPU. MIPS R4000 Microprocessor User's Manual...
FPU form a tightly-coupled unit with a seamless integration of floating-point and fixed-point instruction sets. Since each unit receives and executes instructions in parallel, some floating- point instructions can execute at the same rate (two instructions per cycle) as fixed-point instructions. MIPS R4000 Microprocessor User's Manual...
Introduction Memory Management System (MMU) The R4000 processor has a 36-bit physical addressing range of 64 Gbytes. However, since it is rare for systems to implement a physical memory space this large, the CPU provides a logical expansion of memory space by translating addresses composed in the large virtual address space into available physical memory addresses.
Cache Memory Hierarchy To achieve a high performance in uniprocessor and multiprocessor systems, the R4000 processor supports a two-level cache memory hierarchy that increases memory access bandwidth and reduces the latency of load and store instructions. This hierarchy consists of on-chip instruction and data caches, together with an optional external secondary cache that varies in size from 128 Kbytes to 4 Mbytes.
Each cache has its own 64-bit data path, and each can be accessed in parallel. The R4000 processor primary caches hold from 8 Kbytes to 32 Kbytes; the R4400 processor primary caches are fixed at 16 Kbytes.
Appendix A for detailed descriptions of individual CPU instructions. An overview of the floating-point unit (FPU) instruction set is in Chapter 6; refer to Appendix B for detailed descriptions of individual FPU instructions. MIPS R4000 Microprocessor User's Manual...
5-bit destination register specifier 5-bit shift amount funct 6-bit function field Figure 2-1 CPU Instruction Formats In the MIPS architecture, coprocessor instructions are implementation- dependent; see Appendix A for details of individual Coprocessor 0 instructions. MIPS R4000 Microprocessor User's Manual...
R-Series processor compatibility. However, the scheduling of load delay slots is not absolutely required. Defining Access Types Access type indicates the size of an R4000 processor data item to be loaded or stored, set by the load or store instruction opcode. Access types are defined in Appendix A.
Register-Type instructions • shift instructions • multiply and divide instructions 64-bit Operations When operating in 64-bit mode, 32-bit operands must be sign extended. The result of operations that use incorrect sign-extended 32-bit values is unpredictable. MIPS R4000 Microprocessor User's Manual...
CPU operation. Table 2-2 Multiply/Divide Instruction Cycle Timing Instruction Total Cycles Overlap MULT MULTU DIVU DMULT DMULTU DDIV DDIVU For more information about computational instructions, refer to the individual instruction as described in Appendix A. MIPS R4000 Microprocessor User's Manual...
For more information about branch instructions, refer to the individual instruction as described in Appendix A. † Taken branches have a 3 cycle penalty in this implementation. See Chapter 3 for more information. MIPS R4000 Microprocessor User's Manual...
CP0) and B (for the FPU, CP1). CP0 instructions perform operations specifically on the System Control Coprocessor registers to manipulate the memory management and exception handling facilities of the processor. Appendix A details CP0 instructions. MIPS R4000 Microprocessor User's Manual...
(instructions that follow a branch or load instruction in the pipeline), interruptions to the pipeline flow caused by interlocks and exceptions, and R4400 implementation of an uncached store buffer. The FPU pipeline is described in Chapter 6. MIPS R4000 Microprocessor User's Manual...
Once the pipeline has been filled, eight instructions are executed simultaneously. Figure 3-1 shows the eight stages of the instruction pipeline; the next section describes the pipeline stages. PCycle (8-Deep) MasterClock Cycle TC WB Current Cycle Figure 3-1 Instruction Pipeline Stages MIPS R4000 Microprocessor User's Manual...
The instruction decoder (IDEC) decodes the instruction and checks for interlock conditions. • The instruction cache tag is checked against the page frame number obtained from the ITLB. • Any required operands are fetched from the register file. MIPS R4000 Microprocessor User's Manual...
Page 76
For load and store instructions, the cache performs the tag check during the TC stage. The physical address from the TLB is checked against the cache tag to determine if there is a hit or a miss. † The TLB is described in Chapter 4. MIPS R4000 Microprocessor User's Manual...
Page 77
Data cache access stage 2 Data load or store align JTLB1 Data/Instruction address translation stage 1 JTLB2 Data/Instruction address translation stage 2 Data tag check Instruction virtual address calculation Write back to register file Figure 3-2 CPU Pipeline Activities MIPS R4000 Microprocessor User's Manual...
Figure 3-6. For instance, an Illegal Instruction (II) exception is raised in the execution (EX) stage. Tables 3-1 and 3-2 describe the pipeline interlocks and exceptions listed in Figure 3-6. MIPS R4000 Microprocessor User's Manual...
Page 80
*MP stalls can occur at any stage; they are not associated with any instruction or pipe stage MultB DivB Slip MDOne ShSlip FCBsy ITLB Intr DTLB TLBMod Watch IVACoh ExTrap DVACoh DECCErr Exceptions Reset IECCErr Figure 3-6 Correspondence of Pipeline Stage to Interlock Condition MIPS R4000 Microprocessor User's Manual...
Page 81
Integer Overflow FP Interrupt ExTrap EX Stage Traps DTLB Data Translation or Address Exception TLBMod TLB Modified Data Bus Error Watch Memory Reference Address Compare DVACoh DVA Coherent DECCErr Data ECC Error Non-maskable Interrupt Reset Reset MIPS R4000 Microprocessor User's Manual...
After instruction cancellation, a new instruction stream begins, starting execution at a predefined exception vector. System Control Coprocessor registers are loaded with information that identifies the type of exception and auxiliary information such as the virtual address at which translation exceptions occur. MIPS R4000 Microprocessor User's Manual...
Interlock and Exception Timing To prevent interlock and exception handling from adversely affecting the processor cycle time, the R4000 processor uses both logic and circuit pipeline techniques to reduce critical timing paths. Interlock and exception handling have the following effects on the pipeline: •...
Run Run Run Run Run Run Run Stl Stl Run Run Run Run Run Rst2 Rst1 Restart DS TC TC WB Load DF DS TC WB TC WB RF EX- RF EX+ DF TC WB TC WB Figure 3-7 Pipeline Overrun MIPS R4000 Microprocessor User's Manual...
Handling of the exception is done in this fashion because the frequency of an exception occurring is, by definition, relatively low. MIPS R4000 Microprocessor User's Manual...
Cycle Cache Index Address Restart Rst3 Rst2 Rst1 Load EX DF DS TC WB Figure 3-11 Load Address Bypassing Correctness Considerations An example in which bypassing is necessary to guarantee correctness is a cache write. MIPS R4000 Microprocessor User's Manual...
3.6 R4400 Processor Uncached Store Buffer The R4400 processor contains an uncached store buffer to improve the performance of uncached stores over that available from an R4000 processor. When an uncached store reaches the write-back (WB) stage in the CPU pipeline, the CPU must stall until the store is sent off-chip. In the R4400 processor, a single-entry buffer stores this uncached WB-stage data on the chip without stalling the pipeline.
Page 90
10), an uncached store can occur every eight pipeline cycles. If a larger clock divisor is used, more pipeline cycles are required for each store. CAUTION: The R4000 processor always had a strongly-ordered execution; however, with the addition of the uncached store buffer in...
Memory Management The MIPS R4000 processor provides a full-featured memory management unit (MMU) which uses an on-chip translation lookaside buffer (TLB) to translate virtual addresses into physical addresses. This chapter describes the processor virtual and physical address spaces, the virtual-to-physical address translation, the operation of the TLB in making these translations, and those System Control Coprocessor (CP0) registers that provide the software interface to the TLB.
† There are virtual-to-physical address translations that occur outside of the TLB. For example, addresses in the kseg0 and kseg1 spaces are unmapped translations. In these spaces the physical address is derived by subtracting the base address of the space from the virtual address. MIPS R4000 Microprocessor User's Manual...
3. The Offset, which does not pass through the TLB, is then concatenated to the PFN. Offset Physical address Figure 4-1 Overview of a Virtual-to-Physical Address Translation † Figure 4-8 shows the 32-bit and 64-bit versions of the processor TLB entry. MIPS R4000 Microprocessor User's Manual...
Virtual-to-physical translation is described in greater detail throughout the remainder of this chapter; Figure 4-20 is a flow diagram of the process shown at the end of this chapter. The next two sections describe the 32-bit and 64-bit address translations. MIPS R4000 Microprocessor User's Manual...
0x 0000 0000 0000 0000 Figure 4-4 User Mode Virtual Address Space *NOTE: The R4000 uses 64-bit addresses internally. When the kernel is running in Kernel mode, it initializes registers before switching modes, and saves (or restores, whichever is appropriate) register values on context switches.
Page 98
0x0000 0000 0000 0000 64-bit 1 Tbyte xuseg through A(63:40) = 0 bytes) 0x0000 00FF FFFF FFFF † The cached (C) field in a TLB entry determines whether the reference is cached; see Figure 4-8. MIPS R4000 Microprocessor User's Manual...
Supervisor Mode Operations Supervisor mode is designed for layered operating systems in which a true kernel runs in R4000 Kernel mode, and the rest of the operating system runs in Supervisor mode. The processor operates in Supervisor mode when the Status register contains the following bit-values: •...
Page 100
0x 0000 0000 0000 0000 Figure 4-5 Supervisor Mode Address Space *NOTE: The R4000 uses 64-bit addresses internally. In 32-bit mode, a valid address must be a 32-bit signed number, where bits 63:32 = bit 31. In normal operation it is not possible for a 32-bit Supervisor-mode program to create an invalid address through arithmetic operations.
Page 101
The virtual address is extended with the contents of the 8-bit ASID field to form a unique virtual address. This mapped space begins at virtual address 0xC000 0000 and runs through 0xDFFF FFFF. MIPS R4000 Microprocessor User's Manual...
Page 102
32-bit mode. The virtual address is extended with the contents of the 8-bit ASID field to form a unique virtual address. This mapped space begins at virtual address 0xFFFF FFFF C000 0000 and runs through 0xFFFF FFFF DFFF FFFF. MIPS R4000 Microprocessor User's Manual...
Figure 4-6. Table 4-3 lists the characteristics of the 32-bit kernel mode segments, and Table 4-4 lists the characteristics of the 64-bit kernel mode segments. MIPS R4000 Microprocessor User's Manual...
Page 104
0x 0000 0000 0000 0000 Figure 4-6 Kernel Mode Address Space *NOTE: The R4000 uses 64-bit addresses internally. In 32-bit mode, a valid address must be a 32-bit signed number, where bits 63:32 = bit 31; an invalid address produces an undefined result. In 32-bit mode,...
Page 105
References to kseg0 are not mapped through the TLB; the physical address selected is defined by subtracting 0x8000 0000 from the virtual address. The K0 field of the Config register, described in this chapter, controls cacheability and coherency. MIPS R4000 Microprocessor User's Manual...
Page 106
, the kseg3 virtual address space is selected; it is the current 2 -byte (512-Mbyte) kernel virtual space. The virtual address is extended with the contents of the 8-bit ASID field to form a unique virtual address. MIPS R4000 Microprocessor User's Manual...
Page 107
When ERL = 1 in the Status register, the user address region becomes a 2 byte unmapped (that is, mapped directly to physical addresses) uncached address space. See the Cache Error exception in Chapter 5 for more information. MIPS R4000 Microprocessor User's Manual...
Page 109
This 64-bit virtual address space is the current supervisor virtual space, compatible with the 32-bit address model ksseg. • ckseg3. This 64-bit virtual address space is kernel virtual space, compatible with the 32-bit address model kseg3. MIPS R4000 Microprocessor User's Manual...
Used with exception Used with memory processing. See management system. Chapter 5 for details. *Register number Figure 4-7 CP0 Registers and the TLB † For a description of CP0 data dependencies and hazards, please see Appendix F. MIPS R4000 Microprocessor User's Manual...
R4000 processor 30 29 64-bit Mode MASK 190 189 139 136 135 256-bit TLB VPN2 ASID entry in 64- bit mode of R4000 94 93 processor 30 29 Figure 4-8 Format of a TLB Entry MIPS R4000 Microprocessor User's Manual...
Page 112
63...62 Fill ..Reserved. 0 on read; ignored on write. 0 ... Reserved. Must be written as zeroes, and returns zeroes when read. Figure 4-9 Fields of the PageMask and EntryHi Registers MIPS R4000 Microprocessor User's Manual...
Page 113
G ..Global. If this bit is set in both Lo0 and Lo1, then the processor ignores the ASID during TLB lookup. 0 ... Reserved. Must be written as zeroes, and returns zeroes when read. Figure 4-10 Fields of the EntryLo0 and EntryLo1 Registers MIPS R4000 Microprocessor User's Manual...
Probe failure. Set to 1 when the previous TLBProbe (TLBP) instruction was unsuccessful. Index to the TLB entry affected by the TLBRead and Index TLBWrite instructions Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
Figure 4-12 shows the format of the Random register; Table 4-8 describes the Random register fields. Random Register Random Figure 4-12 Random Register Table 4-8 Random Register Field Descriptions Field Description Random TLB Random index Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
4-10 describes the register fields. Wired Register Wired Figure 4-14 Wired Register Table 4-10 Wired Register Field Descriptions Field Description Wired TLB Wired boundary Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
PRId register fields. PRId Register 16 15 Figure 4-15 Processor Revision Identifier Register Format Table 4-11 PRId Register Fields Field Description Implementation number Revision number Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
The low-order byte (bits 7:0) of the PRId register is interpreted as a revision number, and the high-order byte (bits 15:8) is interpreted as an implementation number. The implementation number of the R4000 processor is 0x04. The content of the high-order halfword (bits 31:16) of the register are reserved.
Page 121
(joint cache) instruction and data separated by SCAddr(17) Secondary Cache port width 128-bit data path to S-cache Reserved System Port width 64-bit 1, 2, 3 Reserved Secondary Cache present S-cache present no S-cache present MIPS R4000 Microprocessor User's Manual...
Page 122
Reserved. Must be written as zeroes, returns zeroes when read. 12+IC Primary I-cache Size (I-cache size = 2 bytes). In the R4000 processor, this is set to 8 Kbytes; in the R4400 processor, this is set to 16 Kbytes. 12+DC Primary D-cache Size (D-cache size = 2 bytes).
Figure 4-18 shows the format of these registers for primary cache operations. Figure 4-19 shows the format of these registers for secondary cache operations. Table 4-13 lists the field definitions of the TagLo and TagHi registers. MIPS R4000 Microprocessor User's Manual...
Page 124
Specifies the virtual index of the associated Primary cache line, VIndex vAddr(14:12) ECC for the STag, SState, and VIndex fields Reserved. Must be written as zeroes, and returns zeroes when read. Undefined The TagHi register should not be used. MIPS R4000 Microprocessor User's Manual...
V) are retrieved from the matching TLB entry. While the V bit of the entry must be set for a valid translation to take place, it is not involved in the determination of a matching TLB entry. Figure 4-20 illustrates the TLB address translation process. MIPS R4000 Microprocessor User's Manual...
Page 129
CPU exception register. The chapter concludes with a description of each exception’s cause, together with the manner in which the CPU processes and services these exceptions. For information about Floating-Point Unit exceptions, see Chapter 7. MIPS R4000 Microprocessor User's Manual...
For a description of the exception handling process, see the description of the individual exception contained in this chapter, or the flowcharts at the end of this chapter. MIPS R4000 Microprocessor User's Manual...
CP0 registers and the TLB are not interlocked, however; there may be some delay before a value written by one instruction is available to following instructions. For more information please see Appendix F. MIPS R4000 Microprocessor User's Manual...
For a 4-Kbyte page size, this format can directly address the pair-table of 8-byte PTEs. For other page and PTE sizes, shifting and masking this value produces the appropriate address. MIPS R4000 Microprocessor User's Manual...
This register can be read or written. It can be written for diagnostic purposes or system initialization; for example, to synchronize processors. Figure 5-3 shows the format of the Count register. Count Register Count Figure 5-3 Count Register Format MIPS R4000 Microprocessor User's Manual...
For diagnostic purposes, the Compare register is a read/write register. In normal use however, the Compare register is write-only. Figure 5-4 shows the format of the Compare register. Compare Register Compare Figure 5-4 Compare Register Format MIPS R4000 Microprocessor User's Manual...
Diagnostic Status (DS) field. All bits in the DS field except TS are readable and writable. Status Register 28 27 25 24 RP FR IM7 - IM0 KSU ERL EXL IE (Cu3:.Cu0) Figure 5-5 Status Register MIPS R4000 Microprocessor User's Manual...
Page 136
TLB refill exception is used for TLB misses on kernel addresses. 32 bit 64 bit Enables 64-bit addressing and operations in Supervisor mode. The extended-addressing TLB refill exception is used for TLB misses on supervisor addresses. 32 bit 64 bit MIPS R4000 Microprocessor User's Manual...
NMI, or Cache Error exception are taken. normal error Exception Level; set by the processor when any exception other than Reset, Soft Reset, NMI, or Cache Error exception are taken. normal exception Interrupt Enable disable interrupts enables interrupts MIPS R4000 Microprocessor User's Manual...
Page 138
CE = 1; see description of the ECC register. Specifies that cache parity or ECC errors cannot cause exceptions. parity/ECC remain enabled disables parity/ECC Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
Kernel mode. Supervisor Address Space Accesses: Access to the supervisor address space is allowed when the processor is in Kernel or Supervisor mode, as described above in the section above titled, Operating Modes. MIPS R4000 Microprocessor User's Manual...
Coprocessor unit number referenced when a Coprocessor Unusable exception is taken. Indicates an interrupt is pending. interrupt pending no interrupt ExcCode Exception code field (see Table 5-6) Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
The processor does not write to the EPC register when the EXL bit in the Status register is set to a 1. Figure 5-8 shows the format of the EPC register. EPC Register 32-bit Mode 64-bit Mode Figure 5-8 EPC Register Format MIPS R4000 Microprocessor User's Manual...
CPU Exception Processing WatchLo (18) and WatchHi (19) Registers R4000 processors provide a debugging feature to detect references to a selected physical address; load and store operations to the location specified by the WatchLo and WatchHi registers cause a Watch exception (described later in this chapter).
The Page Table Entry Base read/write field is normally written with a value PTEBase that allows the operating system to use the Context register as a pointer into the current PTE array in memory. MIPS R4000 Microprocessor User's Manual...
An 8-bit field specifying the ECC bits read from or written to a secondary cache, or the even byte parity bits to be read from or written to a primary cache. Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
Table 5-10 CacheErr Register Fields Field Description Type of reference instruction data Cache level of the error primary secondary Indicates if a data field error occurred no error error Indicates if a tag field error occurred no error error MIPS R4000 Microprocessor User's Manual...
Page 147
Bits vAddr(14:12) of the doubleword in error (used with SIdx to construct PIdx a virtual index for the primary caches). Reserved. Must be written as zeroes, and returns zeroes when read. MIPS R4000 Microprocessor User's Manual...
There is no branch delay slot indication for the ErrorEPC register. Figure 5-13 shows the format of the ErrorEPC register. ErrorEPC Register 32-bit ErrorEPC Mode 64-bit ErrorEPC Mode Figure 5-13 ErrorEPC Register Format MIPS R4000 Microprocessor User's Manual...
Returning from an exception, also resets the EXL bit to 0 (see the ERET instruction in Appendix A). In the following sections, sample hardware processes for various exceptions are shown, together with the servicing required by the handler (software). MIPS R4000 Microprocessor User's Manual...
Watch Virtual Coherency –– Data access Bus error –– Data access Interrupt (lowest priority) Generally speaking, the exceptions described in the following sections are handled (“processed”) by hardware; these exceptions are then serviced by software. MIPS R4000 Microprocessor User's Manual...
• performing diagnostic tests • bootstrapping the operating system † In the following sections—indeed, throughout this book—a signal followed by an asterisk, such as Reset*, is low active. MIPS R4000 Microprocessor User's Manual...
† In this book, a Soft Reset exception caused by assertion of the Reset* signal is referred to as a “soft reset” or “warm reset.” A Soft Reset exception caused by a nonmaskable interrupt (NMI) is referred to as a “nonmaskable interrupt exception.” MIPS R4000 Microprocessor User's Manual...
Page 156
It is not normally possible to continue program execution after returning from this exception, since a Reset* signal can be accepted anytime and an NMI can occur in the midst of another error exception. MIPS R4000 Microprocessor User's Manual...
Address Error exception processing is shown in Figure 5-17. Servicing The process executing at the time is handed a UNIX SIGSEGV (segmentation violation) signal. This error is usually fatal to the process incurring the exception. MIPS R4000 Microprocessor User's Manual...
TLB Modified occurs when a store operation virtual address reference to memory matches a TLB entry which is marked valid but is not dirty (the entry is not writable). The following three sections describe these TLB exceptions. MIPS R4000 Microprocessor User's Manual...
TLB. This condition is processed by allowing a TLB refill exception in the TLB refill handler. This second exception goes to the common exception vector because the EXL bit of the Status register is set. MIPS R4000 Microprocessor User's Manual...
(for example, to maintain a reference bit) After servicing the cause of a TLB Invalid exception, the TLB entry is located with TLBP (TLB Probe), and replaced by an entry with that entry’s Valid bit set. MIPS R4000 Microprocessor User's Manual...
TLB entry that must be altered into the Index register. The EntryLo register is loaded with a word containing the physical page frame and access control bits (with the D bit set), and the EntryHi and EntryLo registers are written into the TLB. MIPS R4000 Microprocessor User's Manual...
Cache Error exception because error detection is disabled while ERL = 1, so the handler should avoid actions which might cause an unnoticed cache error. The R4400 (but not R4000) implements the EW bit in the CacheErr register to record a nonrecoverable error occurring while ERL = 1.
Software can avoid the cost of this exception by using consistent virtual primary cache indexes to access the same physical data. † When a cache miss occurs, the processor refills the primary cache line at the present virtual index before taking an exception. MIPS R4000 Microprocessor User's Manual...
The virtual address of the load and store reference can then be obtained by interpreting the instruction. The physical address can be obtained by using the TLBP instruction and reading the EntryLo register to compute MIPS R4000 Microprocessor User's Manual...
The process executing at the time of the exception is handed a UNIX SIGFPE/FPE_INTOVF_TRAP (floating-point exception/integer overflow) signal. This error is usually fatal to the current process. † See Appendix A for a description of these instructions. MIPS R4000 Microprocessor User's Manual...
Servicing The process executing at the time of a Trap exception is handed a UNIX SIGFPE/FPE_INTOVF_TRAP (floating-point exception/integer overflow) signal. This error is usually fatal. † See Appendix A for a description of these instructions. MIPS R4000 Microprocessor User's Manual...
4 to the EPC register (EPC register + 4) before returning. If a SYSCALL instruction is in a branch delay slot, a more complicated algorithm, beyond the scope of this description, may be required. MIPS R4000 Microprocessor User's Manual...
4 to the EPC register (EPC register + 4) before returning. If a BREAK instruction is in a branch delay slot, interpretation of the branch instruction is required to resume execution. MIPS R4000 Microprocessor User's Manual...
Servicing No instructions in the MIPS ISA are currently interpreted. The process executing at the time of this exception is handed a UNIX SIGILL/ ILL_RESOP_FAULT (illegal instruction/reserved operand fault) signal. This error is usually fatal. MIPS R4000 Microprocessor User's Manual...
• If the process is not entitled access to the coprocessor, the process executing at the time is handed a UNIX SIGILL/ ILL_PRIVIN_FAULT (illegal instruction/privileged instruction fault) signal. This error is usually fatal. MIPS R4000 Microprocessor User's Manual...
This exception is cleared by clearing the appropriate bit in the Floating- Point Control/Status register. For an unimplemented instruction exception, the kernel should emulate the instruction; for other exceptions, the kernel should pass the exception to the user program that caused the exception. MIPS R4000 Microprocessor User's Manual...
To continue, the Watch exception must be disabled to execute the faulting instruction. The Watch exception must then be reenabled. The faulting instruction can be executed either by interpretation or by setting breakpoints. MIPS R4000 Microprocessor User's Manual...
(SW1 or SW0), the interrupt condition is cleared by setting the corresponding Cause register bit to 0. If the interrupt is hardware-generated, the interrupt condition is cleared by correcting the condition causing the interrupt pin to be asserted. MIPS R4000 Microprocessor User's Manual...
• reset, soft reset and NMI exceptions, and a guideline to their handler. Generally speaking, the exceptions are handled by hardware (HW); the exceptions are then serviced by software (SW). MIPS R4000 Microprocessor User's Manual...
Page 175
& interrupt disabled (normal) =1 (bootstrap) PC <- 0xFFFF FFFF 8000 0000 + 180 PC <- 0xFFFF FFFF BFC0 0200 + 180 (unmapped, cached) (unmapped, uncached) To General Exception Servicing Guidelines Figure 5-18 General Exception Handler (HW) MIPS R4000 Microprocessor User's Manual...
Page 176
Jump Instruction * Processor does not execute the instruction which is ERET in the ERET’s branch delay slot * PC <- EPC; EXL <- 0 * LLbit <- 0 Figure 5-19 General Exception Servicing Guidelines (SW) MIPS R4000 Microprocessor User's Manual...
Page 177
(SR bit 22) PC <- 0xFFFF FFFF 8000 0000 + Vec.Off. PC <- 0xFFFF FFFF BFC0 0200 + Vec.Off. (unmapped, cached) (unmapped, uncached) To TLB/XTLB Exception Servicing Guidelines Figure 5-20 TLB/XTLB Miss Exception Handler (HW) MIPS R4000 Microprocessor User's Manual...
Page 178
Jump Instruction * Processor does not execute the instruction which is ERET in the ERET’s branch delay slot * PC <- EPC; EXL <- 0 * LLbit <- 0 Figure 5-21 TLB/XTLB Exception Servicing Guidelines (SW) MIPS R4000 Microprocessor User's Manual...
Page 179
* Processor does not execute the instruction which is in the ERET’s branch delay slot ERET * PC <- ErrorEPC; ERL <- 0 * LLbit <- 0 Figure 5-22 Cache Error Exception Handling (HW) and Servicing Guidelines (SW) MIPS R4000 Microprocessor User's Manual...
Page 180
Status bit 20 NMI Service Code (SR) Soft Reset Service Code Reset Service Code (Optional) ERET Figure 5-23 Reset, Soft Reset & NMI Exception Handling (HW) and Servicing Guidelines (SW) MIPS R4000 Microprocessor User's Manual...
Page 181
The FPU, with associated system software, fully conforms to the requirements of ANSI/IEEE Standard 754–1985, IEEE Standard for Binary Floating-Point Arithmetic. In addition, the MIPS architecture fully supports the recommendations of the standard and precise exceptions. MIPS R4000 Microprocessor User's Manual...
floating-point and fixed-point instruction sets. Since each unit receives and executes instructions in parallel, some floating-point instructions can execute at the same single-cycle- per-instruction rate as fixed-point instructions. MIPS R4000 Microprocessor User's Manual...
FPRs), each of which is 64-bits wide, when the FR bit in the CPU Status register equals 1. The FPRs hold values in either single- or double-precision floating-point format. Each FPR corresponds to an FGR as shown in Figure 6-2. MIPS R4000 Microprocessor User's Manual...
If the FR bit equals 0 during a double-precision floating-point operation, the general registers are accessed in double pairs. Thus, in a double- precision operation, selecting Floating-Point Register 0 (FPR0) actually addresses adjacent Floating-Point General Purpose registers FGR0 and FGR1. MIPS R4000 Microprocessor User's Manual...
FCR1 to FCR30 are reserved. Table 6-1 lists the assignments of the FCRs. Table 6-1 Floating-Point Control Register Assignments FCR Number FCR0 Coprocessor implementation and revision register FCR1 to FCR30 Reserved FCR31 Rounding mode, cause, trap enables, and flags MIPS R4000 Microprocessor User's Manual...
For this reason revision number values are not listed, and software should not rely on the revision number to characterize the chip. MIPS R4000 Microprocessor User's Manual...
Cause, Flag, and Enable bits. Flag bits. See Figure 6-5 and the description of Control/Status register Flags Cause, Flag, and Enable bits. Rounding mode bits. See Table 6-4 and the description of Control/Status register Rounding Mode Control bits. MIPS R4000 Microprocessor User's Manual...
Move Control To Coprocessor 1 (CTC1) instruction. FCR31 must only be written to when the FPU is not actively executing floating-point operations; this can be ensured by reading the contents of the register to empty the pipeline. MIPS R4000 Microprocessor User's Manual...
The Unimplemented Operation (E) bit is set to a 1 if software emulation is required, otherwise it remains 0. The other bits are set to 0 or 1 to indicate the occurrence or non-occurrence (respectively) of an IEEE 754 exception. MIPS R4000 Microprocessor User's Manual...
Page 192
Status register, using a Move To Coprocessor Control instruction. When a floating-point exception is taken, the flag bits are not set by the hardware; floating-point exception software is responsible for setting these bits before invoking a user handler. MIPS R4000 Microprocessor User's Manual...
Round toward + : round to value closest to and not less than the infinitely precise result. Round toward – : round to value closest to and not greater than the infinitely precise result. MIPS R4000 Microprocessor User's Manual...
• -1 (to encode 0 and denormalized numbers) • +1 (to encode and NaNs [Not a Number]) For single- and double-precision formats, each representable nonzero numerical value has just one encoding. MIPS R4000 Microprocessor User's Manual...
Page 195
Table 6-6 Floating-Point Format Parameter Values Format Parameter Single Double +127 +1023 –126 –1022 Exponent bias +127 +1023 Exponent width in bits Integer bit hidden hidden f (Fraction width in bits) Format width in bits MIPS R4000 Microprocessor User's Manual...
Sign Integer Figure 6-8 Binary Fixed-Point Format Field assignments of the binary fixed-point format are: Table 6-8 Binary Fixed-Point Format Fields Field Description sign sign bit integer integer value MIPS R4000 Microprocessor User's Manual...
Store Doubleword From FPU MTC1 Move Word To FPU MFC1 Move Word From FPU CTC1 Move Control Word To FPU CFC1 Move Control Word From FPU DMTC1 Doubleword Move To FPU DMFC1 Doubleword Move From FPU MIPS R4000 Microprocessor User's Manual...
Page 198
Table 6-12 FPU Instruction Summary: Compare and Branch Instructions OpCode Description C.cond.fmt Floating-point Compare BC1T Branch on FPU True BC1F Branch on FPU False BC1TL Branch on FPU True Likely BC1FL Branch on FPU False Likely MIPS R4000 Microprocessor User's Manual...
The instruction immediately following a load can use the contents of the loaded register. In such cases the hardware interlocks, requiring additional real cycles; for this reason, scheduling load delay slots is desirable, although it is not required for functional code. MIPS R4000 Microprocessor User's Manual...
Branch on FPU Condition Instructions Table 6-12 lists the Branch on FPU (coprocessor unit 1) condition instructions that can test the result of the FPU compare (C.cond) instructions. Appendix B gives a detailed description of each instruction. MIPS R4000 Microprocessor User's Manual...
Not Greater Than or Less Greater Than or Less Than Than Not Less Than Less Than Greater Than or Equal Not Greater Than or Equal Not Less Than or Equal Less Than or Equal Greater Than Not Greater Than MIPS R4000 Microprocessor User's Manual...
FPU instructions, however, require more than one cycle in the EX stage. This means the FPU must stall the pipeline if an instruction execution cannot proceed because of register or resource conflicts. Figure 6-10 illustrates the effect of a three-cycle stall on the FPU pipeline. MIPS R4000 Microprocessor User's Manual...
Table 6-14 gives the minimum latency, in processor pipeline cycles, of each floating-point operation for the currently implemented configurations. These latency calculations assume the result of the operation is immediately used in a succeeding operation. MIPS R4000 Microprocessor User's Manual...
Page 209
– – – – – – – – – † While there is no resource conflict in issuing this CMP.[S,D] instruction, the hardware does not allow it. Figure 6-17 MUL.S and CMP.[S,D] Cleanup Cycle Conflict in FPU Adder MIPS R4000 Microprocessor User's Manual...
The multiplier is either idle, or in its second-to-last execution cycle. Idle means an operation unit—adder, multiplier or divider—is either not processing any instruction, or is currently in its last execution cycle completing an instruction. MIPS R4000 Microprocessor User's Manual...
Page 213
- idle, or in its second-to-last execution cycle. - in the first 8 execution cycles (EX...EX+7) of a DIV.S - in the first 21 execution cycles, except for the second execution cycle, (cycles EX, EX+2...EX+20) of a DIV.D) MIPS R4000 Microprocessor User's Manual...
Page 214
The divider is one of the following: - idle, or in its second-to-last execution cycle. - in the third through eighth execution cycle (EX+2...EX+7) of a DIV.S - in the third through twenty-first execution cycle (EX+2...EX+20) of a DIV.D MIPS R4000 Microprocessor User's Manual...
Page 215
The divider is one of the following: - idle, or in its second-to-last execution cycle. - in the third through eighth execution cycle (EX+2...EX+7) of a DIV.S - in the third through twenty-first execution cycle (EX+2...EX+20) of a DIV.D MIPS R4000 Microprocessor User's Manual...
A floating-point exception occurs whenever the FPU cannot handle either the operands or the results of a floating-point operation in its normal way. The FPU responds by generating an exception to initiate a software trap or by setting a status flag. MIPS R4000 Microprocessor User's Manual...
The Unimplemented Operation exception has no Enable or Flag bit; whenever this exception occurs, an unimplemented exception trap is taken (if the FPU interrupt input to the CPU is enabled). Figure 7-1 illustrates the Control/Status register bits that support exceptions. MIPS R4000 Microprocessor User's Manual...
Floating-Point Exception (FPE) code is used, and the Cause bits of the floating-point Control/Status register indicate the reason for the floating- point exception. These bits are, in effect, an extension of the system coprocessor Cause register. MIPS R4000 Microprocessor User's Manual...
+ Modify positive overflows to the format’s largest finite number; modify negative overflows to – Division by Supply a properly signed zero Invalid Supply a quiet Not a Number (NaN) operation MIPS R4000 Microprocessor User's Manual...
Page 221
‡ Exponent underflow sets the U and I Cause bits if both the U and I Enable bits are not set and the FS bit is set; otherwise exponent underflow sets the E Cause bit. MIPS R4000 Microprocessor User's Manual...
Trap Enabled Results: If Inexact exception traps are enabled, the result register is not modified and the source registers are preserved. Trap Disabled Results: The rounded or overflowed result is delivered to the destination register if no other software trap occurs. MIPS R4000 Microprocessor User's Manual...
(–5) or cos–1(3). Refer to Appendix B for examples or for routines to handle these cases. Trap Enabled Results: The original operand values are undisturbed. Trap Disabled Results: A quiet NaN is delivered to the destination register if no other software trap occurs. MIPS R4000 Microprocessor User's Manual...
Trap Enabled Results: The result register is not modified, and the source registers are preserved. Trap Disabled Results: The result, when no trap occurs, is determined by the rounding mode and the sign of the intermediate result (as listed in Table 7-1). MIPS R4000 Microprocessor User's Manual...
Trap Disabled Results: If Underflow and Inexact traps are not enabled and the FS bit is set, the result is determined by the rounding mode and the sign of the intermediate result (as listed in Table 7-1). MIPS R4000 Microprocessor User's Manual...
IEEE Standard 754. Trap Enabled Results: The original operand values are undisturbed. Trap Disabled Results: This trap cannot be disabled. MIPS R4000 Microprocessor User's Manual...
If an exception is possible, the FPU executes the instruction in stall mode to ensure that no more than one instruction (that might cause an exception) is executed at a time. MIPS R4000 Microprocessor User's Manual...
The IEEE Standard 754 recommends that, if enabled, the overflow and underflow traps take precedence over a separate inexact trap. This prioritization is accomplished in software; hardware sets the bits for both the Inexact exception and the Overflow or Underflow exception. MIPS R4000 Microprocessor User's Manual...
R4000 Processor Signal Descriptions This chapter describes the signals used by and in conjunction with the R4000 processor. The signals include the System interface, the Clock/ Control interface, the Secondary Cache interface, the Interrupt interface, the Joint Test Action Group (JTAG) interface, and the Initialization interface.
Page 230
ColdReset* Fault* Reset* VccP VssP Status(7:0) JTDI VccSense JTDO VssSense JTMS JTCK (1) = R4000SC and R4000MC only (2) = R4000PC only (3) = R4000MC only (4) = R4400 only Figure 8-1 R4000 Processor Signals MIPS R4000 Microprocessor User's Manual...
R4000 Processor Signal Descriptions 8.1 System Interface Signals System interface signals provide the connection between the R4000 processor and the other components in the system. IvdAck* and IvdErr* signals are applicable only on R4000MC; on the R4000SC they must be tied to Vcc.
Page 232
WrRdy* when it can accept WrRdy* a processor write request. †. The SysADC(7:0) bits map to the SysAD bus in this manner: SysADC(7) covers SysAD(63:56), SysADC(6) covers SysAD(55:48), and so on down to SysADC(0), which covers SysAD(7:0). MIPS R4000 Microprocessor User's Manual...
TClock(1:0) Transmit clocks Output that establish the System interface frequency. The processor asserts Fault* to indicate a mismatch output of Fault* Fault Output boundary comparators, and indication of System interface input parity or ECC errors. MIPS R4000 Microprocessor User's Manual...
Page 234
Vss node to a package pin Input/ without having to connect to the VssSense Vss sense Output in-package ground planes. VssSense should be connected to Vss in functional system designs. MIPS R4000 Microprocessor User's Manual...
R4000 Processor Signal Descriptions 8.3 Secondary Cache Interface Signals Secondary Cache interface signals constitute the interface between the R4000 processor and secondary cache. These signals are available only on the R4000MC and R4000SC. Table 8-3 lists the Secondary Cache interface signals.
Page 236
RAM. Secondary cache Write enable for the secondary SCWrY* Output write enable cache data and tag RAM. Secondary cache Write enable for the secondary SCWrZ* Output write enable cache data and tag RAM. MIPS R4000 Microprocessor User's Manual...
8.4 Interrupt Interface Signals The Interrupt interface signals make up the interface used by external agents to interrupt the R4000 processor. Int*(5:1) are available only on the R4000PC; Int*(0) and NMI* are available on all three configurations. Table 8-4 lists the Interrupt interface signals.
The assertion of VCCOk initiates the initialization sequence. †. A warm reset restarts processor, but does not affect clocks; it preserves the processor in- ternal state. A description of warm reset is given in Chapter 9. MIPS R4000 Microprocessor User's Manual...
System command/data identifier bus SysCmd(8:0) High System command/data identifier bus parity SysCmdP High Valid input ValidIn* Valid output ValidOut* External request ExtRqst* Release interface Release* Read ready RdRdy* Write ready WrRdy* Invalidate acknowledge IvdAck* Invalidate error IvdErr* MIPS R4000 Microprocessor User's Manual...
Page 240
IOIn High Vcc is OK VCCOk High Cold reset ColdReset* Reset Reset* Fault Fault* Quiet Vcc for PLL VccP High Quiet Vss for PLL VssP High Status Status(7:0) High Vcc sense VccSense Vss sense VssSense MIPS R4000 Microprocessor User's Manual...
Page 241
Receive clocks RClock(1:0) High Master clock MasterClock High Master clock out MasterOut High Synchronization clock out SyncOut High Synchronization clock in SyncIn High I/O output IOOut High I/O input IOIn High Vcc is OK VCCOk High MIPS R4000 Microprocessor User's Manual...
Page 242
Chapter 8 Table 8-8 (cont.) R4000PC Processor Signal Summary Asserted Description Name 3-State State Cold reset ColdReset* Reset Reset* Fault Fault* Quiet Vcc for PLL VccP High Quiet Vss for PLL VssP High MIPS R4000 Microprocessor User's Manual...
Initialization Interface This chapter describes the R4000 Initialization interface. This includes the reset signal description and types, initialization sequence, with signals and timing dependencies, and boot modes, which are set at initialization time. Signal names are listed in bold letters—for instance the signal VCCOk indicates +5 voltage is stable.
Chapter 9 9.1 Functional Overview The R4000 processor has the following three types of resets; they use the VCCOk, ColdReset*, and Reset* input signals. • Power-on reset: starts when the power supply is turned on and completely reinitializes the internal state machine of the processor without saving any state information.
† Asserted means the signal is true, or in its valid state. For example, the low-active Reset* signal is said to be asserted when it is in a low (true) state; the high-active VCCOk signal is true when it is asserted high. MIPS R4000 Microprocessor User's Manual...
64 MasterClock cycles after the deassertion of ColdReset*.) Reset* must be deasserted synchronously with MasterClock. NOTE: ColdReset* must be asserted when VCCOk asserts. The behavior of the processor is undefined if VCCOk asserts while ColdReset* is deasserted. MIPS R4000 Microprocessor User's Manual...
† Since MasterOut is undefined until after the serial PROM is read, reset logic must not depend on MasterOut before the boot PROM is read. MIPS R4000 Microprocessor User's Manual...
ModeClock. The processor samples 256 initialization bits from the ModeIn input. Figures 9-1, 9-2, and 9-3 on the next three pages show the timing diagrams for the power-on, warm, and cold resets. MIPS R4000 Microprocessor User's Manual...
Page 249
Power-on Reset (POR) 5.25V 4.75V Wavy lines indicate one or more identical cycles, not shown due to space constraints MasterClock (MClk) > 100ms VCCOK MClk 256 MClk cycles cycles ModeClock TMDS TMDH Bit 0 Bit 1 ModeIn > 64K MClk cycles* ColdReset* >...
Page 250
Cold Reset Wavy lines indicate one or more identical cycles, not shown due to space constraints MasterClock (MClk) > 64 MClk cycles VCCOK MClk MClk 256 MClk cycles 256 MClk cycles cycles cycles ModeClock TMDS TMDH Bit 1 Bit 0 ModeIn >...
No secondary cache present SysPort: System Interface port width, bit 6 most significant 64 bits Reserved SC64BitMd: Secondary cache interface port width 128 bits Reserved EISpltMd: Specifies secondary cache organization Secondary cache unified Secondary cache split MIPS R4000 Microprocessor User's Manual...
Page 253
Otherwise, only compulsory updates are issued Potential updates enabled Potential updates disabled TWrSUp: Secondary cache write deassertion delay, T in PCycles, bit WrSup 24 most significant 21:24 Undefined 3-15 Number of PClock cycles: Min 3, Max 15 MIPS R4000 Microprocessor User's Manual...
Page 254
NoMPmode off: after a secondary cache miss, the existing valid cache line is invalidated (following writeback if necessary) NoMPmode on: after a secondary cache miss, the existing valid cache line is not invalidated. Available on the R4000SC and R4400SC, to improve performance. MIPS R4000 Microprocessor User's Manual...
Page 255
Secondary Cache Master (SCMaster, paired with SIMaster) 43:45 Reserved Pkg179: R4000 Processor Package type Large (447 pin) Small (179 pin) CycDivisor: This mode determines the clock divisor for the reduced power mode. When the RP bit in the Status register is set to 1, the pipeline clock is divided by one of the following values.
Page 256
RClock, TClock, SClock, and the internal clocks. Enable PLLs Disable PLLs SRTristate: Controls when output-only pins are tristated Only when ColdReset* is asserted When Reset* or ColdReset* are asserted 65:255 Reserved. Scan in zeros. MIPS R4000 Microprocessor User's Manual...
Clock Interface This chapter describes the clock signals (“clocks”) used in the R4000 processor and the processor status reporting mechanism. The subject matter includes basic system clocks, system timing parameters, connecting clocks to a phase-locked system, connecting clocks to a system without phase locking, and processor status outputs.
(clock) to the output of the device (Q). Figures 10-1 and 10-2 illustrate these terms. single clock cycle high-to-low transition low-to-high transition Figure 10-1 Signal Transitions data out data in clock input Clock-to-Q delay Figure 10-2 Clock-to-Q Delay MIPS R4000 Microprocessor User's Manual...
Clock Interface 10.2 Basic System Clocks The various clock signals used in the R4000 processor are described below, starting with MasterClock, upon which the processor bases all internal and external clocking. MasterClock The processor bases all internal and external clocking on the single MasterClock input signal.
Chapter 10 SClock The R4000 processor divides PClock by 2, 3, or 4 (as programmed at boot- mode initialization) to generate the internal clock signal, SClock. The R4400 processor divides PClock by 2, 3, 4, 6 or 8 (as programmed at boot- mode initialization) to generate SClock.
Clocks generated using PLL circuits contain some inherent inaccuracy, or jitter; a clock aligned with MasterClock by the PLL can lead or trail MasterClock by as much as the related maximum jitter allowed by the individual vendor. MIPS R4000 Microprocessor User's Manual...
(Clock Jitter for A Max) – (Clock Jitter for B Max) Figure 10-5 shows a block-level diagram of a phase-locked system using the R4000 processor. MasterClock External Agent R4000 MasterClock MasterClock SysCmd SysCmd SysAD SysAD SyncOut SyncIn RClock TClock Figure 10-5 R4000 Processor Phase-Locked System MIPS R4000 Microprocessor User's Manual...
Clock Interface 10.5 Connecting Clocks to a System without Phase Locking When the R4000 processor is used in a system in which the external agent cannot lock its phase to a common MasterClock, the output clocks RClock and TClock can clock the remainder of the system. Two clocking methodologies are described in this section: connecting to a gate-array device or connecting to discrete CMOS logic devices.
Page 266
Chapter 10 Sampling Staging Register Register Gate Array MasterClock R4000 MasterClock SysCmd SysAD SyncOut SyncIn RClock TClock Sampling Staging Register Register Figure 10-6 Gate-Array System without Phase Lock, using the R4000 Processor MIPS R4000 Microprocessor User's Manual...
Page 267
R4000) + (Minimum External Clock Buffer Delay) – (External Sample Register Setup Time) – (Maximum Clock Jitter for R4000 Internal Clocks) – (Maximum Clock Jitter for RClock) The transmission time for a signal from an external agent composed of gate...
– (Maximum Clock Jitter for TClock) Figure 10-7 is a block diagram of a system without phase lock, employing the R4000 processor and an external agent composed of both a gate array and discrete CMOS logic devices. MIPS R4000 Microprocessor User's Manual...
Page 269
Clock Interface MasterClock R4000 MasterClock SysCmd Control SysAD Gate Array SyncOut SyncIn RClock TClock Sample Registers Memory Memory Figure 10-7 Gate Array and CMOS System without Phase Lock, using the R4000 Processor MIPS R4000 Microprocessor User's Manual...
Page 270
– (Maximum External Output Register Clock-to-Q Delay) – (Maximum External Clock Buffer Delay Mismatch) – (Maximum Clock Jitter for R4000 Internal Clocks) – (Maximum Clock Jitter for TClock) In this clocking methodology, the hold time of data driven from the processor to an external sampling register is a critical parameter.
The Status(7:0) bits are treated as two fields, as follows: • The Status(7:4) field indicates the internal status of the processor during PCycle T-3. • The Status(3:0) bits indicate the internal status of the processor during the PCycle T-2. MIPS R4000 Microprocessor User's Manual...
Page 272
Secondary cache stall Other floating-point instruction (not load, store, or Run cycle conditional branch) Run cycle Instruction killed by branch, jump, or ERET Run cycle Instruction killed by exception Run cycle Floating-point instruction killed by slip MIPS R4000 Microprocessor User's Manual...
Page 273
Cache Organization, Operation, and Coherency This chapter describes in detail the cache memory: its place in the R4000 memory organization, individual operations of the primary and secondary caches, cache interactions, and an example of a cache coherency request cycle. The chapter concludes with a description of R4000 processor synchronization in a multiprocessor environment.
Chapter 11 11.1 Memory Organization Figure 11-1 shows the R4000 system memory hierarchy. In the logical memory hierarchy, caches lie between the CPU and main memory. They are designed to make the speedup of memory accesses transparent to the user. Each functional block in Figure 11-1 has the capacity to hold more data than the block above it.
The R4000 processor has two on-chip primary caches: one holds instructions (the instruction cache), the other holds data (the data cache). Off-chip, the R4000 processor supports a secondary cache on the R4000SC and MC models. 11.2 Overview of Cache Operations As described earlier, caches provide fast temporary data storage, and they make the speedup of memory accesses transparent to the user.
11.3 R4000 Cache Description As Figure 11-1 shows, the R4000 contains separate primary instruction and data caches. Figure 11-1 also shows that the R4000 supports a secondary cache that can be split into separate portions, one portion containing data and the other portion containing instructions, or it can be a joint cache, holding combined instructions and data.
Page 277
Caches D-cache Primary and Secondary Cache R4000SC/MC Main Memory Cache Controller I-cache Primary Caches D-cache I-cache primary instruction cache Secondary Cache D-cache primary data cache Figure 11-2 Cache Support in the R4000PC, R4000SC, and R4000MC MIPS R4000 Microprocessor User's Manual...
The primary instruction and data caches are indexed with a virtual address (VA), while the secondary cache is indexed with a physical address (PA). † Primary and secondary cache tags are described in the following sections. MIPS R4000 Microprocessor User's Manual...
26-bit tag that contains a 24-bit physical address, a single valid bit, and a single parity bit. Byte parity is used on I-cache data. The R4000 processor primary I-cache has the following characteristics: • direct-mapped •...
24-bit physical address, 2-bit cache line state, a write-back bit, a parity bit for the physical address and cache state fields, and a parity bit for the write-back bit. Byte parity is used on D-cache data. The R4000 processor primary D-cache has the following characteristics: • write-back •...
Cache Organization, Operation, and Coherency In all R4000 processors, the W (write-back) bit, not the cache state, indicates whether or not the primary cache contains modified data that must be written back to memory or to the secondary cache. Accessing the Primary Caches Figure 11-5 shows the virtual address (VA) index into the primary caches.
I- and D-caches. Figure 11-6 shows the format of the R4000 processor secondary-cache line. The size of the secondary cache line is set in the SB field of the Config register.
Page 283
Cache Organization, Operation, and Coherency The R4000 processor secondary cache has the following characteristics: • write-back • direct-mapped • indexed with a physical address • checked with a physical tag • organized with either a 4-word (16-byte), 8-word (32-byte), 16-word (64-byte), or 32-word (128-byte) cache line.
PA(21:n*) PIdx *n = 4 for 4-word lines n = 5 for 8-word lines n = 6 for 16-word lines n = 7 for 32-word lines Data Figure 11-7 Secondary Cache Data and Tag Organization MIPS R4000 Microprocessor User's Manual...
Shared: a cache line that is present in more than one cache in the system. Each primary and secondary cache line in the R4000 system is in one of the states described in Table 11-3. Table 11-3 also lists with the types of cache and the R4000 models in which the various states may be found.
Each primary instruction cache line is in one of the following states: • invalid • valid Secondary Cache States Each secondary cache line is in one of the following states: • invalid • shared • dirty shared • clean exclusive • dirty exclusive MIPS R4000 Microprocessor User's Manual...
R4000PC Invalid State Invalid State Invalid State Dirty Exclusive State Clean Exclusive State Clean Exclusive State Dirty Exclusive State Dirty Exclusive State Shared State Figure 11-8 Primary Cache States Available to Each Type of Processor MIPS R4000 Microprocessor User's Manual...
(Chapter 12 defines external agent). • Memory always owns clean cache lines. • The processor gives up ownership of a cache line when the state of the cache line changes to invalid, shared, or clean exclusive. MIPS R4000 Microprocessor User's Manual...
(see the section titled Cache Coherency Overview later in this chapter). In the R4000 system, when the content of a cache line is inconsistent with memory, it is classified as dirty and is written back to memory according to the rules of the cache write-back policy.
• A store to a dirty exclusive line remains in a dirty exclusive state. These state diagrams do not cover the initial state of the system since the initial state is system dependent. MIPS R4000 Microprocessor User's Manual...
Page 291
Bus read [intervention] Figure 11-9 Primary Data Cache State Diagram If the system is in no-secondary-cache mode, the cache state provided by the system is ignored, and the primary data cache state is set to dirty exclusive. MIPS R4000 Microprocessor User's Manual...
Page 292
Update received Write hit Write hit [invalidate] Bus read [intervention] Write hit [update], Read hit Dirty Write hit [invalidate] Dirty Read hit, Write hit Exclusive Shared Bus read [intervention] Figure 11-10 Secondary Cache State Diagram MIPS R4000 Microprocessor User's Manual...
Page 293
For case 1, if the refill occurs on a store miss, the processor changes the cache line state to dirty exclusive. For each of the remaining cases listed above, the R4000 processor passes the state received from the external agent to the secondary cache.
† A coherent read that requests exclusivity implies that the processor functions most efficiently if the requested cache line is returned to it in an exclusive state, but the processor still performs correctly if the cache line is returned in a shared state. MIPS R4000 Microprocessor User's Manual...
Cache Operation Modes The R4000 processor supports the following two cache modes: • secondary-cache mode (R4000MC and R4000SC models; for R4000MC all five cache coherency attributes described above...
X precedes the store to location Y, or vice versa. If this global ordering is enforced, the test algorithm for strong ordering succeeds. MIPS R4000 Microprocessor User's Manual...
If either IvdAck* or IvdErr* is asserted during or after the first cycle that the external agent asserts ExtRqst*, the processor accepts the external request and completes any cache state changes associated with the external request before restarting. † That is, present but not yet executed. MIPS R4000 Microprocessor User's Manual...
Set the primary data cache state to Dirty Exclusive None Dirty Exclusive. † Dirty Exclusive Dirty Exclusive None None † The dirty exclusive primary state allows the primary cache to be written without a secondary access. MIPS R4000 Microprocessor User's Manual...
In such a case, the processor simply discards any external coherency requests that conflict with a pending processor coherent read request. MIPS R4000 Microprocessor User's Manual...
Processor potential update requests cannot be cancelled. Potential updates are always issued with processor read requests and become compulsory only after the response to the processor read request is returned in one of the shared states. MIPS R4000 Microprocessor User's Manual...
Invalidate or Update Unacknowledged: a processor invalidate or update request has been issued but has not yet been acknowl- edged. By definition, no coherent read request is pending. MIPS R4000 Microprocessor User's Manual...
The constraints that the processor must place on the handling of coherency conflicts have certain implications on the design of a multiprocessor system using the R4000MC model. These constraints and their implications are described in this section. MIPS R4000 Microprocessor User's Manual...
• The secondary cache states used are invalid, shared, clean exclusive, and dirty exclusive; the dirty shared secondary cache state is not allowed. MIPS R4000 Microprocessor User's Manual...
Page 307
S-cache Figure 11-12 4-Processor System Illustrating Coherency Transactions Given this system model, the following operations are described: • loads and stores • processor coherent read request and read response • processor invalidate • processor write MIPS R4000 Microprocessor User's Manual...
These are described in the following sections. † The shared indication is the result of an intervention request to another processor, and is supplied by an external agent that is a part of the other three processor subsystems. MIPS R4000 Microprocessor User's Manual...
Processor Write In this system model, an external agent takes no action in response to a write request on the bus. MIPS R4000 Microprocessor User's Manual...
(since the targeted cache line is not present in the cache), conflict detection for processor coherent read requests is not necessary. MIPS R4000 Microprocessor User's Manual...
It is not possible for an invalidate request, or a write request that conflicts with a waiting processor write request, to appear on the system bus; before a processor write request can be issued, the state of the processor cache line must be set to dirty exclusive. MIPS R4000 Microprocessor User's Manual...
It is not possible for a write request that conflicts with a waiting processor invalidate request to appear on the system bus. To issue an invalidate request, the state of the cache line must be shared with every cache in the system that contains the line. MIPS R4000 Microprocessor User's Manual...
Agent A (E Agent B (E Processor Processor A (P B (P Secondary Secondary Cache A (S Cache B (S Figure 11-13 Cache Load Miss Cycle: Coherent Read Request † Request Cycles are described in Chapter 12. MIPS R4000 Microprocessor User's Manual...
Page 314
In Figure 11-14 the retrieved data is in the dirty exclusive state (DE), servicing a load miss, when the state of cache line S goes from dirty † exclusive to dirty shared (DS), indicating P is owner of the line. † Assuming DS mode is enabled. MIPS R4000 Microprocessor User's Manual...
Page 315
Figure 11-15 shows the cache state and cache data returned from P through E to the bus. This cache state and data are returned to E 10. E issues a read response to P 11. P remains owner of the cache line. MIPS R4000 Microprocessor User's Manual...
Chapter 11 11.12 R4000 Processor Synchronization Support In a multiprocessor system, it is essential that two or more processors working on a common task execute without corrupting each other’s subtasks. Synchronization, an operation that guarantees an orderly access to shared memory, must be implemented for a properly functioning multiprocessor system.
Page 317
If the processor is successful at setting the semaphore (step 4), it executes the critical section of code (step 5) and gains access to the shared data, completes its task, unlocks the semaphore (step 6), and continues processing. MIPS R4000 Microprocessor User's Manual...
† The most obvious case where the link is broken occurs when an invalidate to the cache line is the subject of the load. In this case, some other processor has successfully completed a store to that line. MIPS R4000 Microprocessor User's Manual...
This chapter describes the System interface from the point of view of both the processor and the external agent. MIPS R4000 Microprocessor User's Manual...
12.2 System Interface Description The R4000 processor supports a 64-bit address/data interface that can construct systems ranging from a simple uniprocessor with main memory to a multiprocessor system with caches and complete cache coherency.
System interface command that specifies the precise nature of the request • a series of data elements if the request is for a write, read response, or update. R4000 External Agent SysAD(63:0) SysCmd(8:0) Figure 12-1 System Interface Buses MIPS R4000 Microprocessor User's Manual...
As shown in Figure 12-2, RdRdy* must be asserted two cycles prior to the address cycle of the processor read/invalidate/update request to define the address cycle as the issue cycle. SCycle SClock Addr SysAD Bus RdRdy* Figure 12-2 State of RdRdy* Signal for Read, Invalidate, or Update Requests MIPS R4000 Microprocessor User's Manual...
Page 327
In the latter case, the processor issues the processor request (provided the processor request is still necessary) after the external request is complete. The rules governing an issue cycle again apply to the processor request. MIPS R4000 Microprocessor User's Manual...
Release* is asserted by the processor when it transfers the mastership of the System interface to the external agent. • The R4000 processor uses ValidOut* and the external agent uses ValidIn* to indicate valid command/data on the SysCmd/SysAD buses. •...
Figure 12-4 System Interface Register-to-Register Operation Master and Slave States When the R4000 processor is driving the SysAD and SysCmd buses, the System interface is in master state. When the external agent is driving the SysAD and SysCmd buses, the System interface is in slave state.
System interface from master to slave state by asserting Release* for one cycle. The System interface returns to master state as soon as the issue of the external request is complete. This process is described in External Arbitration Protocol, later in this chapter. MIPS R4000 Microprocessor User's Manual...
System interface to slave state, even though the external agent is not arbitrating to issue an external request. This transition to slave state allows the external agent to return read response data. MIPS R4000 Microprocessor User's Manual...
• Update • Null • Invalidate • Update • Snoop • Intervention System Events • Load Miss • Store Miss • Store Hit • Uncached Load/Store • CACHE operations Figure 12-5 Requests and System Events MIPS R4000 Microprocessor User's Manual...
Update request provides a block, doubleword, partial doubleword, word, or partial word of data that must be transferred to every other cache in the system. Table 12-1 lists the processor requests that each type of R4000 can issue. Table 12-1 Supported Processor Requests Request...
Page 335
WrRdy*. The processor request cycle sequence is shown in Figure 12-8. External Agent R4000 1. Processor issues read, write, invalidate, or update request 2. External system controls acceptance of requests by asserting RdRdy* or WrRdy* Figure 12-8 Processor Request MIPS R4000 Microprocessor User's Manual...
In no-secondary-cache mode, the external agent must be capable of accepting a processor read request any time the following two conditions are met: • There is no processor read request pending. • The signal RdRdy* has been asserted for two or more cycles. MIPS R4000 Microprocessor User's Manual...
In no-secondary-cache mode, the external agent must be capable of accepting a processor write request any time the following two conditions are met: • No processor read request is pending. • The signal WrRdy* has been asserted for two or more cycles. MIPS R4000 Microprocessor User's Manual...
Page 339
The processor re-examines the state of the cache line and discovers the cache line which was target of the store is now invalid. The processor issues a processor read request to service the store miss. MIPS R4000 Microprocessor User's Manual...
IvdErr* signals a processor update request has failed. Since a completion acknowledge for processor update requests is signaled through the System interface on dedicated pins, this acknowledgment can occur in parallel with processor and external requests. MIPS R4000 Microprocessor User's Manual...
Once the processor issues a read request, a potential update request follows, regardless of the state of RdRdy*. Potential update requests do not obey the RdRdy* flow control rules for issuance, but rather issue with a single address cycle regardless of the state of RdRdy*. MIPS R4000 Microprocessor User's Manual...
Page 342
WrRdy*. Any external request that changes the state of a cache line from dirty exclusive or dirty shared to clean exclusive, shared, or invalid obviates the need for a write back of that cache line. MIPS R4000 Microprocessor User's Manual...
The state of the line can also be modified by this request. MIPS R4000 Microprocessor User's Manual...
Page 344
System interface to the master state without affecting the processor. Table 12-2 lists the external requests that each type of R4000 can receive (an X indicates the request is supported on that model). Table 12-2 Supported External Requests...
Page 345
If waiting for the response to a read request after the processor has made an uncompelled change to a slave state, the external agent can issue an external request before providing the read response data. MIPS R4000 Microprocessor User's Manual...
External Update Request When an external agent issues an update request, the specified resource is accessed and the line is replaced. An external update request is considered complete after the request has been transmitted. MIPS R4000 Microprocessor User's Manual...
System interface arbitration. For this reason, read responses are handled separately from all other external requests, and are simply called read responses. R4000 External Agent 1. Read request 2. Read response Figure 12-13 Read Response MIPS R4000 Microprocessor User's Manual...
If the coherency attribute is sharable or update, the processor issues a coherent read request. • If the coherency attribute is noncoherent, the processor issues a noncoherent read request. Table 12-3 shows the actions taken on a load miss to primary and secondary caches. MIPS R4000 Microprocessor User's Manual...
Page 349
R-W ....Cluster: Processor coherent block read request with write forthcoming followed by processor block write request ..... Processor coherent block read request with exclusivity -W....Cluster: Processor coherent block read request with exclusivity and write forthcoming followed by processor block write request MIPS R4000 Microprocessor User's Manual...
If the current cache line must be written back, the processor issues a write request to save the dirty cache line in memory. † Only noncoherent and uncached attributes are supported in no-secondary-cache mode. MIPS R4000 Microprocessor User's Manual...
• If the coherency attribute is noncoherent, a noncoherent block read request is issued. Table 12-4 shows the actions taken on a store miss to primary and secondary caches. MIPS R4000 Microprocessor User's Manual...
Page 352
R-W/U ....Cluster: Processor coherent block read request with write forthcoming followed by processor block write request, followed by processor update request (if read response data is shared or dirty shared) ....Potential update disable [Modebit(20): PotUpdDis = 1] ....Potential update enable [Modebit(20): PotUpdDis = 0] MIPS R4000 Microprocessor User's Manual...
Page 354
The external agent must forward the update to the system, then signal the acknowledge to the processor when the update is complete. The processor will not complete the store until it has received an acknowledge for the update request. MIPS R4000 Microprocessor User's Manual...
In no-secondary-cache mode, if the new cache line replaces a current cache line whose Write back (W) bit is set, the current cache line moves to an internal write buffer before the new cache line is loaded in the primary cache. MIPS R4000 Microprocessor User's Manual...
R4400 processor, it is possible for the external agent to receive cached and uncached stores out of program order, as the example below illustrates. Figure 12-14 shows a cached and uncached store instruction sequence: MIPS R4000 Microprocessor User's Manual...
Load Linked Store Conditional instruction sequence maps to the same cache line to which the instruction area containing the Load Linked Store Conditional code sequence is mapped. In this case, immediately after executing the Load Linked instruction, the cache line that contains the link MIPS R4000 Microprocessor User's Manual...
Page 358
For more information, refer to Chapter 11, or see the specific Load Linked and Store Conditional instructions described in Appendix A. MIPS R4000 Microprocessor User's Manual...
A noncoherent data identifier for the last data NEOD element A coherent data identifier for a data element other CData than the last data element CEOD A coherent data identifier for the last data element MIPS R4000 Microprocessor User's Manual...
The processor makes an uncompelled change to slave state either at the issue cycle of the read request, or sometime after the issue cycle of the read request by asserting the Release* signal for one cycle. MIPS R4000 Microprocessor User's Manual...
Page 361
NOTE: Timings for the SysADC and SysCmdP buses are the same as those of the SysAD and SysCmd buses, respectively. Master Slave SCycle SClock Addr SysAD Bus Read SysCmd Bus ValidOut* ValidIn* RdRdy* WrRdy* Release* Figure 12-17 Processor Read Request Protocol MIPS R4000 Microprocessor User's Manual...
Page 362
ExtRqst*, whereupon the processor accepts either a read response, or any other external request. If any external request other than a read response is issued, the processor performs another uncompelled change to slave state, asserting Release*, after processing the external request. MIPS R4000 Microprocessor User's Manual...
ValidIn* RdRdy* WrRdy* Release* Figure 12-19 Processor Noncoherent Single Word Write Request Protocol † Called word to distinguish it from block request protocol. Data transferred can actually be doubleword, partial doubleword, word, or partial word. MIPS R4000 Microprocessor User's Manual...
Page 364
Figures 12-20 and 12-21 illustrate a processor coherent block request for eight words of data. Master SCycle SClock Addr Data0 Data1 Data2 Data3 SysAD Bus Write CData CData CData CEOD SysCmd Bus ValidOut* ValidIn* RdRdy* WrRdy* Release* Figure 12-20 Processor Coherent Block Write Request Protocol MIPS R4000 Microprocessor User's Manual...
IvdAck* occurs in parallel with requests on the SysAD and SysCmd buses. IvdAck* or IvdErr* can be driven at any time after a processor update or invalidate request is issued, provided the update request is compulsory. MIPS R4000 Microprocessor User's Manual...
Figure 12-27 illustrates the issue of a processor write request delayed for the assertion of WrRdy* and the completion of an external invalidate request. NOTE: Timings for the SysADC and SysCmdP buses are the same as those of the SysAD and SysCmd buses, respectively. MIPS R4000 Microprocessor User's Manual...
Page 369
Addr Data0 Addr Data0 Data1 Data2 Data3 SysAD Bus Read CEOD Write CData CData CData CEOD SysCmd Bus ValidOut* ValidIn* RdRdy* WrRdy* Release* Figure 12-25 Processor Read Request within a Cluster Delayed for the Assertion of RdRdy* MIPS R4000 Microprocessor User's Manual...
Page 370
Addr Data0 SysAD Bus Write CEOD Write NEOD SysCmd Bus ValidOut* ValidIn* RdRdy* WrRdy* ExtRqst* Release* Figure 12-27 Processor Write Request Delayed for the Assertion of WrRdy* and the Completion of an External Invalidate Request MIPS R4000 Microprocessor User's Manual...
As long as ExtRqst* is asserted, the string of external requests is not interrupted by a processor request. This section describes the following external request protocols: • read • null • write • invalidate and update • intervention • snoop • read response MIPS R4000 Microprocessor User's Manual...
NOTE: Timings for the SysADC and SysCmdP buses are the same as those of the SysAD and SysCmd buses, respectively. Master Master Slave SCycle SClock Addr Data0 SysAD Bus Cmd NEOD SysCmd Bus ValidIn* ExtRqst* Release* Figure 12-28 Arbitration Protocol for External Requests MIPS R4000 Microprocessor User's Manual...
SysAD and SysCmd buses, respectively. External read requests are only allowed to read a word of data from the processor. The processor response to external read requests for any data element other than a word is undefined. MIPS R4000 Microprocessor User's Manual...
• A System interface release external null request returns the System interface to master state from slave state without otherwise affecting the processor. MIPS R4000 Microprocessor User's Manual...
Page 375
For a secondary cache release external null request, the System interface remains in slave state. For a System interface release external null request, the external agent releases the SysCmd and SysAD buses, and expects the System interface to return to master state. MIPS R4000 Microprocessor User's Manual...
† If the cache line that is the target of the intervention request is not present in the cache— that is, the tag comparison for the cache line at the target cache address fails—the cache line that is the target of the intervention request is considered to be in the invalid state. MIPS R4000 Microprocessor User's Manual...
Page 380
SysAD and SysCmd buses, respectively. Master Slave Master SCycle SClock Addr Unsd SysAD Bus Ivtn SysCmd Bus CEOD ValidOut* ValidIn* ExtRqst* Release* Figure 12-34 External Intervention Request, Shared Line, System Interface in Master State MIPS R4000 Microprocessor User's Manual...
Page 381
Note, however, that if the intervention address targets the doubleword at the beginning of the block, subblock ordering is equivalent to sequential ordering. MIPS R4000 Microprocessor User's Manual...
Figure 12-37 shows an external snoop request submitted with the System interface in slave state. NOTE: Timings for the SysADC and SysCmdP buses are the same as those of the SysAD and SysCmd buses, respectively. MIPS R4000 Microprocessor User's Manual...
Page 383
Figure 12-36 External Snoop Request, System Interface in Master State Master Slave Slave SCycle SClock Addr Unsd SysAD Bus Snoop SysCmd Bus CEOD ValidOut* ValidIn* ExtRqst* Release* Figure 12-37 External Snoop Request, System Interface in Slave State MIPS R4000 Microprocessor User's Manual...
The behavior of the processor is undefined if the read response is returned before a processor write request is accepted. MIPS R4000 Microprocessor User's Manual...
Page 385
Figure 12-38 Processor Word Read Request, followed by a Word Read Response Slave Master SCycle SClock Data0 Data1 Data2 Data3 SysAD Bus CData CData CData CEOD SysCmd Bus ValidOut* ValidIn* ExtRqst* Release* Figure 12-39 Block Read Response, System Interface already in Slave State MIPS R4000 Microprocessor User's Manual...
Doublewords in the transfer pattern are numbered beginning at 0: the odd-numbered doublewords are the second, fourth, sixth, and so on. MIPS R4000 Microprocessor User's Manual...
These are called independent transmissions. To effect an independent transmission, the external agent must coordinate control of the SysAD bus by using arbitration handshake signals and external null requests. MIPS R4000 Microprocessor User's Manual...
Software cannot change the endianness of the System interface and the external system; software can set the reverse endian bit to reverse the interpretation of endianness inside the processor, but the endianness of the System interface remains unchanged. MIPS R4000 Microprocessor User's Manual...
For System interface commands, SysCmd(8) must be set to 0. For System interface data identifiers, SysCmd(8) must be set to 1. MIPS R4000 Microprocessor User's Manual...
SysCmd(7:5) Command Read Request Read-With-Write-Forthcoming Request Write Request Null Request Invalidate Request Update Request Intervention Request Snoop Request SysCmd(4:0) are specific to each type of request and are defined in each of the following sections. MIPS R4000 Microprocessor User's Manual...
Table 12-13 Encoding of SysCmd(2:0) for Coherent and Noncoherent Block Read Request SysCmd(2) Link Address Retained Indication Link address not retained Link address retained SysCmd(1:0) Read Block Size 4 words 8 words 16 words 32 words MIPS R4000 Microprocessor User's Manual...
SysCmd(2:0). Write Request Specific (see tables) Figure 12-44 Write Request SysCmd Bus Bit Definition Table 12-15 Write Request Encoding of SysCmd(4:3) SysCmd(4:3) Write Attributes Reserved Reserved Block write Doubleword, partial doubleword, word, or partial word MIPS R4000 Microprocessor User's Manual...
Table 12-21 lists the encodings of SysCmd(4:0) for external update requests. Table 12-22 lists the encodings of SysCmd(4:0) for processor update requests. The remaining upper bits are the same for both processor and external update requests. MIPS R4000 Microprocessor User's Manual...
If cache state is clean exclusive, dirty exclusive, or dirty shared, change to shared; otherwise make no change to cache state Change to invalid regardless of current cache state Reserved Reserved MIPS R4000 Microprocessor User's Manual...
Page 403
If cache state is clean exclusive, dirty exclusive, or dirty shared, change to shared; otherwise make no change to cache state Change to invalid regardless of current cache state Reserved Reserved MIPS R4000 Microprocessor User's Manual...
• data that is associated with external write requests • data that is returned in response to an external read request • data that is associated with processor update requests. MIPS R4000 Microprocessor User's Manual...
SysCmd(2:0) are reserved for noncoherent data identifiers. Table 12-25 lists the encodings of SysCmd(7:3) for processor data identifiers. Table 12-26 lists the encodings of SysCmd(7:3) for external data identifiers. Table 12-27 lists the encodings of SysCmd(2:0) for coherent data identifiers. MIPS R4000 Microprocessor User's Manual...
Page 406
Data is not response data SysCmd(5) Good Data Indication Data is error free Data is erroneous SysCmd(4) Data Checking Enable Check the data and check bits Do not check the data and check bits Reserved SysCmd(3) MIPS R4000 Microprocessor User's Manual...
• Word requests set the low-order 2 bits of address to 0. • Halfword requests set the low-order bit of address to 0. • Byte, tribyte, quintibyte, sextibyte, and septibyte requests use the byte address. MIPS R4000 Microprocessor User's Manual...
Erroneous Data bit, SysCmd(5), set. The Interrupt register is the only processor internal resource available for write access by an external request. The Interrupt register is accessed by an external write request with an address of 000 on bits 6:4 of the SysAD bus. MIPS R4000 Microprocessor User's Manual...
Secondary Cache Interface The R4000SC and R4000MC versions of the R4000 processor contain interface signals for an optional external secondary cache. This interface consists of: • a 128-bit data bus • a 25-bit tag bus • an 18-bit address bus •...
† Other cache designs within this constraint are also acceptable. For example, a smaller cache design can use 22 8-Kbyte-by-8-bit static RAMs; this design presents less load on the address pins and control signals, and reduces the overall parts count. MIPS R4000 Microprocessor User's Manual...
These signals are useful for saving power on snoop and invalidate requests since access to the data array is not necessary. These signals also write data from the primary data cache to the secondary cache. MIPS R4000 Microprocessor User's Manual...
If a read cycle is aborted by a write cycle, SCOE* must be deasserted for the period before the write cycle can begin. Read cycles can also be extended indefinitely. There is no requirement to change the address at the end of a read cycle. MIPS R4000 Microprocessor User's Manual...
Figure 13-4 illustrates the 4-word write cycle. Either the upper or lower data doubleword can be driven first. MIPS R4000 Microprocessor User's Manual...
SCAddr(0) changes and ends when SCWR* is asserted for the second time. The lower half of SCData is driven on the same edge as the change in SCAddr(0). Figure 13-5 illustrates the 8-word write cycle. MIPS R4000 Microprocessor User's Manual...
When receiving data from the System interface, the first data doubleword can arrive several cycles before the second data doubleword. In this case, the cache state machine enters a wait-state that extends SCWR* until period after the second data item is transmitted. WrSUp MIPS R4000 Microprocessor User's Manual...
JTAG Interface The R4000 processor provides a boundary-scan interface that is compatible with Joint Test Action Group (JTAG) specifications, using the industry-standard JTAG protocol. This chapter describes that interface, including descriptions of boundary scanning, the pins and signals used by the interface, and the Test Access Port (TAP).
To accomplish this, the tests use the four signals described in the next section: JTDI, JTDO, JTMS, and JTCK. Integrated Circuit IC package pin Boundary-scan cells Figure 14-1 JTAG Boundary-scan Cells MIPS R4000 Microprocessor User's Manual...
In addition, the JTAG mechanism provides rudimentary capability for low-speed logical testing of the secondary cache RAM. The JTAG mechanism does not provide any capability for testing the processor itself. MIPS R4000 Microprocessor User's Manual...
Boundary-Scan Register The Boundary-scan register is a single, 319-bit-wide, shift register-based path containing cells connected to all input and output pads on the R4000 processor. Figure 14-5 shows the three most-significant bits of the Boundary-scan register; these three bits control the output enables on the various bidirectional buses.
Figure 14-6 JTAG Test Access Port Data on the JTDI and JTMS pins is sampled on the rising edge of the JTCK input clock signal. Data on the JTDO pin changes on the falling edge of the JTCK clock signal. MIPS R4000 Microprocessor User's Manual...
When the TAP controller is in the Shift-IR state, data is loaded serially into the shift register stage of the Instruction register from the JTDI input pin, and the MSB of the Instruction register’s shift register stage is shifted onto the JTDO pin. MIPS R4000 Microprocessor User's Manual...
Page 427
I/O pins whose outputs are enabled (by the three MSBs of the Boundary-scan register), are loaded onto the processor pins. Table 14-2 shows the boundary scan order of the processor signals. Table 14-2 JTAG Scan Order of R4000 Processor Pins Pin # Signal Name Pin #...
Page 428
Chapter 14 Table 14-2 (cont.) JTAG Scan Order of R4000 Processor Pins Pin # Signal Name Pin # Signal Name Pin # Signal Name Pin # Signal Name 97. SysAD(55) 98. SCData(23) 99. SysAD(23) 100. SCData(119) 101. Release* 102. SCTChk(2) 103.
Page 429
JTAG Interface Table 14-2 (cont.) JTAG Scan Order of R4000 Processor Pins Pin # Signal Name Pin # Signal Name Pin # Signal Name Pin # Signal Name 225. SysAD(37) 226. SCData(37) 227. SCData(70) 228. WrRdy* 229. ModeClock 230. SCData(102) 231.
Processor Clock-based register before they actually enable the data onto the pads. Therefore, the delay from the rising edge of JTCK in the Update-DR (Boundary-scan) state to data valid at the output pins of the chip is greater than two MasterClock periods. MIPS R4000 Microprocessor User's Manual...
R4000 Processor Interrupts The R4000 processor supports the following interrupts: six hardware interrupts, one internal “timer interrupt,” two software interrupts, and one nonmaskable interrupt. The processor takes an exception on any interrupt. This chapter describes the six hardware and single nonmaskable interrupts.
15.2 Nonmaskable Interrupt (NMI) The nonmaskable interrupt is caused either by an external write request to the R4000 or by a dedicated pin in the R4000. This pin is latched into an internal register by the rising edge of SClock.
Page 433
The select line for the Timer Interrupt multiplexer is enabled by boot- mode bit 19, TimerIntDis, as described in Chapter 9. The Timer Interrupt input to the multiplexer is asserted when the Count register equals the Compare register. MIPS R4000 Microprocessor User's Manual...
Page 434
14:10 of the Cause register. Interrupt register (5:0) Figure 15-5. Cause Timer register Interrupt OR gate (Internal SClock register) multiplexer Int*(3) Int*(1) Int*(5) Int*(4) Int*(2) Int*(0) Figure 15-3 R4000PC Interrupt Signals MIPS R4000 Microprocessor User's Manual...
Page 435
Bit 6 of the Interrupt register is then ORed with the inverted value of NMI* to form the nonmaskable interrupt. Interrupt register (6) (Internal register) (Internal) NMI* Edge- SClock triggered Inverter OR gate Flip-flop Figure 15-4 R4000 Nonmaskable Interrupt Signal MIPS R4000 Microprocessor User's Manual...
Page 436
Chapter 15 Figure 15-5 shows the masking of the R4000 interrupt signal. • Cause register bits 15:8 (IP7-IP0) are AND-ORed with Status register interrupt mask bits 15:8 (IM7-IM0) to mask individual interrupts. • Status register bit 0 is a global Interrupt Enable (IE). It is ANDed with the output of the AND-OR logic to produce the R4000 interrupt signal.
Page 437
Error Checking and Correcting This chapter describes the Error Checking and Correcting (ECC) mechanism used in both the R4000 and R4400 processors. This chapter also contains a description of the Master/Checker mode used in the R4400 processor. MIPS R4000 Microprocessor User's Manual...
Even Parity adds 1 to any odd number of 1s in the data, making the total number of 1s even (including the parity bit). Odd and even parity are shown in the example below: Data(3:0) Odd Parity Bit Even Parity Bit 0 0 1 0 MIPS R4000 Microprocessor User's Manual...
† The 64-bit data code is a modification of one of the 64-bit codes proposed by M. Y. Hsiao, to include the ability to detect 3- and 4-bit errors within a nibble. The 25-bit tag code was created using the patterns observed in the 64-bit data code. MIPS R4000 Microprocessor User's Manual...
Page 440
‡ This makes it possible to decode the syndrome to find which data bit is in error, using 4- input NAND gates, provided a pre-decode AND of bits 0-3 and bits 4-7 of the syndrome is available. For the check bits, a full 8-bit decode of the syndrome is required. MIPS R4000 Microprocessor User's Manual...
Page 441
five 1s or seven 1s. • 4-bit errors within a nibble are indicated by syndromes that contain either four 1s or six 1s. Because these are even numbers of 1s, 4-bit errors within a nibble look like double-bit errors. MIPS R4000 Microprocessor User's Manual...
SECDED code that also detects any 3- or 4-bit error in a nibble. The 8 check bits for each half of the secondary cache data bus are always generated in accordance with the SECDED code. MIPS R4000 Microprocessor User's Manual...
System Interface Command Bus In the R4000 processor, the System interface command bus has a single parity bit, SysCmdP, that provides even parity over the 9 bits of this bus. The SysCmdP parity bit is generated when the System interface is in master state, but it is not checked when the System interface is in slave state.
25 bits. ECC Check Bits The R4000 processor provides the following check bits: 16 check bits, SCDChk(15:0), are used for the secondary cache data bus; 7 check bits, SCTChk(6:0), are used for the secondary cache tag bus; 8 check bits, SysADC(7:0), are used for the System interface address and data bus;...
3333 5511 3333 5511 3333 3333 3333 3333 3333 3333 3333 3333 3333 3333 5511 3333 5511 3333 syndrome* Figure 16-1 Check Matrix for Data ECC Code NOTE: * This row indicates the number of 1s in the generated syndrome for each data bit in error. MIPS R4000 Microprocessor User's Manual...
Page 446
They are 0001 0011 Take even parity of check bits 0001 0011 Parity (even) MSB (7) LSB (0) This even parity value, 0001 0011 , is sent out over the bus as ECC check bits, ECC(7:0). MIPS R4000 Microprocessor User's Manual...
Page 447
Using Figure 16-1, generate even parity for the ECC check codes in columns 0, 1, and 6: Column 0 ECC Column 1 ECC Column 6 ECC Parity (even) This parity value, 0011 1100 , is sent out over the ECC(7:0) check bus. MIPS R4000 Microprocessor User's Manual...
System A. If the syndrome is any other value than 0000 0000 , it is assumed either the received word or the received check bits are in error. MIPS R4000 Microprocessor User's Manual...
Page 449
• multiple data bit errors (2 consecutive bits in a nibble) • multiple data bit errors (3 consecutive bits in a nibble) • multiple data bit errors (4 consecutive bits in a nibble) MIPS R4000 Microprocessor User's Manual...
, corresponds to data bit 0. This means the state of received data bit 0 is incorrect. To correct the error, the system inverts the state of the received data bit 0 from a value of 1 to 0. MIPS R4000 Microprocessor User's Manual...
0. This indicates that the state of the received check bit 0 is incorrect. To correct the error, the system inverts the state of the received check bit 0 from a value of 1 to 0. MIPS R4000 Microprocessor User's Manual...
, and the System B regenerated check bits, 0011 0000 The resulting syndrome is 0011 0000 The syndrome of two 1s (or an even number of 1s) indicates that a double-bit error has been detected. Double-bit errors cannot be corrected. MIPS R4000 Microprocessor User's Manual...
The resulting syndrome has five 1s. Since no four of the 1s are contained in check bits (7:4) or check bits (3:0), three errors have occurred within a nibble. Triple-bit errors within a nibble cannot be corrected. MIPS R4000 Microprocessor User's Manual...
The resulting syndrome is 1111 0000 Since the resulting syndrome has four 1s (or an even number of 1s), this error is recognized as some variation of a double-bit error. A 4-bit error within a nibble cannot be corrected. MIPS R4000 Microprocessor User's Manual...
3331 3311 3311 3311 3333 3333 3333 3333 syndrome* Figure 16-4 Check Matrix for the Tag ECC Code NOTE: * This row indicates the number of 1s in the generated syndrome for each data bit in error. MIPS R4000 Microprocessor User's Manual...
Trap on Processor † error System Interface Data Checked; Generated Check Bits Trap on † Error † If error level (ERL bit of the Status register) is 1, the error is reported to the Fault* pin. MIPS R4000 Microprocessor User's Manual...
Page 457
‡ If error level (ERL bit of the Status register) is 1, the error is reported to the Fault* pin. * Only if the current CACHE op needs to modify and write back the tag. MIPS R4000 Microprocessor User's Manual...
Page 458
Not Checked; System Interface Data Generated Trap on Not Checked reported to the Check Bits Error Fault* pin † Read-Modify-Write cycle ‡ Only the pair of doublewords accessed on the read portion of RMW is checked. MIPS R4000 Microprocessor User's Manual...
Page 459
Fault* reported to the and Check Bits: Fault* pin Fault* pin Receive From Secondary System Interface Data Cache System Interface Data From Secondary Check Bits Cache † Read-Modify-Write cycle MIPS R4000 Microprocessor User's Manual...
Complete Master mode. In a fault tolerant system, there are two possible configurations using the Master-Listener and Cross-Coupled modes described in Table 16-5. These are referred to as lock-step configurations, and are described later in this section. MIPS R4000 Microprocessor User's Manual...
The remaining processor signals can be connected either in parallel or independently. † Fault* is a non-persistent signal which is synchronous with the System interface. Fault* signal timing is determined by the PClock-to-SClock divisor from boot-time mode bit settings. MIPS R4000 Microprocessor User's Manual...
SC Master SCAddress SysAD/ SysCmd SCData/ SCTag SysADC/ SysCmdP Data Chk/ Tag Chk Maintenance Fault* Processor Figure 16-6 Cross-Coupled Configuration of Master/Checker Mode † This includes such errors as an input parity error at SysCmd. MIPS R4000 Microprocessor User's Manual...
Page 464
It should be noted that the fault detection mechanism associated with the Fault* pin does not cause any exceptions; the processor continues to run normally regardless of the state of the Fault* signal. It is up to external logic to handle an asserted Fault* signal. MIPS R4000 Microprocessor User's Manual...
System interface cycle is reported in the current cycle. In Complete Master mode, output fault reporting is disabled for the Secondary Cache interface, but enabled for the following System interface signals: SysCmd, SysCmdP, SysAD, SysADC, ValidOut*, and Release*. MIPS R4000 Microprocessor User's Manual...
The fault history bits can be reset (cleared) while the R4400 processor is running by asserting 1 to the ModeIn pin. Consequently, ModeIn must be held to 0 to maintain the status of the fault history bits. Table 16-6 presents this information in tabular form. MIPS R4000 Microprocessor User's Manual...
Page 467
Forced Complete Master Output Fault Reset* just asserted History bit is (R4400 is reset) connected to the Fault* pin Input Fault Reset just asserted History bit is (R4400 is reset) connected to Fault* pin MIPS R4000 Microprocessor User's Manual...
Page 469
CPU Instruction Set Details This appendix provides a detailed description of the operation of each R4000 instruction in both 32- and 64-bit modes. The instructions are listed in alphabetical order. Exceptions that may occur due to the execution of each instruction are listed after the description of each instruction.
Page 470
Coprocessor zero (CP0) instructions manipulate the memory management and exception handling facilities of the processor. • Special instructions perform a variety of tasks, including movement of data between special and general registers, trap, and breakpoint. They are always R-type. MIPS R4000 Microprocessor User's Manual...
Page 471
5-bit target (source/destination) or branch condition 16-bit immediate, branch displacement or address immediate displacement target 26-bit jump target address 5-bit destination register specifier shamt 5-bit shift amount funct 6-bit function field Figure A-1 CPU Instruction Formats MIPS R4000 Microprocessor User's Manual...
Page 472
In the instruction descriptions that follow, the Operation section describes the operation performed by each instruction using a high-level language notation. The R4000 can operate as either a 32- or 64-bit microprocessor and the operation for both modes is included with the instruction description.
Page 473
T+ i at time i + j . The interpretation of the order of execution between two instructions or two operations which execute at the same time should be pessimistic; the or- der is not defined. MIPS R4000 Microprocessor User's Manual...
Page 474
Bit 15 (the sign bit) of an immediate value is extended for 16 bit positions, and the result is concatenated with bits 15 through 0 of the immediate value to form a 32-bit sign extended value. MIPS R4000 Microprocessor User's Manual...
Page 475
Two special instructions are provided in the R4000 implementation of the MIPS ISA, Load Linked and Store Conditional. These instructions are...
Page 476
HALFWORD 2 bytes (16 bits) BYTE 1 byte (8 bits) The bytes within the addressed doubleword which are used can be determined directly from the access type and the three low-order bits of the address. MIPS R4000 Microprocessor User's Manual...
Page 477
Since instructions must be word-aligned, a Jump Register or Jump and Link Register instruction must use a register whose two low-order bits are zero. If these low-order bits are not zero, an address exception will occur when the jump target instruction is subsequently fetched. MIPS R4000 Microprocessor User's Manual...
Page 478
CP0 registers. Several CP0 instructions are defined to directly read, write, and probe TLB entries and to modify the operating modes in preparation for returning to User mode or interrupt-enabled states. A-10 MIPS R4000 Microprocessor User's Manual...
Page 479
An overflow exception occurs if the carries out of bits 30 and 31 differ (2’s complement overflow). The destination register rd is not modified when an integer overflow exception occurs. Operation: GPR[rd] GPR[rs] + GPR[rt] temp GPR[rs] + GPR[rt] GPR[rd] (temp || temp 31...0 Exceptions: Integer overflow exception MIPS R4000 Microprocessor User's Manual A-11...
Page 480
The destination register rt is not modified when an integer overflow exception occurs. Operation: GPR [rt] GPR[rs] +(immediate || immediate 15...0 temp GPR[rs] + (immediate || immediate 15...0 GPR[rt] (temp || temp 31...0 Exceptions: Integer overflow exception A-12 MIPS R4000 Microprocessor User's Manual...
Page 481
The only difference between this instruction and the ADDI instruction is that ADDIU never causes an overflow exception. Operation: GPR [rt] GPR[rs] + (immediate || immediate 15...0 temp GPR[rs] + (immediate || immediate 15...0 GPR[rt] (temp || temp 31...0 Exceptions: None MIPS R4000 Microprocessor User's Manual A-13...
Page 482
The only difference between this instruction and the ADD instruction is that ADDU never causes an overflow exception. Operation: GPR[rd] GPR[rs] + GPR[rt] temp GPR[rs] + GPR[rt] GPR[rd] (temp || temp 31...0 Exceptions: None A-14 MIPS R4000 Microprocessor User's Manual...
Page 483
The contents of general register rs are combined with the contents of general register rt in a bit-wise logical AND operation. The result is placed into general register rd. Operation: GPR[rd] GPR[rs] and GPR[rt] GPR[rd] GPR[rs] and GPR[rt] Exceptions: None MIPS R4000 Microprocessor User's Manual A-15...
Page 484
The 16-bit immediate is zero-extended and combined with the contents of general register rs in a bit-wise logical AND operation. The result is placed into general register rt. Operation: GPR[rt] || (immediate and GPR[rs] 15...0 GPR[rt] || (immediate and GPR[rs] 15...0 Exceptions: None A-16 MIPS R4000 Microprocessor User's Manual...
Page 485
(offset || offset || 0 T+1: if condition then PC + target endif *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-17...
Page 486
Bit # 0 0 0 BC1F 31 30 29 28 27 26 24 23 22 21 20 19 18 17 16 Bit # 0 0 0 BC2F Opcode BC sub-opcode Branch condition Coprocessor Unit Number A-18 MIPS R4000 Microprocessor User's Manual...
Page 487
*See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-19...
Page 488
24 23 22 21 20 19 18 17 16 Bit # BC1FL 31 30 29 28 27 26 24 23 22 21 20 19 18 17 16 Bit # BC2FL Opcode BC sub-opcode Branch condition Coprocessor Unit Number A-20 MIPS R4000 Microprocessor User's Manual...
Page 489
(offset || offset || 0 T+1: if condition then PC + target endif *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-21...
Page 490
24 23 22 21 20 19 18 17 16 Bit # 0 0 1 BC1T 31 30 29 28 27 26 24 23 22 21 20 19 18 17 16 Bit # BC2T Opcode BC sub-opcode Branch condition Coprocessor Unit Number A-22 MIPS R4000 Microprocessor User's Manual...
Page 491
|| offset || 0 T+1: if condition then PC + target else NullifyCurrentInstruction endif *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-23...
Page 492
Bit # 0 1 1 BC1TL 31 30 29 28 27 26 24 23 22 21 20 19 18 17 16 Bit # 0 1 1 BC2TL Opcode BC sub-opcode Branch condition Coprocessor Unit Number A-24 MIPS R4000 Microprocessor User's Manual...
Page 493
|| offset || 0 condition (GPR[rs] = GPR[rt]) T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = GPR[rt]) T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-25...
Page 494
(GPR[rs] = GPR[rt]) T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = GPR[rt]) T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-26 MIPS R4000 Microprocessor User's Manual...
Page 495
|| offset || 0 condition (GPR[rs] = 0) T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 0) T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-27...
Page 496
PC + 8 T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 0) GPR[31] PC + 8 T+1: if condition then PC + target endif Exceptions: None A-28 MIPS R4000 Microprocessor User's Manual...
Page 497
T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 0) GPR[31] PC + 8 T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-29...
Page 498
= 0) T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 0) T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-30 MIPS R4000 Microprocessor User's Manual...
Page 499
= 0) and (GPR[rs] T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 0) and (GPR[rs] T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-31...
Page 500
T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 0) and (GPR[rs] T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-32 MIPS R4000 Microprocessor User's Manual...
Page 501
= 1) or (GPR[rs] = 0 T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 1) or (GPR[rs] T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-33...
Page 502
T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 1) or (GPR[rs] T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-34 MIPS R4000 Microprocessor User's Manual...
Page 503
|| offset || 0 condition (GPR[rs] = 1) T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 1) T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-35...
Page 504
PC + 8 T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] = 1) GPR[31] PC + 8 T+1: if condition then PC + target endif Exceptions: None A-36 MIPS R4000 Microprocessor User's Manual...
Page 505
T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 1) GPR[31] PC + 8 T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-37...
Page 506
= 1) T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] = 1) T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-38 MIPS R4000 Microprocessor User's Manual...
Page 507
|| offset || 0 condition (GPR[rs] GPR[rt]) T+1: if condition then PC + target endif target (offset || offset || 0 condition (GPR[rs] GPR[rt]) T+1: if condition then PC + target endif Exceptions: None MIPS R4000 Microprocessor User's Manual A-39...
Page 508
(GPR[rs] GPR[rt]) T+1: if condition then PC + target else NullifyCurrentInstruction endif target (offset || offset || 0 condition (GPR[rs] GPR[rt]) T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: None A-40 MIPS R4000 Microprocessor User's Manual...
Page 509
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64 BreakpointException Exceptions: Breakpoint exception MIPS R4000 Microprocessor User's Manual A-41...
Page 510
(a hit). If the cache block is invalid or contains a different address (a miss), no operation is performed. A-42 MIPS R4000 Microprocessor User's Manual...
Page 511
TLB exceptions. This operation never causes TLB Modified or Virtual Coherency exceptions. Bits 17...16 of the instruction specify the cache as follows: Code Name Cache primary instruction primary data secondary instruction secondary data (or combined instruction/data) MIPS R4000 Microprocessor User's Manual A-43...
Page 512
Write the tag for the cache block at the specified index from the TagLo and TagHi CP0 registers. The processor uses computed parity for the Index Store primary caches and the TagLo register in the case of the secondary cache. A-44 MIPS R4000 Microprocessor User's Manual...
Page 513
CE bit of the Status register is set, the contents of the Invalidate ECC register is XOR’d into the computed check bits during the write to the secondary cache for the addressed doubleword. MIPS R4000 Microprocessor User's Manual A-45...
Page 514
When a secondary cache is present, and the CE bit of Hit Writeback the Status register is set, the contents of the ECC register is XOR’d into the computed check bits during the write to the secondary cache for the addressed doubleword. A-46 MIPS R4000 Microprocessor User's Manual...
Page 515
The CH bit in the Status register is set or cleared to indicate a hit or miss. Operation: 32, 64 vAddr ((offset || offset ) + GPR[base] 15...0 (pAddr, uncached) AddressTranslation (vAddr, DATA) CacheOp (op, vAddr, pAddr) Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual A-47...
Page 516
(CCR[z,rd] || CCR[z,rd] T+1: GPR[rt] data Exceptions: Coprocessor unusable exception *Opcode Bit Encoding: 22 21 31 30 Bit # CFCz CFC1 22 21 31 30 Bit # CFC2 Opcode Coprocessor Suboperation Coprocessor Unit Number A-48 MIPS R4000 Microprocessor User's Manual...
Page 518
This instruction is not valid for CP0. Operation: 32,64 data GPR[rt] T + 1: CCR[z,rd] data Exceptions: Coprocessor unusable *See “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. A-50 MIPS R4000 Microprocessor User's Manual...
Page 519
An overflow exception occurs if the carries out of bits 62 and 63 differ (2’s complement overflow). The destination register rd is not modified when an integer overflow exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 520
An overflow exception occurs if carries out of bits 62 and 63 differ (2’s complement overflow). The destination register rt is not modified when an integer overflow exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 521
The only difference between this instruction and the DADDI instruction is that DADDIU never causes an overflow exception. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 522
The only difference between this instruction and the DADD instruction is that DADDU never causes an overflow exception. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 523
Correct operation requires separating reads of HI or LO from writes by two or more instructions. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 524
Correct operation requires separating reads of HI or LO from writes by two or more instructions. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 525
If either of the two preceding instructions is MFHI or MFLO, the results of those instructions are undefined. Correct operation requires separating reads of HI or LO from writes by two or more instructions. MIPS R4000 Microprocessor User's Manual A-57...
Page 526
T–1: undefined undefined GPR[rs] div GPR[rt] GPR[rs] mod GPR[rt] T–2: undefined undefined T–1: undefined undefined GPR[rs] div GPR[rt] 31...0 31...0 GPR[rs] mod GPR[rt] 31...0 31...0 || q 31...0 || r 31...0 Exceptions: None A-58 MIPS R4000 Microprocessor User's Manual...
Page 527
If either of the two preceding instructions is MFHI or MFLO, the results of those instructions are undefined. Correct operation requires separating reads of HI or LO from writes by two or more instructions. MIPS R4000 Microprocessor User's Manual A-59...
Page 529
The contents of coprocessor register rd of the CP0 are loaded into general register rt. This operation is defined for the R4000 operating in 64-bit mode and in 32- bit kernel mode. Execution of this instruction in 32-bit user or supervisor mode causes a reserved instruction exception.
Page 530
The contents of general register rt are loaded into coprocessor register rd of the CP0. This operation is defined for the R4000 operating in 64-bit mode or in 32- bit kernel mode. Execution of this instruction in 32-bit user or supervisor mode causes a reserved instruction exception.
Page 531
Correct operation requires separating reads of HI or LO from writes by a minimum of two other instructions. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 532
Correct operation requires separating reads of HI or LO from writes by a minimum of two instructions. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 533
The contents of general register rt are shifted left by sa bits, inserting zeros into the low-order bits. The result is placed in register rd. Operation: 0 || sa GPR[rd] GPR[rt] || 0 (63–s)...0 Exceptions: Reserved instruction exception (R4000 in 32-bit mode) MIPS R4000 Microprocessor User's Manual A-65...
Page 534
The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 535
The contents of general register rt are shifted left by 32+sa bits, inserting zeros into the low-order bits. The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 536
The contents of general register rt are shifted right by sa bits, sign- extending the high-order bits. The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 537
The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 538
The contents of general register rt are shifted right by 32+sa bits, sign- extending the high-order bits. The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 539
The contents of general register rt are shifted right by sa bits, inserting zeros into the high-order bits. The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 540
The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 541
The contents of general register rt are shifted right by 32+sa bits, inserting zeros into the high-order bits. The result is placed in register rd. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 542
63 differ (2’s complement overflow). The destination register rd is not modified when an integer overflow exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 543
The only difference between this instruction and the DSUB instruction is that DSUBU never traps on overflow. No integer overflow exception occurs under any circumstances. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 544
Format: ERET Description: ERET is the R4000 instruction for returning from an interrupt, exception, or error trap. Unlike a branch or jump instruction, ERET does not execute the next instruction. ERET must not itself be placed in a branch delay slot.
Page 545
The program unconditionally jumps to this calculated address with a delay of one instruction. Operation: temp target T+1: PC || temp || 0 31...28 temp target T+1: PC || temp || 0 63...28 Exceptions: None MIPS R4000 Microprocessor User's Manual A-77...
Page 546
The address of the instruction after the delay slot is placed in the link register, r31. Operation: temp target GPR[31] PC + 8 T+1: PC || temp || 0 31...28 temp target GPR[31] PC + 8 T+1: PC || temp || 0 63...28 Exceptions: None A-78 MIPS R4000 Microprocessor User's Manual...
Page 547
If these low-order bits are not zero, an address exception will occur when the jump target instruction is subsequently fetched. Operation: 32, 64 temp GPR [rs] GPR[rd] PC + 8 T+1: temp Exceptions: None MIPS R4000 Microprocessor User's Manual A-79...
Page 548
(rs) whose two low-order bits are zero. If these low-order bits are not zero, an address exception will occur when the jump target instruction is subsequently fetched. Operation: 32, 64 temp GPR[rs] T+1: temp Exceptions: None A-80 MIPS R4000 Microprocessor User's Manual...
Page 551
If any of the three least-significant bits of the effective address are non- zero, an address error exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 552
This instruction is undefined when the least-significant bit of the rt field is non-zero. *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. A-84 MIPS R4000 Microprocessor User's Manual...
Page 553
Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception Coprocessor unusable exception Opcode Bit Encoding: LDCz 31 30 Bit # LDC1 31 30 Bit # LDC2 Coprocessor Unit Number Opcode MIPS R4000 Microprocessor User's Manual A-85...
Page 554
(big-endian) register 10 11 12 13 14 15 address 8 A B C D E F G H before address 0 LDL $24,3($0) 3 4 5 6 7 F G H after A-86 MIPS R4000 Microprocessor User's Manual...
Page 555
LDL (or LDR) instruction which also specifies register rt. No address exceptions due to alignment are possible. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 556
Type AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception Reserved instruction exception (R4000 in 32-bit mode) A-88 MIPS R4000 Microprocessor User's Manual...
Page 557
(big-endian) register 10 11 12 13 14 15 address 8 B C D E F G H before address 0 LDR $24,4($0) register after B C 0 1 2 3 4 MIPS R4000 Microprocessor User's Manual A-89...
Page 558
LDR (or LDL) instruction which also specifies register rt. No address exceptions due to alignment are possible. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 559
Type AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception Reserved instruction exception (R4000 in 32-bit mode) MIPS R4000 Microprocessor User's Manual A-91...
Page 562
LL and SC, otherwise the SC may never be successful. Exceptions also cause SC to fail, so persistent exceptions must be avoided. If either of the two least-significant bits of the effective address are non-zero, an address error exception takes place. A-94 MIPS R4000 Microprocessor User's Manual...
Page 564
T1, (T0) T2, T1, 1 T2, (T0) T2, 0, L1 This atomically increments the word addressed by T0. Changing the ADD to an OR changes this to an atomic bit set. A-96 MIPS R4000 Microprocessor User's Manual...
Page 565
If any of the three least-significant bits of the effective address are non- zero, an address error exception takes place. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 566
The 16-bit immediate is shifted left 16 bits and concatenated to 16 bits of zeros. The result is placed into general register rt. In 64-bit mode, the loaded word is sign-extended. Operation: GPR[rt] immediate || 0 GPR[rt] (immediate || immediate || 0 Exceptions: None A-98 MIPS R4000 Microprocessor User's Manual...
Page 568
This instruction is not valid for use with CP0. *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. A-100 MIPS R4000 Microprocessor User's Manual...
Page 569
COPzLW (byte, rt, mem) Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception Coprocessor unusable exception Opcode Bit Encoding: LWCz Bit # LWC1 Bit # LWC2 Coprocessor Unit Number Opcode MIPS R4000 Microprocessor User's Manual A-101...
Page 570
The least-significant (right-most) byte(s) of the register will not be changed. memory (big-endian) register address 4 before address 0 LWL $24,1($0) after A-102 MIPS R4000 Microprocessor User's Manual...
Page 572
Little-endian memory (BigEndianMem = 0) BigEndianMem = 1 Type AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 sign-extend of destination Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception A-104 MIPS R4000 Microprocessor User's Manual...
Page 573
The most significant (left-most) byte(s) of the register will not be changed. memory (big-endian) register address 4 before address 0 LWR $24,4($0) after MIPS R4000 Microprocessor User's Manual A-105...
Page 575
AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 sign-extend of destination either unchanged or sign-extend of destination Exceptions: TLB refill exception TLB invalid exception Bus error exception Address error exception MIPS R4000 Microprocessor User's Manual A-107...
Page 576
If either of the two least-significant bits of the effective address is non-zero, an address error exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 577
Description: The contents of coprocessor register rd of the CP0 are loaded into general register rt. Operation: data CPR[0,rd] T+1: GPR[rt] data data CPR[0,rd] T+1: GPR[rt] (data || data 31...0 Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual A-109...
Page 578
|| 0] 4...1 63...32 endif T+1: GPR[rt] (data || data Exceptions: Coprocessor unusable exception *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. A-110 MIPS R4000 Microprocessor User's Manual...
Page 579
MFCz MFCz (continued) Opcode Bit Encoding: MFCz 22 21 31 30 Bit # MFC0 22 21 31 30 Bit # MFC1 22 21 31 30 Bit # MFC2 Coprocessor Suboperation Opcode Coprocessor Unit Number MIPS R4000 Microprocessor User's Manual A-111...
Page 580
To ensure proper operation in the event of interruptions, the two instructions which follow a MFHI instruction may not be any of the instructions which modify the HI register: MULT, MULTU, DIV, DIVU, MTHI, DMULT, DMULTU, DDIV, DDIVU. Operation: 32, 64 GPR[rd] Exceptions: None A-112 MIPS R4000 Microprocessor User's Manual...
Page 581
To ensure proper operation in the event of interruptions, the two instructions which follow a MFLO instruction may not be any of the instructions which modify the LO register: MULT, MULTU, DIV, DIVU, MTLO, DMULT, DMULTU, DDIV, DDIVU. Operation: 32, 64 GPR[rd] Exceptions: None MIPS R4000 Microprocessor User's Manual A-113...
Page 582
TLB operations immediately prior to and after this instruction are undefined. Operation: 32, 64 data GPR[rt] T+1: CPR[0,rd] data Exceptions: Coprocessor unusable exception A-114 MIPS R4000 Microprocessor User's Manual...
Page 583
Coprocessor unusable exception *Opcode Bit Encoding: 22 21 31 30 Bit # MTCz C0P0 22 21 31 30 Bit # C0P1 22 21 31 30 Bit # C0P2 Opcode Coprocessor Unit Number Coprocessor Suboperation MIPS R4000 Microprocessor User's Manual A-115...
Page 584
If a MTHI operation is executed following a MULT, MULTU, DIV, or DIVU instruction, but before any MFLO, MFHI, MTLO, or MTHI instructions, the contents of special register LO are undefined. Operation: 32,64 T–2: HI undefined T–1: HI undefined GPR[rs] Exceptions: None A-116 MIPS R4000 Microprocessor User's Manual...
Page 585
If a MTLO operation is executed following a MULT, MULTU, DIV, or DIVU instruction, but before any MFLO, MFHI, MTLO, or MTHI instructions, the contents of special register HI are undefined. Operation: 32,64 T–2: LO undefined T–1: LO undefined GPR[rs] Exceptions: None MIPS R4000 Microprocessor User's Manual A-117...
Page 586
If either of the two preceding instructions is MFHI or MFLO, the results of these instructions are undefined. Correct operation requires separating reads of HI or LO from writes by a minimum of two other instructions. A-118 MIPS R4000 Microprocessor User's Manual...
Page 587
T–2: LO undefined undefined T–1: LO undefined undefined GPR[rs] * GPR[rt] 31...0 63...32 T–2: LO undefined undefined T–1: LO undefined undefined GPR[rs] * GPR[rt] 31...0 31...0 || t 31...0 || t 63...32 Exceptions: None MIPS R4000 Microprocessor User's Manual A-119...
Page 588
If either of the two preceding instructions is MFHI or MFLO, the results of these instructions are undefined. Correct operation requires separating reads of HI or LO from writes by a minimum of two instructions. A-120 MIPS R4000 Microprocessor User's Manual...
Page 590
The contents of general register rs are combined with the contents of general register rt in a bit-wise logical NOR operation. The result is placed into general register rd. Operation: 32, 64 GPR[rd] GPR[rs] nor GPR[rt] Exceptions: None A-122 MIPS R4000 Microprocessor User's Manual...
Page 591
The contents of general register rs are combined with the contents of general register rt in a bit-wise logical OR operation. The result is placed into general register rd. Operation: 32, 64 GPR[rd] GPR[rs] or GPR[rt] Exceptions: None MIPS R4000 Microprocessor User's Manual A-123...
Page 592
OR operation. The result is placed into general register rt. Operation: GPR[rt] GPR[rs] || (immediate or GPR[rs] 31...16 15...0 GPR[rt] GPR[rs] || (immediate or GPR[rs] 63...16 15...0 Exceptions: None A-124 MIPS R4000 Microprocessor User's Manual...
Page 594
If either of the two least-significant bits of the effective address is non-zero, an address error exception takes place. If this instruction should both fail and take an exception, the exception takes precedence. A-126 MIPS R4000 Microprocessor User's Manual...
Page 596
This instruction is available in User mode; it is not necessary for CP0 to be enabled. If either of the three least-significant bits of the effective address is non- zero, an address error exception takes place. A-128 MIPS R4000 Microprocessor User's Manual...
Page 597
(continued) If this instruction should both fail and take an exception, the exception takes precedence. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception. Operation:...
Page 598
If either of the three least-significant bits of the effective address are non- zero, an address error exception occurs. This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception.
Page 599
(pAddr, uncached) AddressTranslation (vAddr, DATA) data COPzSD(rt), StoreMemory (uncached, DOUBLEWORD, data, pAddr, vAddr, DATA) *See the table, “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-131...
Page 600
TLB invalid exception TLB modification exception Bus error exception Address error exception Coprocessor unusable exception Opcode Bit Encoding: SDCz 31 30 Bit # SDC1 31 30 Bit # SDC2 SD opcode Coprocessor Unit Number A-132 MIPS R4000 Microprocessor User's Manual...
Page 601
No address exceptions due to alignment are possible. memory (big-endian) register 10 11 12 13 14 15 address 8 before A B C D E F G H address 0 SDL $24,1($0) address 8 10 11 12 13 after address 0 MIPS R4000 Microprocessor User's Manual A-133...
Page 602
Appendix A Store Doubleword Left (continued) This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception. Operation: vAddr ((offset || offset ) + GPR[base] 15...0 (pAddr, uncached)
Page 603
AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception TLB modification exception Bus error exception Address error exception Reserved instruction exception (R4000 in 32-bit mode) MIPS R4000 Microprocessor User's Manual A-135...
Page 604
8 10 11 12 13 14 15 before B C D E F G H address 0 memory SDR $24,4($0) (big-endian) address 8 10 11 12 13 14 15 after address 0 A-136 MIPS R4000 Microprocessor User's Manual...
Page 605
CPU Instruction Set Details Store Doubleword Right (continued) This operation is only defined for the R4000 operating in 64-bit mode. Execution of this instruction in 32-bit mode causes a reserved instruction exception. Operation: T: vAddr ((offset || offset ) + GPR[base] 15...0...
Page 606
AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception TLB modification exception Bus error exception Address error exception Reserved instruction exception (R4000 in 32-bit mode) A-138 MIPS R4000 Microprocessor User's Manual...
Page 608
If using SLL with a zero shift to truncate 64-bit values, check the assembler you are using. Operation: GPR[rd] GPR[rt] || 0 31– sa...0 0 || sa temp GPR[rt] || 0 31-s...0 GPR[rd] (temp || temp Exceptions: None A-140 MIPS R4000 Microprocessor User's Manual...
The result is placed in register rd. In 64-bit mode, the operand must be a valid sign-extended, 32-bit value. Operation: GPR[rd] (GPR[rt] || GPR[rt] 31...sa 0 || sa temp (GPR[rt] || GPR[rt] 31...s GPR[rd] (temp || temp Exceptions: None A-146 MIPS R4000 Microprocessor User's Manual...
Page 615
The result is placed in register rd. In 64-bit mode, the operand must be a valid sign-extended, 32-bit value. Operation: GPR[rs] 4...0 GPR[rd] (GPR[rt] || GPR[rt] 31...s GPR[rs] 4...0 temp (GPR[rt] || GPR[rt] 31...s GPR[rd] (temp || temp Exceptions: None MIPS R4000 Microprocessor User's Manual A-147...
Page 616
The result is placed in register rd. In 64-bit mode, the operand must be a valid sign-extended, 32-bit value. Operation: GPR[rd] || GPR[rt] 31...sa 0 || sa temp || GPR[rt] 31...s GPR[rd] (temp || temp Exceptions: None A-148 MIPS R4000 Microprocessor User's Manual...
Page 617
The result is placed in register rd. In 64-bit mode, the operand must be a valid sign-extended, 32-bit value. Operation: GPR[rs] 4...0 GPR[rd] || GPR[rt] 31...s GPR[rs] 4...0 temp || GPR[rt] 31...s GPR[rd] (temp || temp Exceptions: None MIPS R4000 Microprocessor User's Manual A-149...
Page 618
31 differ (2’s complement overflow). The destination register rd is not modified when an integer overflow exception occurs. Operation: GPR[rd] GPR[rs] – GPR[rt] temp GPR[rs] - GPR[rt] GPR[rd] (temp || temp 31...0 Exceptions: Integer overflow exception A-150 MIPS R4000 Microprocessor User's Manual...
Page 619
The only difference between this instruction and the SUB instruction is that SUBU never traps on overflow. No integer overflow exception occurs under any circumstances. Operation: GPR[rd] GPR[rs] – GPR[rt] temp GPR[rs] - GPR[rt] GPR[rd] (temp || temp 31...0 Exceptions: None MIPS R4000 Microprocessor User's Manual A-151...
Page 621
(BigEndianCPU || 0 2...0 data COPzSW (byte,rt) StoreMemory (uncached, WORD, data, pAddr, vAddr DATA) *See the table “Opcode Bit Encoding” on next page, or “CPU Instruction Opcode Bit Encoding” at the end of Appendix A. MIPS R4000 Microprocessor User's Manual A-153...
Page 622
TLB invalid exception TLB modification exception Bus error exception Address error exception Coprocessor unusable exception Opcode Bit Encoding: SWCz 31 30 Bit # SWC1 31 30 Bit # SWC2 SW opcode Coprocessor Unit Number A-154 MIPS R4000 Microprocessor User's Manual...
Page 623
No address exceptions due to alignment are possible. memory (big-endian) register address 4 before address 0 SWL $24,1($0) address 4 after address 0 MIPS R4000 Microprocessor User's Manual A-155...
Page 624
BigEndianCPU 1...0 if (vAddr xor BigEndianCPU) = 0 then 24-8*byte data || 0 || GPR[rt] 31...24-8*byte else 24-8*byte data || GPR[rt] || 0 31...24-8*byte endif StoreMemory(uncached, byte, data, pAddr, vAddr, DATA) A-156 MIPS R4000 Microprocessor User's Manual...
Page 625
Little-endian memory (BigEndianMem = 0) BigEndianMem = 1 Type AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception TLB modification exception Bus error exception Address error exception MIPS R4000 Microprocessor User's Manual A-157...
Page 626
No address exceptions due to alignment are possible. memory (big-endian) register address 4 before address 0 SWR $24,1($0) address 4 after address 0 A-158 MIPS R4000 Microprocessor User's Manual...
Page 627
BigEndianCPU 1...0 if (vAddr xor BigEndianCPU) = 0 then 8*byte data || GPR[rt] || 0 31-8*byte...0 else 8*byte data GPR[rt] || 0 || 0 31-8*byte...0 endif StoreMemory(uncached, WORD-byte, data, pAddr, vAddr, DATA) MIPS R4000 Microprocessor User's Manual A-159...
Page 628
Little-endian memory (BigEndianMem = 0) BigEndianMem = 1 Type AccessType (see Table 2-1) sent to memory Offset pAddr sent to memory 2...0 Exceptions: TLB refill exception TLB invalid exception TLB modification exception Bus error exception Address error exception A-160 MIPS R4000 Microprocessor User's Manual...
Page 629
NOP. LL and SC instructions implicitly perform a SYNC. This instruction is allowed in User mode. Operation: 32, 64 SyncOperation() Exceptions: None MIPS R4000 Microprocessor User's Manual A-161...
Page 630
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64 T: SystemCallException Exceptions: System Call exception A-162 MIPS R4000 Microprocessor User's Manual...
Page 631
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64 if GPR[rs] = GPR[rt] then TrapException endif Exceptions: Trap exception MIPS R4000 Microprocessor User's Manual A-163...
Page 632
If the contents of general register rs are equal to the sign-extended immediate, a trap exception occurs. Operation: if GPR[rs] = (immediate || immediate then 15...0 TrapException endif if GPR[rs] = (immediate || immediate then 15...0 TrapException endif Exceptions: Trap exception A-164 MIPS R4000 Microprocessor User's Manual...
Page 633
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64 T: if GPR[rs] GPR[rt] then TrapException endif Exceptions: Trap exception MIPS R4000 Microprocessor User's Manual A-165...
Page 634
Operation: T: if GPR[rs] (immediate || immediate then 15...0 TrapException endif T: if GPR[rs] (immediate || immediate then 15...0 TrapException endif Exceptions: Trap exception A-166 MIPS R4000 Microprocessor User's Manual...
Page 636
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: if (0 || GPR[rs]) (0 || GPR[rt]) then TrapException endif Exceptions: Trap exception A-168 MIPS R4000 Microprocessor User's Manual...
Page 637
|| TLB[i] 167...141 216...205 = EntryHi ) and not (0 || TLB[i] )) and 39...13 216...205 (TLB[i] or (TLB[i] = EntryHi )) then 135...128 7...0 Index || i 5...0 endif endfor Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual A-169...
Page 639
TLB Index register are greater than the number of TLB entries in the processor. Operation: 32, 64T: TLB[Index 5...0 PageMask || (EntryHi and not PageMask) || EntryLo1 || EntryLo0 Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual A-171...
Page 640
The TLB entry pointed at by the contents of the TLB Random register is loaded with the contents of the EntryHi and EntryLo registers. Operation: 32, 64T: TLB[Random 5...0 PageMask || (EntryHi and not PageMask) || EntryLo1 || EntryLo0 Exceptions: Coprocessor unusable exception A-172 MIPS R4000 Microprocessor User's Manual...
Page 641
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64 T: if GPR[rs] < GPR[rt] then TrapException endif Exceptions: Trap exception MIPS R4000 Microprocessor User's Manual A-173...
Page 642
Operation: T: if GPR[rs] < (immediate || immediate then 15...0 TrapException endif T: if GPR[rs] < (immediate || immediate then 15...0 TrapException endif Exceptions: Trap exception A-174 MIPS R4000 Microprocessor User's Manual...
Page 644
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64T: if (0 || GPR[rs]) < (0 || GPR[rt]) then TrapException endif Exceptions: Trap exception A-176 MIPS R4000 Microprocessor User's Manual...
Page 645
The code field is available for use as software parameters, but is retrieved by the exception handler only by loading the contents of the memory word containing the instruction. Operation: 32, 64T: if GPR[rs] GPR[rt] then TrapException endif Exceptions: Trap exception MIPS R4000 Microprocessor User's Manual A-177...
Page 646
If the contents of general register rs are not equal to the sign-extended immediate, a trap exception occurs. Operation: if GPR[rs] (immediate || immediate then 15...0 TrapException endif if GPR[rs] (immediate || immediate then 15...0 TrapException endif Exceptions: Trap exception A-178 MIPS R4000 Microprocessor User's Manual...
Page 647
The contents of general register rs are combined with the contents of general register rt in a bit-wise logical exclusive OR operation. The result is placed into general register rd. Operation: 32, 64 GPR[rd] GPR[rs] xor GPR[rt] Exceptions: None MIPS R4000 Microprocessor User's Manual A-179...
Page 648
The 16-bit immediate is zero-extended and combined with the contents of general register rs in a bit-wise logical exclusive OR operation. The result is placed into general register rt. Operation: GPR[rt] GPR[rs] xor (0 || immediate) GPR[rt] GPR[rs] xor (0 || immediate) Exceptions: None A-180 MIPS R4000 Microprocessor User's Manual...
Page 649
CPU Instruction Set Details CPU Instruction Opcode Bit Encoding The remainder of this Appendix presents the opcode bit encoding for the CPU instruction set (ISA and extensions), as implemented by the R4000. Figure A-2 lists the R4000 Opcode Bit Encoding. 28...26 Opcode 31...29...
Page 650
Operation codes marked with a gamma cause a reserved instruction exception. They are reserved for future versions of the architecture. Operation codes marked with a delta are valid only for R4000 processors with CP0 enabled, and cause a reserved instruction exception on other processors.
Page 651
Figure B-3 at the end of this appendix lists the entire bit encoding for the constant fields of the floating-point instruction set; the bit encoding for each instruction is included with that individual instruction. MIPS R4000 Microprocessor User's Manual...
Page 652
(marked V in Table B-1). Combinations marked R in Table B-1 are not currently specified by this architecture, and cause an unimplemented operation trap. They will be available for future extensions to the architecture. MIPS R4000 Microprocessor User's Manual...
Page 653
FPU Instruction Set Details Table B-1 Valid FPU Instruction Formats Source Format Operation Single Double Word Longword SQRT TRUNC.L ROUND.L CEIL.L FLOOR.L TRUNC.W ROUND.W CEIL.W FLOOR.W CVT.S CVT.D CVT.W CVT.L MIPS R4000 Microprocessor User's Manual...
Page 654
16 distinct comparisons, as shown in Table B-2 below. Table B-2 Logical Negation of Predicates by Condition True/False Condition Relations Invalid Operation Mnemonic Greater Less Exception If Code Equal Unordered Than Than True False Unordered NGLE MIPS R4000 Microprocessor User's Manual...
Page 655
Specifically, these operations obtain a result which is identical to an infinite-precision result rounded to the specified format, using the current rounding mode. Instructions must specify the format of their operands. Except for conversion functions, mixed-format operations are not provided. MIPS R4000 Microprocessor User's Manual...
Page 656
Bit 15 (the sign bit) of an immediate value is extended for 16 bit positions, and the result is concatenated with bits 15 through 0 of the immediate value to form a 32-bit sign extended value. MIPS R4000 Microprocessor User's Manual...
Page 657
FPU Instruction Set Details B.3 Load and Store Instructions In the R4000 implementation, the instruction immediately following a load may use the contents of the register being loaded. In such cases, the hardware interlocks, requiring additional real cycles, so scheduling load delay slots is still desirable, although not required for functional code.
Page 658
Regardless of byte-numbering order (endianness), the address specifies that byte which has the smallest byte-address in the addressed field. For a big-endian machine, this is the leftmost byte; for a little-endian machine, this is the rightmost byte. MIPS R4000 Microprocessor User's Manual...
Page 659
Table B-4. Table B-4 Format Field Decoding Code Mnemonic Size Format single Binary floating-point double Binary floating-point Reserved Reserved single 32-bit binary fixed-point longword 64-bit binary fixed-point 22–31 Reserved Table B-5 lists all floating-point instructions. MIPS R4000 Microprocessor User's Manual...
Page 660
Reserved CVT.S Convert to single floating-point CVT.D Convert to double floating-point – Reserved – Reserved CVT.W Convert to 32-bit binary fixed-point CVT.L Convert to 64-bit (long) binary fixed-point 38–47 – Reserved 48–63 Floating-point compare B-10 MIPS R4000 Microprocessor User's Manual...
Page 661
= 0 then /* valid specifier, 32-bit wide FGRs */ case fmt of S, W: value FGR[fpr] return D, L: value FGR[fpr+1] || FGR[fpr] return endcase else /* undefined result for odd 32-bit reg #s */ value undefined endif MIPS R4000 Microprocessor User's Manual B-11...
Page 662
= 0 then /* valid specifier, 32-bit wide FGRs */ case fmt of S, W: FGR[fpr+1] undefined FGR[fpr] value return D, L: FGR[fpr+1] value 63...32 FGR[fpr] value 31...0 return endcase else /* undefined result for odd 32-bit reg #s */ undefined_result endif B-12 MIPS R4000 Microprocessor User's Manual...
Page 663
When the FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR(fd, fmt, AbsoluteValue(ValueFPR(fs, fmt))) Exceptions: Coprocessor unusable exception Coprocessor exception trap Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception MIPS R4000 Microprocessor User's Manual B-13...
Page 665
|| offset || 0 T+1: if condition then PC + target endif T–1: condition not COC[1] target (offset || offset || 0 T+1: if condition then PC + target endif Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual B-15...
Page 666
T+1: if condition then PC + target else NullifyCurrentInstruction endif T–1: condition not COC[1] target (offset || offset || 0 T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: Coprocessor unusable exception B-16 MIPS R4000 Microprocessor User's Manual...
Page 667
(offset || offset || 0 T+1: if condition then PC + target endif T–1: condition COC[1] target (offset || offset || 0 T+1: if condition then PC + target endif Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual B-17...
Page 668
|| offset || 0 T+1: if condition then PC + target else NullifyCurrentInstruction endif T–1: condition COC[1] target (offset || offset || 0 T+1: if condition then PC + target else NullifyCurrentInstruction endif Exceptions: Coprocessor unusable exception B-18 MIPS R4000 Microprocessor User's Manual...
Page 669
When the FR bit in the Status register equals one, both even and odd register numbers are valid. *See “FPU Instruction Opcode Bit Encoding” at the end of Appendix B. MIPS R4000 Microprocessor User's Manual B-19...
Page 670
ValueFPR(fs, fmt) = ValueFPR(ft, fmt) unordered false endif and equal) or condition (cond and less) or (cond (cond and unordered) FCR[31] condition COC[1] condition Exceptions: Coprocessor unusable Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception B-20 MIPS R4000 Microprocessor User's Manual...
Page 671
When the source operand is an Infinity, NaN, or the correctly rounded integer result is outside of –2 to 2 – 1, the Invalid operation exception is raised. If the Invalid operation is not enabled then no exception is taken and 2 –1 is returned. MIPS R4000 Microprocessor User's Manual B-21...
Page 673
When the source operand is an Infinity or NaN, or the correctly rounded integer result is outside of –2 to 2 – 1, the Invalid operation exception is raised. If the Invalid operation is not enabled then no exception is taken and 2 –1 is returned. MIPS R4000 Microprocessor User's Manual B-23...
Page 675
This operation is only defined when fs equals 0 or 31. The contents of general register rt are undefined for the instruction immediately following CFC1. Operation: temp FCR[fs] T+1: GPR[rt] temp temp FCR[fs] T+1: GPR[rt] (temp || temp Exceptions: Coprocessor unusable exception MIPS R4000 Microprocessor User's Manual B-25...
Page 680
If Invalid operation is not enabled, then no exception is taken and –1 is returned. Operation: StoreFPR(fd, W, ConvertFmt(ValueFPR(fs, fmt), fmt, W)) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Invalid operation exception Unimplemented operation exception Inexact exception Overflow exception B-30 MIPS R4000 Microprocessor User's Manual...
Page 681
FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR (fd, fmt, ValueFPR(fs, fmt)/ValueFPR(ft, fmt)) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception Division-by-zero exception Inexact exception Overflow exception Underflow exception MIPS R4000 Microprocessor User's Manual B-31...
Page 682
The FR bit in the Status register specifies whether all 32 registers of the R4000 are addressable. When FR equals zero, this instruction is not defined when the least significant bit of fs is non-zero. When FR is set, fs may specify either odd or even registers.
Page 683
DMTC1. The FR bit in the Status register specifies whether all 32 registers of the R4000 are addressable. When FR equals zero, this instruction is not defined when the least significant bit of fs is non-zero. When FR equals one, fs may specify either odd or even registers.
Page 684
When the source operand is an Infinity, NaN, or the correctly rounded integer result is outside of –2 to 2 – 1, the Invalid operation exception is raised. If the Invalid operation is not enabled then no exception is taken and 2 –1 is returned. B-34 MIPS R4000 Microprocessor User's Manual...
Page 686
When the source operand is an Infinity or NaN, or the correctly rounded integer result is outside of –2 to 2 –1, an Invalid operation exception is raised. If Invalid operation is not enabled, then no exception is taken and –1 is returned. B-36 MIPS R4000 Microprocessor User's Manual...
Page 688
The FR bit of the Status register (SR ) specifies whether all 32 registers of the R4000 are addressable. If FR equals zero, this instruction is not defined when the least significant bit of ft is non-zero. If FR equals one, ft may specify either odd or even registers.
Page 689
= 0 then /* valid specifier, 32-bit wide FGRs */ FGR[ft+1] data 63...32 FGR[ft] data 31...0 else /* undefined result if odd */ undefined_result endif Exceptions: Coprocessor unusable TLB refill exception TLB invalid exception Bus error exception Address error exception MIPS R4000 Microprocessor User's Manual B-39...
Page 690
16 even Floating-Point registers. If FR equals one, LWC1 loads the low 32-bits of both even and odd Floating-Point registers. If either of the two least-significant bits of the effective address is non-zero, an address error exception occurs. B-40 MIPS R4000 Microprocessor User's Manual...
Page 692
The FR bit of the Status register specifies whether all 32 registers of the R4000 are addressable. If FR equals zero, MFC1 stores either the high or low half of the 16 even Floating-Point registers. If FR equals one, MFC1 stores the low 32-bits of both even and odd Floating-Point registers.
Page 693
When the FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR(fd, fmt, ValueFPR(fs, fmt)) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception MIPS R4000 Microprocessor User's Manual B-43...
Page 694
The FR bit of the Status register specifies whether all 32 registers of the R4000 are addressable. If FR equals zero, MTC1 loads either the high or low half of the 16 even Floating-Point registers. If FR equals one, MTC1 loads the low 32-bits of both even and odd Floating-Point registers.
Page 695
FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR (fd, fmt, ValueFPR(fs, fmt) * ValueFPR(ft, fmt)) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception Inexact exception Overflow exception Underflow exception MIPS R4000 Microprocessor User's Manual B-45...
Page 696
When the FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR(fd, fmt, Negate(ValueFPR(fs, fmt))) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception B-46 MIPS R4000 Microprocessor User's Manual...
Page 697
When the source operand is an Infinity, NaN, or the correctly rounded integer result is outside of –2 to 2 – 1, the Invalid operation exception is raised. If the Invalid operation is not enabled then no exception is taken and 2 –1 is returned. MIPS R4000 Microprocessor User's Manual B-47...
Page 699
When the source operand is an Infinity or NaN, or the correctly rounded integer result is outside of –2 to 2 –1, an Invalid operation exception is raised. If Invalid operation is not enabled, then no exception is taken and –1 is returned. MIPS R4000 Microprocessor User's Manual B-49...
Page 701
The FR bit of the Status register (SR ) specifies whether all 32 registers of the R4000 are addressable. When FR equals zero, this instruction is not defined if the least significant bit of ft is non-zero. If FR equals one, ft may specify either odd or even registers.
Page 703
FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR(fd, fmt, SquareRoot(ValueFPR(fs, fmt))) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception Inexact exception MIPS R4000 Microprocessor User's Manual B-53...
Page 704
FR bit in the Status register equals one, both even and odd register numbers are valid. Operation: StoreFPR (fd, fmt, ValueFPR(fs, fmt) – ValueFPR(ft, fmt)) Exceptions: Coprocessor unusable exception Floating-Point exception Coprocessor Exceptions: Unimplemented operation exception Invalid operation exception Inexact exception Overflow exception Underflow exception B-54 MIPS R4000 Microprocessor User's Manual...
Page 705
If FR equals one, SWC1 stores the low 32-bits of both even and odd floating-point registers. If either of the two least-significant bits of the effective address are non- zero, an address error exception occurs. MIPS R4000 Microprocessor User's Manual B-55...
Page 707
When the source operand is an Infinity, NaN, or the correctly rounded integer result is outside of –2 to 2 –1, the Invalid operation exception is raised. If the Invalid operation is not enabled then no exception is taken and 2 –1 is returned. MIPS R4000 Microprocessor User's Manual B-57...
Page 709
When the source operand is an Infinity or NaN, or the correctly rounded 31–1 integer result is outside of –2 to 2 , an Invalid operation exception is raised. If Invalid operation is not enabled, then no exception is taken and –2 is returned. MIPS R4000 Microprocessor User's Manual B-59...
Page 711
FPU Instruction Set Details FPU Instruction Opcode Bit Encoding Opcode 28...26 31...29 COP1 LDC1 LWC1 SDC1 SWC1 23...21 25...24 18...16 20...19 BCFL BCTL Figure B-3 Bit Encoding for FPU Instructions MIPS R4000 Microprocessor User's Manual B-61...
Page 712
Operation codes marked with an eta are valid only when MIPS III instructions are enabled. Any attempt to execute these without MIPS III instructions enabled causes an unimplemented operation exception. B-62 MIPS R4000 Microprocessor User's Manual...
A block of data elements (whether bytes, halfwords, words, or doublewords) can be retrieved from storage in two ways: in sequential order, or using a subblock order. This chapter describes these retrieval methods, with an emphasis on subblock ordering. MIPS R4000 Microprocessor User's Manual...
Page 714
8 doublewords, in which DW2 is taken first. hexword (block) octalword quadword Order of retrieval DW 3 taken third taken eighth taken second taken fourth taken seventh taken fifth taken first taken sixth Figure C-2 Retrieving Data in a Subblock Order MIPS R4000 Microprocessor User's Manual...
Page 715
XOR of address 0010 with the binary count of DW8, 0111 . The result is 0101 , or DW5 (shown in Table C-1). The remaining tables illustrate this method of subblock ordering, using various address permutations. MIPS R4000 Microprocessor User's Manual...
Page 719
Output Buffer i/ t Control Mechanism The speed of the R4000 output drivers is controlled by a negative feedback loop that insures the drive-off times are only as fast as necessary to meet the system requirement for single cycle transfers. This guarantees the minimum ground bounce from L* i/ t) of the switching buffers, consistent with the system timing requirements.
• connecting an incident-wave trace of length L with a capacitive loading of C between the IO_In and IO_Out pins of the R4000 • connecting a reflected wave trace of length L/2 to the IO_In pin of the R4000.
Page 722
Appendix D MIPS R4000 Microprocessor User's Manual...
Page 723
VssP (as shown), VccP, or one to VssP and one to VccP. Note that C2 and the Cp capacitors are incorporated into both the 179PGA and 447PGA package designs as surface-mounted chip capacitors. MIPS R4000 Microprocessor User's Manual...
Page 724
Appendix E PLLCap1 VccP R4000 C1, C3, Rs and Ls are Board Caps VssP PLLCap0 Figure E-1 PLL Passive Components MIPS R4000 Microprocessor User's Manual...
Page 725
In addition, the chokes (inductors: L) can be considered for use as an alternative to the resistors (R) for use in filtering the power supply. MIPS R4000 Microprocessor User's Manual...
Page 726
Appendix E MIPS R4000 Microprocessor User's Manual...
Page 727
In addition to instructions, events can be writers and users of CP0 information. For instance, an exception writes information to CP0 registers and events that occur for every instruction, like an instruction MIPS R4000 Microprocessor User's Manual...
Page 728
1. This means 1 instruction must be inserted between the MTC0 and TLBWR. If the result of the computation is less than or equal to zero, there is no hazard and no instructions are required between the pair. MIPS R4000 Microprocessor User's Manual...
Page 729
Coprocessor 0 Hazards Table F-1 R4000 Coprocessor 0 Data Writer and User Timing Instruction or Event CP0 Data Used, Stage Used CP0 Data Written, Stage Available MTC0 / DMTC0 CPR[0,rd] MFC0 / DMFC0 CPR[0,rd] PageMask, EntryHi, TLBR Index, TLB EntryLo0, EntryLo1...
Page 730
†. You cannot depend on a delay in effect if the instruction execution order is changed by exceptions. In this case, for example, the minimum delay for IE to be effective is the maximum delay before a pending, enabled interrupt can occur. MIPS R4000 Microprocessor User's Manual...
Page 731
R4000 Pinouts This Appendix shows the pinouts for the three microprocessor configurations: R4000PC, R4000SC, and R4000MC. NOTE: This entire Appendix, Appendix G, is new for the second edition. MIPS R4000 Microprocessor User's Manual...
• • • • • • • • • • • • • • • • AW AU AR AN AG AE AC AA AP AM AK AH AD AB Figure G-2 R4000MC/SC Physical Pinout MIPS R4000 Microprocessor User's Manual...
Page 736
AN13 SCData22 AT14 SCData23 AR17 SCData24 AT22 †. Used only in the MC part. Must be tied to Vcc for the SC part. ‡. This node has capacitors for the PLL premounted to the package. MIPS R4000 Microprocessor User's Manual...
Page 740
PC Pkg R4000 PC Pkg R4000 PC Pkg Function Function Function AV22 AV30 AV34 AW39 AB36 AB38 AF34 AH36 AK38 AP14 AP22 AP30 AP34 AP36 AT12 AT20 AT28 AT34 AT38 AV10 AV18 AV26 AV36 G-10 MIPS R4000 Microprocessor User's Manual...
Page 741
MIPS R2000, R3000, and R6000 data format processors double-precision FP format architecture floating-point registers 64-bit superpipeline internal data path widths array, page table entry (PTE) 6, 39, 67 operations ASID. See address space identifier System interface virtual-to-physical-address translation MIPS R4000 Microprocessor User's Manual...
Page 742
Cache Error (CacheErr) register line size Cache Error exception secondary cache Cache Error exception process accessing caches line size attributes organization clean states clean exclusive dirty dirty exclusive MIPS R4000 Microprocessor User's Manual...
Page 743
See also System Control historical context Coprocessor computational instructions, CPU System interface 64-bit operations See also System interface cycle timing for multiply and divide transfers between FPU and CPU instructions CISC. See complex instruction set formats computer MIPS R4000 Microprocessor User's Manual...
Page 744
Bus Error dirty exclusive, cache attribute Cache Error dirty shared, cache attribute Cache Error exception process dirty, cache attribute Coprocessor Unusable divide registers, CPU Floating-Point Division-by-Zero exception general exception process doublewords, byte ordering in Integer Overflow MIPS R4000 Microprocessor User's Manual...
Page 745
See yellow_slugs Exception Program Counter (EPC) register general exception 100, 112 handler exclusive, cache attribute process Execution (EX) servicing guidelines 68, 69, 73, 109, 112, 119 EXL bit extensions, to instruction set architecture external stalls, conditions MIPS R4000 Microprocessor User's Manual...
Page 746
(ISA) instructions, FPU extensions to branch overview compare instruction set, CPU computational extensions conversion 14, 35 overview latency types of instructions load See also instructions, CPU move instruction set, FPU pipeline stage sequences MIPS R4000 Microprocessor User's Manual...
Page 747
Joint Test Action Group (JTAG) interface language suite approach, benefits of boundary scanning, explanation of latency determining operation external read response registers 361, 363 external response Boundary-scan fault detection Bypass FPU instruction Instruction FPU operation MIPS R4000 Microprocessor User's Manual...
Page 748
System Control Coprocessor (CP0) exception conditions memory organization, hierarchy external stalls MIPS RISCompilers, language suite load delay MIPS R-Series processors, instructions operation 16–23 common to overrun move instructions, FPU performance considerations multiply registers, CPU slip conditions MIPS R4000 Microprocessor User's Manual...
Page 749
EC bit ECC Fault* signal Load Linked Address (LLAddr) enhancements over R4000 EW bit Processor Revision Identifier fault detection latency (PRId) IC bit, setting primary I-cache size register numbers Master/Checker boot-mode bits Status 223, 225 TagHi MIPS R4000 Microprocessor User's Manual...
Page 750
JTAG interface Instruction request cycle control signals Request Secondary Cache interface requests. See System interface summary Reserved Instruction exception system clocks Reset exception System interface handling slips, conditions overview slugs, banana. See UCSC process I-10 MIPS R4000 Microprocessor User's Manual...
Page 751
SysAD bus xsseg secondary cache transfers xsuseg secondary cache write cycle time suseg 69, 109 293–294 SX bit description System Call exception endianness System Control Coprocessor (CP0) hazards instructions register numbers MIPS R4000 Microprocessor User's Manual I-11...