RISC MICROPROCESSOR ARCHITECTURE

Abstract: The microprocessor (100) executes at 100 native MIPS peak performance with a 100-MHz internal clock frequency. The CPU instruction sets are hardwired, allowing most instructions to execute in a single cycle. A "flow-through" design allows the next instruction to start before the prior instruction completes, thus increasing performance. MPU (108) contains 52 general-purpose registers, including 16 global data registers (104), an index register (132), a count register (134), a 16-deep addressable register/return stack (124), and an 18-deep operand stack (122). Both stacks contain an index register (128, or 130) in the top elements, are cached on chip, and, when required, automatically spill to and refill from external memory. The stacks minimize the data movement and also minimize memory access during procedure calls, parameter passing, and variable assignments. Additionally, the MPU contains a mode/status register (136) and 41 locally addressed registers (102) for I/O, control, configuration, and status. The CPU (100) contains both a high-performance, zero-operand, dual-stack architecture microprocessing unit (MPU) (108), and an input-output processor (IOP) (110) that executes instructions to transfer data, count events, measure time, and perform other timing-dependent functions. A zero-operand (stack) architecture eliminates operand bits. Stacks also minimize register saves and loads within and across procedures, thus allowing shorter instruction sequences and faster-running code. Instructions are simple to decode and execute, allowing the MPU (108) and IOP (110) to issue and complete instructions in a single clock cycle - each at 100 native MIPS peak execution. Using 8-bit opcodes, the CPU (100) obtains up to four instructions from memory each time an instruction fetch or pre-fetch is performed. These instructions can be repeated without rereading them from memory. This maintains high performance when connected directly to DRAM, without a cache.

Description: RISC MICROPROCESSOR ARCHITECTURE CROSS-REFERENCE TO RELATED APPLICATIONS This invention is directed to improvements in the inventions disclosed and/or claimed in U.S. Application Serial No. 07/389,334, filed August 3, 1989, now U.S. Patent 5,440,749, and the following divisional applications of that application: U.S. Application Serial Nos. 08/480,462; 08/480,911 ; 08/480,015; 08/485,031 ; 08/484,918; 08/484,230; 08/484,920; 08/480,206; 08/484,935; 08/482, 185; 08/480,901 and 08/486,454, all filed June 7, 1995, and is based on U.S. Provisional Application Serial No. 60/005,408, filed October 6, 1995. INTRODUCTION Technical Field This invention relates to an improved form of a simplified, reduced instruction set computer (RISC) microprocessor. More particularly, it relates to such a microprocessor implemented with a stack architecture. Background Since the invention of the microprocessor described in the above related applications, all based on a common disclosure which is hereby incorporated by reference herein, improvements have been made in that microprocessor to enhance its performance and manufacturabiliry. The following description discloses those improvements in the context of a presently preferred embodiment of that microprocessor. SUMMARY OF THE INVENTION In one aspect of the invention, a microprocessor system includes a microprocessing unit and an input-output processor (IOP). A global memory unit is coupled to the central processing unit and to the IOP. A means arbitrates access of the central processing unit and the IOP to the global memory unit. In one form, the global memory unit comprises a plurality of global registers. In another aspect of the invention, a microprocessor system, has a microprocessing unit and an input-output processor (IOP). A memory interface unit selectively couples the central processing unit and the IOP to a system bus. A means grants the IOP access to the system bus at predetermined intervals. In a further aspect of the invention, a microprocessor system has a microprocessing unit in which is included an arithmetic logic unit coupled to a stack cache. A means, coupled to the arithmetic logic unit and to the stack cache, determines the availability of stack cache resources by determining whether a value is included in at least one cell of the stack cache and whether at least one other cell of the stack cache is empty. A means, coupled to the means for determining the availability of the stack cache resources, selectively inhibits instruction execution by the arithmetic logic unit based on the availability of the stack cache resources. In still another aspect of the invention, a microprocessor system has a microprocessing unit in which is included an arithmetic logic unit coupled to a stack cache. The stack cache is allocated at least a first portion of system memory. A means, coupled to the microprocessing unit and to the stack cache, executes a stack management trap when a stack pointer of the stack cache assumes an address within a boundary region of the first portion of the system memory. The stack management trap determines availability of at least one other portion of the system memory. A means, coupled to the means for executing the stack management trap, prevents another execution of the stack management trap until after the stack pointer has assumed an address within a predefined region of the first portion of the system not included within the boundary region. In a still further aspect of the invention, a microprocessor system has a microprocessing unit and a memory interface unit coupling the microprocessing unit to system random access memory (RAM). The microprocessor system includes means, coupled to the memory interface unit, for converting logical row addresses provided by the microprocessing unit to physical row addresses of die system RAM so as to define virtual system memory using the system RAM. In yet another aspect of the invention, a microprocessor system, includes a register unit. The register unit has at least one storage location containing a value to be interpreted as a memory address. A memory interface unit is coupled to the register unit. A memory bus is coupled to the memory interface unit. A system memory is coupled to me memory interface unit by the memory bus. The memory interface unit comprises transfer logic to increment the memory address and to generate a boundary detected signal when, after a memory bus transaction to the system memory using the memory address, me memory address after incrementing has a value that is an even multiple of 2 n , where n is a nonnegative integer. In a still further aspect of the invention, a microprocessor system includes a central processing unit and a bit input register coupled to the central processing unit. The bit input register receives logical input over at least one bit line. The bit input register has a latch coupled to the at least one bit line, which initially samples the at least one bit line in order to determine a logic level thereof. A zero persistence control unit is coupled to the latch for storing the logic level in a register assigned to the at least one bit line. The logic level remains stored in the register until the zero persistence control unit is provided with a predefined signal by d e central processing unit. In another aspect of the invention, a microprocessor system, comprising a microprocessing unit, an input-output processor (IOP), and a memory interface unit selectively coupling said central processing unit and said IOP to a system bus, said IOP including program counter means for providing system address information to said memory interface unit. In a further aspect of the invention, a microprocessor system includes a microprocessing unit having a stack cache. A system for effecting floating-point mathematical instructions includes an arithmetic logic unit means for performing floating-point operations upon values within cells of the stack cache. A means, coupled to the arithmetic logic unit means, generates floating point exceptions in response to performance of selected ones of me floating point operations. A mode register means, coupled to the arithmetic logic unit means and to me means for generating floating point exceptions, enables the microprocessing unit to execute predefined floating point routines in response to the floating point exceptions. In still another aspect of the invention, a microprocessor system includes a microprocessing unit having a stack cache. A method for executing a breakpoint instruction comprises the steps of: pushing into the stack cache a memory address of the breakpoint instruction; and executing a breakpoint service routine. In a still further aspect of the invention, a microprocessor system includes system memory and a microprocessing unit having one or more internal registers. The system memory is assigned a first address space for communication with the microprocessing unit. A method for transferring data wid in the microprocessing unit comprising the steps of: assigning the one or more internal registers a second address space different from die first address space; and transferring data to and from portions of the one or more internal registers identified by addresses within the second address space. In yet anoti er aspect of the invention, a microprocessor system including a microprocessing unit having a stack cache. A method for address arithmetic comprises the steps of: storing a first address value in a first cell of the stack cache; storing a second address value in a second cell of die stack cache; and adding the first address value to the second address value and storing a resultant sum value in the first cell of the stack cache. In a yet further aspect of the invention, a microprocessor system includes a microprocessing unit having a stack cache. A method for performing a copy byte operation comprises the steps of: reading a least significant one of a plurality of data bytes stored in a cell; replacing at least one other of the plurality of data bytes widi the least significant data byte. In still another aspect of the invention, a microprocessor system includes a microprocessing unit having a stack cache and a carry register. A method for performing a test byte operation comprises the steps of: reading each of a plurality of bytes stored within a cell of the stack cache; and storing a first logical value in the carry register when any of the bytes are of zero value, and storing a second logical value in die carry register otherwise. In a still further aspect of the invention, a microprocessor system including a system memory and a microprocessing unit coupled to me system memory. A stack cache is coupled to d e system memory and a program counter coupled to me stack cache. A single step processing system includes a means, coupled to die stack cache and to die program counter, for loading a first memory address from a first cell of the stack cache into the program counter. A means is coupled to the program counter for executing a first instruction stored in die system memory of the microprocessor system at a location corresponding to the first memory address. A means executes a single-step trap routine during which a second memory address is loaded into the first cell wherein a second instruction following the first instruction is stored at a location in the system memory corresponding to die second memory address. In another aspect of the invention, a microprocessor system includes system memory and a microprocessing unit coupled to die system memory having a stack cache. A stack cache management system includes a means, coupled to the stack cache, for determining a number of cells currendy included widiin the stack cache. A means, coupled to said means for determining die number of cells, performs a comparison of the number of cells to a predefined depth of the stack cache. A means, coupled to said means for performing the comparison, provides an indication of a current stack depd based on said comparison. In a further aspect of the invention, a microprocessor system includes system memory and a microprocessing unit coupled to die system memory having a stack cache. A stack cache management system includes a stack depth means, coupled to said stack cache, for determining a number of cells currently included within said stack cache. A means, coupled to me stack depdi means, provides an indication of the stack depdi. In another aspect of the invention, a microprocessor system includes system memory, and a microprocessing unit having a stack cache. A stack cache management system comprises means, coupled to the stack cache, for determining a current number cells in the stack cache. A means is coupled to the means for determining the current number of cells, for computing a number of cells capable of being added to die stack cache by comparing the current number of cells to a maximum stack depdi. A means is coupled to die stack cache and to the means for computing the number of cells capable of being added to me stack cache, for adding to the current number of cells in d e stack cache a number of the cells equivalent to the number of cells capable of being added to the stack cache. In still another aspect of the invention, a microprocessor includes a microprocessing unit mat has an aridimetic logic unit and a push-down stack coupled to die aridimetic logic unit. The arithmetic logic unit includes a bit- shifting means to shift bits. The bit shifting means shifts a count of bits in one or more partial shifts with the count reducing by die number of bits shifted each partial shift. The shifting is performed by multiple bits while the count is greater dian the multiple. The multiple then is reduced, and then the shifting and the reductions of die count repeat until die count reaches zero. BRIEF DESCRIPΗON OF THE DRAWINGS Figure 1 is a block diagram of a microprocessor central processing unit (CPU) in accordance with the invention. Figure 2 is a block diagram of a microprocessing unit (MPU) portion of the microprocessor CPU shown in Figure 1. Figure 3 is a diagrammatic representation of registers in the MPU portion shown in Figure 2. Figure 3a is a diagrammatic representation of an add operation using certain of the registers shown in Figure 3 Figure 4 is a diagrammatic representation of a memory map for the CPU shown in Figure 1. Figure 5 is a diagrammatic representation of stack exception regions in the memory for the CPU shown in Figure 1. Figure 6 is a diagrammatic representation of instruction formats for the MPU of Figure 2. Figure 6a is a diagrammatic representation of floating point number formats used with the MPU of Figure 2 Figure 7 is a more detailed diagrammatic representation of a mode register shown in Figure 5. Figure 8 is a block diagram of an input-output processor (IOP) shown in Figure 1. Figure 9 is a diagrammatic representation of register usage in die IOP of Figure 8. Figure 10 is a diagrammatic representation of instruction formats for the IOP of Figure 8. Figure 11 is a block diagram of a direct memory access controller (DMAC) shown in Figure 1. Figure 12 is a diagrammatic representation of an input-output (I/O)-channel transfer data format utilized in the microprocessor of Figure 1. Figure 13 is a block diagram of an interrupt controller (INTC) shown in Figure 1. Figure 14 is a block diagram of bit inputs for the bit input register ioin shown in Figure 8. Figure 15 is a block diagram of bit outputs for die bit output register ioout shown in Figure 8. Figure 16 is a diagrammatic representation of group-select and bank-select bits used in memory accesses with the microprocessor of Figure 1. Figure 17 is a block diagram of a single memory bank system using the microprocessor of Figure 1. Figure 18 is a block diagram of a multiple memory bank system using the microprocessor of Figure 1. Figure 19 is a set of signal timing diagrams for memory accesses using the systems of Figures 17-18. Figure 20 is a diagrammatic representation of on-chip resource registers shown in Figure 1. Figures 21 -46a are more detailed diagrammatic representations of the on- chip resource registers shown in Figure 20 and reserved register addresses. Figures 47-62 are sets of signal timing diagrams for memory accesses using the systems of Figures 17-18. Figures 63-65 are block diagrams of systems incorporating me microprocessor of Figure 1. Figures 66-76 are sets of signal timing diagrams useful for understanding operation of die microprocessor of Figure 1. DESCRIPΗON OF SPECIFIC EMBODIMENTS The ShBoom Microprocessor 100 (Figure 1) is a highly integrated 32-bit RISC processor that offers high performance at low system cost for a wide range of embedded applications. At 100 MHz internally, the processor executes widi 100 native MIPS peak performance. The 32-bit registers 102 and 104 and data paths 106 fully support 32-bit addresses and data types. The processor 100 addresses up to four gigabytes of physical memory, and supports virtual memory with the use of external mapping logic. Conventional high-performance microprocessors are register-based widi large register sets, and are pipelined or superscaler. These complex architectures consume costly silicon with multiple-operand instructions, multiple execution units, or leng iy execution pipelines. All these features diminish the fastest possible execution of individual instructions and increase silicon size, thus increasing chip cost. The ShBoom CPU 100 architectural philosophy is that of simplification and efficiency of use. A zero-operand design eliminates most operand bits and die decoding time and instruction space diey require. Instructions are shrunk to 8- bits, significandy increasing instruction bandwidth and reducing program size. By not using pipeline or superscalar execution, the resulting control simplicity increases execution speed to issue and complete an instruction in a single clock cycle - as often as every clock cycle - without a conventional instruction cache. To ensure a low-cost chip, a data cache and its cost are also elminated in favor of efficient register caches. The ShBoom CPU 100 operates up to four groups of programmable bus configurations from as fast as 20 ns to as slow as 810 ns, allowing any desired mix of high-speed and low-speed memory. Minimum system cost is reduced, dius allowing the system designer to trade system cost for performance as needed. By incorporating many on-chip system functions and a "glueless" bus interface, support chips are elminated further lowering system cost. The CPU 100 includes an MPU 108, an I/O processor 110, a DMA controller 112, an interrupt controller 114, bit inputs 116, bit outputs 118, and a programmable memory interface 120. It can operate with 32-bit-wide or 8-bit-wide memory and devices, and includes hardware debugging support. A minimum system consists of ShBoom CPU, an 8-bit-wide EPROM, an oscillator, and optionally one x8 or two xl6 memories - a total of 4 or 5 active components. The small die, which contains only 137,500 transistors, produces a high-performance, low-cost CPU, and a high level of integration produces a high-performance, low-cost system. FEATURES Microprocessing Unit (MPU) 108 (Figure 2) Zero-operand dual-stack 122 and 124 architecture 10-ns instructions cycle 52 General-Purpose 32-Bit Registers 16 global data registers (g0-gl5) 104 16 local registers (r0-rl5) double as return stack cache 124 rO is an index register 128 widi predecrement and postincrement Automatic local-register stack 124 spill and refill 18 operand stack cache registers (s0-sl7) 122 sO is an address register 130 Automatic operand stack spill and refill Index register (x) 132 widi predecrement and postincrement Count register (ct) 134 Stack paging traps Cache-management instructions MPU 108 communicates widi DMA 112 and IOP 110 via global registers 104 Hardware single- and double-precision IEEE floating-point support Fast multiply Fast bit-shifter Hardware single-step and breakpoint Virtual-memory support Posted write Power-on-reset flag Instruction-space-saving 8-bit opcodes Direct Memory Access Controller (DMAC) 112 (Figure 11) Eight prioritized DMA channels Fixed or revolving DMA priorities Byte, four-byte or cell DMA devices Single or back-to-back DMA requests Transfer rates to 200 MB/ second Programmable timing per channel Interrupt MPU on transfer boundary/count reached Terminate DMA on transfer boundary /count reached Channels can be configured as event counters DMA 112 communicates widi MPU 108 and IOP 110 via global registers 104 Input-Output Processor (IOP) 110 Executes instruction stream independent of MPU 108 Deterministic execution Used to perform timing, time-synchronous data transfers, bit output operations, DRAM refresh Eight transfer channels Byte, four-byte or cell device transfers Programmable timing per channel Interrupt MPU on transfer boundary/count reached Set/reset output bits Set MPU interrupt Test and branch on input bit Looping instructions Load transfer address, direction, interrupt on boundary IOP 110 communicates with DMA 112 and MPU 108 via global registers 104 or memory Channels can be configured as timers Instruction-space-saving 8-bit opcodes Input- Output 116 and 118/Interτupts Eight input 116 bits Bits can be configured as zero-persistent Register- and bit-addressable Eight output 118 bits Register- and bit-addressable I/O bits available on pins or multiplexed on bus Eight prioritized and vectored interrupts Programmable Memory Interface (MIF) 120 Programmable bus interface timing to 1/4 external clock Four independently configurable memory groups: Any combination of 32-bit and 8-bit devices Any combination of EPROM, SRAM, DRAM, VRAM Almost any DRAM size/configuration Fast-page mode access for each DRAM group Glueless support for one memory bank per group 1.25 gates per memory bank for decoding up to 16 memory banks (four per memory group) Virtual-memory support DRAM refresh support (via IOP) VRAM support includes DSF, OE, WE " , CaTbefore RAS COΠUΌI Signals shown in Figure 1 are described below in Table 1. Notes I = Input Only Pins A() = Asynchronous inputs 1(H) = high value on reset O = Output-Only Pins S(sym) = Synchronous inputs must meet setup and I(L) = low value on reset I/O = Bidirectional Pins hold requirements relative to symbol I(Z) = high impedance on reset Signal pinouts from die single chip microprocessor 100 when packaged in a National Semiconductor type VJG/VJU 100 Pin Plastic Quad Flat Package are shown below in Table 2. Purpose The following material describes me architecture, hardware interface, and programming of the ShBoom Microprocessor 100. The processor is targeted for embedded applications diat require high MPU performance and low system cost. These include laser printers, graphics accelerators, ignition controllers, network routers, personal digital assistants, set-top cable controllers, video games, and many other applications. This material provides d e information required to design products that will use die ShBoom CPU 100, including functional capability, electrical characteristics and ratings, and package definitions, as well as programming both d e MPU 108 and IOP 110. Overview The ShBoom Microprocessor 100 is a highly integrated 32-bit RISC processor that executes at 100 native MIPS peak performance widi a 100-MHz internal clock frequency. The CPU 100 is designed specifically for use in embedded applications for which MPU performance and system cost are deciding selection factors. The ShBoom CPU instruction sets are hardwired, allowing most instructions to execute in a single cycle, without die use of pipelines or superscalar architecture. A "flow-dirough" design allows d e next instruction to start before the prior instruction completes, us increasing performance. The ShBoom MPU 108 (see Figure 2) contains 52 general-purpose registers, including 16 global data registers 104, an index register 132, a count register 134, a 16-deep addressable register/ return stack 124, and an 18-deep operand stack 122. Both stacks contain an index register 128 or 130 in die top elements, are cached on chip, and, when required, automatically spill to and refill from external memory. The stacks minimize die data movement typical of register-based architectures, and also minimize memory access during procedure calls, parameter passing, and variable assignments. Additionally, d e MPU contains a mode/status register 136 and 41 locally addressed registers 102 for I/O, control, configuration, and status. KEY FEATURES Dual-Processor Architecture: The CPU 100 contains both a high- performance, zero-operand, dual-stack architecture microprocessing unit (MPU) 108, and an input-output processor (IOP) 110 that executes instructions to transfer data, count events, measure time, and perform other timing-dependent functions. Zero-Operand Architecture: Many RISC architectures waste valuable instruction space - often 15 bits or more per instruction - by specifying diree possible operands for every instruction. Zero-operand (stack) architectures eliminate these operand bits, thus allowing much shorter instructions - typically one-fourth the size - and dius a higher instruction-execution bandwiddi and smaller program size. Stacks also minimize register saves and loads widiin and across procedures, dius allowing shorter instruction sequences and faster-running code. Fast. Simple Instructions: Instructions are simpler to decode and execute d an those of conventional RISC processors, allowing the ShBoom MPU 108 and IOP 110 to issue and complete instructions in a single clock cycle - each at 100 native MIPS peak execution. Four-Instruction Buffer: Using 8-bit opcodes, die CPU 100 obtains up to four instructions from memory each time an instruction fetch or pre-fetch is performed. These instructions can be repeated without rereading them from memory. This maintains high performance when connected directly to DRAM, without die expense of a cache. Local and Global Registers: Local and global registers minimize the number of accesses to data memory. The local-register stack 124 automatically caches up to sixteen registers and die operand stack 122 up to eighteen registers. As stacks, the data space allocated efficiently nests and unnests across procedure calls. The sixteen global registers 104 provide storage for share data. Posted Write: Decouples die processor from data writes to memory, allowing the processor to continue executing after a write is posted. Programmable Memorv/Bus Interface: Allows the use of lower-cost memory and system components in price-sensitive systems. The interface supports many types of EPROM/SRAM/DRAM/VRAM directly, including fast-page mode on up to four groups of DRAM devices. On-chip support of RAS cycle OE and WE, CAS-before-RAS, and the DSF signal allow use of VRAM without additional external hardware. Programmable bus timing and driver power allow die designer a range of solutions to system design challenges to match die time, performance and budget requirements for each project. Clock Multiplier: Internally doubles and quadruples die external clock. An on-chip PLL circuit eliminates typical stringent oscillator specifications, dius allowing die use of lower-cost oscillators. Fully Static Design: A fully static design allows running me clock from DC up to rated speed. Lower clock speeds can be used to drastically cut power consumption. Hardware Debugging Support: Bodi breakpoint and single-step capability aid in debugging programs. Virtual Memory: Supported d rough the use of external mapping SRAMs and support logic. Floating-Point Support: Special instructions implement efficient single- and double-precision IEEE floating-point arithmetic. Interrupt Controller: Supports up to eight prioritized levels wid interrupt responses as fast as eight 2X-clock cycles. Eight Bit Inputs 116 and Eight Bit Outputs 118: I/O bits are available for MPU and IOP application use, reducing die need for external hardware. CENTRAL PROCESSING UNIT The ShBoom CPU 100 architectural philosophy is that of simplification and efficiency of use: implement the simplest solution mat adequately solves die problem and provides die best utilization of existing resources. In hardware, diis typically equates to using fewer transistors, and fewer transistors means a lower- cost CPU. Early RISC processors reduced transistor counts compared to CISC processors, and gained dieir cost and performance improvements therein. Today, interconnections between transistors dominate die silicon of many CPUs. The ShBoom MPU architectural philosophy results in, along widi fewer transistors, the minimization of interconnections compared to register-based MPUs. Resources The ShBoom CPU 100 (Figure 1) contains ten major functional units: microprocessing unit (MPU) 108, input-output processor (IOP) 110, global registers 104, direct memory acces controller (DMAC) 112, interrupt controller (INTC) 114, on-chip resources 102, bit inputs 116, bit outputs 118, programmable memory interface (MIF) 120, and clock 140. In part, die ShBoom CPU gains its small silicon size and capability from the resource sharing within and among diese units. For example: - The global registers 104 are shared by the MPU 108, the IOP 110, and transfer logic 142 within the MIF 120. They are used by the MPU 108 for data storage and control communication with die DMAC 112 and d e IOP 110; by die IOP 110 for transfer information, loop counts, and delay counts; and by die DMAC 112 for transfer information. Further, the transfer information is used by the transfer logic in the MIF 120 that is shared by the IOP 110 and DMAC 112. - The MIF 120 is shared by the MPU 108, the IOP 110, die DMAC 112, d e bit outputs 118 and d e bit inputs 116 for access to the system bus. Bus transaction requests are arbitrated and prioritized by die MIF 120 to ensure temporally deterministic execution of die IOP 110. - The DMAC 112 transfer-termination logic is significantly reduced by using specific termination conditions and close coupling widi the MPU 108 for intelligent termination action. - The INTC 114 is shared by the bit inputs 116, he IOP 110, and the DMAC 112 (dirough die MIF 120 transfer logic 142) for interrupt requests to die MPU 108. - The bit outputs 118 are made available to d e system through die On-Chip Resources Registers 102. They are shared by the MPU 108 and the IOP 110 for programmed output, and are bit-addressable. Aldiough die maximum usage case requiring a complex IOP 110 program, many interrupt sources, many input bits, many output bits, all available DMA channels, and maximum MPU 108 computational ability might leave a shortage of resources, such applications are not typical. The sharing of resources among functional units significantly reduces transistor count, package pin count, and thus silicon size and cost, and increases CPU capability and flexibility. The ability to select among available resources, compared to die fixed resource set of other CPUs, allows die ShBoom CPU 100 to be used for a wider range of applications. Clock Speed The clock speed of a CPU is not a predictor of its performance. For instance, the PowerPC 604, running at about half the speed of die DEC Alpha 21064 A, achieves about die same SPECint95 benchmark performance. In this respect, die ShBoom CPU 100 is more like the DEC Alpha than die PowerPC. However, die ShBoom CPU 100 is based on a significantly different design philosophy dian either of diese CPUs. Most processors historically have forced d e system designer to maintain a balanced triangle among CPU execution speed, memory bandwiddi, and I/O bandwidth. However, as system clock rate increases so typically does bus speed, cache memory speed and system interface costs. Typically, too, so does CPU cost, as often thousands of transistors are added to maintain this balance. The ShBoom CPU 100 lets the system designer select die performance level desired, while maintaining low system cost. This may tilt the triangle slightly, but cost is not part of die triangle-balancing equation. The ShBoom CPU's programmable memory interface permits a wide range of memory speeds to be used, allowing systems to use slow or fast memory as needed. Slow memory will clearly degrade system performance, but die fast internal clock speed of die ShBoom CPU 100 causes internal operations to be completed quickly. Thus the multi-cycle multiply and divide instructions always execute quickly, without d e silicon expense of a single-cycle multiply unit. At up to eight times the clock rate of competing parts with single-cycle multipliers, die difference in multiply/divide performance diminishes while die remainder of d e application executes correspondingly faster. Aldiough higher performance can sometimes be gained by dedicating large numbers of transistors to functions such as these, silicon cost also increases, and increased cost did not fit die design goals for this version of the ShBoom CPU 100. MICROPROCESSING UNIT The MPU 108 (Figure 2) supports the ShBoom CPU architecmral philosophy of simplification and efficiency of use dirough die basic design in several interrelated ways. Whereas most RISC processors use pipelines and superscalar execution to execute at high clock rates, the ShBoom MPU 108 uses neidier. By having a simpler architecture, the ShBoom MPU issues and completes most instructions in a single clock cycle. There are no pipelines to fill and none to flush during changes in program flow. Though more instructions are sometimes required to perform me same procedure in ShBoom MPU code, the MPU operates at a higher clock frequency dian odier processors of similar silicon size and technology, thus giving comparable performance at significantly reduced cost. A microprocessor's performance is often limited by how quickly it can be fed instructions from memory. The MPU 108 reduces diis bottleneck by using 8- bit instructions so diat up to four instructions (an instruction group) can be obtained during each memory access. Each instruction typically takes one 2X- clock cycle to execute, dius requiring four 2X-clock cycles to execute die instruction group. Because a memory access can take four 2X-clock cycles, the next instruction group completes. This makes it possible to feed instructions to the processor at maximum instruction-execution bandwiddi widiout the cost and complexity of an instruction cache. The zero-operand (stack) architecture makes 8-bit instructions possible. The stack architecture eliminates die need to specify source and destination operands in every instruction. By not using opcode bits on every instruction for operand specification, a much greater bandwiddi of functional operations - up to four times as high - is possible. Table 3 depicts an example ShBoom MPU instruction sequence diat demonstrates twice die typical RISC CPU instruction bandwiddi. The instruction sequence on die ShBoom MPU requires one-half die instruction bits, and the uncached performance benefits from the resulting increase in instruction bandwidth. RECEIVED BLANK BY RO/US Table 3 - Instruction Bandwiddi Comparison g5 = gl - (g2 + 1) + g3 - (g4*2) Typical RISC MPU add g 2, n, g5 sub g5, gl, g5 add g5, g3, g5 sh_ιog4, #1, temp sub temp, g5, g5 20 bytes Example of twice the instruction bandwiddi 15 available on the ShBoom MPU Stack MPUs are thus simpler than register-based MPUs, and the ShBoom MPU 108 has two hardware stacks 122 and 124 to take advantage of diis: the operand stack 122 and the local-register stack 124. The simplicity is widespread and is reflected in the efficient ways stacks are used during execution. ALU 150 processes data from primarily one source of inputs - die top 130 of the operand stack 122. The ALU 150 is also used for branch address calculations. Data bussing is dius greatly reduced and simplified. Intermediate results typically "stack up" to unlimited depth and are used directly when needed, rather han requiring specific register allocations and management. The stacks 122 and 124 are individually cached and spill and refill automatically, eliminating software overhead for stack manipulation typical in other RISC processors. Function parameters are passed on, and consumed directly off of, the operand stack 122, elminating the need for most stack frame management. When additional local storage is needed, die local-register stack 124 supplies registers that efficiently nest and unnest across functions. As stacks, the stack register spaces are only allocated for data actually stored, maximizing storage utilization and bus bandwidth when registers are spilled or refilled - unlike architectures using fixed-size register windows. Stacks speed context switches, such as interrupt servicing, because registers do not need to be explicitly saved before use - additional stack space is allocated as needed. The stacks thus reduce die number of explicitly addressable registers odierwise required, and speed execution by reducing data location specification and movement. Stack storage is inherently local, so the global registers 104 supply non-local register resources when required. Eight-bit opcodes are too small to contain much associated data. Additional bytes are necessary for immediate values and branch offsets. However, variable-length instructions usually complicate decoding and complicate and lengdien me associated data access padis. To simplify the problem, byte literal data is taken only from the rightmost byte of the instruction group, regardless of the location of the byte literal opcode withing the group. Similarly, branch offsets are taken as all bits to the right of the branch opcode, regardless of die opcode position. For 32-bit literal data, die data is taken from a subsequent memory cell. These design choices ensure that the required data is always right-justified for placement on die internal data busses, reducing interconnections and simplifying and speeding execution. Since most instructions decode and execute in a single clock cycle, the same ALU 150 that is used for data operations is also available, and is used, for branch address calculations. This eliminates an entire ALU normally required for branch offset calculations. Rather than consume the chip area for a single-cycle multiply-accumulate unit, the higher clock speed of the MPU 108 reduces the execution time of conventional multi-cycle multiply and divide instructions. For efficiently multiplying by constants, a fast multiply instruction will multiply only by me specified number of bits. Ra er than consume the chip area for a barrel shifter the counted bit-shift operation is "smart" to first shift by bytes, and then by bits, to minimuze the cycles required. The shift operations can also shift double cells (64 bits), allowing bit- rotate instructions to be easily synthesized. Aldiough floating-point math is useful, and sometimes required, it is not heavily used in embedded applications. Rather than consume die chip area for a floating-point unit, MPU instructions to efficiently perform the most time- consuming aspects of basic IEEE floating-point math operations, in both single- and double-precision, are supplied. The operations use die "smart" shifter to reduce die cycles required. Byte read and write operations are available, but cycling dirough individual bytes is slow when scanning for byte values. These types of operations are made more efficient by instructions that operate on all of die bytes within a cell at once. Address Space The MPU 108 fully supports a linear four-gigabyte address space for all program and data operations. I/O devices are selected by mapping them into memory addresses. By convention, me uppermost address bits select I/O device addresses decoded in external hardware. This convention leaves a contiguous linear program and data space of two gigabytes with a sparse address space above two gigabytes. It also allows simultaneous addressing of an I/O device and a memory address for I/O channel transfers. See Memory and Device Addressing, below. Several instructions of operations expect addresses aligned on four-byte (cell) boundaries. These addresses are referred to as cell-aligned. Only die upper 30 bits of the address are used to locate the data; the two least-significant address bits are ignored. Wi in a cell, the high order byte is located at die low byte address. The next lower-order byte is at the next higher address, and so on. For example, the value 0x12345678 would exist at byte addresses in memory, from low to high address, as 12 34 56 78. Registers and Stacks The register set contains 52 general-purpose registers 122, 124, 104, 132 and 134 (Figure 3), mode/status register 136, and 41 local address-mapped on-chip resource registers 102 (Figure 20) used for I/O, configuration, and status. The operand stack 122 contains eighteen registers s0-sl7 and operates as a push-down stack, with direct access to the top three registers (s0-s2). These registers and die remaining registers (s3-sl7) operate together as a stack cache. Arithmetic, logical, and date-movement operations, as well as intermediate result processing, are performed on me operand stack. Parameters are passed to procedures and results are returned from procedures on die stack, without die requirement of building a stack frame or necessarily moving data between other registers and the frame. As a true stack, registers are allocated only as needed for efficient use of available storage. The local-register stack 124 contains sixteen registers r0-rl5 and operates as a push-down stack with direct access to the first fifteen registers (r0-rl4). These registers and die remaining register (rl5) operate together as a stack cache. As a stack, they are used to hold subroutine return addresses and automatically nest local-register data. Both cached stacks 122 and 124 automatically spill to memory and refill from memory, and can be arbitrarily deep. Additionally, sO and rO can be used for memory access. See Stacks and Stack Caches below. The use of stack-cached operand and local registers improves performance by eliminating the overhead required to save and restore context (when compared to processors wid only global registers available). This allows for very efficient interrupt and subroutine processing. In addition to die stacks are sixteen global registers 104 and d ree other registers. The global registers (g0-gl5) are used for data storage, as operand storage for the MPU multiply and divide instructions (gO), and for die IOP 110. Since these registers are shared, the MPU 108 and die IOP 110 can also communicate through them. Remaining are mode register 136, which contains mode and status bits; x register 132, which is an index register (in addition to sO and rO); and ct register 134, which is a loop counter and also participates in floating-point operations. Programming Model For d ose familiar with American National Standard Forth (ANS Forth), or Hewlett-Packard calculators that use postfix notation, commonly known as Reverse Polish Notation (RPN), programming the ShBoom MPU will in many ways be very familiar. An MPU architecture can be classified as to d e number of operands specified within its instruction format. Typical 16-bit and 32-bit CISC and RISC MPUs are usually two- or diree-operand architectures, whereas smaller microcontrollers are often one-operand archictecmres. In each instruction, two- and diree-operand architectures specify a source and destination, or two sources and a destination, whereas one-operand architectures specify only one source and have an implicit destination, typically the accumulator. Architectures are also usually not pure. For example, one-operand archictecmres often have two-operand instructions to specify both a source and destination for data movement between registers. The ShBoom MPU 100 is a zero-operand architecture, known as a stack computer. Operand sources and destinations are assumed to be on the top of die operand stack, which is also the accumulator. See Figure 3a. An operation such as add uses both source operands from ie top of the operand stack 122, adds diem as indicated at 152, and returns the result to the top of die operand stack 122, thus causing a net reduction of one in the operand stack depdi. Most ALU 150 operations behave similarly, usiing two source operands and returning one result operand to die operand stack. A few ALU operations use one source operand and return one result operand to the operand stack. Some ALU and odier operations also require a non-stack register, and a very few do not use the operand stack at all. Non- ALU operations are also similar. Loads (memory reads) eimer use an address on the operand stack or in a specified register, and place the retrieved data on d e operand stack. Stores (memory writes) use eimer an address on the operand stack or in a register, and use data from the operand stack. Data movement operations push data from a register onto me operand stack, or pop data from the stack into a register. Once data is on die operand stack it can be used for any instruction diat expects data mere. The result of an add, for instance, can be left on the stack indefinitely, until needed by a subsequent instruction. See Table 3 above. Instructions are also available to reorder the data in the top few cells of the operand stack so that prior results can be accessed when required. Data can also be removed from die operand stack and placed in local or global registers to minimize or eliminate later reordering of stack elements. Data can even be popped from the operand stack and restacked by pushing it onto die local-register stack. Computations are usually most efficiently performed by executing me most deeply nested computations first, leaving die intermediate results on die operand stack, and d en combining the intermediate results as die computation unnests. If the nesting of the computation is complex, or if the intermediate results need to be used sometime later after other data will have been added to die operand stack, die intermediate results can be removed from e operand stack and stored in global or local registers. Global registers are used direcdy and maintain their data indefinitely. Local registers are registers within die local-register stack cache and, as a stack, must first be allocated. Allocation can be performed by popping data from die operand stack and pushing it onto the local-register stack one cell at a time. It can also be performed by allocating a block of uninitialized stack registers at one time; die uninitialized registers are then initialized by popping data, one cell at a time, into die registers in any order. The allocated local registers can be deallocated by pushing data onto d e operand stack and popping it off of d e local register stack one cell at a time, and dien discarding from d e operand stack the data diat is unneeded. Alternatively, the allocated local registers can be deallocated by first saving any data needed from the registers, and then deallocating a block of registers at one time. The method selected will depend on me number of registers required and whe er the data on the operand stack is in die required order. Registers on bodi stacks 122 and 124 are referenced relative to the tops of the stacks and are d us local in scope. What was accessible in rO, for example, after one cell has been push onto the local-register stack 124, is accessible as rl; the newly pushed value is accessible as rO. Parameters are passed to and returned from subroutines on the operand stack 122. An unlimited number of parameters can be passed and returned in this manner. An unlimited number of local-register allocations can also be made. Parameters and allocated local registers dius conveniently nest and unnest across subroutines and program basic blocks. Subroutine return addresses are pushed onto die local-register stack 124 and d us appear as rO on entry to the subroutine, with the previous rO accessible as rl, and so on. As data is pushed onto die stacks and the available register space fills, registers are spilled to memory when required. Similarly, as data is removed from me stacks and die register space empties, me registers are refilled from memory as required. Thus from the program's perspective, the stack registers are always available. Instruction Set Overview Table 4 lists the MPU instructions; Table 34, below, and Table 37, below, list the mnemonics and opcodes. All instructions consist of eight bits, except for those that require immediate data. This allows up to four instructions (an instruction group) to be obtained on each instruction fetch, thus reducing memory- bandwidth requirements compared to typical RISC machines with 32-bit instructions. This characteristic also allows looping on an instruction group (a micro-loop) without additional instruction fetches from memory, further increasing efficiency. Instruction formats are depicted in Figure 6. Table 4 - MPU Instruction Set ALU Operations Almost all ALU operations occur on the top of d e operand stack 122 in sO and, if needed, si . A few operands also use gO, ct 134, or pc. Only one ALU status bit, carry, is maintained and is stored in mode 136. Since there are no odier ALU status bits, all other conditional operations are performed by testing sO on me fly. eqz is used to reverse die zero/non-zero state of sO. Most arithmetic operations modify carry from the result produced out of bit 31 of sO. The instruction add pc is available to perform pc-relative data references, adda is available to perform address aridimetic widiout changing carry. Other operations modify carry as part of die result of die operation. sO and si can be used togedier for double-cell shifts, with sO containing the more-significant cell and si the less-significant cell of the 64-bit value. Both single-cell and double-cell shifts transfer a bit between carry and bit 31 of sO. Code depicting single-cell rotates constructed from the double-cell shift is given below. All ALU instructions opcodes are formatted as 8-bit values widi no encoded fields. Table 5 - ALU Instructions Table 6 - Code Examples: Rotate Table 7 - Branch, Loop and Skip Instructions 25 Branches. Skips, and Loops (Table 7) The instructions br, bz. call and dbr are variable-length. The three least- significant bits in the opcode and all of the bits in the current instruction group to the right of the opcode are used for the relative branch offset. See Figure 6. Branch destination addresses are cell-aligned to maximize the range of the offset and die number of instructions that will be executed at the destination. The offset is 3, 11, 19 or 27 bits long, depending on die location of the opcode within the current instruction group. The address of die destination is offset from the address of die beginning of the cell containing the branch opcode. The offsets have a range of + 12/-16, +4092/-4096, +1048572/- 1048576, and +268435452/- 268435456 bytes, respectively. If an offset is not of sufficient size for the branch to reach the destination, the branch must be moved to an instruction group where more offset bits are available, or br [] or call [] can be used. Register-indirect branches are available with br [] and call [] . They use an absolute byte address from sO. The instruction add pc can be used if a computed pc-relative branch is required. The mloop_ instructions are referred to as micro- loops. If specified, a condition is tested, and dien ct is decremented. If a termination condition is not met, execution continues at die beginning of the current instruction group. Micro- loops are used to re-execute short instructions sequences without re-fetching the instructions from memory. See Table 10. Other than branching on zero with bz, other conditional branching is performed widi die skip_ instructions. They terminate execution of the current instruction group and continue execution at die beginning of the next instruction group. They can be combined with the br, call, dbr, and ret (or other instructions) to create additional flow-of-control operations. Table 8 - Literal Instruction Literals (Table 8) To maximize opcode bandwiddi, diree sizes of literals are available. The data for four-bit (nibble) literals, with a range of -7 to +8, is encoded in die four least-significant bits of die opcode; die numbers are encoded as two's-complement values widi die value 1000 binary decoded as +8. The data for eight-bit (byte) literals, with a range of 0-255, is located in the right-most byte of the instruction group, regardless of ie position of d e opcode within the instruction group. The data for 32-bit (long, or cell) literals, is located in a cell following die instruction group in the instruction stream. Multiple push. l instructions in the same instruction group access consecutive cells immediately following the instruction group. See Figure 6. Table 9 - Load and Store Instructions Loads and Stores (Table 9) rO and x support register-indirect addressing and also register-indirect addressing widi predecrement by four our postincrement by four. These modes allow for efficient memory reference operations. Code depicting memory move and fill operations is given in Table 10. Register indirect addressing can also be performed wid die address in sO. O ier addressing modes can be implemented using adda. Table 11 depicts d e code for a complex memory reference operation. The memory accesses depicted in die examples above are cell-aligned, widi die two least-significant bits of the memory addresses ignored. Memory can also be read at byte addresses widi ld.b [] and written at byte addresses using x and replb. See Byte Operations. The MPU contains a one-level posted write. This allows the MPU to continue executing while the posted write is in progress and can significantly reduce execution time. Memory coherency is maintained by giving die posted write priority bus access over other MPU bus requests, thus writes are not indefinitely deferred. In die code examples in Table 10, die loop execution overhead is zero when using posted writes. Posted writes are enabled by setting mspwe. All load and store instruction opcodes are formatted as 8-bit values widi no encoded fields. Table 10 - Code Examples: Memory Move and Fill ; Memory Move ;(cell_source cell dest cell count--) moye cells:: Table 11 - Code Example: Complex Addressing Mode ;addc [g0+g2+20].#8,[g0-g3-4] push go push g2 adda push.b #20 adda Id [] pusfe.n #8push addc push neg adda dec stgO g3 # [] ;The carry into and out of addc is maintained. Table 12 - Data Movement Instructions Data Movement (Table 12) Register data is moved by first pushing die register onto the operand stack , and dien popping it into d e destination register. Memory data is moved similarly. See Loads and Stores, above. The opcodes for d e date-movement instructions diat access gi and ri are 8- bit values with die register number encoded in the four least-significant bits. All odier date-movement instruction opcodes are formatted as 8-bit values with no encoded fields. Table 13 - Stack Data Management Instructions lframe pop pop Istack push push Istack rev sframe xcg Stack Data Management (Table 13) Operand stack data is used from the top of the stack and is generally consumed when processed. This can require die use of instructions to duplicate, discard, or reorder die stack data. Data can also be moved to die local-register stack to place it temporarily out of the way, or to reverse its stack access order, or to place it in a local register for direct access. See the code examples in Table 10. If more dian a few stack data management instructions are required to access a given operand stack cell, performance usually improves by placing data in a local or global register. However, diere is a finite supply of global registers, and local registers, at some point, spill to memory. Data should be maintained on die operand stack only while it is efficient to do so. In general, if die program requires frequent access to data in ie operand stack deeper dian s2, diat data, or odier more accessible data, should be placed in directly addressable registers to simplify access. To use the local-register stack, data can be popped from die operand stack and pushed onto die local-register stack, or data can be popped from die local- register stack and push onto the operand stack. This mechanism is convenient to move a few more cells when the resulting operand stack order is acceptable. When moving more data, or when d e data order on die operand stack is not as desired, lframe can be used to allocate or deallocate d e required local registers, and then die registers can be written and read directly. Using lframe also has die advantage of making the required local-register stack space available by spilling the stack as a continuous sequence of bus transactions, which will minimize the number of RAS cycles required when writing to DRAM. The instruction sframe behaves similarly to lframe and is primarily used to discard a number of cells from the operand stack. All stack data management instruction opcodes are formatted as 8-bit values with no encoded fields. Table 14 - Stack Cache Management Instructions lcaαhe ldepth pop la pop sa push la push sa scache sdepth Stack Cache Management (Table 14) Other dian initialization, and possibly monitoring of overflow and underflow via the related traps, the stack caches do not require active management. Several instructions exist to efficiently manipulate the caches for context switching, status checking, and spill and refill scheduling. The _depth instructions can be used to determine the number of cells in the SRAM part of the stack caches. This value can be used to discard the values currently in die cache, to later restore the cache depth widi _cache, or to compute me total on-chip and external stack depth. The cache instructions can be used to ensure either that data is in die cache or diat space for data exists in the cache, so that spills and refills will occur at preferential times. This allows more control over the caching process and thus a greater degree of determination during die program execution process. Scheduling stack spills and refills in diis way can also improve performance by minimizing the RAS cycles required due to stack memory accesses. The _frame instructions can be used to allocate a block of uninitialized register space at die top of die SRAM part of the stack, or to discard such a block of register space when no longer needed. They, like the cache instructions, can be used to group stack spills and refills to improve performance by minimizing the RAS cycles required due to stack memory accesses. See Stacks and Stack Caching for more information. All stack cache management instruction opcodes are formatted as 8-bit values widi no encoded fields. Table 15 - Byte Operation Instructions Byte Operations (Table 15) Bytes can be addressed and read from memory directly and can be addressed and written to memory widi d e code depicted in Table 16. Table 16 - Code Example: Byte Store Table 17 - Code Example: Byte Search RECEIVED BLANK BY RO/US Instructions are available for manipulating bytes within cells. A byte can be replicated across a cell, die bytes wid in a cell can be tested for zero, and a cell can be shifted by left or right by one byte. Code examples depicting scanning for a specified byte, scanning for a null byte, and moving a null-terminated string in cell-sized units are given in Tables 17-19. All byte operation instruction opcodes are formatted as 8-bit values with no encoded fields. Table 18 - Code Examples: Null Search Table 19 - Code Example: Null-Terminated String Move ;Move cell-aligned null-termined string ;(ceJl source cell dest ~ ) mull move:: pop destination pop Istack ; source null move loop: : id test*) st mloopnc »[r0++] [x*+] xheck for zero null move loop Table 20 - Floating-Point Math Instructions addexp denorm expdif extexp extsig norml normr replexp rnds subexp testexp Floating-Point Math (Table 20. The instructions above are used to implement efficient single- and double- precision IEEE floating-point software for basic math functions ( + , -, *, / ), and to aid in the development of floating-point library routines. The instructions performs primarily the normalization, denormalization, exponent aridimetic, rounding and detection of exceptional numbers and conditions d at are odierwise execution-time-intensive when programmed conventionally. See Floating-Point Math Support. All floating-point math instruction opcodes are formatted as 8-bit values widi no encoded fields. Table 21 - Debugging Instructions bkpr step Debugging Features (Table 21) Each of these instructions signals an exception and traps to an application- supplied execution-monitoring program to assist in the debugging of programs. See Debugging Support. Both debugging instruction opcodes are formatted as 8-bit values widi no encoded fields. Table 22 - On-Chip Resources Instructions ido [] ldo^i j stojj sto.i [] I On-Chip Resources (Table 22) These instructions allow access to the on-chip peripherals, status registers, and configuration registers. All registers can be accessed widi the Ido [] and sto [] instructions. The first six registers each contain eight bits, which are also bit addressable with ldo.i [] and sto.i []. See On-Chip Resource Registers. All on-chip resource instruction opcodes are formatted as 8-bit values with no encoded fields. Table 23 - Miscellaneous Instructions di ei nop pop mode push mode split Miscellaneous (Table 23) The disable- and enable-interrupt instructions are the only system control instructions; diey are supplied to make interrupt processing more efficient. Other system control functions are performed by setting or clearing bits in mode, or in an on-chip resource register. The instruction split separates a 32-bit value into two cells, each containing 16 bits of the original value. All miscellaneous insuπiction opcodes are formatted as 8-bit values widi no encoded fields. Stacks and Stack Caches The stack caches optimize use of die stack register resources by minimizing the overhead required for the allocation and saving of registers during programmed or exceptional context switches (such as call subroutine execution and trap or interrupt servicing). The local-register stack 124 (Figure 3) consists of an on-chip SRAM array that is addressed to behave as a conventional last-in, first out queue. Local registers r0-rl5 are addressed internally relative to die current top of stack. The registers r0-rl4 are individually addressable and are always contiguously allocated and filled. If a register is accessed that is not in die cache, all die lower-ordinal registers will be read in to ensure a contiguous data set. The operand stack 122 is constructed similarily, with die addition of two registers in front of die SRAM stack cache array to supply inputs to die ALU. These registers are designated sO and si, and die SRAM array is designated s2- sl7. Only registers sO, si and sw are individually addressable, but odierwise the operand stack behaves similarly to the local-register stack. Whereas the SRAM array, s2-sl7, can become "empty" (see below), sO and si are always considered to contain data. The stack caches are designed to always allow die current opertion to execute to completion before an implicit stack memory operation is required to occur. No instruction explicitly pushes or explicitly pops more than one cell from either stack (except for stack management instructions). Thus to allow execution to completion, the stack cache logic ensures d at diere is always one or more cells full and one or more cells empty in each stack cache (except immediately after power-up, see below) before instruction execution. If, after the execution of an instruction, diis is not d e case on eidier stack, the corresponding stack cache will be automatically spilled to memory or refilled from memory to reach this condition before the next instruction is allowed to execute. Similarly, die instructions cache, frame, pop sa, and pop la, which explicitly change the stack cache depdi, will execute to completion, and dien ensure die above conditions exist. Thus rl5 and sl7 can be filled by die execution of an instruction, but diey will be spilled before die next instruction executes. Similarly, rO and s2 can be emptied by die execution of an instruction, but diey will be filled before die next instruction executes. The stacks can be arbitrarily deep. When a stack spills, data is written at die address in the stack pointer and dien the stack pointer is decremented by four (postdecremented stack pointer). Conversely, when a stack refills, the stack pointer is incremented by four, and then data is read from memory (preincremented stack pointer). The stack pointer for the operand stack is sa, and d e stack pointer for the local-register stack is la. Since die stacks are dynamically allocated memory areas, some amount of planning or management is required to ensure die memory areas do not overflow or underflow. Alternatively, stack memory can be dynamically allocated or monitored through the use of stack-page exceptions. Stack-Page Exceptions Stack-page exceptions occur on any stack-cache memory access near the boundary of any 1024-byte memory page to allow overflow and underflow protection and stack memory management. To prevent thrashing stack-page exceptions near the margins of the page boundary areas, once a boundary area is accessed and d e corresponding stack-page exception is signaled, die stack pointer must move to the middle region of the stack page before another stack-page exception will be signaled. See Figure 5. Stack-page exceptions enable stack memory to be managed by allowing stack memory pages to be reallocated or relocated when die edges of die current stack page are approached. The boundary regions of the stack pages are located 32 cells from die ends of each page to allow even a cache or frame instruction to execute to completion and to allow for the corresponding stack cache to be emptied to memory. Using the stack-page exceptions requires that only 2 KB of addressable memory be allotted to each stack at any given time: the current stack page and the page near the most recendy encroached boundary. Each stack supports stack-page overflow and stack-page underflow exceptions. These exception conditions are tested against the memory address that is accessed when die corresponding stack spills or refills between the execution the execution of instructions mode contains bits that signal local-stack overflow, local- stack underflow, operand stack overflow and operand stack underflow, as well as die corresponding trap enable bits. The stack-page exceptions have the highest priority of all of the traps. As this implies, it is important to consider carefully the stack effects of the stack trap handler code so that stack-page boundaries will not be violated during its execution. Table 24 - Code Example: Stack Initialization Stack Initialization (Table 24) After CPU reset both of the MPU stacks should be considered uninitialized until d e rest corresponding stack pointers are loaded, and d is should be one of the first operations performed by die MPU. After a reset, die stacks are abnormally empty. That is, rO nd s2 have not been allocated, and will be allocated on die first push operation to, or stack pointer initialization of, the corresponding stack. However, popping die pushed cell will cause diat stack to be empty and require a refill. The first pushed cell should therefore be left on that stack, or the corresponding stack pointer should be initialized, before die stack is used further. Stack Depth The total number of cells on each stack can readily be determined by adding die number of cells diat have spilled to memory and die number of cells in die on-chip caches. See Table 25. Stack Flush and Restore When performing a context switch, it is necessary to spill the data in the stack caches to memory so that d e stach caches can be reloaded for the new context. Attention must be given to ensure that die parts of the stack caches that are always maintained on-chip, rO and s0-s2, are forced into d e spillable area of the stack caches so diat diey can be written to memory. Code examples are given for flushing and restoring the caches in Table 26 and Table 27, respectively. Table QJ. Code Example: Stack Restore Table 28. Traps Dependent on System State Exceptions and Trapping Exception handling is precise and is managed by trapping to executable- code vectors in low memory. Each 32-bit vector location can contain up to four instructions. This allows servicing the trap wid in those four instructions or by branching to a longer trap routine. Traps are prioritized and nested to ensure proper handling. The trap names and executable vector locations are shown in Figure 4. An exception is said to be signaled when die defined conditions exist to cause the exception. If the trap is enabled, die trap is then processed. Traps are processed by the trap logic causing a call subroutine to the associated executable- code vector address. When multiple traps occur concurrently, die lowest-priority trap is processed first, but before die executable-code vector is executed, die next- higher-priority trap is processed, and so on, until die highest-priority trap is processed. The highest-priority trap's executable-code vector d en executes. The nested executable-code vector return addresses unnest as each trap handler executes ret, dius producing die prioritized trap executions. Interrupts are disabled during trap processing and nesting until an instruction diat begins in byte one of an instruction group is executed. Interrupts do not need to nest widi the traps since dieir request state is maintained in die INTC registers. Table 29. lists d e priorities of each trap. Traps that can occur explicitly due to die data processed or instruction executed are listed in Table 30. Traps that can occur due to die current state of the system, concurrently with d e traps in Table 30, are listed in Table 28. Table 29. Trap Priorities Table SA Traps Independent of System State instruction Trap Combinations addexp FP Unf. FP Ovf bkpt Breakpoint denorm FP Nm norm! FP Unf, FP Nm, FP Unf & FP Nm FP Ovf, FP Nm. FP Ovf & FP Nm 10 rnd FP Round step Single Step subexp FP Unf. FP Ovf testexp FP Exponent Notes: FP _3 Floaπng Point, Unf = Underflow. Ovf = Overflow. Nm = Normalize Floating-Point Math Support The MPU supports single-precision (32-bit) and double-precision (64-bit) IEEE floating-point math software. Rather than a floating-point unit and the silicon area it would require, the MPU contains instructions to perform most of the time-consuming operations required when programming basic floating-point math operations. Existing integer math operations are used to supply the core add, substract, multiply and divide functions, while the exponents and detect exception conditions. Additionally, a diree-bit extension to the top one or two stack cells (depending on die precision) is used to aid in rounding and to supply the required precision and exception signaling operations. Data Formats Though single- and double-precision IEEE formats are supported, from the perspective of die MPU, only 32-bit values are manipulated at any one time (except for double shifting). See Figure 6a. The MPU instructions directly support die normalized data formats depicted. The related denormalized formats are detected by testexp and fully supportable in software. Status and Control Bits mode register 136 contains 13 bits that set floating-point precision, rounding mode, exception signals, and trap enables. See Figure 7. Table 31. GRS Extension Bit Mampulaoon Instructions shift shiftd shrd #l RECEIVED BLANK BY RO/US GRS Extension Bits To maintain die precision required by die IEEE standard, more significand bits are required dian are held in die IEEE format numbers. These extra bits are used to hold bits diat have been shifted out of the right of the significand. They are used to maintain additional precision, to determine if any precision has been lost during processing, and to determine whedier rounding should occur. The three bits appear in mode so diey can be saved, restored and manipulated. Individually, the bits are named guard bit, round bit and sticky bit. Several instructions manipulate or modify die bits. See Table 31. When denorm and normr shift bits into the GRS extension, the source of die bits is always d e least-significant bits of the significand. In single-precision mode die GRS extension bits are taken from sO, and in double-precision mode die bits are taken from si. For conventional right shifts, the GRS extension bits always come from the least significant bits of the shift (i.e., sO if a single shift and si if a double shift). The instruction norml is the only instruction to shift bits out of the GRS extension; it will shift into sO in single-precision mode and into si in double-precision mode. Conventional left shifts will always shift in zeros and do not affect d e GRS extension bits. Rounding The GRS extension maintains three extra bits of precision while producing a floating-point result. These bits are used to decide how to round d e result to fit die destination format. If one views the bits as if diey were just to die right of d e binary point, then guard bit has a position value of one-half, round bit has a positional value of one-quarter, and sticky bit has a positional value of one-eighth. The rounding operation selected by fp round mode uses the GRS extension bits and die sign bit of ct to determine how rounding should occur. If guard bit is zero die value of GRS extension is below one-half. If guard bit is one die value of GRS extension is one-half or greater. Since die GRS extension bits are not part of the destination format they are discarded when die operation is complete. This information is the basis for the operation of the instruction rnd. Most rounding adjustments by rnd involve doing nodiing or incrementing sO. Whedier d is is rounding downn or rounding up depends on die sign of die loating-int result diat in ct. If the GRS extension bits are non-zero, then doing nodiing has the effect of "rounding down" if the result is positive, and "rounding up" if the result is negative. Similarly, incrementing die result has die effect of "rounding up" if die result is positive and "rounding down" if die result is negative. If die GRS extension bits are zero then die result was exact and rounding is not required. See Table 32. In practice, die significand (or lower cell of die double-precision significand) is in sO, and die sign and exponent are in ct. carry is set if the increment from rnd carried out of bit 31 of sO; otherwise, carry is cleared. This allows carry to be propagated into die upper cell of a double-precision significand. Exceptions To speed processing, exception conditions detected by die floating-point instructions set exception signaling bits in mode and, if enabled, trap. The following traps are supported: Exponent signaled from testexp Underflow signaled from norml, addexp, subexp Overflow signaled from normr, addexp, subexp • Normalize signaled from denorm, norml, normr • Rounded signaled from rnd Exceptions are prioritized when the instruction completes and are processed with any odier system exceptions or traps that occur concurrently. See Exceptions and Trapping. • Exponent Trap: Detects special-case exponents. If the tested exponent is all zeros or all ones, carry is set and the exception is signaled. Setting carry allows testing the result without processing a trap. • Underflow Trap: Detects exponents that have become too small due to calculations or decrementing while shifting. • Overflow Trap: Detects exponents that have become too large due to calculations or incrementing while shifting. Table 33. Code Example: Floating-Point Multiply RECEIVED BLANK BY RO/US • Normalize Exception: Detects bits lost due to shifting into the GRS extension. The exception condition is tested at the end of instruction execution and is signaled if any of die bits in the GRS extension are set. Testing at diis time allows normal right shifts to be used to set die GRS extension bits for later floating-point instructions to test and signal. • Rounded Exception: Detects a change in bit zero of sO due to rounding. HARDWARE DEBUGGING SUPPORT The MPU 100 contains both a breakpoint instruction, bkpt, and a single- step instruction, step. The instruction bkpt executes die breakpoint trap and supplies the address of the bkpt opcode to die trap handler. This allows execution at full processor speed up to die breakpoint, and dien execution in a program- controlled manner following the breakpoint, step executes the instruction at the supplied address, and d en executes die single-step trap. The single-step trap can efficiently monitor execution on an instruction-by-instruction basis. Breakpoint The instruction bkpt performs an operation similar to a call subroutine to address 0x134, except that die return address is die address of the bkpt opcode. This behavior is required because, due to die instruction push.l, the address of a call subroutine cannot always be determined from its return address. Commonly, bkpt is used to temporarily replace an instruction in an application at a point of interest for debugging. The trap handler for bkpt will typically restore the original instruction, display information for die user, and wait for a command. Or, die trap handler could implement a conditional breakpoint by checking for a termination condition (such as a register value or the number of executions of d is particular breakpoint), continuing execution of the application until die condition is met. The advantage of bkpt over step is that the applications executes at full speed between breakpoints. Single-Step The instruction step is used to execute an application program one instruction at a time. It acts much like a return from subroutine, except that after executing one instruction at the return address, a trap to address 0x138 occurs. The return address from the trap is the address of the next instruction. The trap handler for step will typically display information for the user, and wait for a command. Or, die trap handler could instead check for a termination condition (such as a register value or d e number of executions of this particular location), continuing execution of the application until the condition is met. step is processed and prioritized similarly to the odier exception traps. This means that all traps will execute before the step trap. The result is diat step cannot directly single-step dirough die program code of odier d * ap handlers. The instruction step is normally considered to be below die operating-system level, dius operating-system functions such as stack-page traps must execute without its intervention. Higher-priority trap handlers can be single-stepped by re-prioritizing them in software. Rather than directly executing a higher-priority trap handler from die corresponding executable trap vector, the vector would branch to code to rearrange the return addresses ont he return stack to change the resulting execution sequence of the trap handlers. Various housekeeping tasks must also be performed, and d e various handlers must ensure diat d e stack memory area boundaries are not violated by die re-prioritized handlers. VIRTUAL-MEMORY SUPPORT The MPU 100 supports virtual memory through die use of external mapping logic diat translates logical to physical memory addresses. During MPU RAS memory cycles, the CPU-supplied logical row address is translated by an external SRAM to the physical row address and a memory page-fault bit. The memory page-fault bit is sampled during die memory cycle to determine if die translated page in memory is valid or invalid. Sufficient time exists in the normal RAS prechange porition of DRAM memory cycles to map the logical pages to physical pages widi no memory-cycle-time overhead. An invalid memory page indication causes die memory-fault exception to be signaled and, if enabled, die trap to be executed to service the fault condition. Posted- write faults are completed in die trap routine; odier types of faulting operations are completed by returning from die trap routine to re-execute them. Whe er the fault is from a read or write operation is indicated by mflt write. The fault address and data (if a write) are stored in mfltaddr and mfltdata. Memory-fault traps are enabled by mflt trap en. See the code example in Table 34. Table 34. Code Example: Memory-Fault Service Routine ; Memory-fault trap handler memfit handler: : push mode di ;Get data (if any) and fault address. push, #mfltdata ;must be read first loldo [] push. #mfltaddr ;must be read last Ido π ;Now go and get die faulted page from disk into memory, ; update the mapping SRAM, etc. ;(mode data addr - mode data addr) ;If memory fault occurred while attempting a posted write, ;ρerform the write in the handler. 20 ;check if fault was read or write Table 35. VRAM Commands VIDEO RAM SUPPORT Video RAM (VRAMs) are DRAMs that have a second port that provides serial access to die DRAM array. This allows video data to be serially clocked out of die memory to the display while normal MPU accesses occur to die DRAM array. To prevent DRAM array access contentions, the MPU periodically issues read transfer requests, which copy die selected DRAM row to the serial transfer buffer. To eliminate read transfer synchronization problems, many VRAMs have split transfer buffers, which allow greater timing flexibility for the MPU's read transfer operations. The MPU instructs the VRAM to perform a read transfer or a split read transfer by encoding die command on die state of the VRAM OE, WE, and DSF (device special function) during die time RAS falls. These operations are encoded by writing vram and performing an appropriate read or write to d e desired VRAM memory address. See Figure 27. Some VRAMs have more advanced operations - such as line fills, block fills, and bit-bits - which are encoded widi odier combinations of WE, OE, DSF, RAS, and CAS. A basic set of operations and commands is common among manufacturers, but the commands for more advanced functions vary. The MPU supports all 32 combinations of possible encodings. mode Register mode contains a variety of bits that indicate die status and execution options of die MPU. Except as noted, all bits are writable. The register is shown in Figure 7. mflt write After a memory-fault is signaled, indicates diat die fault occurred due to a memory write. guard bit The most-significant bit of a 3-bit extension below the least-significant bit of sO (si , if fp_precision is set) that is used to aid in rounding floating-point numbers. round bit The middle bit of a 3-bit extension below the least-significant bit of sO (si , if fp_precision is set) that is used to aid in rounding floating-point numbers. sticky bit The least-significant of a 3-bit extension below the least-significant bit os sO (si, if fp_precision is set) that is used to aid in rounding floating-point numbers. Once set due to shifting or writing die bit directly, die bit stays set even though zero bits are shifted right through it, until it is explicity cleared or written to zero. mflt trap en If set, enables memory-fault traps. mflt exc sig Set if a memory fault is detected. Is boundary Set if ls ovf exc sig or ls unf exc sig becomes set as a result of a stack spill or refill. Cleared when the address in la, as die result of a stack spill or refill, has entered die middle region of a 1024-byte memory page. Used by die local-register stack trap logic to prevent unnecessary stack overflow and underflow u * aps when repeated local-register stack spills and refills occur near a 1024-byte memory page boundary. Not writable. ls unf trap en If set, enables a local-register stack underflow trap to occur after a local- register stack underflow exception is signaled. ls unf exc sig Set if a local-register stack refill occurs, Is boundary is clear, and the accessed memory address is in the last thirty-two cells of a 1024-byte memory page. ls_ovf_trap_en If set, enables a local-register stack overflow trap to occur after a local- register stack overflow exception is signaled. ls unf exc sig Set if a local-register stack refill occurs, Is boundary is clear, and die accessed memory address is in the last diirty-two cells of a 1024-byte memory page. ls_ovf_trap_en If set, enables a local-register stack overflow trap to occur after a local- register stack overflow exception is signaled. ls ovf exc sig Set if a local-register stack spill occurs, Is boundary is clear, and d e accessed memory address is in die first thirty-two cells of a 1024-byte memory page. os boundary Set if os_ovf_exc_sig or os unf exc sig becomes set as the result of a stack spill or refill. Cleared when die address in sa, as d e result of a stack spill or refill, has entered die middle region of a 1024-byte memory page. Used by die operand stack trap logic to prevent unnecessary stack overflow and underflow traps when repeated operand stack spills and refills occur near a 1024-byte memory page boundary. Not writable. os unf trap en If set, enables an operand stack underflow trap to occur after an operand stack underflow exception is signaled. os_unf_exc_sig Set if an operand stack refill occurs, os boundary is clear, and die accessed memory address is in die last diirty-two cells of a 1024-byte memory page. os_ovf_trap_en If set, enables an operand stack overflow trap to occur after an operand stack overflow exception is signaled. os_ovf_exc_sig Set if an operand stack spill occurs, os boundary is clear, and die accessed memory address is in the first thirty-two cells of a 1024-byte memory page. carry Contains the carry bit from the accumulator. Saving and restoring mode can be used to save and restore carry. power fail Set during power-up to indicate diat a power failure has occurred. Cleared by any write to mode. Odierwise, not writable. interrupt en If set, interrupts are globally enabled. Set by die instruction ei, cleared by di. fp rnd exc sig If set, a previous execution of rnd caused a change in die least significant bit of sO (si, if fp_precision is set). fp rnd trap en If set, enables a floating-point round trap to occur after a floating-point round exception is signaled. fp_nrm_exc_sig If set, one or more of the guard_bit, roundJ. it and sticky _bit were set after a previous execution of denorm, norml or normr. fp nrm trap en If set, enables a floating-point normalize trap to occur after a floating-point normalize execption is signaled. fp_ovf_exc_sig If set, a previous execution of normr, addexp or subexp caused die exponent field to increase to or beyond all ones. fp ovf trap en If set, enables a floating-point overflow trap to occur after a floating-point overflow exception is signaled. fp unf exc sig If set, a previous execution of norml, addexp or subexp caused the exponent field to decrease to or beyond all zeros. fp unf trap en . If set, enables a floating-point underflow trap to occur after a floating-point underflow exception is signaled. fp exp exc sig If set, a previous execution of testexp detected an exponent field containing all ones or all zeros. fp exp trap en If set, enables a floating-point exponent trap to occur after a floating-point exponent exception is signaled. fp_round_mode Contains the type of rounding to be performed by die MPU instruction rnd. fp_precision If clear, the floating-point instructions operate on stack values in IEEE single-precision (32-bit) format. If set, the floating-point instructions operate on stack values in IEEE double-precision (64-bit) format. MPU RESET After reset, the IOP 110 begins executing at address 0x80000004, before the MPU begins execution. The IOP must be programmed to execute delay before the MPU can access die bus and begin execution. Once the IOP executes delay, die MPU begins executing at address 0x80000008. Details of various startup configurations are detailed in Processor Startup, below. INTERRUPTS The CPU 100 contains an on-chip prioritized interrupt controller 114 that supports up to eight different interrupt levels from twenty-four interrupt sources. Interrupts can be received through the bit inputs, from I/O-channel transfers, from the IOP, or can be forced in software by writing to ioin. For complete details of interrupts and dieir servicing, see Interrupt Controller, below. BIT INPUTS The CPU 100 contains eight general-purpose bit inputs 116 diat are shared with the INTC 114 and DMAC 112 as requests for those services. The bits are taken from IN [7:0], or if so configured, are sampled from AD [7:0] on the bus. Sampling from the bus can allow die use of smaller, less-expensive packages for the CPU; it can also reduce PWB area requirements through reuse of the AD bus rather than routing a separate bit-input bus. See Bit Inputs, below. BIT OUTPUTS The CPU 100 contains eight general-purpose bit outputs 118 diat can be written by the MPU 108 or IOP 110. The bits are output on OUT[7:0] and are also available on AD[7:0] during RAS inactive. Taking the bits from the bus can allow die use of smaller, less-expensive packages for die CPU; it can also reduce PWB area requirements dirough reuse of the AD bus radier dian routing a separate bit-output bus. See Bit Outputs, below. ON-CHIP RESOURCES The non-MPU hardware features of die CPU 100 are generally accessed by die MPU 108 dirough a set of 41 registers 102 located in dieir own address space. Using a separate address space simplifies implementation, preserves opcodes, and prevents cluttering die normal memory address space widi peripherals. Collectively known as On-Chip Resources, these registers 102 allow access to the bit inputs, bit outputs, INTC, DMAC, MIF, system configuration, and some functions of the IOP. These registers and dieir functions are referenced diroughout this manual and are described in detail in On-Chip Resource Registers, below. INSTRUCTION REFERENCE As a stack-based MPU architecture, the ShBoom MPU instructions have documentation requirements similar to stack based programming languages, such as American National Standards Institute (ANSI) standard Forth. Not surprisingly, many of the American National Standard (ANS) Forth core operations are instructions on die ShBoom MPU. As a result, die ANS Forth stack notation used for language documentation is useful for describing ShBoom MPU instructions. The basic notation adapted for the ShBoom MPU is: (input_operands — output operands) (L:input_operands — output operands) where "--" indicates die execution of die instruction. "Input operands" and "output_operands" are lists of values on die operand stack (the default) or local register stack (preceded by "L: "). These are similar, though not always identical, to die source and destination operands diat can be represented wid in instruction mnemonics. The value held in die top-of-stack register (sO or rO) is always on the right of the operand list with d e values held in the higher ordinal registers appearing to the left (e.g., s2 si sO). The only items in d e operand lists are diose d at are pertinent to the instruction; other values may exist under diese on d e stacks. All of the input operands are considered to be popped off the stack, die operation performed, and the output operands pushed on the stack. For example, a notational expression: nl n2 - n3 represents two inputs operands, nl and n2, and one output operand, n3. For the instruction add, nl (taken from si) is added to n2 (taken from sO), and die result is n3 (left in sO). If the name of a value on e left of either diagram is die same as die name of a value on the right, d en die value was required, but unchanged. The name represents the operand type. Numeric suffixes are added to indicate different or changed operands of die same type. The values may be bytes, integers, floating-point numbers, addresses, or any odier type of a value that can be placed in a single 32-bit cell. addr address byte character or byte (upper 24 bits zero) r real number (floating-point number) flag true/false flag (non-zero = true) n integer or 32 arbitrary bits other text integer or 32 arbitrary bits ANS Forth defines odier operand types and operands diat occupy more than one stack cell; those are not used here. Note that typically all stack action is described by die notation and is not explicitly described in the text. If there are multiple possible outcomes then the outcome options are on separate lines and should be considered as individual cases. If other regions or memory variables are modified, dien diat effect is documented in die text. Also on die stack diagram line is an indication of die effect on carry, if any, as well as the opcode and execution time in the right margin. A timing with an "m" indicates die specified number of required memory cycles. The timing of a memory cycle depends on and die programmed cycle time and whedier a RAS or CAS cycle occurs. See Appendix A for mneomic stacks code. Table 36. MPU Mnemonics and Opcodes (Mnemonic Order) Table 37. MPU Mnemonics and Opcodes (Opcode Order) INPUT-OUTPUT PROCESSOR The Input-Output Processor (IOP) 110 (Figure 8) is a special-purpose processing unit that executes instructions to transfer data between device and memory, refresch dynamic memory, measure time, manipulate bit inputs and bit outputs, and perform system timing functions. IOP programs are usually written to be temporally deterministic. Because it can be difficult or impossible to write programs that contain conditional execution paths that execute in an efficient temporally deterministic manner, the IOP contains no computational and minimal decision-making ability. IOP programs are intended to be relatively simple, using interrupts to the MPU 108 to perform computation or decision making. To ensure temporally deterministic execution, the IOP exercises absolute priority over bus access. Bus timing must always be deterministic; wait states are not even available on the ShBoom CPU 100. Temporal determinism is achieved by counting IOP execution and bus clock cycles between die timed IOP events. Bus access is granted to die IOP 110 unless it is executing delay, which allows MPU and DMA requests access to the bus during a specified time. Thus, when a memory access is needed, die IOP simply seizes the bus and performs the required operation at precisely die programmed instant. The MIF 120 ensures diat the bus will be available when die IOP 110 requires it. The MPU 108 and the DMAC 112 request die bus from the MIF 120, which prioritizes the requests and grants die bus while die IOP 110 is executing delay. The MIF 120 ensures that any transactions will be complete before the IOP next requires the bus. When transferring data, die IOP 110 does not modify any data diat is transferred; it only causes d e bus transaction to occur at die programmed time. It performs time-synchronous I/O-channel transfers, as opposed to DMAC 112, which prioritizes and performs asynchronous I/O-channel transfers. Other dian how diey are initiated, die two types of transfers are identical. Usage An IOP program can be used to eliminate an extensive amount of external logic and simply system designs. Further, by using die IOP 110 for timing- dependent system and application operations, timing constraints on die MPU program can often be eliminated or greatly relaxed. For example, an IOP program of about 150 bytes supplies die data transfers and timing for a video display. The program produces vertical and horizontal sync, and transfers data from DRAM to a video shift register or palette. Additionally, die IOP supplies flexibility. Video data from various areas of memory could be displayed, widiout requiring diat die data be moved to create a contiguous frame buffer. As new data areas are specified, die IOP instructions are rewritten by the MPU 108 to change die program the IOP 110 will execute for the next video frame. While this is executing, die MPU still has access to die bus to execute instructions and process data, and die DMAC 112 still has access to die bus to transfer data. Many odier applications are possible. The IOP 110 is best used for applications that require data to be moved, or some odier event to occur, at specific times. For example: • sending digitized 16-bit data values to a pair of DACs to play CD-quality stereo sound, • sampling data from input devices at specified time intervals for the MPU to later process, • sending data and control signals to display images on an LCD display, • transferring synchronous data blocks for an intelligent SCSI controller, • sending multiple channels of data to DACs for a wave-table syndiesizer, • controlling video and I/O for serial and X-Windows video terminals or PC video accelerators, • controlling timed events in process-control environments, • controlling ignition and fuel for automotive engines, or • combining several of the above applications to create a PC multimedia board. The IOP 110 is designed to dictate access to d e bus (to ensure temporally deterministic execution), but to be a slave to d e MPU 108. The IOP can communicate status to die MPU by. • d e status changing on a device the IOP has accessed, • loading a value in a global register, • setting a bit output, or • consuming a bit input. The MPU 108 can control die IOP 110 by: • rewriting IOP instructions in memory, • modifying die global registers the IOP is using, • clearing a bit input, or • resetting the IOP. The events controlled do not need to occur at a persistent, constant rate. The IOP is appropriate for applications whose event rates must be consistently controlled, whedier once or many times. As an example of the former, the IOP can take audio data from memory and send it to a DAC to play the sound at a continuous rate, for as long as the audio clip lasts. As an example of the latter, die IOP 110 can be synchronized to die rotation of an automotive engine by the MPU 108 in order for the IOP to time fuel injection and ignition, widi die synchronization constantly changed by die MPU (by changing global registers or rewriting the IOP program) as the MPU monitors engine performance. Resources The IOP consists of instruction decode and execution processes, and control paths to other CPU resources, as shown in Figure 8. The IOP 110 and related registers include: • Bit input register, ioin: bit inputs configured as DMA or interrupt requests, or general bit inputs. See Figure 21. • Interrupt pending register, ioip: indicates which interrupts have been recognized but are waiting to be prioritized and serviced. See Figure 22. • Bit output register, ioout: bits that were last written by eidier die MPU or die IOP. See Figure 24. • IOP reset register, iopreset: writing any value causes the IOP to begin execution at the IOP software reset address. See Figure 46. • Global registers gl through g7: contain values used by delay. • Global registers g8 through gl5: contain loop counts or I/O-channel transfer specifications. Transfer specifications consist of device and memory transfer addresses and control bits. See Figure 12. Register Usage (Fieure 9) 5 The IOP 110 shares global registers gl-gl5 with the MPU 108, and uses diem for loop counts, delay initialization counts, and transfer information. See Figure 9. Loop counts and delay counts are 32 bits. Transfer addresses in bits 31-2 typically address cells, but can also address bytes, depending on die I/O- channel configuration. Bit one determines whedier die transfer is a memory write 10 or a memory read, and bit zero enable interrupts on 1024-byte memory page boundary crossings (see Interrupts, below). See Figure 12. The MPU can read or write any registers used by die IOP at any time. If there is a register-access contention between the MPU and die IOP, die MPU is held off until die IOP access is complete. 15 Table 38. IOP Instructions Instruction Set Table 38 lists the IOP instructions; Table 40 and Table 41 list the mnemonics and opcodes. Details of instruction execution are given in Instruction 25 Reference, below. Instruction Formats All instructions consist of eight bits except for Id, which requires 32-bit immediate data, and jump, which requires a page-relative destination address. The use of eight-bit instructions allows up to four instructions (referred to as an 30 instruction group) to be obtained on each instruction fetch, dius reducing memory- bandwiddi requirements compared to typical 32-bit processors. This characteristic also allows looping on the instruction group (a micro-loop) widiout additional instruction fetches, further increasing efficiency. Instruction formats are depicted in Figure 10. Jumps The instruction jump is variable-length. The jump opcode can occur in any position within the instruction group. The four least-significant bits in the opcode and all of die bits in die current instruction group to the right of die opcode are used for the page-relative destination address. See Figure 10. These destination addresses are cell-aligned to maximize the range of the destination address bits and die number of instructions that will be executed at die destination. The page- relative destination address is 4, 12, 20 or 28 bits long, depending on die location of the opcode widiin the current instruction group. The bits are used to replace the same cell-address bits within the next IOP pc. The next IOP pc is the cell address following d e current instruction group, incremented for each Id instruction that preceded the jump in the current instruction group. The destination address bits can reach any locations within die current 64-byte memory page, within die current 4KB memory page, within the current 1MB memory page, or widiin die current 256MB memory page, depending on die number of bits in the instruction. If the destination address bits are not of sufficient range for the jump to reach die destination, die jump must be moved to an instruction group where more destination address bits are available. Literals The instruction Id requires a total of 40 bits, eight bits for the opcode in the current instruction group, and 32 bits following the current instruction group for the literal data. The Id opcode can occur in any position within die instruction group. The data for die first Id in an instruction group immediately follows the instruction group in memory; die data for each subsequent Id occupies successive locations. The four least-significant bits in the opcode contain the number of the global register that is the destination for the data. Global register zero (gO) is not allowed. Others All other instructions require eight bits. Most have a register or bit number encoded in die three or four least-significant bits of the opcode. See Instruction Reference, below, for details on the odier individual instructions. Execution Timing Counting execution clock cycles is the key to programming the IOP. Each instruction requires execution time as described in Instruction Reference. In general, instructions require one 2X-clock cycle to execute plus the time for any delay or explicit or implicit bus transaction. Bus transaction times are as programmed and described in Programmable Memory Interface, below and Bus Operation, below. Additionally, instruction fetch between the execution of instruction groups must be considered. There is no instruction pre-fetch in the IOP, so timing computation is simplified. When execution of die instructions in an instruction group has completed, instruction fetch begins. It requires one 2X-clock cycle for the bus request, plus die time for the bus transaction (including die slot check). To ensure temporally deterministic execution, after the execution of delay or refresh, the first IOP access to each memory group will result in a RAS cycle, even if one is otherwise not required. RAS cycles will also occur for other reasons. See Table 49. Thus, die primary timing concerns are the memory addresses accessed (whether a RAS or CAS cycle will be implicitly required), and whedier or not delay or refresh has been executed since the last access to a memory group. A code example of a typical refresh routine is given in Table 39. Address Space. Memory and Device Addressing The IOP 110 uses d e same 32-bit address space as die MPU 108, but has it own program counter 154 and executes independently and concurrently. I/O devices addressed during die execution of xfer are within the same address space, xfer bus transactions are identical to I/O-channel bus transactions except for how they are initiated. See Direct Memory Access Controller, below. Interrupts The IOP 110 can request any of the eight MPU interrupts by executing int. The IOP can also request an MPU interrupt by accessing me last location in a 1024-byte memory page during die execution of xfer. xfer transfer interrupts and I/O-channel transfer interrupts are identical. See Direct Memory Access Controller, below, for more information. The MPU 108 can respond to interrupt requests when die IOP 110 next executes delay. Bus Transactions IOP 110 instruction-fetch bus transactions are identical to MPU 108 memory-read bus transactions, xfer bus transactions are identical to DMA bus transactions except for how they are intitiated. See Bus Operations, below. Bit Inputs and Bit Outputs The bit inputs in ioin are accessed by the IOP 110 widi tskipz. This instruction tests an input bit, consumes it, and conditionally skips the remainder of die instruction group. This allows for polled device transfers or complex device- transfer sequences rather than the simple asynchronous transfers available with die DMAC 112. See Bit Inputs, below. Note that since tskipz causes conditional execution, care must be taken when designating program code diat contains tskipz if deterministic execution is expected. The bit outputs in ioout can be individually set or cleared by die IOP 110 widi outt and outf. They can be used to activate external events, generate synchronization pulses, etc. See Bit Outputs, below. IOP Hardware and Software Reset After hardware reset, die IOP 110 begins executing an address 0x80000004, before the MPU 108 begins execution. The IOP can then perform the RAS cycles required to initialize DRAM, and begin a program loop to maintain DRAM refresh, before executing delay to allow die MPU to configure the system. Once the MPU 108 has configured die system, the IOP 110 typically is required to begin execution of its application program code. The IOP power-on- reset address selects the boot memory device, usually because A31 is set and odier high address bits are zero. To clear A31 and dius begin execution in non-boot memory, a software reset must be issued by die MPU. See Table 39. The software reset is the only way to clear A31. The software reset can also be used in odier instances to cause die IOP to begin execution of a new program. See Processor Startup, below. Instruction Reference The following text contains a description of each of d e IOP instructions. In addition to a functional description, at die right margin is the instruction opcode and die number of 2X-clock cycles required to execute. See Appendix B for mnemonic codes. DIRECT MEMORY ACCESS CONTROLLER A Direct Memory Access Controller (DMAC) 112 (Figure 11) allows I/O devices to transfer data to and from system memory widiout the intervention of the MPU. The DMAC supports eight I/O channels prioritized from eight separate sources. Direct memory access (DMA) requests are received from die bit inputs dirough ioin. DMA and MPU bus request priorities are eidier fixed, which allows higher-priority requests to block lower-priority requests, or revolving, which prevents higher-priority requests diat cannot be satisfied from blocking lower- priority requests. DMA is supported for bodi cell-wide and byte-wide devices in botii cell- wide and byte- wide memory. Each I/O channel can be individually configured as to die type of device and bus timing requirement. Byte-wide devices can be configured as eidier one-byte byte-transfer or four-byte byte-transfer devices. Transfers are flybys or are buffered, as required for die I/O-channel bus transaction. See Table 52. DMAC and IOP xfer transfers are identical except for how they are initiated. DMAC transfers occur from asynchronous requests whereas xfer transfers occur at their programmed time. Resources The DMAC consists of several registers and associated control logic. DMA request zero, which corresponds to bit zero of die registers, has die highest priority; DMA request seven, which corresponds to bit seven of the registers, has the lowest priority. The DMAC and related registers include: • Bit input register, ioin: bit inputs configured as DMA or interrupt requests, or general bit inputs. See Figure 21. • Interrupt enable register, ioie: indicates which ioin bits are to be recognized as interrupt requests. See Figure 25. • DMA enable register, iodmae: indicates which ioin bits are to be recognized as DMA requests. If DMA is enabled on an ioin bit, interrupt enable by ioie on diat bit is ignored. See Figure 26. • DMA enable expiration register, iodmaex: indicates which iodmae bits will be cleared following a DMA transfer involving die last location in a 1024-byte memory page occurs on mat channel. See Figure 44. • Global registers g8 through gl5: contain I/O-channel transfer specifications. Transfer specifications consist of device and memory transfer addresses and control bits. See Figure 12. • Fixed DMA priorities bit, fdmap, in register miscellaneous B, miscb: prevents or allows lower-priority bus requests to contend for access to the buss if a higher-priority request cannot be satisfied (i.e., die available bus transaction slot is too small). See Figure 29. DMA Requests An ioin bit is configured as a DMA request source when the corresponding iodmae bit is set and the corresponding ioie bit is clear (tiiough ioie is ignored when iodmae is set). Once a zero reaches ioin, it is available to request a DMA I/O-channel transfer. See DMA Usage, below. A DMA request is forced in software by clearing the corresponding ioin bit. Individually disabling DMA operations on an I/O channel by clearing its iodmae bit prevents a corresponding zero bit in ioin from being recognized as a DMA request, but does not affect the zero-persistence of die corresponding bit in ioin. Prioritization A DMA request is prioritized widi other pending DMA requests, and, if the request has the highest priority or is the next request in revolving-priority sequence (see below), its corresponding I/O channel will be the next to request die bus. DMA request prioritization requires one 2X-clock cycle to complete. When the I/O channel bus request is made, die MIF 120 waits until d e current bus transaction, if any, is almost complete. It then checks iopdelay to determine if die available bus slot is large enough for the required I/O channel bus transaction. If the bus slot is large enough, die bus is granted to die I/O channel, and d e bus transaction begins. The IOP always seizes the bus when iopdelay decrements to zero. Odierwise, a DMA I/O channel bus request and an MPU 108 bus request contend for the bus, with the DMA I/O channel bus request having higher priority. If fdmap is set and die bus slot is too small, die DMA I/O channel does not get die bus. Until a higher-priority DMA I/O channel request is made d at fits die shrinking available bus slot, no bus transactions occur until die IOP seizes the bus. When die IOP 110 next executes delay, die highest-priority DMA request, or the MPU 108 if there are no DMA requests, repeats die bus request process. If fdmap is clear and die bus slot is too small, die DMA I/O channel does not get the bus. The next lower-priority bus request is then allowed to request die bus, widi the MPU 108 as die lowest-priority request. The process repeats until die bus is granted or d e IOP 110 seizes the bus. When die IOP 110 next executes delay, die highest-priority DMA request, or the MPU 108 if there are no DMA requests, repeats the bus request process. Memory and Device Addressing Addresses used for I/O channel transfers contain botii d e I/O device address and d e memory address. By convention, the uppermost address bits (when A31 is set) select I/O device addresses, while die lower address bits select the memory source/destination for die transfer. Multi-cycle transfer operations (e.g., transferring between a byte device and cell memory) assume A31 is part of the external I/O-device address decode and pass/clear A31 to select/deselect die I/O device as needed during die bus transaction. See I/O Addressing, below, and I/O-Channel Transfers, below. 1024-byte memory page boundaries have special significance to I/O channel transfers. When each I/O-channel bus transaction completes, bits 15-2 of the memory address in die global register are incremented. The new address is evaluated to determine if die last location in a 1024-byte memory page was just transferred (by detecting diat bits 9-2 are now zero). When the last location in a 1024-JDyte memory page was just transferred, and MPU interrupt can be requested or DMA can be disabled. See Interrupts and Terminating DMA I/O-Channel Transfers, below. Interrupts An MPU 108 interrupt can be requested after an I/O channel transfer accesses the last location in a 1024-byte memory page. The interrupt requested is die same as the I/O-channel number, and occurs if interrupts are enabled on diat channel (i.e., if bit zero of the corresponding global register is set). See Figure 12, and Interrupt Controller, below. This allows, for example, the MPU to be notified diat a transfer has completed (by aligning the end of a transfer memory area widi the end of a 1024-byte memory page), or to inform the MPU of progress during long transfers. Note that for the interrupt to be serviced, die MPU 108 must obtain die bus for sufficient time to execute the ISR. If die IOP 110 does not execute delay, or continuous DMA transfers occur, the MPU will be unable to get die bus. Bus Transaction Types The type of bus transaction performed widi an I/O device depends on whedier the memory group involved is cell-wide or byte-wide and the whether die device is a one-byte byte-transfer, four-byte byte-transfer, or one-cell cell-transfer device. See I/O-Channel Transfers, below. Device Access Timing Any I/O device accessed during an I/O-channel transfer must complete the transfer by the end of the programmed bus cycle. Wait states are not available. Since I/O devices generally have longer access times man memory, during an I/O- channel bus cycle die programmed bus timing for the accessed memory group is modified by substituting ioXebt for the corresponding value in mgXebt. Note diat ioXebt must be adequate botii for the I/O device and for any memory group involved in die transfer. See Programmable Memory Interface, below. Maximum Bandwiddi Transfers When die external input source for ioin is IN[7:0], maximum-bandwidtii, back-to-back DMA transfers are possible. To achieve diis, at the end of die DMA bus transaction an internal circuit bypasses die input sampling circuitry to check die DMA request bit directly on IN[7:0]; if the signal is low and no higher- priority requests are pending, another DMA bus request occurs immediately widiout die usual sampling and prioritization delays. This requires that die external DMA hardware ensure d e bit is valid at diis time. See Figure 76 78, page 192. If the remaining bus slot is large enough, die DMA bus request is granted, and die transfer starts immediately. To terminate back-to-back DMA bus transactions, the DMA request input must go high before the end of die current DMA bus transaction, or the corresponding DMA enable bit must be cleared. See Terminating DMA I/O-Channel Transfers, below. The maximum possible transfer rate is four bytes every two 2X-clock cycles. For example, with a 50-MHz IX clock, the maximum transfer rate is 200 MB/second. Terminating DMA I/O-Channel Transfers DMA I/O channel bus transactions occur on an I/O channel while DMA remains enabled and DMA requests are received. To limit DMA transfers to a specified number of transactions: • program the DMA transfer address so diat die last data transfer desired occurs using die last location in a 1024-byte memory page, and • set die corresponding iodmaex bit. When die above transaction completes, the DMA enable bit in iodmae is cleared. If die transfer interrupt is enabled in the global register for the corresponding I/O channel, a corresponding MPU interrupt will also be requested. If more dian 1024 bytes are to be transferred, enable die transfer interrupt for the I/O channel in the corresponding global register. Program the interrupt service routine to check die global register for d e next-to-last 1024-byte page, and, at diat time, set die corresponding iodmaex bit. When die last location in die next 1024-byte page is transferred, the corresponding bit in iodmae will be cleared, disabling DMA on diat channel. Note that this assumes die bus is available to die MPU to execute the ISR during d e DMA transfers. Other Capabilities The DMAC 112 can also be used to count events, and to interrupt the MPU 108 when a given count is reached. To do diis, events are designed to produce a normal DMA memory read request, and die resulting transfer cycle increments the "address" in the corresponding global register. This "address" becomes die event counter. The MPU can also examine die register at any time to determine how many events have occurred. To interrupt die MPU after a given event count, program the global register for a negative count value within bits 9-2, and enable the page-boundary interrup. The MPU 108 will be interrupted when die counter reaches zero. INTERRUPT CONTROLLER An interrupt controller (INTC) 114 (Figure 13) allows multiple ex t ernal or internal requests to gain, in an orderly and prioritized manner, the a tt en t ion of t he MPU. The INTC supports up to eight prioritized interrupt requests from t wen t y- four sources. Interrupts are received from the bit inputs through ioin, from I/O- channel transfers, or from the IOP interrupt instruction int. Resources The INTC 114 consists of several registers and associated control logic. Interrupt zero, which corresponds to bit zero of die registers, has the highest priority; interrupt seven, which corresponds to bit seven of the registers, has die lowest priority. The INTC 114 and related registers include: • Bit input register 116, ioin: bit inputs configured as DMA or interrupt requests, or general bit inputs. See Figure 21. • Interrupt enable register 158, ioie: indicates which ioin bits are t o be recognized as interrupt requests. See Figure 25. * Interrupt pending register, ioip: indicates which interrupts have been recognized, but are waiting to be prioritized and serviced. See Figure 22. • Interrupt under service register, ioius: indicates which interrupts are currently being serviced. See Figure 23. • Global registers g8 through gl5: contain I/O-channel transfer specifications. Transfer specifications consist of device and memory transfer addresses and control bits. Bit zero enables interrupts during I/O-channel transfers on the corresponding channel. See Figure 12. • DMA enable register, iodmae: indicates which ioin bits are to be recognized as DMA requests. If DMA is enabled on an ioin bit, interrupt enable by ioie on that bit is ignored. See Figure 26. Table 42. Sources of Interrupts Intermpt s Interrupt Source ioin bit X I/O channel X (register g(8+X)) IOP instruction int X Operation Each interrupt request is shared by tiiree sources. A request can arrive from a zero bit in ioin (typically from an external input low), from an I/O-channel transfer interrupt, or from the IOP instruction int. Interrupt request zero comes from ioin bit zero, I/O channel zero (using g8), or int 0; interrupt request one comes from ioin bit one, I/O channel one (using g9), or int 1; the odier interrupt requests are similarly assigned. See Table 42. Application usage typically designates only one source for an interrupt request, though diis is not required. Associated widi each of the eight interrupt requests is an interrupt service routine (ISR) executable-code vector located in external memory. See Figure 4. A single ISR executable-code vector for a given interrupt request is used for all requests on that interrupt. It is programmed to contain executable code, typically a branch to the ISR. When more man one source is possible, die current source might be determined by examining associated bits in ioin, ioie, iodmae and die global registers. Interrupt Request Servicing When an interrupt request from any source occurs, die corresponding bit in ioip is set, and die interrupt request is now a pending interrupt. Pending interrupts are prioritized each 2X-clock cycle. The interrupt en bit in mode holds die current global interrupt enable state. It can be set with die MPU enable- interrupt instruction, ei; cleared with the disable-interrupt instruction, di; or changed by modifying mode. Globally disabling interrupts allows all interrupt requests to reach ioip, but prevents the pending interrupts in ioip from being serviced. When interrupts are enabled, interrupts are recognized by die MPU between instruction groups, just before die execution of the first instruction in die group. This allows short, atomic, uninterruptable instruction sequences to be written easily widiout having to save, restore, and manipulate the interrupt state. The stack architecture allows interrupt service routines to be executed without requiring registers to be explicitly saved, and die stack caches minimize the memory accesses required when making additional register resources available. If interrupts are globally enabled and die highest-priority ioip bit has a higher priority than the highest-priority ioius bit, the highest-priority ioip bit is cleared, the corresponding ioius bit is set, and the MPU is interrupted just before die next execution of die first instruction in an instruction group. This nests the interrupt servicing, and die pending interrupt is now the current interrupt under service. The ioip bits are not considered for interrupt servicing while interrupts are globally disabled, or while none of the ioip bits has a higher priority than the highest-priority ioius bit. Unless software modifies ioius, the current interrupt under service is represented by die highest-priority ioius bit currently set. reti is used at die end of ISRs to clear the highest-priority ioius bit that is set and to return to the interrupted program. If the interrupted program was a lower-priority interrupt service routine, diis effectively "unnests" the interrupt servicing. External Interrupts An ioin bit is configured as an interrup request source if the corresponding ioie bit is set and die corresponding iodmae bit is clear. Once a zero reaches ioin, it is available to request an interrupt. An interrupt request is forced in software by clearing the corresponding ioin bit or by setting die corresponding ioip bit. Individually disabling an interrupt request by clearing its ioie bit prevents a corresponding zero bit in ioin from being recognized as an interrupt request, but does not affect a corresponding interrupt request from another source. While an interrupt request is being processed, until its ISR terminates by executing reti, die corresponding ioin but is not zero-persistent and follows die sampled level of die external input pin. Specifically, for a given interrupt request, while its ioin bit is not zero-persistent. This effect can be used to disable zero- persistent behavior on non- interrupting bits. For waveforms, see Figure 75 and Figure 76. I/O-Channel Transfer Interrupts If an ioin bit is configured as a DMA request, or if that I/O channel is used by xfer, interrupt requests occur after a transfer involving the last location in a 1024-byte memory page, provided bit zero in die corresponding global register is set (i.e. , transfer interrupts are enabled). The request occurs by the corresponding ioip bit being set, and is thus not disabled by clearing die corresponding ioie bit. See Direct Memory Access Controller, above, and Input-Output Processor, above. IOP int Interrupts The IOP can also directly request any of die eight available interrupts by executing int. The request occurs by the corresponding ioip bit being set, and is dius not disabled by clearing die corresponding ioie bit. The MPU will be able to respond to die interrupt request when the IOP next executes delay. ISR Processing When an interrupt request is recognized by the MPU, a call to die corresponding ISR executable-code vector is performed, and interrupts are blocked until an instruction that begins in byte one of an instruction group is executed. To service an interrupt widiout being interrupted by a higher-priority interrupt: • die ISR executable-code vector typically contains a four-byte branch, and • die first instruction group of the interrupt service routine must globally disable interrupts. See die code example in Table 43. If interrupts are left globally enabled during ISR processing, a higher- priority interrupt can interrupt die MPU during processing of the current ISR. This allows devices widi more immediate servicing requirements to be serviced promptly even when frequent interrupts at many priority levels are occurring. Note that there is a delay of one 2X-clock cycle between the execution of ei, di, or pop mode and the change in the global interrupt enable state taking effect. To ensure die global interrupt enable state change takes effect before byte zero of the next instruction group, the state-changing instruction must not be the last instruction in the current instruction group. If die global interrupt enable state is to be changed by die ISR, the prior global interrupt enable state should be saved wid push mode and restored widi pop mode within the ISR. Usually a pop mode, reti sequence is placed in d e same instruction group at the end of die ISR to ensure diat reti is executed, and the local-register stack unnests, before another interrupt is serviced. Since die return address from an ISR is always to byte zero of an instruction group (because of the way interrupts are recognized), anodier interrupt can be serviced immediately after execution of reti. See the code example in Table 43. Table 43. Code Example: ISR Vectors ;org 0x100 set in linker ; highest-priority ISR ; lowest-priority ISR ;org set in linker file int_0_ISR:: push mode ;save carry ;This ISR can't be interrupted because int 0 has 20; the highest priority. mode ; restore carry inC5A_ISR: push mode ;save carry ;This ISR can be interrupted by a higher priority ; interrupt reti int_B_ISR:: push mode .save carry & ei state 35di ;Don't allow this ISR to be interrupted at all. • ensure return before interrupts re-enabled 40. quad 2 pop mode reu int C ISR: 45push mode ;save carry & ei state R9P Istack -place accessible di ;Don't allow this critical part of the ISR to be ; interrupted. 50- push rO pop mode : restore ei state ;ISR can be interrupted by higher-priority interrupts 55;now push Istack pop mode reti ; restore carry - As described above for processing ISR executable-code vectors, interrupt requests are similarly blocked during die execution of all traps. This allows software to prevent, for example, further data from being pushed on die local- register stack due to interrupts during d e servicing of a local-register stack- overflow exception. When resolving concurrent trap and interrupt requests, interrupts have the lowest priority. BIT INPUTS Eight external bit inputs are available in bit input register 116 ioin (Figure 14). They are shared for use as interrupt requests, as DMA request, as input to the IOP instruction tskipz, and as bit inputs for general use by the MPU. They are sampled externally from one Of two sources determined by die state of pkgio. Resources The bit inputs consist of several registers, package pins, and associated input sampling circuitry. These resources include: • Bit input register 116, ioin: bit inputs configured as DMA or interrupt requests, or general bit inputs. See Figure 21. • Interrupt enable register, ioie: indicates which ioin bits are to be recognized as interrupt requests. See Figure 25. • Interrupt pending register, ioip: indicates which interrupts have been recognized, but are waiting to be prioritized and serviced. See Figure 22. • Interrupt under service register, ioius: indicates which interrupts are currently being serviced. See Figure 23. • DMA enable register, iodmae: indicates which ioin bits are to be recognized as DMA requests for the corresponding I/O channels. If DMA is enabled on an ioin bit, interrupt enable by ioie on that bit is ignored. See Figure 26. • Package I/O pins bit, pkgio, in register miscellaneous B, miscb: selects whedier the bit inputs are sampled from the dedicated inputs IN[7:0] or multiplexed off AD[7:0]. See Figure 29. Input Sources and Sampling If pkgio is clear, the bit inputs are sampled form AD[7:0] while RAS is low and CAS is high. External hardware must place die bit inputs on AD [7:0] and remove d em at die appropriate time. Using AD[7:0] for bit inputs can reduce PWB area and cost compared widi using IN[7:0]. AD[7:0] are sampled for input: • while CAS is high, four 2X-clock cycles after RAS transitions low, • every four 2X-clock cycles while CAS remains high, • immediately before CAS transitions low if at least four 2X-clock cycles have elapsed since the last sample, and • four 2X-clock cycles after CAS transitions high, provided CAS is still high. This ensures: • time for external hardware to place data on die bus before sampling, • continuous sampling while CAS is high, and • at least one sample every CAS bus Cycle when four 2X-clocks have elapsed since die last sample. To ensure sampling in a given state, an input bit must be valid at die designated sample times or remain low for a worst-case sample interval, which, as described above, depends on die programmed bus timing and activity. See Figure 79 81, page 196, for waveforms. If pkgio is set, the bit inputs are sampled from IN[7:0] every four 2X-clock cycles. To ensure sampling in a given state, a bit input must be valid for just more dian four 2X-clock cycles. See Figure 78 80, page 194, for waveforms. All asynchronously sampled signals are susceptible to metastable conditions. To reduce the possibility of metastable conditions resulting from the sampling of the bit inputs, d ey are held for four 2X-clock cycles to resolve to a valid logic level before being made available to ioin and thus for use within the CPU. The worst-case sampling delay for bit inputs taken from AD [7:0] to reach ioin depends on d e bus cycle times. The worst-case sampling delay for bit inputs from ΪN[7:0] to reach ioin is eight 2X-clock cycles. The sample delay causes bit- input consumers not to detect an external signal change for the specified period. The bit inputs reaching ioin are normally zero-persistent. That is, once an ioin bit is zero, it stays zero regardless of the bit state at subsequent samplings until the bit is "consumed" and released, or is written widi a one by die MPU. Zero-persistent bits have die advantage of both edge-sensitive and level-sensitive inputs, widiout the noise susceptibility and non-shareability of edge-sensitive inputs. Under certain conditions during DMA request servicing and ioin interrupt servicing, the ioin bits are not zero-persistent. See DMA Usage and Interrupt Usage below. An effect of the INTC can be used to disable zero-persistent behavior on die bits. See General-Purpose Bits below. DMA Usage An ioin bit is configured as a DMA request source when its corresponding iodmae bit is set. After die DMA bus transaction begins, the ioin bit is consumed. When die external input source for ioin is IN [7:0], maximum-bandwidtii back-to-back DMA transfers are possible. To achieve this, an internal circuit bypasses die sampling and zero-persistence circuitry to check die DMA request bit on lN[7:0] at the end of die DMA bus transaction without die usual sampling and prioritizing delays. See Maximum Bandwidth Transfers, above. Interrupt Usage An ioin bit is configured as an interrupt request source when the corresponding ioie bit is set and die corresponding iodmae bit is clear. While an interrupt request is being processed, until its ISR terminates by executing reti, corresponding ioin bit is not zero-persistent and follows the sampled level of die external input. Specifically, for a given interrupt request, while its ioie bit is set, and its ioip bit or ioius bit is set, its ioin bit is not zero-persistent. This effect can be used to disable zero-persistent behavior on non- interrupting bits (see below). Table 44. Code Example: Bit Input Widiout Zero-Persistence ; Disable zero-persistence for bit input 7 5push.n #-1 ;true flag push.b sto.i #io7ius i [] ;set under service bit lopush.b sto.i #io7ie i pop [] " ;enable interrupt : discard flag 10 General-Purpose Bits If an ioin bit is configured neither for interrupt requests nor for the DMA requests, then it is a zero-persistent general-purpose ioin bit. Alternatively, by using an effect of the INTC, general-purpose ioin bits can be configured with 15 zero-persistence. Any bits so configured should be the lowest-priority ioin bits in order to prevent blocking a lower-priority interrupt. They are configured by setting dieir ioie and ioius bits. The ioius bit prevents die ioin bit from zero- persisting and from being prioritized and causing an interrupt request. See the code example in Table 44. 20 IOP Usage An ioin bit can be used as input to tskipz. This instruction reads, tests, and consumes die bit. The ioin bits cannot be written by die IOP 110. General- purpose ioin bits are typically used for tskipz, but there are no hardware restrictions on usage. 25 MPU Usage Bits in ioin are read and written by the MPU 108 as a group with Ido [ioin] and sto [ioin], or are read an written individually widi ldo.i [ioXin i] and sto.i [ioXin ] . Writing zero bits to ioin has the same effect as though the external bit inputs had transitioned low for one sampling cycle, except that there is no sampling delay. This allows software to simulate events such as external interrupt or DMA requests. Writing one bits to ioin, unlike data from external inputs when die bits are zero-persistent, releases persisting zeros to accept die current sample. 10 The written data is available immediately after the write completes. The MPU can read ioin at any time, without regard to the designations of the ioin bits, and widi no effect on the state of the bits. The MPU does not consume die state of ioin bits during reads. See the code examples in Table 45. Table 46. Code Example: MPU "Real Time" Bit Input Read ;Read current state of zero-persistence input pins. ; (Assumes pkgio is set, ana bits are zero-persistent) l0;Assume we just tickled a device and we want to ;see if it just responded, but we have the bits ; configured as zero-persistent. The sample interval ;of four 2X-clock cycles and the sample holding :delay of four 2X-clock cycles means there is a i5;worst-case delay of eight 2X-clock cycles before ;the data will be available in ioin. So... ;Tickle device... nop ;wait the delay time 20nop nop nop nop nop ;6 here, two below ;R_3_d last sampled state of all zero-persistent bit inputs ; (Assumes all bits are configured as zero-persistent) push.n #-1 ;all ones for all bits (7) push.n #ioin ;(2X-clock cycle #8) 30 ;...data is now available ;to ioin. sto [] ; Temporarily remove ; persistence, latest ; sample latches, 35pop ; discard- 1 ush.n #ioin „ ido [] ;get last sample To perform a "real-time" external-bit-input read on zero-persistent bits, ones bits must be written to die bits of interest in ioin before reading ioin. This releases any persisting zeros, latches the most recently resolved sample, and reads diat value. Bits d at are not configured as zero-persistent do not require diis write. Note diat any value read can be as much as two worst-case sample delays old. To read d e values currently on the external inputs requires waiting two worst-case sample delays for the values to reach ioin. See die code example in Table 46. BIT OUTPUTS Eight general-purpose bit outputs can be set high or low by eidier die MPU or the IOP. The bits are available in the bit output register 118, ioout (Figure 15). Resources The bit outputs consist of a register, package pins, and associated circuitry. These resources include: • Bit output register, ioout: bits that were last written by eidier die MPU or the IOP. See Figure 24. • Outputs, OUT[7:0]: die dedicated output pins. • Address Data bus, AD[7:0]: multiplexed bit outputs on diese pins while RAS is high. • Output pin driver current bits, outdrv, in driver current register, driver: sets die drive capability of OUT[7:0]. See Figure 45. Usage The bits are read and written by die MPU as a group widi Ido [ioout] and sto [ioout], or are read and written individually widi ldo.i [ioXout i] and sto.i [ioXout i]. The bit outputs are written individually by die IOP widi outt and outf. The bit outputs cannot be read by die IOP. When written, the new values are available immediately after die write completes. Note diat if botii the MPU and IOP write die same bit during the same 2X-clock cycle, any one bit written prevails. The bits are always available on OUT[7:0], and on AD[7:0] when RAS is high. When sampled from AD[7:0], external hardware is required to latch die bits when RAS falls. Note that (by definition) these bits are only updated when a RAS cycle occurs. Using AD[7:0] for output cna reduce PWB area and cost compared to using OUT[7:0J. See Figure 74 for waveforms. The drive capability of OUT[7:0] can be programmed in driver. PROGRAMMABLE MEMORY INTERFACE The programmable Memory Interface (MIF) 120 allows the timing and behavior of the CPU bus interface to be adapted to die needs of peripheral devices wid minimal external logic, thus reducing system cost while maintaining performance. A variety of memory devices are supported, including EPROM, SRAM, DRAM and VRAM, as well as a variety of I/O devices. All operations on the bus are directed by the MIF 120. Most aspects of the bus interface are programmable, including address setup and hold times, data setup and hold times, output buffer enable and disable times, write enable activation times, memory cycle times, DRAM-type device address multiplexing, and when DRAM-type RAS cycles occur. Additional specifications are available for I/O devices, including data setup and hold times, output buffer enable and disable times, and device transfer type (one-byte, four-byte or one-cell). Resources The MIF consists of several registers, package pins, and associated control logic. These resources include: • VRAM control bit register, vram: controls OE, LWE, CASes, RASes, and DSF to initiate special VRAM operations. See Figure 27. • Miscellaneous A register, misca: controls refresh and RAS-cycle generation. See Figure 28. • Miscellaneous B register, miscb: selects each memory group data width (cell-wide or byte-wide), and die memory bank-select architecture. See Figure 29. • Memory system group-select mask register, msgsm: indicates which address bits are decoded to select groups of memory devices. See Figure 32. • Memory group device size register, mgds: indicates the size and configuration of memory devices for each memory group. See Figure 33. • Miscellaneous C register, miscc: controls RAS-cycle generation and the location of bank-select address bits for SRAM memory groups. See Figure 34. • Memory group X extended bus timing register mgXebt: indicates memory- cycle expansion or extension values, which create longer data semp and hold times and output buffer enable and disable times for the memory devices in the corresponding memory group. See Figure 35. • Memory group X CAS bus timing register, mgXcasbt: indicates die unexpanded and unextended address and data strobe activation times for the CAS portion of a bus cycle. See Figure 36. • Memory group X RAS bus timing register, mgXrasbt: indicates die RAS precharge and address hold times to be prepended to the CAS part of a bus cycle to create a RAS cycle. See Figure 37. • I/O channel X extended bus timing register, ioXebt: indicates memory cycle expansion or extension values, which create longer data setup and hold times and output buffer enable and disable times for the I/O device on d e corresponding I/O channel. See Figure 38. • Memory system refresh address, msra: indicates d e row address to be used during die next DRAM refresh cycle. See Figure 39. • I/O device transfer types A register iodtta: indicates die type of transfer for each of I/O channels 0, 1, 2 and 3. See Figure 41. • I/O device transfer types B register, iodttb: indicates die type of transfer for each of I/O channels 4, 5, 6 and 7. See Figure 42. • Driver current register, driver: indicates die relative drive current of die various output drivers. See Figure 45. Memory System Architecture The MIF 120 supports direct connection to a variety of memory and peripheral devices. The primary requirement is diat die device access time be deterministic; wait states are not available because diey would create non- deterministic timing for the IOP 110. The MIF 120 directly suppons a wide range of sizes for multiplexed-address devices (DRAM, VRAM, etc.) up to 128 MB, as well as sizes for demultiplexed-address devices (SRAM, EPROM, etc.) up to 1 MB. Fast-page mode access and RAS-only refresh to DRAM-type devices are supported. SRAM-type devices appear to the MIF as DRAM with no RAS address bits and a larger number of CAS address bits. See Figure 33. Address bits are multiplexed out of die CPU on ASD[31:9] to reduce package pin count. DRAM-type devices collect die entire memory address in two pieces, referred to as die row address (upper address bits) and a column address (lower address bits). Their associated bus cycles are referred to as Row Address Strobe (RAS) cycles and Column Address Strobe (CAS) cycles. Widi die exception of memory faults, refresh and CAS-before-RAS VRAM cycles, a RAS cycle contains, enclosed within the RAS active period, a CAS cycle. Thus RAS cycles are no longer than CAS cycles. While RAS cycles are not required for the operation of SRAM-type devices, RAS cycles can occur for several reasons which are discussed below. Though I/O devices can be addressed like memory for access by the MPU, I/O-channel transfers require addressing an I/O device and a memory location simultaneously. This is achieved by splitting d e available 32 address bits into two areas: the lower address bits, which address memory, and the higher address bits, which address I/O devices. The location of the split depends upon application requirements for the quantity of addressable memory and I/O devices installed. The areas can overlap, if required, with the side effect that an I/O device can only transfer data with the side effect that an I/O device can only transfer data widi a corresponding area of memory. These higher address bits are discussed below. Memory Groups The MIF 120 operates up to four memory groups, maintaining for each the most recent RAS address bits and a unique configuration. Up to two address bits are decoded to determine die current group. The address bits for diis function are set in the memory system group-selected mask register, msgsm. Each memory group is programmed for device widtii, bus timing, and device size (which specifies how address bits are multiplexed onto AD [31:9]). Address bits below the group-selected mask are typically used to address memory devices or portions of an I/O device, and bits above the group-select mask are typically used to address I/O devices. Memory Banks Each memory group can have one or more memory banks, which are selected in a manner dependent upon die bus interface mode. All memory banks within a memory group share the configuration and most recent RAS address of that group. Two address bits are decoded to determine die current memory bank. In Single Memory Bank (SMB) mode (mmb = 0), msgsm sets die group- select bits to be die same bits. This allows up to four groups at one bank per group, totalling four banks: group 0, bank 0; group 1 , bank 1; group 2, bank 2; and group 3, bank 3. MGSx/RASx signals for direct connection to memory devices. See Figure 17. In Multiple Memory Bank (MMB) mode (mmb = 1), depending on whether msgsm overlaps die bank-select bits, one, two or four banks can be selected in each group. This allows up to sixteen banks for all groups combined; more banks can be decoded by defining additional bank-select bits widi external logic. The address bits that select die current memory bank either located immediately above die row-address bits for DRAM devices (mgXds values 0- OxOe), or are specified by the mssbs bits for all SRAM devices in the system (mgXds value OxOf). The group-selected bits determine die MGSx/RASx (which output the MGSx signal), and die bank-select bits determine die CASx that activates in any given bus cycle. See Figure 20. Gating the four MGSx signals with the four CASx signals creates up to sixteen memory bank selects. See Figure 18. A hybrid of die two modes can also be programmed by selecting MMB mode and placing the msgsm bits overlapping die banks bits. This allows using MGSx directly as a faster chip select for SRAM-type devices dian CASx strobes can be connected directly to die memory device and only one NOR gate per group is needed to create the RAS for that group. Device Requirements Programming Each memory group can be programmed with a unique configuration of device widtii, device size, and bus timing. After a CPU reset, the system operates in byte-wide mode, with the slowest possible bus timing, and executes from the memory group zero, typically from an external PROM. See Processor Startup, below. Usually, die program code in die PROM will initially execute code to determine and set the proper configuration for the memory groups, I/O devices, and odier requirements of die system. Device Sizes Memory device sizes are programmed to one of sixteen settings in mgds. Most currently available and soon to be available DRAM-type device sizes can be selected, as well as an SRAM-type option. The selection of the device size and widdi determines die arrangement of the address bits on AD [31 :9]. See Table 47 and Table 48. For DRAM, during botii RAS and CAS cycles, some or all of die high address bits are on AD above diose AD used for the RAS and CAS address bits. These high address bits can be used by die application, e.g., for decoding by external hardware to select I/O devices. On high-performance systems with fast CAS cycles, RAS cycles are often required for I/O address decoding. If die external decoding hardware is sufficiently fast, however, CAS-cycle I/O is possible. For SRAM, to allow addressing as much as memory as possible widi CAS cycles, die only high address bit diat appears during CAS address time is 31. I/O devices can still be selected on CAS cycles by translating the device addressing bits in software to lower address bits, provided diat diese translated bits do not interfere with the desired SRAM memory addressing. The device addressing bits must be translated to tiiose address bits diat will appear during SRAM access on the AD that are externally decoded for I/O addressing. Device Width Memory device widtiis are either 8-bits (byte) or 32-bits (cell), and are programmed using mgXds in miscb. As shown in Table 47, cell-wide memory groups do not use Al or AO to address the memory device. All accesses to cell-wide devices are cell-aligned and transfer the entire cell. Memory device address lines are attached to the CPU on AD [x: ll] (x is determined by die device size). Access to a byte-wide memory group are also cell-aligned and transfer all four bytes widiin die cell, from most significant to least significant (i.e. , 0, 1, 2, 3). The only exception is for an I/O-channel transfer widi a one-byte byte-transfer device, in which case only one arbitrarily addressed byte is transferred. See Bus Operation, below. As shown in Table 48, byte- wide memory devices require die use of Al and AO. Since for DRAM the RAS and CAS memory device address bits must be on the same AD, the address lines (except A31) are internally rotated left two bits. This properly places AO on AD 11 for connection to DRAM. This also means, however that die high address bits used for I/O address decoding appear on AD differently for a byte-wide memory group an for a cell-wide memory group. Since I/O device address decoding hardware is wired to fixed AD, die address bits used to access a device are different when transferring data widi a byte-wide memory device dian when transferring data widi a cell-wide memory device. a _ . - s a Programmable Timing The timing for RAS and CAS cycles on each memory group, as well as data semp and hold times for each I/O channel, is programmable. Depending on die parameter, timing granularity is in eidier 2X-clock cycles or 4X -clock cycles. In some cases, timing is specified in 2X-clock cycles widi a modifier available to advance die event by one 4X-clock cycle. Timing specification is broken into three pieces: RAS prefix, basic CAS cycle, and CAS extension/expansion timing. All CAS cycles consist of the basic CAS cycle timing and die appropriate CAS extension/expansion timing. This combination is referred to as die CAS part of die memory cycle. All RAS cycles consist of a RAS prefix plus a CAS part. Bus transactions of multiple bus cycles are simply the required sequence of RAS prefixes and CAS parts in immediate succession. Only discrete read cycles or write cycles are performed; read-modify write cycles are not performed. RAS Prefix Timing This timing for a memory group is specified by programming the fields in die corresponding mgXrasbt. The RAS prefix of a RAS cycle consists of a leading 2X-clock cycle; die RAS inactive portion, also referred to as RAS precharge (mgbtras); and die RAS address hold time (mgbtrhld). The last two are modified by die early RAS bit (mgbteras). For computation of the RAS-cycle duration, mgbtrast must contained die sum of mgbtras and mgbtrhld plus one. During this time the DRAM RAS address bits, high address bits, and bit outputs are on AD. See Figure 37. CAS Part Timing This timing for a memory group is specified by programming the fields in mgXcasbt and mgXebt. The CAS part of the cycle begins widi die timing for the CAS inactive portion, also referred to as CAS precharge (mgbtcas). Next is the CAS address hold time/beginning of data time (mgbtdob), when DOB, and possibly OE or LWE, go active. Then CAS, DOB, and either OE (if a memory read) or both EWE and LWE (if a memory write) go inactive again (mgbtcast). To accommodate longer data setup and buffer delay times, die CAS cycle can be expanded at DOB fall (mgebtdobe). To accommodate longer data hold and output buffer disable times, the CAS strobes can be extended following DOB inactive (mgebtcase). Memory write cycles can be programmed to have EWE go active eidier at die beginning of the CAS cycle (before RAS rise if a RAS cycle) or at CAS fall (mgbtewea). Similarly, LWE can be programmed to go active either at DOB fall plus expansion or at DOB fall plus expansion plus one 4X-clock cycle (mgbtlwea). EWE generally accommodates DRAM-type devices. Further, DOB going inactive tracks EWE/LWE or OE, either of which can be made to go inactive earlier than the unextended CAS time by one 4X-clock cycle duration, mgbtcast is added to mgebtsum, the latter of which must contain the sum of mgebtdobe and mgebtcase. See Figure 36 and Figure 35. When MPU bus transactions or IOP instruction-fetch bus transactions occur, the bus cycle timing for the memory group uses die values in mgXebt, as described above. When an I/O channel bus transaction occurs, the values in ioXebt for the appropriate I/O channel are substimted for die mgXebt values. The ioXebt values must be programmed to accommodate any memory group that might be involved in die transfer, as well as the I/O device. DRAM Refresh DRAM requires periodic accesses to each row widiin die memory device to maintain die memory contents. Most DRAM devices support several modes of refresh, including die RAS-only refresh mode supplied by die IOP instruction refresh. The IOP must be programmed to execute refresh at intervals short enough for the most restrictive DRAM in the system. The timing during die refresh cycle uses the RAS cycle timing of the memory group indicated by msrtg, which must be long enough for the slowest DRAM refresh cycle in the system. Refresh on each memory group can be individually enabled or disabled. See Figure 28. msra contains data used during each refresh cycle, refresh increments die 14-bit row address in msrra after the refresh cycle completes. The address bits in msra31 and msrha are normally zero, but can be written if die zero values interfere with odier system hardware during refresh cycles. Video RAM Support Special VRAM operating modes are supported dirough the use of vram. See Figure 27 and Table 35. Many VRAM modes use a RAS cycle to set an operating state in the VRAM device. Unexpected RAS cycles can thus cause undesirable results. Refresh cycles are one source of unexpected RAS cycles; these can be disabled on groups containing VRAM by setting the appropriate mgXrd bits. See Figure 28. Changes in die high address bits are a second source of unexpected RAS cycles; these can be prevented from occurring on memory group msvgrp by setting msevhacr. The high address bits are typically used for I/O device addresses, and will require a RAS cycle when these bits change if mshacd is clear. An I/O- channel transfer immediately prior to a VRAM group access is an example of such an occurrence. The RAS cycle might be required for proper system operation, but the VRAM group can be prevented from receiving die RAS cycle by setting msevhacr. The RAS precharge portion of the cycle will occur on RAS and RAS, but not on the MGSx RASx of the VRAM group. Note that if more dian one memory group is used for VRAM then this protection will not be effective. See Figure 34. System Requirements Programming RAS Cycle Generation RAS cycles are primarily required to bring new row addresses onto AD for DRAM-type devices. They are also required, in certain instances, to ensure temporally deterministic execution of the IOP, or to ensure correct operation after certain events. The MIF handles diese cases automatically. RAS cycles can also be configured to occur in order to supply additional time for decoding I/O addresses, for example. Since RAS cycles generally take considerably longer dian CAS cycles, it is desirable to minimize their use. The various sources of RAS cycles are listed in Table 49. Table 49. Sources of RAS cycles When the current and previous addresses are compared to determine if a RAS cycle is required, die MIF uses die following rules: • The current DRAM RAS address bits are compared to tiiose from the most recent RAS cycle on the current memory group. If the bits are different, a RAS cycle occurs. • The middle address bits are not compared (see Figure 16). The middle address bits are: for DRAM, above the RAS address bits up to and including msgsm; for SRAM, from A22 up to and including msgsm. If msgsm is zero mere are no middle address bits in eidier case. If msgsm includes A31, A31 becomes part of the high address bits and is optionally compared. • The current high address bits are compared to tiiose from the most recent RAS cycle, depending on die configuration options discussed below. The location of the high address bits depends on msgsm. See Figure 32. Three high-address-bit configuration options are available to minimize the occurrence of RAS cycles caused by high-address-bit comparisons. • The high address bits are typically used for I/O device addresses, and dius when diey change, a RAS cycle might be required for their proper decoding by external hardware. The high address bits can be excluded from RAS-cycle determination by setting the memory system high-address-bit compare disable (mshacd). See Figure 28. • During bus transactions between four-byte-transfer devices and cell memory or between one-cell cell-transfer devices and byte memory, A31 is passed (taken from the global register, usually set) or cleared (by the MIF) to select or deselect the I/O device when required. Decoding A31 externally for this purpose can be done more quickly than a full address decode, so diis separate option is avadable. A31 can be included in or excluded from die high-address- bit compare (msexa31hac). See Figure 34. • In systems that require a RAS cycle to decode I/O device addresses but not to decode changes in A31 (mshacd clear and msexa31hac set), it might be necessary for the memory address bits and I/O addressing bits to overlap if the system contains a large amount of memory and I/O devices. This can prevent a RAS cycle from occurring because some of the overlapped address bits do not cause a RAS (middle address bits), or do not require a RAS (DRAM RAS address bits), or do not require a RAS (DRAM RAS address bits), even tiiough diey changed from die last system RAS cycle. In this case, a RAS can be forced to ensure that I/O device addresses will be decoded by setting A31 (msras31d clear). This option can also be useful any odier time forcing a RAS cycle is desirable. Driver Current The drive capability of all the package output drivers is programmable. See Figure 45. Memory Faults Virtual memory page-fault detection is enable dirough mflt_enable in mode. The memory fault input can either come from AD8 or MFLT, depending on die state of pkgmflt. See Figure 34. I/O-Channel Programming As previously discussed, die normal memory-group bus timing is changed during an I/O-channel bus transaction by substituting the values in the corresponding ioXebt for die values in mgXebt for die memory group involved. This allows each I/O channel to be programmed to meet die requirements of the device. The ioXebt values must be adequate for the I/O device, as well as any memory group with which a data transfer might occur. See Figure 38. In addition to timing, the type of transfer on each I/O channel can be specified in iodtta or iodttb. Transfer can eidier be one byte or four bytes per transaction for byte-wide devices, or one cell per transaction for cell-wide devices. Four-byte byte-transfer devices might need to contend for the bus less often dian one-byte byte-transfer devices, and dius can transfer data more efficiently. Also, widi cell-wide memory, four-byte byte transfers are cell-aligned and pack die data into the memory cells, whereas one-byte byte transfers place only one byte per memory cell. See Bus Operation, below. See Direct Memory Access Controller, above, for odier I/O-channel transfer options On-Chip Resource Registers The on-chip resource registers 102 (Figure 20) comprise portions of various functional units on die CPU 100 including die MPU 108, IOP 110, DMAC 112, INTC 114, MIF 120, bit inputs 116, and bit outputs 118. The registers are addressed from die MPU in dieir own address space using die instructions Ido [] and sto [] at die register level, or Ido.i [] and sto.i [] at die bit level (for tiiose registers diat have bit addresses). On odier processors, resources of diis type are often either memory-mapped or opcode-mapped. By using a separate address space remains uncluttered, and opcodes are preserved. Except as noted, all registers are readable and writable. Areas marked "Reserved Zeros" contain no programmable bits and always return to zero. Areas marked "Reserved" contain unused programmable bits. Both areas might contain functional programmable bits in the future. The first six registers are bit addressable in addition to being register addressable. This allows the MPU to modify individual bits without corrupting odier bits diat might be changed concurrently by die IOP, DMAC, or INTC logic. Bus activity should be prevented to avoid an invalid bus cycle when changing die value in any register that affects the bus configuration or timing of a bus cycle diat might be in progress. Bus activity can be prevented by ensuring: • no DMA requests will be serviced, • the IOP will not seize the bus (because iopdelay goes to zero), • no writes are posted, and • pre-fetch will not occur. This is typically not a problem because most changes are made just after power-up when no DMA or IOP activity of concern is occurring. Posted writes can be ensured complete by ensuring an MPU memory access (such as an instruction fetch) occurs after the write is posted. Bit Input Register ioin (Figure 21 contains sampled data from IN [7:0] or AD [7:0], depending on die value of pkgio. ioin is the source of inputs for all consumers of bit inputs. Bits are zero persistent: once a bit is zero in ioin it stays zero until consumed by the IOP, DMAC, or INTC, or written by die MPU widi a one. Under certain conditions bits become not zero-persistent. See Bit Inputs, above. The bits can be individually read, set and cleared to prevent race conditions between d e MPU and other CPU logic. Interrupt Pending Register ioip (Figure 22) contains interrupt requests diat are waiting to be serviced, Interrupts are serviced in order of priority (0 = highest, 7 = lowest). An interrupt request from an I/O channel transfer or from int occurs by the corresponding pending bit being set. Bits can be set or cleared to submit or wid draw interrupt requests. When an ioip bit and corresponding ioie bit are set, die corresponding ioin bit is not zero-persistent. See Interrupt Controller, above. The bits can be individually read, set and cleared to prevent race conditions between the MPU and INTC logic. Interrupt Under Service Register ioius (Figure 23) contains die current interrupt service request and tiiose that have been temporarily suspended to service a higher-priority request. When an ISR executable-code vector for an interrupt request is executed, the ioius bit for diat interrupt request is set and die corresponding ioip bit is cleared. When an ISR executes reti, the highest-priority interrupt under-service bit is cleared. The bits are used to prevent interrupts from interrupting higher-priority ISRs. When an ioius bit and corresponding ioie bit are set, the corresponding ioin bit is not zero-persistent. See Interrupt Controller, above. The bits can be individually read, set and cleared to prevent race conditions between die MPU and INTC logic. Bit Output Register ioout (Figure 24) contains the bits from MPU and IOP bit-output operations. Bits appear on OUT [7:0] immediately after writing and on AD [7:0] while RAS is inactive. See Bit Outputs, above. The bits can be individually read, set and cleared to prevent race conditions between the MPU and IOP. The Interrupt Enable Register ioie is shown in Figure 25. If die corresponding iodmae bit is not set, allows a corresponding zero bit ioin to request die corresponding zero bit in ioin to request die corresponding interrupt service. When an enabled interrupt request is recognized, die corresponding ioip bit is set and die corresponding ioin bit is no longer zero-persistent. See Interrupt Controller, above. The bits can be individually read, set and cleared. Bit addressability for this register is an artifact of its position in the address space, and does not imply any race conditions on this register can exist. Figure 26 shows the DMA Enable Register iodmae. It allows a corresponding zero bit in ioin to request a DMA I/O-channel transfer for die corresponding I/O channel. When an enabled DMA request is recognized, die corresponding zero bit in ioin is set. If die corresponding iodmaex bit is set, die iodmae bit will be cleared (to disable further DMA requests from that channel) when an I/O-channel transfer on that channel accesses the last location in a 1024- byte memory page. See Direct Memory Access Controller, above. When a iodmae bit is set die corresponding ioie bit is ignored. Figure 27 shows die VRAM Control Bit Register vram. These bits control the behavior of OE, LWE, the CASes, and DSF at CAS fall time. They can be used in any combination to activate d e various modes on VRAMs. The bits from vram move through a hidden register prior to controlling the memory strobes during a subsequent MPU memory cycle. The bits stored for msvgrp in die hidden register determine which memory group is die current VRAM memory group, whose strobes will be affected by die accompanying data in d e hidden register. The hidden register is locked once data has been transferred into it from vram until an MPU access to die VRAM memory group occurs, thus consuming the data in the hidden register. When a sto [] to vram occurs and d e hidden register is not currently locked, d e data from vram is transferred into die hidden register immediately if a posted write (to any memory group) is not waiting or in process, or at the end of d e posted write if a posted write is waiting or in process. When a sto [] to vram occurs and die hidden register is already locked, die data in vram is not transferred (and is replaceable) until after the next access to the VRAM memory group occurs. The next access to the VRAM memory group will use the data in the hidden register, and when die memory access is complete, die data in vram will be transferred to the hidden register. Only MPU memory accesses have an effect on vram or the hidden register. Immediately after transferring vram to the hidden register, dsfvras, casbvras, wevras, and oevras in vram are cleared. After the VRAM group access, additional CAS or RAS cycles can occur on the VRAM memory group without rewriting d e register, and will use die current (cleared) vram data. When writes to vram are paired widi one or more accesses to the VRAM memory group of the required RAS or CAS type, the internal operations described above will be transparent to die program. Note that RAS precharge must be at least three 2X- clock cycles in duration for proper VRAM operation. See Video RAM Support, above and below. msvgrp Specifies the memory group containing the VRAM that is controlled by diis register. IOP and MPU instructions should not be fetched from me memory group used for VRAM because die VRAM operations will likely occur on an instruction- fetch bus transaction rather than the intended VRAM transaction. dsfvcas Contains the state applied to DSF at the start of the next CAS-part of a memory cycle on die VRAM memory group. The bit is persistent and is not automatically cleared after being transferred to die hidden register. DSF is low when not accessing die VRAM memory group. dsfvras Contains the state applied to DSF two 2X-clock cycles after the RAS rises during the next RAS cycle on the VRAM memory group. DSF changes to die dsfvcas state at the expiration of die row-address hold time. The bit is automatically cleared after being transferred to die hidden register. casbvras If set, during die next RAS cycle on the VRAM memory group all CAS signals are active two 2X-clock cycles after RAS rises, and are inactive at die normal expiration time. OE, EWE and LWE go inactive at the expiration of die row-address hold time. The next access to the memory group msvgφ is forced by internal logic to be a RAS cycle. Note that since all read and write strobes are inactive throughout their normally active times during the bus cycle, no data I/O with memory can occur. The data associated widi die ST or LD used to cause die cycle is lost or undefined. The casbvras bit is automatically cleared after being transferred to die hidden register. wevras If set, LWE is low two 2X-clock cycles after RAS rises during die next RAS cycle on the VRAM memory group, and is high at the expiration of the row- address hold time. Otherwise, LWE is high until die expiration of the row- address hold time during die next RAS cycle on the VRAM memory group. In either case, during die CAS portion of the cycle LWE behaves normally and die data transferred is part of die function performed. The bit is automatically cleared after being transferred to die hidden register. oevras If set, UE is low two 2X-clock cycles after RAS rises during die next RAS cycle on the VRAM memory group, and is high at the expiration of die row- address hold time. Otherwise, OE is high until the expiration of die row-address hold time during the next RAS cycle on the VRAM memory group. In either case, during die CAS portion of die cycle ϋF behaves normally and die date transferred is part of the function performed. The bit is automatically cleared after being transferred to the hidden register. The Miscellaneous A Register misca is shown in Figure 28. mgXrd Allows (if clear) or prevents (if set) a refresh cycle from occurring on the corresponding memory group when refresh executes. Allowing refresh on some memory groups can be undesirable or inappropriate. For example, me primary side effect of refresh is that the current row address latched in the memory device is changed. This can be undesirable on VRAM devices when a RAS cycle sets persistent operational modes and addresses. Anotiier refresh side effect is that the next memory cycle to the memory group will need to be a RAS cycle to reselect the operational memory row. This is usually undesirable in SRAM because refresh is unneeded; the refresh and RAS cycles only slow execution, or make otherwise predictable timing unpredictable. msras31d If set, allows non-RAS cycles when A31 is a one. If clear, forces a RAS cycle on both one-bus-cycle transactions and die first cycle of four-bus-cycle byte transactions when A31 is a one. In large memory systems in which the I/O-device addressing bits overlap the group, bank, or DRAM RAS bits, this option forces a RAS cycle when one might not otherwise occur because these various bits either are excluded from the RAS comparison logic or could inadvertently match the I/O- device address bits. RAS cycles might be required by design to allow enough time for I/O decode and select. A31 is used in selecting I/O addresses. mshacd If clear, enables the comparison of die high address bits to those of the most recent RAS cycle to determine if a RAS cycle must occur. If set, disables diis comparison. These bits are typically used for I/O addresses diat require external decoding logic, which might need d e additional time available in a RAS cycle for this decoding. However, widi high-speed logic it is often possible to decode die I/O address in die time available within a CAS cycle, dius speeding I/O access. A31 can be excluded from the high address-bit compare by setting msexa31hac. msrtg Contains the number of the memory group whose RAS cycle timing is to be used for refresh cycles produced by refresh. The memory group specified must be the group widi die most- restrictive (slowest) refresh timing. The Miscellaneous B Register miscb is shown in Figure 29. mmb If clear, selects Single Memory Bank (SMB) mode for all memory groups. RASx signals appear on the corresponding package pins. Bank-select bits correspond widi the msgsm bits. Up to four memory banks (i.e., one memory bank per memory group) can be directly connected and accessed. See Figure 17. If set, selects Multiple Memory Bank (MMB) mode for all memory groups. MGSx signals appear on die corresponding package pins. Bank-select bits are located immediately above die DRAM RAS bits, or for SRAM in the mssbs location. Up to sixteen memory banks (i.e. , four banks per memory group) can be connected widi 1.25 two- input gates per bank. Widi additional inputs per gate and additional decoding, an arbitrarily large number of memory banks can easily be connected. See Figure 20. fdmap DMA requests contend for die bus; die highest-priority request gets die first chance at access. If iopdelay is large enough to allow bus access by die highest-priority request, die bus is granted to die device. If fdmap is set and iopdelay is too small for die highest-priority DMA request, the DMA request does not get the bus. Unless a higher-priority DMA request occurs that fits the shrinking available bus slot, no bus transactions occur until the IOP seizes the bus. When the IOP next executes delay, die highest- priority DMA request— or die MPU if tiiere are no DMA requests-repeats the bus request process. If fdmap is clear and iopdelay is too small for the highest-priority DMA request, die request does not get die bus. The next lower-priority bus request is then allowed to request the bus, with the MPU as the lowest-priority request. The process repeats until the bus is granted or the IOP seizes the bus. When the IOP next executes delay, d e highest-priority DMA request-or the MPU if there are no DMA requests—repeats the bus request process. pkgio If set, inputs to ioin are taken from IN " [7:0]. If clear inputs are taken from AD [7:0] when RAS is low and CAS is high. See Bit Inputs, above. oed If set, disables OE from going active during bus cycles. If clear, OE behaves normally. On CPU reset, the OE signal is disabled to prevent conventionally connected memory from responding; diis allows booting from a device in I/O space. See Processor Startup, below. mgXbw If clear, the corresponding memory group is cell-wide and is read and written 32-bits per bus cycle. If set, the corresponding memory group is byte- wide and is read and written in a single bus transaction of four bus cycles, one byte per cycle. The Memory Fault Address Register is shown in Figure 30. When a memory page-fault exception occurs during a memory read or write, mfltaddr contains the address diat caused die exception. The contents of mfltaddr and mfltdata are latched until die first read of mfltaddr after die fault. After reading mfltaddr, the data in mfltaddr and mfltdata are no longer valid. The Memory Fault Data Register is shown in Figure 31. When a memory page-fault exception occurs during a memory write, mfltdata contains the data to be stored at mfltaddr. The contents of mfltdata and mfltdata are latched until die first read of mfltaddr after d e fault. The Memory System Group-Select Mask Register is shown in Figure 32. It contains zero, one, or two adjacent bits diat locate die memory group-select bits between A16 and A31. When no bits are set, all memory accesses occur in memory group zero. The memory system high address bits occur in die address bits: for DRAM, above the memory group zero DRAM RAS address; for SRAM, above A21. When one bit is set, it will determine the address bit diat selects accesses between memory group zero and memory group one. The memory system high address bits occur in die address bits higher dian the bit selected, but always include A31. When two adjacent bits are set, diey are decoded to select one of four memory groups that will be accessed. The memory system high address bits occur in d e address bits higher dian d e bits selected, but always include A31. The Memory Group Device Size Register is shown in Figure 33. It contains 4-bit codes d at select die DRAM address bit configuration, or SRAM, for each memory group. The code determines which bits are used during RAS and CAS addressing and which bits are compared to determine if a RAS cycle is needed (due to d e DFRAM row-address changing). See Table 47 and Table 48. The Miscellaneous C Register is shown in Figure 36. pkgmflt If set, the memory-fault input is sampled from MFLT. If clear, die memory-fault input is sampled from AD8 when RAS falls. See Figure 70. mspwe If set, enables a one-level MPU posted-write buffer, hich allows the MPU to continue executing after a write to memory occurs. A posted write has precedence over subsequent MPU reads to maintain memory coherency. If clear, the MPU must wait for writes to complete before continuing. msexa31hac If set, A31 is not included in die high-address-bit compare. If clear, A31 is included in die high-address-bit compare. See mshacd for more information. The high address bits are typically used for I/O addresses, and require external decoding logic that might need die additional time available in a RAS cycle for decoding. Some bus transactions contain adjacent bus cycles whose high address bits will differ by only the state of A31, and could dius require a RAS cycle due solely to the change in this bit. However, some system designs can decode die A31 change in die time available in a CAS cycle, thus speeding I/O access. mssbs For multiple memory bank mode only, these bits contain the offset from A14 (A12 for a byte-mode group) to die two address bits used to select banks within any memory group containing SRAM devices. Typically set to place die bits immediately above die address bits of die SRAM devices used. The Memory Group 0-3 Extended Bus Timing Registers are shown in Figure 35. These values compensate for propagation, turn-on, turn-off, and odier delays in die memory system. They are specified separately for each memory group. When an I/O-channel bus transaction occurs, the I/O-channel extension, ioXebt, is substimted die corresponding value. The I/O-channel extensions must be sufficient for any memory group into which that I/O channel might transfer. mgebtsum Programmed to contain the sum of mgebtcase and mgebtdobe. This value is used only during the slot check to compute the total time required for die bus cycle. mgebtdobe Expands the CAS cycle at DOB fall by the specified time. This parameter is used to compensate for memory group buffer delays, device access time, and odier operational requirements. If the bus cycle is a memory read cycle, OE is expanded. If the bus cycle is a memory write cycle, EWE is expanded and LWE fall is delayed the specified time. mgebtcase Extends d e CAS cycle by die specified amount after die unextended CAS time. DOB, OE, EWE and LWE will rise unextended. This parameter is used to allows for data hold times or to allow for devices to disable dieir output drivers. When used in combination widi mgbtewe or mgbteoe, hold or disable times can be set in most increments of 4X-clock cycles. The Memory Group 0-3 CAS Bus Timing Registers are shown in Figure 36. They define die basic timing for CAS-only cycles and the CAS portion of RAS cycles. Timing is specified separately for each memory group. The values that refer to CAS apply to CAS, CASO, CAS1, CAS2 and CAS3, appropriately. The basic CAS cycle timing is augmented by mgXebt and ioXebt values. mgbtcas Specifies die CAS-cycle precharge time, the time from the start of the CAS-timed portion of the memory cycle until CAS goes low. mgbtdob Specifies the end of address time (column address hold) and die beginning of data time on he bus relative to die start of the CAS portion of the memory cycle. This is the time the CPU places write data on die bus or begins accepting read data from die bus. mgbtcast Specifies the total unexpanded and unextended time of a CAS cycle, DOB, OE, EWE and LWE will rise at this time unless modified by mgbteoe or mgbtewe. This, value is also used during die slot check to compute die total time required for the bus cycle. mgbtewea In a system with fast SRAM, EWE fall at cycle start is needed to have an adequate write enable. Odier devices require dieir addresses to be valid before write enable falls; in these cases CAS low is required. mgbtlwea Specifies a delay of zero or one 4X-clock cycle after DOB fall, plus expansion for LWE fall. Expansion refers to die value of mgebtdobe or ioebtdobe. as appropriate. Allows adjustment for system and device delays. For example, DRAM expects data valid at its write-enable fall. In small systems DOB plus one 4X-clock cycle (widi an expansion of zero) might be appropriate. In a large system with a heavily loaded (or buffered) LWE, DOB might be appropriate for die fastest memory cycle. If a larger delay is needed, an expansion value can be set. Allows resolution of one 4X-clock cycle in expansion timing. mgbteoe If set, OE rises one 4X-clock cycle before the end of die unextended CAS cycle. If clear, OE rises widi d e end of the unextended CAS cycle. One 4X- clock cycle is sufficient output-driver disable time for some devices; if not, output- driver disable time can be created in most increments of 4X-clock cycles by combining mgebtcase and mgbteoe. mgbtewe. If set, EWE and LWE rise one 4X-clock cycle before the end of the unextended CAS cycle. If clear, EWE and LWE rise with die end of die unextended CAS cycle. One 4X-clock cycle is sufficient hold time for some devices; if not, hold time can be created inmost increments of 4X-clock cycles by combining mgebtcase and mgbtewe. Figure 37. shows die Memory Group 0-3 RAS Bus Timing Registers. They define die timing for die RAS-prefix portion a of RAS memory cycle. Timing is specified separately for each memory group. The values are selected as needed for die memory devices used. Timing values that refer to RAS apply to RAS, RAS0, RAS1, RAS2 and RAS3, appropriately, mgbtrast Programmed to contain die sum of mgbtras and mghtrhld plus one. At d e end of diis time the CAS portion of the memory cycle begins. This value is used only during die slot check to compute die total time required for die bus cycle. mbgtras Specifies the RAS precharge time, me time RAS is high at the beginning of a RAS cycle. The time can be shortened widi mgbteras. mghtrhld Specifies the row-address hold time of a RAS cycle, immediately preceding the CAS timing portion of the cycle. The time can be lengthened with mgbteras. Immediately following this time the CAS address is placed on die bus, if appropriate. mgbteras If set, reduces die RAS precharge time (specified by mgbtras) and extends e row-address hold time (specified by mgbtrhld) by one 4X-clock cycle. Figure 38 shows the I/O Channel 0-7 Extended Bus Timing Registers. These values compensate for signal propagation, turn-on, turn-off, device, and odier delays in the memory and I/O systems. They are substimted for the memory group values, mgXebt, during I/O channel transfers and dius must be sufficient for the I/O device, as well as any memory group widi which the I/O device will transfer. ioebtsum Programmed to contain the sum of ioebtcase and ioebtdobe. This value is used only during die slot check to compute die total time required for the bus cycle. ioebtdobe Expands die CAS cycle at DOB fall by die specified time. This parameter is used to compensate for memory group buffer delays, device access time, and odier operational requirements. If the bus cycle is a memory read cycle, OE is expanded. IF die bus cycle a is memory write cycle, EWE is expanded and LWE fall if delayed die specified time. ioebtcase Extends the CAS cycle by the specified amount after the unextended CAS time. DOB, OE, EWE and LWE will rise unextended. This parameter is used to allow for data hold times or to allow for devices to disable dieir output drivers. When used in combination widi mgbtewe or mgbteoe, hold or disable times can be set in most increments of 4X-clock cycles. Figure 39 shows a Memory System Refresh Address. This contains the next address used for memory-system refresh. The values are placed on die specified pins when refresh executes, and msrra is incremented by one. Time timing for a refresh cycle is set by msrtg, and those memory groups at are refreshed are set by mgXrd. Figure 40 shows an IOP Delay Count Register. This contains the number of 2X-clock cycles until the IOP seizes the bus. The counter is decremented once each 2X-clock cycle. The counter can be used, for example, to determine if a time-critical task can be completed before the IOP seizes the bus, or to measure time in 2X-clock increments. Figure 41 shows an I/O Device Transfer Types A Register. Figure 42 shows an I/O Device Transfer Types B Register. These registers specify one of three transfer types for the device attached to the corresponding I/O channel. • Four-Byte Byte-Transfer Type: Transfers four bytes of data, one byte at a time, between the device and memory in a single bus transaction. The transaction consists of four bus cycles accessing the device, plus one additional busy cycle to access memory if the memory is cell- wide. All initial transfer addresses are to cell boundaries. • One-Byte Byte-Transfer Type: Transfers one byte of data between die device and memory in a single bus transaction. The transaction consists of a single bus cycle. Transfers to cell-wide memory are to byte zero of the addressed cell, with the remaining 24 bits undefined. Transfers to byte- wide memory are to die specified byte. • One-Cell Cell-Transfer Type: Transfers one cell of data between d e device and memory in a single bus transaction. The transaction consists of one bus cycle to access the device, plus four additional busy cycles to access memory if the memory is byte- wide. All initial transfers are to cell boundaries. Figure 43 shows Reserved Register Addresses. These addresses are reserved. Figure 44 shows a DMA Enable Expiration Register. This register clears the corresponding DMA enable bit in iodmae after a DMA I/O channel transfer is made to die last location in a 1024-byte memory page. This allows DMA on die corresponding I/O channel to be disable after transferring a predetermined number of bytes. See Direct Memory Access Controller, above. Figure 45 shows a Driver Current Register. This register allows programming the relative amount of current available to drive the various singles out of the package. The programmed driver current has several effects. • The amount of current selected determines the rise and fall times of the signals into a given load. The rise and fall times, PWB wire lengths, and PWB construction determine whedier d e signals will need to be treated as transmission lines, and whedier signal terminations are required. • Greater driver current increase di/dt, and dius increases package and system electrical noise. Though total power consumption does not change when driver current is changed (since the same load is charged, just slower or faster), tiiere is less noise produced when di/dt is decreased. Reducing output driver pre- driver current also reduces package and system electrical noise, and can d us facilitate approval of electromagnetic compliance for products. Programmable drivers allow the system designer to trade among system design complexity, system cost, and system performance. Output drivers consist of a pre-driver and an output driver. The current- supply capability of each part of die output driver can be programmed separately. The low bit of each filed selects full- or half-drive capability on die pre-drivers for that set of signals. The upper one or two bits select 1/3-, 2/3- or full-drive capability. The pre-drivers are supplied by the core logic power, and the noise generated by dieir operation can affect the performance of the CPU in systems with an inadequate power supply or decoupling. In such systems, lowering pre- driver current can possibly compensate for system design flaws. The drivers are on two separate power buses: one for AD and one for control signals and all odier output pins. As a result, inside die package, electrical noise caused by AD driver switching is prevented from corrupting the quality of the control signals. This separation, however, does not preclude noise coupling between die power pins outside die package. Depending on system loading, die output drivers account for 50% to 95% of die power consumed by die CPU, and dius are a potentially large noise source. Figure 46 shows an IOP Reset Register. Writing any value causes the IOP to begin executing at its software reset executable-code vector (location OxOOOOOOlO) at the end of d e current memory cycle. This is the mechanism used to clear bit 31 in die IOP PC after hardware reset, and to direct the IOP to execute a new procedure. The value of die register is -1 during die IOP reset process (i.e. , from die time iopreset is written until die IOP begins execution of the software reset executable-code vector); odierwise, its value is zero. Table 50 shows a Bit Field to On-Chip Register Cross Reference. Table 50. Bit Field to On-Chip Register Cross-Reference BUS OPERATION The MIF 120 handles requests from all sources for access to d e system bus. Requests arrive and are prioritized, respectively, from die IOP 110, DMAC 112 and MPU 108. This order ensures diat d e IOP always has predictable memory timing, that DMA has bus availability (because die MPU can saturate the bus), and that memory coherency is maintained for die MPU. Operation The MIF 120 must always grant me bus to the IOP 110 immediately when required in order to guarantee temporally deterministic IOP execution. To allow diis, die IOP has exclusive access to the bus except when it is executing delay. When a DMA or MPU bus request is made, die MIF determines the type of bus transaction, computes the estimated time required (see Table 51), and compares diis to iopdelay-die amount of time before the IOP seizes the bus. This available bus time is called die slot. If iopdelay is zero, die IOP currently has the bus. If iopdelay is larger dian die value computed for the bus transaction, die bus is granted to die requestor. Odierwise, die bus remains idle until a bus request occurs diat can be satisfied, or until die IOP seizes the bus. This slot check requires one 2X-clock cycle to complete. Once a bus request has passed die slot check, d e bus transaction begins on the next 2X-clock cycle. The slot check computation is an estimate because for I/O channel bus transactions ioXebt is used for all parts of the computation even though a mix of ioXebt and mgXebt times might be used during die transaction. The effect of this simplified computation is that the slot requested might be larger dian the bus time actually sued. The bus becomes immediately available for use when the ac al bus transaction completes. Within the MPU, bus requests arrive from and are prioritized, from highest to lowest: posted-write, instruction pre-fetch, local-register stack spill or refill, operand stack spill or refill. Id, st, and instruction fetch. The address lines out of the CPU are multiplexed to reduce package pin count and provide an easy interface to DRAM. DRAMs have their addresses split into two pieces: d e upper-address bits, or row address, and die lower-address bits, or column address. The two pieces of the address are clocked in the DRAM with two corresponding clock signals: RAS and CAS. AD [31:0] also output higher- order address bits than die DRAM now and column addresses during RAS and CAS times, as well as data input or ouφut during the last portion of each bus cycle while DOB is active. Bit outputs and bit inputs are also available on AD [7:0]. I/O Addressing All the address bits above the msgsm bits are referred to as die high address bits. These bits are typically used to address I/O devices widi external decoding hardware. They can be configured to be included in RAS-cycle determination, or excluded for faster I/O cycles, to match the requirements of the external decoding hardware. See System Requirements Programming, above, for the available configuration options. Bus Transaction Types The CPU supports both cell-wide and byte-wide memory, cell- wide and byte- wide devices, and single-or multi-bus-cycle transactions. Various combinations of diese are allowed; diey require one, four, or five bus cycles to complete the bus transaction, which can include zero, one, or two RAS cycles. The underlying structure of all bus cycles is the same. Depending on the programmed system configuration, device-memory combination, and current system state, RAS prefix and CAS parts of bus cycles are combined to provide correct address generation and memory device operation. Table 53 lists die various combinations of RAS and CAS cycles diat are possible widiin a given bus 140 transaction. MPU and IOP (non-xfer) Memory Cycles The MPU and die IOP can read and execute programs stored in cell-wide or byte-wide memory. The MPU can also read data from and write data to cell- wide and byte-wide memory. All accesses to cell-wide or byte-wise memory involve an entire cell. Accesses to cell-wide memory involve an entire cell. Accesses to cell- wide memory dius require one bus cycle, while accesses to byte- wide memory require four busy cycles. Cell Memory Write from MPU Cell Memory Read to MPU/IOP Table 53 and die referenced figures provide details regarding diese bus transactions. These transactions require on bus cycle. Byte Memory Write from MPU Byte Memory Rad to MPU/IOP Table 53 and die referenced figures provide details regarding diese bus transactions. These transactions require four bus cycles. Byte address bits Al and A0 are incremented from 0 to 3 to address die most-significant through the least- significant byte of die accessed cell. I/O-Channel Transfers Depending on the device transfer type and memory device widtii, a variety of bus cycle combinations occur between I/O devices and memory, as shown in Table 52. These starting address for the transaction comes from the global register that corresponds to die I/O channel involved (g8 corresponds to I/O channel 0, ... , gl5 corresponds to 1/0 channel 7). The direction of the transfer relative to memory is indicated by bit one of die same register. See Figure 12. The device transfer type for the transactions comes from the corresponding field in iodtta or iodttb. The bus transaction proceeds with die cycles and strobes listed in Table 55. Cell Memory Write from Four-byte Byte-transfer Device Table 53 and die referenced figure provide details regarding the bus transaction. The transaction requires five bus cycles. Data is collected from the device and stored in die MIF during die first four bus cycles, and is written to memory by die MIF during the fifth bus cycle. Data that is written to memory while being collected from die device during die first four bus cycles is replaced during die fifth bus cycle. A31 is cleared to deselect die I/O device in order to prevent contention widi die MIF during the fifth busy cycle. Byte address bits Al and AO are incremented from 0 to 3 to address die most-significant through die least-significant byte of die accessed cell while die data is being transferred from die device. Table 52. Cell Memory Read to Four-byte Byte Transfer Device Table 53 and the referenced figure provide details regarding the bus transaction. The transaction requires five bus cycles. Data is collected from memory and stored in die MIF during the first bus cycle and written to die device by die MIF during the last four bus cycles. OE is suppressed during the last four bus cycles to prevent bus contention between memory and die MIF while the device is written. A31 is cleared to deselect die I/O device in order to prevent contention widi memory during the first bus cycle. Byte address bits Al and AO are incremented from 0 to 3 to address die most-significant dirough the least- significant byte of the accessed cell while the data is being transferred to die device. Byte Memory Write from Four-byte Byte-transfer Device Table 53 and the referenced figure provide details regarding die bus transaction. The transaction requires four bus cycles. Byte address bits Al and AO are incremented from 0 to 3 to address die most-significant through the least- significant byte of the accessed cell on botii die device and memory. The data is transferred on the bus directly from the device to memory without die intervention of the MIF. Byte Memory Read to Four-byte Byte-transfer Device Table 53 and die referenced figure provide details regarding the bus transaction. The transaction requires four bus cycles. Byte address bits Al and AO are incremented from 0 to 3 to address the most-significant through the least- significant byte of d e accessed cell on both the device and memory, The data is transferred on the bus directly from memory to the device widiout the intervention of the MIF. Cell Memory Write from One-byte Byte-transfer Device Table 53 and the referenced figure provide details regarding die bus transaction. The transaction requires bus cycle. Data is typically supplied by die device on AD [7:O], and is written to the corresponding bits in memory. AD [31:8] are also written to memory, and, if not driven by an external device, will still hold d e address bits. Cell Memory Read to One-byte Byte-transfer Device Table 53 and die referenced figure provide details regarding die bus transaction. The transaction requires one bus cycle. Data is typically taken by the device from AD [7:0], which come from the corresponding bits in memory. The other memory bits are driven by memory, but are typically unused by die device. Byte Memory Write from One-byte Byte-transfer Device Table 53 and d e referenced figure provide details regarding die bus transaction. The transaction requires one bus cycle. Addresses in die global registers normally address cells because die lowest two bits are unavailable for addressing. However, for this transaction, die address in die global register is a modified byte address. That is, the address is shifted left two bits (pre-shifted in software) to be correctly positioned for the byte- wide memory connected to AD. The address is not shifted again before reaching AD.A31 remains in place, A30 and A29 become unavailable, and die group bits exist two bits to the right of their normal position due to die pre-shifting in the supplied address. This transaction allows bytes to be transferred, one byte per bus transaction, and packed into byte- wide memory. Byte Memory Read to One-byte Byte-transfer Device Table 53 and d e referenced figure provide details regarding the bus transaction. The transaction requires one bus cycle. Addresses in die global registers normally address cells because the lowest two bits are unavailable for addressing. However, for this transaction, the address in die global register is a modified byte address. That is, the address is shifted left two bits (pre-shifted in software) to be correctly positioned for the byte-wide connected to AD). The address is not shifted again before reaching AD. A31 remains in place, A30 and A29 become unavailable, and die groups bits exist two bits to the right of their normal position in die due to die pre-shifting in die supplied address. This transaction allows bytes to be transferred, one byte per bus transaction, and unpacked from byte- wide memory to a device. Cell Memory Write from One-cell Cell-transfer Device Table 53 and the referenced figure provide details regarding die bus transaction. The transaction requires one bus cycle. Cell Memory Read to One-cell Cell-transfer Device Table 53. and d e referenced figure provide details regarding die bus transaction. The transaction requires one bus cycle. Byte Memory Write from One-cell Cell-transfer Device Table 53 and die referenced figure provide details regarding die bus transaction. The transaction requires five bus cycles. Data is collected from the device and stored in die MIF during die first bus cycle and written to memory by the MIF during die last four bus cycles. Data that is written to memory while being collected from the device during the first bus cycle is replaced during die second cycle. A31 is cleared to deselect die I/O device in order to prevent contention with the MIF during die last four bus cycles. Byte address bits Al and A0 are incremented from 0 to 3 to address die most-significant through the least- significant byte of the accessed cell while die data is being transferred from me MIF to memory. Byte Memory Read to One-cell Cell-transfer Device Table 53 and the referenced figure provide details regarding the bus transaction. The transaction requires five bus cycles. Data is collected from memory and stored in die MIF during d e first four bus cycles and written to die device by die MIF during d e last bus cycle. OE is suppressed during die fifth bus cycle to prevent a bus contention between the memory and MIF while die device is written. A31 is cleared to deselect die I/O device in order to prevent contention with memory during d e first four bus cycles. Byte address bits Al and AO are incremented from 0 to 3 to address die most-significant dirough die least- significant byte of the accessed cell while the data is being transferred from die memory to the MIF. Bus Reset External hardware reset initializes the entire CPU to the power-on configuration, except for power fail in mode. While the reset is active (external or power-on self-reset), the AD go to a high-impedance state, OUT [7:0] go high, RASes go active, and all other ouφuts go inactive. See Figure 66 for waveforms. Video RAM Support VRAMs increase the speed of graphics operations primarily by greatly reducing die system memory bandwiddi required to display pixels on die video display. A VRAM command is used to transfer an entire row of data from the DRAM array to an internal serial access memory to be clocked out to die video display. VRAMs also support odier commands to enhance graphics operations. The VRAM operations are encoded by writing vram and performing an appropriate read or write to the desired VRAM memory address. Basic timing for VRAM bus cycles is die same as any similar bus transaction in diat memory group. See Figure 27. Refresh and RAS cycles might also affect VRAM operations. See Video RAM Support, above. Waveforms representing the effects of the various vram options are in Figure 72. Virtual-Memory Page Faults Input The MIF detects memory page faults that are caused by MPU memory accesses by integrating fault detection widi RAS cycles. The mapped page size is dius the size of the CAS page. The memory system RAS page address is mapped from a logical page address to a physical page address during RAS precharge dirough die use of an external SRAM. A memory fault signal supplied from the SRAM is sampled during RAS fall and, if low, indicates diat a memory page fault has occurred. See Figure 46a. The memory fault signal is input from MFLT or AD8. See Alternate Memory Fault Input, below. When a memory fault is detected, the bus transaction completes without any of the signals that would nor-really go active during die C Λ S part of the bus cycle. A memory fault exception is then signaled to the MPU, which will execute a trap to service the fault condition. See Figure 70, for waveforms. Alternate Inputs and Ouφuts The bit inputs * bit ouφuts, memory fault input, and reset input can be multiplexed on AD rather dian using the dedicated pins. This feature can be used to reduce die number of tracks routed on die PWB (to reduce PWB size and cost), and can allow die ShBoom CPU to be supplied in smaller packages. See Figure 74 for waveforms. Alternative Bit Inputs The bit inputs can be sampled eidier from IN [7:0] or from AD [7:0] while RAS is low and CAS is high. The source is determined by pkgio. See Figure 29 and Bit Inputs, above. Alternative Bit Ouφuts The bit ouφuts appear both on OUT [7:0] and on AD [7:0] while RAS is high. Since they appear in botii places, no selection bit is required. See Bit Ouφuts, above. Alternative Memory Fault Input The memory fault signal can be sampled eidier from MFLT or from AD8 during RAS fall. The source is determined by pkgmflt. See Figure 34. Alternative Reset Input External hardware reset can be taken either from RESET or from AD8; the determination is made at power-on. The power-on and reset sequence is described in detail in Processor Startup, below. PROCESSOR STARTUP Power-on Reset The CPU self-resets on power-up (see Reset Process, below). The CPU contains an internal circuit that holds internal reset active and keeps die processor from running, regardless of the state of the external hardware reset, until die supply voltage reaches approximately 3 V. Once the supply reaches 3 V, RESET is sampled and, if active, is used as die source of external reset for the CPU. Odierwise, external reset is multiplexed on AD8. This determination applies until power is cycled again. If one of the resets is active, the CPU waits until that reset goes inactive before continuing. If neither reset source is active, the processor immediately begins the reset sequence. The clock input at CLK, therefore, must be stable before that time. If the system is capable of running as the power supply rises from 3 V to normal supply voltage, and die system does not require an external reset, then RESET need not be connected and AD8 need not be driven as a reset source. Otherwise, external reset must be held low long enough for die clock, power, and odier system components to power up properly before reset rises to logic high and allows the CPU to run. During the power-on-reset process, the mode bit power fail is set to indicate that the power had previously failed. The bit is cleared by any write to 15001 147 mode. Boot Memory The CPU supports booting from byte-wide memory mat is configured as eidier an OE-activated or boot-only memory device. The boot-only memory configuration is primarily used to keep die typically slow boot EPROMs out of the heavily used low-address memory pages. Boot-only memory is distinct from OE-activated memory in mat it is wired into die system to place data on die bus widiout die use of OE or memory bank- or group-specific (RAS x or CASx) signals. OED is initially set during a CPU reset to disable OE during die boot-up process to allow die described operation. The boot-only memory select signal is externally decoded from the uppermost address bits that contain Ox8OO .... The number of uppermost address bits used depends on the system's I/O device address decoding requirements. The lowest address bits are connected so as to address individual bytes and cells as diey are for a normal memory. Thus the boot-only memory device will be selected regardless of which memory group is accessed. Reset Process When reset occurs, die CPU leaves on-chip RAM uninitialized and clears most registers to zero, except for strategically placed bits diat assist in the reset sequence. Specifically, the CPU resets to the most conservative system configuration. See Table 54. The mode bit power fail is set only by the power-on- reset process and can be checked to determine whether die reset was caused by a power failure or reset going active. The first bus transaction after reset is a cell read of four bytes from byte- wide memory in memory group zero, memory bank zero, starting from addresses 0x80000000, with OE disabled, in SMB mode. This address consists of I/O device address 0x800... and memory device address 0x...N. Because OE is disabled, OE~- activated memory will not respond, dius allowing a boot-only memory to respond. The CPU tests the byte returned from address 0x80000000. If the byte is Oxa5 then a boot-only memory responded and execution continues wid OE disabled. Odierwise, a boot-only memory did not respond, and die CPU assumes booting will occur from OE-activated memory. The CPU en clears OED to activate OE for diis memory to respond on subsequent bus cycles. Bootstrap Programs With eidier boot-only or OE-activated memory, bus accesses continue in SMB mode from die byte-wide memory device. The second bus transaction is to the hardware reset address for die IOP at 0x80000004. This typically contains a jump to a small refresh delay loop. The delay makes die bus available and allows the MPU to begin executing at its reset address, 0x80000008. If the system is wired in MMB mode, booting is simpler from a boot-only memory. Booting from OE-activated memory is also possible, but requires external gating to prevent bank zero of memory groups one, two, and tiiree from being selected when memory group zero is accessed. Next, die MPU begins executing and typically is programmed to branch to the system bootstrap routine. The MPU bootstrap is programmed to: • set the configuration registers needed for the system hardware, • set d e software reset vector for the IOP, • copy die initial MPU and IOP application programs from the boot device into memory (if needed), • branch to the application program for the MPU, and • reset die IOP in software to begin IOP program execution. System startup is now complete. The following pages describe several startup configurations. For actual code see Example ShBoom CPU System, below. The configurations described below are: • Boot from byte-wide boot-only memory and copy the application program to cell-wide R/W memory. • Boot from cell-wide boot-only memory and copy d e application program to cell- wide R/VV memory. • Boot and run from byte- wide memory. • Boot and run from cell-wide memory. Boot from Byte-Wide Boot-Only Memory and Copy die Application Code to Cell- Wide RA/V Memory This process requires external decoding hardware to cause the boot-only memory to activate as previously described. To indicate that boot-only memory is present, the memory must have 0xa5 at location zero. This signature byte must be detected at startup to continue the boot process from a boot-only memory. Construct the boot program execution sequence to be as follows: 1. The IOP executes JUMP from is power-on-reset location to code diat performs eight RAS cycles on each memory group (by performing refresh cycles) to initial¬ ize system DRAM. It then enters a micro-loop that includes refresh for DRAM, and delay to allow the MPU to execute. The micro-loop repeats refresh and delay, and eliminates the need for the IOP to access the bus for further instructions during configuration delay allows the MPU bus access to begin configuring the system before more refresh cycles are required. The refresh cycles are not required if the system does not contain DRAM. 2. The MPU executes br from its reset location to the program code to configure the system. The br should contain bits that address memory group three. This will later allow the configuration for memory group tiiree to be used for boot-only device access timing while memory groups zero, one and two are programmed for the system timing requirements. Although memory group one or two could be used instead of three in the manner described herein, only memory group tiiree will be discussed for simplicity. The MPU configuration program code should be arranged to hold off instruction pre-fetch so that the configurations of the current memory group and die global memory system are not changed during a bus cycle. 3. When programming miscb, set mmb if required. In systems wired for MMB mode diis allows RAS-type cycles to occur properly on all memory groups. 4. Set msgsm to define four memory groups, even if the system will ultimately not have them. During the next instruction fetch the boot-only memory will again be selected. However, the address bits for memory group three placed in die PC by br in step two will cause die configuration for memory group three to be used. 5. Program the timing of memory group three to optimize access to the boot-only memory. Then program the remainder of die system configuration. During diis Process d e IOP will typically perform three or so sets of refresh cycles. Though it is possible for the MPU to be changing pertinent configuration registers during a refresh cycle, it is very unlikely due to die long bus cycle times of EPROMs typically used for boot-only memory. Further, die worst result would be inappropriate timing on a single refresh cycle, which is of little acmal consequence since there is no data yet in DRAM to be protected. If memory group tiiree is used by die application, it will need to be configured later from the loaded application code. 6. Read die final boot code (if any) and the application program from the boot- only memory and write them to the appropriate locations in RAN memory. The entire application program can be loaded into R W RAM, except for that part, if any, that is destined for memory group tiiree, where the boot-only memory is running. This will need to be copied by the application once it is running. 7. Layout a single instruction group that contains programming to clear O£O and to branch to the application program. Using br [ ] clears A31 so that the boot-only memory will not activate at the branch destination. 8. Now the application program is executing. Configure memory group three, if needed. If loading memory group three from the boot-only memory is necessary, then arrange the code between two instruction groups to first ensure pre-fetch is complete, then set OED, then execute a micro-loop to transfer the application to memory group three, and reenable OED when the micro-loop completes. 9. Reset the IOP in software to begin execution of its application program. A software reset of the IOP causes it to begin executing at OxlO, and as a result clears A31 from the IOP PC so the boot-only memory will no longer be selected. The boot process is complete. Boot from Cell- Wide Boot-Only Memory and Copy die Application Program to Cell-Wide R/W Memory This process requires external decoding hardware to cause die boot-only memory to activate as previously described. The CPU always initially boots from byte-wide memory since diis is die reset configuration. The CPU will execute instructions from the low byte of each address until die configuration for the current memory group is programmed to be cell wide. Up to this point, the upper 24 bits of die boot-device data will be unused. The boot process is otherwise the same as booting from byte- wide boot- only memory, except diat at step 3, when writing miscb, also set memory groups zero and tiiree to be cell- wide. In die instruction group with the sto to mcb place a br to the next instruction group. This will hold off pre-fetch so that die next instruction fetch will be cell-wide. Note that the boot-only memory must be carefully programmed so that the instructions before the br are represented as byte-wide and after die br are represented as cell-wide. Boot and Run from Byte-Wide Memory This process requires the boot/run memory device to be activated by MGSO/RASO/CASO. A31 is not used when selecting die boot/ run memory. To indicate that OE-activated memory is present, the memory must not respond with Oxa5 at location zero when OE is not asserted. The lack of this signature byte is detected at startup to indicate diat UE is required to continue the boot process. OED is set during a CPU reset to disable OED during die boot-up process, and cleared when die signature byte Oxa5 is not detected, re-enabling OE. Construct the boot program execution sequence to be as follows: 1. The IOP executes JUMP from its power-on-reset location to code diat perform eight RAS cycles on each memory group (by performing refresh cycles) to initial¬ ize system DRAM. It the enters a micro-loops that includes refresh for DRAM, and delay to allow die MPU to execute. The micro-loop repeats refresh and delay, and eliminates the need for the IOP to access the bus for further instructions during configuration delay allows die MPU bus access to begin configuring the system before more refresh cycles are required. The refresh cycles are not required if die system does not contain DRAM. 2. The MPU executes br from its reset location to the program code to configure the system. The MPU configuration program code should be arranged to hold off instruction pre-fetch so that the configurations of die current memory group and die global memory system are not changed during a bus cycle. 3. When programming miscb, set mmb if required. In systems wired for MMB mode diis allows RAS-type cycles to occur properly on all memory groups. 4. Program the timing of memory group zero to optimize access to the memory. Then program the remainder of the system configuration. During this process the IOP will typically perform three or so sets of refresh cycles. Though it is possible for the MPU to be changing pertinent configuration registers during a refresh cycle, it is very unlikely due to the long bus cycle times of EPROMs. Further, the worst result would be inappropriate timing on a single refresh cycle, which is of little acmal consequence since there is no data yet in DRAM to be protected. 5. Reset the IOP in software to begin execution of its application program. A software reset of the IOP causes it to begin executing at 0x10, and as a result clears A31 from die IOP PC so die boot-only memory will no longer be selected. 6. Begin execution of the application program. The boot process is complete. Boot and Run from Cell-Wide/Memory This process requires the boot/run memory device to be activated by MGSO/RASO/CASO. A31 is not used when selecting die boot/run memory. The CPU always initially boots from byte-wide memory since mis is the reset configuration. The CPU will execute instructions from the low byte of each address until the configuration for the current memory group is programmed to be cell wide. Up to d is point, the upper 24 bits of the boot-device data will be unused. The boot process is otherwise die same as booting and running from byte- wide memory, except that at step 3, when writing miscb, also set memory group zero to be cell- wide. In die instruction group with die sto to miscb place a br to die next instruction group. This will hold off pre-fetch so diat die next instruction fetch will be cell-wide. Note diat the boot-only memory must be carefully programmed so d at die instructions before the br are represented as byte-wide and after the br are represented as cell- wide. Stack Initialization After CPU reset both of the MPU stacks should be considered uninitialized until die corresponding stack pointers are loaded, and this should be one of die first operations performed by die MPU. After a reset, die operand stack is abnormally empty. That is, s2 has not been allocated, and will be allocated on die first push operation. However, popping this item will cause the stack to be empty and require a refill. The first pushed item should dierefore be left on the stack, or sa should be initialized, before the operand stack is used further. Tht CPU rwtc Stacks 11 AU tmem_pα. nps. faults. DMAs, and DMA upm-ons dtsaMcd. VRAM memory group set to memory grα_p three, no VRAM option set. VRAM memory group included « high addrcu bit compare cawed RAS cycles. Refresh amMod oα aϋ poups wa memory group aero tuning, refresh addreu be stamng at xero Cauu RAS cyde whcα A3) - I. Cause RAS cycle when high addreu bra cheer. A31 included m high add. Mi-b« compere. S gle memory beak per memory group (SMB) n I ADβ. All memory group* an byta- ide. All memory device sues set to SRAM Memory bue cycles set far maximum length, actual CAS cvric length to 51 2X-c.ocl- cyc s with CAS precftange of sight 4X-ciock cycle f ueteum icg-ii set 10 maximum, which requests a she larger than actually needed). CAS addreu hold time of eight 4X-dαck cycles, fall at (ail, memory «tnc data senφ time to fall of 15 2X- dock cycles, memory wroe _Ha ιetι_p itmc to and πse of 39 2X -dock cvcks. o? active time of 39 2X-dock cycles, dan hoM iiαw/bufler disable time m tow 2X-ctock cycles. RAS pracMrge of 16 2Λ-ck k cycles. RAS sddrcss hold time of 2X-clock cycks. All I/O-channel umings set for rmutimum length .the same bus cycles as memory above) Revotvtng DMA pnαπsiα. Device n hr typss all set » few-byte byte-tramfer devicei EXAMPLE ShBoom CPU SYSTEMS Example System 1 Figure 68 depicts a minimal system with an 8-bit wide EPROM in memory group zero, and 256K of 8-bit-wide DRAM in memory group one. Memory group zero and memory group one should be configured with timing appropriate for the devices used, and mglds set to 0x02 appropriate for the devices used, and mglds set to 0x02 (256K DRAM). Otherwise, the default system configuration is suitable. The system can boot and run directly from die EPROM, or, since EPROMs are generally slower than DRAM, can copy the EPROM into DRAM for faster code execution. Example System 2 Figure 69 depicts a minimal system with 32-bit-wide DRAM in memory group zero, an 8-bit-wide-EPROM as a boot-only memory device, and an I/O address decoder. The I/O address decoding is performed by a 74HC137, a 3-to-8 decoder widi latch. The decoder is wired to supply four device selects when A31 is set, and anodier four when A31 is clear. The sets of four selects are latched during RAS precharge and enabled during CAS active. They are decoded from A30 and A29 when a 32-bit-wide memory group is involved and from A28 and A27 when an 8-bit-wide memory group is involved. The device select widi A31 set and d e odier decoded address bits clear is used to select die EPROM as a boot-only memory device. The EPROM must be programmed with 0xa5 at location zero. Memory group zero should be configured widi timing appropriate for the devices used, mgObw set to zero (cell wide), and mgOds set to 0x02 (256K DRAM). Since RAS is used to latch die I/O address, msras31d, mshacd and msexa31hac must remain in dieir default configuration of clear. Example System 3 Figure 70 depicts a system with 32 KB of 32-bit-wide SRAM in memory group zero, 1 MB of 32-bit-wide DRAM in memory group one, an 8-bit-wide EPROM as a boot-only memory device, and an I/O address decoder. Address 5001 159 latching of the CAS address for d e SRAM is performed by two 74ACT841 transparent latches. The address inputs of the DRAM and EPROM are also connected to the outputs of the latches, though diey could have been connected to the corresponding AD instead. The I/O address decoding is performed by a 74FCT138A, a 3-to-i decoder, using die latched CAS address bits. The decoder is wired to supply eight device selects when A31 is set. The selects are enabled during CAδ active. They are decoded from A30 and A29 when the DRAM memory group is involved and from A20 and A21 when d e SRAM memory group is involved. Since die EPROM is 8-bit-wide, die selects are decoded address bits clear is used to select die EPROM as a boot-only memory device. The EPROM must be programmed with 0xa5 at location zero. The memory groups should be configured with timing appropriate for the devices used, mgObw and mglbw set to zero (cell wide), mgOds set to OxOf (SRAM), and mglds set to 0x02 (256K DRAM). Since RAS is not used to latch die I/O address, msras31d, mshacd and msexa31hac can be set to reduce he number of RAS cycles involved in I/O. ELECTRICAL CHARACTERISTICS Power and Grounding The ShBoom CPU is implemented in CMOS for low average power requirements. However, the high clock-frequency capability of the CPU can require large switching currents of as much as eleven amperes, depending on the output loading. Thus, all V.. and V ss should be connected to planes within the PWB (printed wire board) for adequate power distribution. The switching current required by cV.. and cV ss is characterized by the internal clock and output driver pre-drivers. The internal clock requires approximately 500 mA with significant 5-GHz frequency components every clock transition. The output driver pre-drivers require as much as 3 A widi significant 1-GHz frequency components every output transition. Package diagrams indicate which of cV cc and cV S5 are closest to the internal clock drivers. The switching current required by ctrV.. and ctrlV 5S is characterized by the supplied output drivers and externally attached loads. Assuming a worst-case average load of 100 pF and 16 pins switching at once, these drivers would require 2.67 A widi significant 300-MHz frequency components every output transition. Switching-current requirements reduce substantially linearly with a reduction in external loading. The switching power required by adV.. and adV ss is characterized by the supplied output drivers and externally attached loads. Assuming a worst-case average load of 100 pF and 32 pins switching at once, diese drivers would require 5.33 A widi significant 300-MHz frequency components every output transition. Switching-current requirements reduce substantially linearly with a reduction in external loading. Power Decoupling Due to d e switching characteristics discussed above, power decoupling at die CPU is typically required. Surface-mount capacitors widi low ESR are preferred. Generally, smaller-sized and smaller- valued capacitors have better frequency characteristics (i.e. , lower series inductance, resulting in higher self- resonance frequency) than larger-sized and larger- valued capacitors, making it preferable to use an assortment of smaller to larger capacitor values. The smallest-valued capacitors and die local charge in teh PWB power planes (typically about 100 pF/in 2 ) will supply the current requirements of the initial highest- frequency components of the switching signals, while the larger capacitors will supply die lower-frequency components. Appropriate decoupling also reduces EMC problems. The charge supply required by die decoupling capacitors can be calculated from die relation C = I/(fΔV), where I is the current required, f is die frequency, and ΔV is die allowed voltage drop, typically . I V. Thus, cV cc and cV S5 require 1000 pF for die internal clock and .03 μF for the output driver pre-drivers, while ctrlV.- and ctrlV ss together widi adV cc and adV ss require .24 μ¥. These requirements can generally be met with: • four 100 pF NPO capacitors, or equivalent capacitance in smaller capacitors, mounted, one each, as close to each of the sets cV cc and cV ss as possible, on the same side of die PWB as d e ShBoom CPU package, if appropriate; • four 4700 pF X7R capacitors, mounted as above, on die opposite side of die PWB from die ShBoom CPU package, if appropriate; • four 4700 pF X7R capacitors, mounted as above, on die opposite side of the PWB from the ShBoom CPU package; and, • six .047 μF X7R capacitors, distributed amound ctrlV cc and ctrlV ss , and among adV.. and adV ss , as close to diose pins as practical. Note that the above represent essentially worst-case requirements. If die average output driver loading is 50 pF radier dian 100 pF, die six .047 μF X7R capacitors could be reduced to three or four; other engineering trade-offs can also be made. Note d at mounting capacitors on teh same PWB surface as die ShBoom CPU package can allow connecting traces of about 25 mils in length, while mounting capacitors on me opposite PWB surface requires U * aces of over 100 mils in length. At die switching frequencies listed, die difference in trace lengdis creates significant differences in decoupling effectiveness. The package and capacitor power and ground connections should be fabricated wid VIP (via-in- pad), if possible, for the same reasons. Connection Recommendations All output drivers are designated to directly drive die heavy capacitive loads of memory systems, thus minimizing the external components and propagation delays associated widi buffering logic. However, with increased loading comes increased power dissipation, and trade-offs must be made to ensure that die ShBoom CPU operating temperature does not exceed operating limitations. Systems with heavy CPU bus loads might require heat sinks or forced air ventilation. Note that reducing output driver current does not reduce total power dissipation because power consumption is dependent on output loading and not on signal transition edge rates. To reduce system cost, all inputs have internal circuitry to provide a stable input voltage if the input is unused. Thus, unused inputs do not need pull-ups. RESET contains an approximately 10K ohm pull-up to cV cc , and is a CMOS Schmitt-trigger. MFLT contains an approximately 20K ohm pull-up to cV__. ΪN[7:00] each contain a TBD K ohn pull-up to cV cc . AD each have repeaters with an impedance of approximately 5K ohms to cV cc and cV ss . These will maintain the last bus state when die pin is odierwise undriven. Clock The ShBoom CPU requires an external CMOS oscillator at one-half the processor frequency. The oscillator is doubled internally (2X-clock cycle) to operate the MPU and the IOP, and doubled again to provide fine-granularity programmable bus timing (4X-clock cycle). Inexpensive oscillators typically have guaranteed duty cycles of only 60/40. The narrower half of the clock cycle would normally represent at clock period at which die CPU appears to be operating. A 100-MHz CPU would dius be limited widi a 60/40 oscillator to 80 MHz (40 MHz externally), because widi an 80 MHz 2X-clock the 40% clock period would be 10 ns. To obtain 100-MHz speed, a much more-expensive oscillator would be needed. To reduce system cost and increase system performance, the CPU intenally uses a phase-locked loop circuit to stabilize the oscillator input an lock in a 50/50 duty cycle. The 2X-clock frequency selected should depend on application and system hardware requirements. A clock frequency might be selected for the IOP t produce appropriate application timing, or for the MIF to optimize bus timing. For instance, if the system requires a 35 ns bus cycle, it might be more efficient to operate at 84 MHz with a three 2X-clock cycle long bus cycle (35.7 ns) than to operate at 100 MHz with a four 2X-clock cycle long bus cycle (40 ns). No. Characteristic Min Max Unit Notes Notes: 1. AD have I OK ohm bus repeaters thai hold the last bus state when not driven by the CPU or an external device. 2. Does not apply to byte-wide data transfers. See note 1. 3. Minimum applies when time 5 is minimum. 4. Times apply to bus cycles involving the CPU. 5. mgbtcase is encoded. Use decoded value of 0, 1 , 2 or 4 for calculation. Table 62. Refresh Timing Table 63. VRAM Training Table 64. DMA Request Timing. Table 65. VO on Bus Timing Table 67. Bit input from Bus Sample Timing. Table 69. PBGA Package Thermal Characteristics RECEIVED BLANK BY RO/US See boot code in Appendix C. To the extent not already incorporated herein, further details on this embodiment of the invention are available in the publication "ShBoom™ Microprocessor", Poway CA 92064, 1995, Patriot Scientific Corporation. All publications and patent applications mentioned in this specification are herein incorporated by reference to the same extent as if each individual publication or patent application was specifically and individually indicated to be incorporated by reference. The invention now being fully described, it will be apparent to one of ordinary skill in the art that many changes and modifications can be made thereto without departing from the spirit or scope of the appended claims.

Claims: WHAT IS CLAIMED IS: 1. A microprocessor system, comprising a microprocessing unit, an input-output processor (IOP), a global memory unit coupled to said central processing unit and to said IOP, and means for arbitrating access of said central processing unit and said IOP to said global memory unit. 2. The microprocessor system of claim 1 in which said global memory unit comprises a plurality of global registers. 3. The microprocessor system of claim 1 wherein said central processing unit includes an arithmetic logic unit and a push-down stack coupled to said arithmetic logic unit. 4. The microprocessor system of claim 1 further including a memory interface unit coupled to said global memory unit, to said microprocessing unit, and to said IOP. 5. The microprocessor system of claim 4 further including a means for arbitrating access of said memory interface unit and said microprocessing unit to said global memory unit. 6. The microprocessor system of claim 5 additionally comprising a system memory and at least one input-output device coupled to said memory interface unit and wherein each storage location in said global memory unit holds a single address comprised of a first grouping of address bits coupled to address said system memory and a second grouping of address bits coupled to address said at least one input-output device. 7. The microprocessor system of claim 5 additionally comprising a system memory, at least one input-output device and a system bus coupled to said memory interface unit, said system bus having a first grouping of address lines coupled to address said system memory and a second grouping of address lines coupled to address said at least one input-output device. 8. A microprocessor system, comprising a microprocessing unit, an input-output processor (IOP), a memory interface unit through which said central processing unit and said IOP are selectively coupled to a system bus, and means for granting said IOP access to said system bus at predetermined intervals. 9. The microprocessor system of claim 8 wherein said memory interface unit includes means for defining available time slots during which said system bus may be accessed, said available time slots being defined as being between accesses to said system bus by said IOP at said predetermined intervals. 10. The microprocessor system of claim 8 wherein said memory interface unit includes means for computing a bus access time required for one or more bus cycles involving said system bus, and for allocating one of said available time slots equal to or longer than said access time for execution of said one or more bus cycles. 11. The microprocessor system of claim 10 wherein said one or more bus cycles are memory cycles. 12. The microprocessor system of claim 11 in which the computation of said means for computing modifies the bus access time to provide sufficient time for input-output cycles. 13. In a microprocessor system having a microprocessing unit in which is included an arithmetic logic unit coupled to a stack cache, the improvement comprising: means, coupled to said arithmetic logic unit and to said stack cache, for determining the availability of stack cache resources by determining whether a value is included in at least one cell of said stack cache and whether at least one other cell of stack cache is empty; and means, coupled to said means for determining the availability of said stack cache resources, for selectively inhibiting instruction execution by said arithmetic logic unit based on said availability of said stack cache resources. 14. The microprocessor system of claim 13 wherein said arithmetic logic unit includes means for executing instructions which generally push and pop only individual cells of said stack cache, said availability of stack cache resources being determined prior to initiating execution of each of said instructions. 15. In a microprocessor system having a microprocessing unit in which is included an arithmetic logic unit coupled to a stack cache, said stack cache being allocated at least a first portion of system memory, the improvement comprising: means, coupled to said microprocessing unit and to said stack cache, for executing a stack management trap when a stack pointer of said stack cache assumes an address within a boundary region of said first portion of said system memory, said first stack management trap determining availability of at least one other portion of said system memory; and means, coupled to said means for executing the stack management trap, for preventing another execution of said stack management trap until after said stack pointer has assumed an address within a predefined region of said first portion of said system not included within said boundary region. 16. A microprocessor system, comprising a microprocessing unit and a memory interface unit coupling said microprocessing unit to system random access memory (RAM), said microprocessor system including means, coupled to said memory interface unit, for converting logical row addresses provided by said microprocessing unit to physical row addresses of said system RAM so as to define virtual system memory using said system RAM. 17. The microprocessor system of claim 16 further including means, coupled to said memory interface unit, for accessing said system RAM wherein each row address strobe (RAS) cycle includes a RAS precharge interval, said logical row addresses being converted to said physical addresses of said system RAM during said RAS precharge intervals. 18. A microprocessor system, comprising a register unit, said register unit comprising at least one storage location containing a value to be interpreted as a memory address; a memory interface unit coupled to said register unit; a memory bus coupled to said memory interface unit; and a system memory coupled to said memory interface unit by said memory bus; said memory interface unit comprising transfer logic to increment said memory address and to generate a boundary detected signal when, after a memory bus transaction to said system memory using said memory address, said memory address after incrementing has a value that is an even multiple of 2 n , where n is a nonnegative integer. 19. The microprocessor system of claim 18 further comprising a microprocessing unit coupled to said memory interface unit and including means to interrupt said microprocessing unit after said boundary detected signal is generated by said memory interface unit. 20. The microprocessor system of claim 18 further comprising means coupled to said memory interface unit for generating a transfer request signal as an input to said memory interface unit for requesting said memory bus transaction to occur. 21. The microprocessor system of claim 20 further comprising an input-output processor (IOP) coupled to said memory interface unit, and said means for generating the transfer request signal is a means to execute instructions, one of said instructions activating said transfer request signal. 22. The microprocessor system of claim 18 wherein said incrementing of said memory address and the resulting said boundary detected signal is used to count an event. 23. The microprocessor system of claim 18 additionally comprising means coupled to said memory interface unit to disable said transfer logic to prevent further transfers after said boundary detected signal is generated. 24. The microprocessor system of claim 18 further comprising an input-output device coupled to said memory bus wherein said memory address is further comprised of a first grouping of address bits used to address said system memory and a second group of address bits used to address said input-output device. 25. In a microprocessor system including a central processing unit and a bit input register coupled to said central processing unit, said bit input register receiving logical input over at least one bit line, said bit input register comprising: latch means, coupled to said at least one bit line, for initially sampling said at least one bit line in order to determine a logic level thereof; and a zero persistence control unit, coupled to said latch means, for storing said logic level in a register assigned to said at least one bit line, said logic level remaining stored in said register until said zero persistence control unit is provided with a predefined signal by said central processing unit. 26. The microprocessor system of claim 25 further including a direct memory access controller (DMAC) coupled to said zero persistence controller, said DMAC including means for generating said predefined signal 27. A microprocessor system, comprising a microprocessing unit, an input-output processor (IOP), and a memory interface unit selectively coupling said central processing unit and said IOP to a system bus, said IOP including program counter means for providing system address information to said memory interface unit. 15001 187 28. The microprocessor system of claim 27 further including means, coupled to said IOP and to said system bus, for granting said IOP access to said system bus at predetermined intervals. 29. The microprocessor system of claim 27 wherein said IOP includes latch means, coupled to said system bus, for latching data received from said system bus. 30. The microprocessor system of claim 27 wherein said IOP includes a multiplexer controlled by said program counter means, an instruction latch, and a decode/execute module, said multiplexer coupled between said instruction latch and said decode/execute module. 31. In a microprocessor system including a microprocessing unit having a stack cache, a system for effecting floating-point mathematical instructions comprising: arithmetic logic unit means for performing floating-point operations upon values within cells of said stack cache; means, coupled to said arithmetic logic unit means, for generating floating point exceptions in response to performance of selected ones of said floating point operations; and mode register means, coupled to said arithmetic logic unit means and to said means for generating floating point exceptions, for enabling said microprocessing unit to execute predefined floating point routines in response to said floating point exceptions. 32. The system of claim 31 wherein said means for performing floating-point operations includes means, coupled to said stack cache, for executing test exponent, extract exponent, add exponents, and restore exponent instructions. 33. In a microprocessor system including a microprocessing unit having a stack cache, a method for executing a breakpoint instruction comprising the steps of: pushing into said stack cache a memory address of said breakpoint instruction; and executing a breakpoint service routine. 34. In a microprocessor system including system memory and a microprocessing unit having one or more internal registers, said system memory being assigned a first address space for communication with said microprocessing unit, a method for transferring data within said microprocessing unit comprising the steps of: assigning said one or more internal registers a second address space different from said first address space; and transferring data to and from portions of said one or more internal registers identified by addresses within said second address space. 35. In a microprocessor system including a microprocessing unit having a stack cache, a method for address arithmetic comprising the steps of: storing a first address value in a first cell of said stack cache; storing a second address value in a second cell of said stack cache; and adding said first address value to said second address value and storing a resultant sum value in said first cell of said stack cache. 36. In a microprocessor system including a microprocessing unit having a stack cache, a method for performing a copy byte operation comprising the steps of: reading a least significant one of a plurality of data bytes stored in a cell; replacing at least one other of said plurality of data bytes with said least significant data byte. 37. In a microprocessor system including a microprocessing unit having a stack cache and a carry register, a method for performing a test byte operation comprising the steps of: reading each of a plurality of bytes stored within a cell of said stack cache; and storing a first logical value in said carry register when any of said bytes are of zero value, and storing a second logical value in said carry register otherwise. 38. In a microprocessor system including a system memory, a microprocessing unit coupled to said system memory, having a stack cache coupled to said system memory and a program counter coupled to said stack cache, a single step processing system comprising: means, coupled to said stack cache and to said program counter, for loading a first memory address from a first cell of said stack cache into said program counter; means, coupled to said program counter, for executing a first instruction stored in said system memory of said microprocessor system at a location corresponding to said first memory address; and means for executing a single-step trap routine during which a second memory address is loaded into said first cell wherein a second instruction following said first instruction is stored at a location in said system memory corresponding to said second memory address. 39. In a microprocessor system including system memory, and a microprocessing unit coupled to said system memory having a stack cache, a stack cache management system comprising: means, coupled to said stack cache, for determining a number of cells currently included within said stack cache; means, coupled to said means for determining the number of cells, for performing a comparison of said number of cells to a predefined depth of said stack cache; and means, coupled to said means for performing the comparison, for providing an indication of a current stack depth based on said comparison. 40. In a microprocessor system including system memory, and a microprocessing unit coupled to said system memory having a stack cache, a stack cache management system comprising: stack depth means, coupled to said stack cache, for determining a number of cells currently included within said stack cache; and means, coupled to said stack depth means, for providing an indication of said stack depth. 41. In a microprocessor system including system memory, and a microprocessing unit having a stack cache, a stack cache management system comprising: means, coupled to said stack cache, for determining a current number cells in said stack cache; means, coupled to said means for determining the current number of cells, for computing a number of cells capable of being added to said stack cache by comparing said current number of cells to a maximum stack depth; and means, coupled to said stack cache and to said means for computing me number of cells capable of being added to said stack cache, for adding to said current number of cells in said stack cache a number of said cells equivalent to said number of cells capable of being added to said stack cache. 42. The system of claim 41 further including means, coupled to said stack cache, for removing from said current number of cells in said stack cache an additional number of said cells in said stack cache, and means for loading from said system memory into said stack cache said additional number of new cells. 43. A microprocessor comprising a microprocessing unit that includes an arithmetic logic unit and a push¬ down stack coupled to said arithmetic logic unit, said arithmetic logic unit including a bit-shifting means to shift bits, said bit shifting means shifting a count of bits in one or more partial shifts with said count reducing by the number of bits shifted each partial shift, said shifting being performed by multiple bits while said count is greater than said multiple, said multiple then being reduced, and then said shifting and said reductions of said count repeating until said count reaches zero. 44. The microprocessor of claim 43 wherein said multiple is initially eight and said multiple is reduced to one when said count is less than eight.

Inventors: FISH RUSSEL H III, JENSEN BRADLEY D, MCCLURG MARTIN G, MOORE CHARLES H, SHAW GEORGE W, FISH, RUSSEL, H., III, JENSEN, BRADLEY, D., MCCLURG, MARTIN, G., MOORE, CHARLES, H., SHAW, GEORGE, W.
Applicants: FISH RUSSEL H III, JENSEN BRADLEY D, MCCLURG MARTIN G, MOORE CHARLES H, PATRIOT SCIENT CORP, SHAW GEORGE W, FISH, RUSSEL, H., III, JENSEN, BRADLEY, D., MCCLURG, MARTIN, G., MOORE, CHARLES, H., PATRIOT SCIENTIFIC CORPORATION, SHAW, GEORGE, W.
Application year: 1996
Main classification: G06F
IPC codes: G06F9, G06F12, G09G5