US7496734B1 - System and method for handling register dependency in a stack-based pipelined processor - Google Patents

System and method for handling register dependency in a stack-based pipelined processor Download PDF

Info

Publication number
US7496734B1
US7496734B1 US09/561,241 US56124100A US7496734B1 US 7496734 B1 US7496734 B1 US 7496734B1 US 56124100 A US56124100 A US 56124100A US 7496734 B1 US7496734 B1 US 7496734B1
Authority
US
United States
Prior art keywords
register
mapping
instruction
data
physical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
US09/561,241
Inventor
Nicholas J. Richardson
Lun Bin Huang
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
STMicroelectronics lnc USA
Original Assignee
STMicroelectronics lnc USA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by STMicroelectronics lnc USA filed Critical STMicroelectronics lnc USA
Priority to US09/561,241 priority Critical patent/US7496734B1/en
Assigned to STMICROELECTRONICS, INC. reassignment STMICROELECTRONICS, INC. ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: HUANG, LUN BIN, RICHARDSON, NICHOLAS J.
Priority to EP01303827A priority patent/EP1150203A3/en
Priority to JP2001130880A priority patent/JP2001356905A/en
Application granted granted Critical
Publication of US7496734B1 publication Critical patent/US7496734B1/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • G06F9/3012Organisation of register space, e.g. banked or distributed register file
    • G06F9/30134Register stacks; shift registers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3838Dependency mechanisms, e.g. register scoreboarding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3838Dependency mechanisms, e.g. register scoreboarding
    • G06F9/384Register renaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3854Instruction completion, e.g. retiring, committing or graduating
    • G06F9/3858Result writeback, i.e. updating the architectural state or memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3861Recovery, e.g. branch miss-prediction, exception handling
    • G06F9/3863Recovery, e.g. branch miss-prediction, exception handling using multiple copies of the architectural state, e.g. shadow registers

Definitions

  • the present invention is directed, in general, to data processing systems and, more specifically, to a system for handling data dependencies in a stack-based pipelined processor.
  • processor throughput One way to increase processor throughput is to use a pipeline architecture in which the processor is divided into separate processing stages that form the pipeline. Instructions are broken down into elemental steps that are executed in different stages in an assembly line fashion.
  • a pipelined processor is capable of executing several different machine instructions concurrently. This is accomplished by breaking down the processing steps for each instruction into several discrete processing phases, each of which is executed by a separate pipeline stage. Hence, each instruction must pass sequentially through each pipeline stage in order to complete its execution. In general, a given instruction is processed by only one pipeline stage at a time, with one clock cycle being required for each stage. Since instructions use the pipeline stages in the same order and typically only stay in each stage for a single clock cycle, an “n” stage pipeline is capable of simultaneously processing “n” instructions. When filled with instructions, a processor with “n” pipeline stages completes one instruction each clock cycle.
  • a non-pipelined processor is a processor that completes execution of one instruction before proceeding to the next instruction.
  • pipeline overheads and other factors decrease somewhat the execution advantage rate that a pipelined processor has over a non-pipelined processor.
  • a simplified five stage processor pipeline may consist of an instruction fetch (IF) stage, a decode (DCD) stage, an operand fetch (OF) stage, an execute (EXE) stage, and a write-back (WBK) stage.
  • the processor may have an instruction cache that stores program instructions for execution, a data cache that temporarily stores data operands that otherwise are stored in processor memory, and a register stack that also temporarily stores data operands.
  • the instruction fetch stage fetches an instruction for execution from the instruction cache and stores it into an instruction fetch buffer (IFB).
  • the decode stage takes the instruction from the instruction fetch buffer in the instruction cache and decodes the instruction into a set of signals that can be directly used for executing subsequent pipeline stages.
  • the operand fetch stage fetches required operands from the data cache or registers in the register stack.
  • the execute stage performs the actual programmed operation (e.g., add, multiply, divide, and the like) on the operands fetched by the operand fetch stage and generates the result.
  • the write-back stage then writes the result generated by the execute stage back into the data cache or the register stack.
  • a typical pipeline program instruction sequence may have several instructions with dependencies on the results and effects of preceding instructions. As a result, there is normally some degree of interaction between instructions which occupy different stages of the pipeline. For example, a given instruction may need to use the data result from an earlier instruction as its operands.
  • the increment instruction has a dependency on the first instruction.
  • the increment instruction must wait until the first instruction loads register A with the content of memory location 1 before it can increment the content of register A.
  • the increment instruction requires the result of the first load instruction by the time the increment instruction is in the operand fetch stage.
  • the first instruction can proceed through the execute and write-back stages, which results in register A being loaded with the required operand data by the time the increment instruction is in the operand fetch stage.
  • a one clock cycle delay is incurred for the increment instruction.
  • the increment instruction requires the result of the first instruction when the increment instruction is in the operand fetch stage and the first instruction is in the write-back stage.
  • the load instruction is about to write the required data from memory into register A.
  • the data from memory that is destined for register A is actually still in temporary registers in the write-back stage, ready for transfer to register A.
  • the contents of the temporary registers may be sent directly to the operand fetch stage for use by the increment instruction, thereby bypassing register A. This bypass prevents the increment instruction from incurring any delay.
  • a register scoreboard comprises logic that tracks which of the processor registers (A, B, C in the example) are about to be updated by instructions that are active in the pipeline.
  • the register scoreboard also identifies which pipeline stage is occupied by the respective instructions during any given clock cycle.
  • a subsequent instruction can check the register scoreboard to determine whether its required source operands (A, B, or C) are in the process of being generated by preceding instructions in the pipeline. If the source operands are being generated, the dependent instruction may then perform a stalling (delay) operation or a bypassing operation to obtain the required data.
  • Pipeline processors implemented with a register-stack based architecture have a more complex problem when addressing data dependencies between pipelined instructions. This problem is caused by the fact that the addresses of architectural registers which store the data results of particular operations (i.e., those registers seen by the program) are no longer fixed, but dynamically change in response to instruction execution.
  • a register-stack based architecture is generally based on the premise that the architectural registers are organized as a first-in-first-out (FIFO) stack. Instructions requiring source operands in a register-stack architecture implicitly use the data from the top of the stack by first popping it from the top of the stack and then by pushing any result to the top of the stack when execution is completed. Thus, all stack entries move toward the top of the stack when dependent data is removed from the stack and toward the bottom of the stack when result data is added to the stack.
  • FIFO first-in-first-out
  • registers A, B, and C are organized as a register-stack, with register A always being at the top of the stack, register B in the middle, and register C at the bottom.
  • the register stack-based architecture adds complexity to the pipeline data dependency problem, since the architectural registers (i.e., those registers seen by the program) dynamically change as each subsequent instruction is executed in the pipeline.
  • the architectural register in which the required data result resides can be changed by any or all intervening instructions between the instruction creating the data and the instruction requiring the data.
  • a primary object of the present invention to provide a data processor comprising 1) a register stack comprising a plurality of architectural registers capable of storing operands required by instructions executed by the data processor; 2) an instruction execution pipeline comprising N processing stages, each of the N processing stages capable of performing one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline; and 3) at least one mapping register associated with at least one of the N processing stages, wherein the at least one mapping register is capable of storing mapping data that may be used to determine a physical register associated with an architectural stack register accessed by the pending instruction.
  • the mapping data comprises a physical identifier code identifying the physical register.
  • the mapping data comprises a virtual identifier identifying the architectural register.
  • the physical register is one of: 1) a source register containing a first operand to be retrieved by the pending instruction and 2) a target register in which the first operand is to be stored by the pending instruction.
  • the at least one mapping register comprises a first mapping register associated a first one of the N processing stages and a second mapping register associated with the second one of the N processing stages.
  • the first mapping register is capable of storing first mapping data that may be used to determine a first physical register associated with a first architectural stack register accessed by a first instruction being processed in the first processing stage and wherein the second mapping register is capable of storing second mapping data that may be used to determine a second physical register associated with a second architectural stack register accessed by a second instruction being processed in the second processing stage.
  • the first mapping register is capable of transferring the first mapping data to the second mapping register when the first instruction is transferred from the first processing stage to the second processing stage.
  • the data processor further comprises a third mapping register associated with the register stack capable of storing third mapping data that may be used to determine third physical register associated with third architectural stack register accessed by a last executed instruction.
  • the data processor is capable of transferring the third mapping data from the third mapping register to at least one of the first mapping register and the second mapping register.
  • FIG. 1 illustrates an isometric view of an exemplary processing system, namely a personal computer, that contains a register stack-based, pipelined processor in accordance with the principles of the present invention
  • FIG. 2 illustrates in greater detail the exemplary pipelined processor according to one embodiment of the present invention.
  • FIG. 3 is a flow chart illustrating the operation of the exemplary pipelined processor according to one embodiment of the present invention.
  • FIGS. 1 through 3 discussed below, and the various embodiments used to describe the principles of the present invention in this patent document are by way of illustration only and should not be construed in any way to limit the scope of the invention. Those skilled in the art will understand that the principles of the present invention may be implemented in any suitably arranged data processor.
  • FIG. 1 illustrates an isometric view of an exemplary processing system, namely personal computer 100 , that contains register stack-based, pipelined processor 106 in accordance with the principles of the present invention.
  • Personal computer 100 comprises chassis 101 , monitor 102 and keyboard 103 .
  • Monitor 102 and keyboard 103 may be replaced by, or combined with, other input/output (I/O) devices.
  • Chassis 101 is illustrated with a cutaway view that shows floppy disk drive 104 and hard disk drive 105 .
  • Floppy disk drive 104 is capable of reading and writing to removable floppy diskettes.
  • Hard disk drive 105 provides fast access data storage and retrieval.
  • processor 106 may comprise an on-board two level cache system, including a Level 1 (L1) cache and a Level 2 (L2) cache.
  • the two level cache is a system in which a small, fast cache (the L1 cache) is connected to a slower, larger cache (the L2 cache).
  • the cache system first tests to see if the data belonging to that location is in the L1 cache. If the data is in the L1 cache, then the data is provided or updated quickly by the L1 cache. If the data is not in the L1 cache, then an L1 cache read “miss” or an L1 cache write “miss” has occurred.
  • the data is then provided or updated to the CPU core logic by the L2 cache.
  • the line containing the requested data is also transferred from the L2 cache to the L1 cache, so that the data may be provided more quickly the next time processor 106 accesses the data. This is known as an L1 cache line fill.
  • an L2 cache miss has occurred and the line containing the requested data is fetched from main memory and then loaded into the L2 cache for faster access the next time the data is requested. This is known as an L2 cache line fill.
  • FIG. 2 illustrates in greater detail exemplary pipelined processor 106 according to one embodiment of the present invention.
  • Processor 106 contains an instruction pipeline comprising instruction fetch (IF) stage 205 , decode stage 210 , operand fetch stage 215 , execute stage 220 , and write-back stage 225 .
  • Processor 106 also comprises register stack 230 , instruction cache 235 , data cache 240 and mapping registers 251 - 254 .
  • Instruction cache 235 and data cache 240 are the portions of the L1 cache that hold instructions and data, respectively.
  • Processor 106 is a central processing unit (CPU) capable of fetching and interpreting instructions, retrieving data, executing instructions, and storing results.
  • the illustrated pipeline is a mechanism capable of executing several different operations concurrently. The pipeline does this by breaking down the processing steps for each major task into several discrete processing phases, each of which is executed by a separate pipeline stage. Each task must pass sequentially through each processing phase, and hence each pipeline stage, to complete its execution.
  • Instruction fetch stage 205 fetches an instruction for execution from instruction cache 235 and transfers it into an instruction fetch buffer (IFB).
  • Decode stage 210 takes the instruction from the instruction fetch buffer and decodes the instruction into sets of signals that can be used directly for execution by subsequent pipeline stages.
  • Operand fetch stage 215 fetches operands from data cache 240 or register stack 230 .
  • Execute stage 220 executes the instruction specified operation on the operands fetched in operand fetch stage 215 (e.g., add, multiply, divide, and the like) and generates the results.
  • Write-back stage 225 writes the results generated by execute stage 220 back into data cache 240 or into register stack 230 .
  • each of mapping registers 251 - 254 stores a logical mapping between a physical register and an architectural name of a physical register.
  • Each of mapping registers 251 - 254 is associated with a particular stage in the execution pipeline.
  • mapping register 251 is associated with decode stage 210
  • mapping register 252 is associated with operand fetch stage 215
  • mapping register 253 is associated with execute stage 220
  • mapping register 254 is associated with write-back stage 225 .
  • decode stages 210 determines the mapping between the architectural name of a register in an instruction and the physical register that actually holds the data needed by that instruction. This mapping is placed in mapping register 251 .
  • the mapping flows along with the instruction through mapping register 252 , mapping register 253 , and mapping register 254 .
  • Each physical register in register stack 230 is designated by two different identifiers.
  • the first identifier is known as the physical identifier (PID).
  • the PID is a fixed binary code that identifies a specific on-chip physical register in register stack 230 . Thus, each PID is hardwired as part of the design and is unchangeable.
  • the second identifier is known as the virtual identifier (VID).
  • the VID represents the architectural name (e.g., A, B, C) of the physical register seen by programs. Thus, a VID may change as instructions reorder entries in register stack 230 .
  • Each VID is stored in a separate binary VID field associated with each physical register.
  • write-back stage 225 writes a result generated by execute stage 220 into a physical register with a particular VID in register stack 230 , the result remains in the physical register until write-back stage 225 overwrites the result with a new result designated for the same physical register. If a subsequent instruction causes an existing result to alter its position (i.e., change its architectural register) in register stack 230 , the position change is reflected by writing the VID representing the new architectural register into the VID field of the physical register in which the result resides.
  • decode stage 210 determines the new mapping between VIDS and PIDS for that instruction. All instruction references to architectural (virtual) registers are replaced with their equivalent physical register name (PID). As an instruction flows further down the pipeline, the PIDs of the source and target registers of the instruction and the VID-PID mapping of the instruction are sent along with the instruction. This is accomplished by shifting the PID information and the VID-PID mapping information through mapping registers 251 - 254 .
  • decode stage 210 creates the new VID-PID mapping by taking into account the VID-PID mapping of the previous instructions as well as the effect of the new instruction on the VID-PID mapping.
  • the register scoreboarding logic may directly compare the source and target PIDs of different instructions in the pipeline to determine whether stalling or bypassing is required for any given instruction. This is a straight forward process because the PIDs are always absolute, unambiguous references to physical registers.
  • three architectural registers A, B, and C may be mapped to three physical registers R 0 , R 1 , R 2 (i.e., PIDS).
  • R 0 , R 1 , R 2 i.e., PIDS
  • the VID-PID mapping in decode stage 210 may become inaccurate if a pipeline flush occurs. This can occur when some instructions in the pipeline are executed speculatively, depending on the result of a previous instruction. For example, if instructions are speculatively executed from a predicted branch path and the branch prediction is not correct, then the effects of the speculatively executed instructions must be annulled. In part, this involves correcting the VID-PID mapping in decode stage 210 to remove the effects of canceled instructions. This is, in part, why the VID-PID mapping for each instruction is sent through mapping registers 251 - 254 along with the instruction itself. The mapping for the last instruction to execute is stored in register stack 230 itself.
  • the VID-PID mapping associated with the last correctly-executed instruction (which is still in the mapping registers of register stack 230 ) is copied into the VID-PID mapping held in mapping register 251 for decode stage 210 .
  • the present invention overcomes the data dependency problems associated with register stack-based pipelined processor architectures through the following steps:
  • decode stage 210 determines which on-chip physical register is mapped to which architectural (program-visible) register using a virtual identifier (VID) associated with the physical identifier (PID) of each physical register.
  • VIP virtual identifier
  • Decode stage 210 converts architectural register names (designated by VIDs) into physical register names (designated by PIDs) in the current VID-PID mapping in mapping register 251 , which changes with each instruction flowing through decode stage 210 .
  • decode stage 210 replaces the architectural source and target register names with the physical source and target register names (PIDs)
  • Decode stage 210 sends the VID-PID mapping associated with each instruction down the pipeline along with the instruction using mapping registers 251 - 254 .
  • Each stage of the pipeline compares the PIDs of different instructions in the pipeline to determine the absolute source of target dependencies and to determine whether stalling or bypassing is required.
  • processor 106 rolls back the VID-PID mapping in decode stage 210 by overwriting it with the VID-PID mapping of the last correctly executed instruction, which is held in mapping register 231 associated with register stack 230 .
  • processor 106 may be more generally described as an N stage pipelined CPU, the final stage of which writes results to one of M physical data registers.
  • M physical data registers Each of the M physical data registers has a fixed physical register name, given by a Physical Identifier (PID), and a variable architectural register name, given by a Virtual Identifier (VID), that is held in a VID register.
  • PID Physical Identifier
  • VID Virtual Identifier
  • One VID register is associated with each physical data register.
  • Processor 106 uses an instruction set architecture (ISA) that permits each instruction either to write new results to architectural registers or to reorder existing results between architectural registers (such as in a stack-based architecture), or both.
  • ISA instruction set architecture
  • An architectural-register reordering mechanism associated with each stage allows instructions to symbolically, rather than physically, reorder results between architectural registers by changing the contents of the VID registers associated with each physical data register. This eliminates the transfer of data between physical registers for operations that simply reorder data between registers, and hence eliminates potential data dependencies caused by such transfers.
  • Processor 106 also comprises an architectural register name (VID) to physical data register name (PID) mapping mechanism that is associated with an early pipeline stage (e.g., decode sage 210 ).
  • the VID-PID mapping mechanism uses a VID-PID mapping table to convert the architectural register names (VIDs) used by the CPU instruction entering that pipeline stage into physical register names (PIDs).
  • the VID-PID mapping mechanism then tracks the generated VID-PID mapping associated with that instruction along each subsequent pipeline stage until it ultimately updates the final VID fields associated with the physical data registers at the end of the pipeline.
  • register-based data dependencies between instructions in pipeline stages which follow the pipeline stage containing the mapping mechanism may be detected by directly comparing the PIDs of registers used as sources by instructions in earlier pipeline stages with the PIDs of registers written as destinations by instructions in later pipeline stages. This eliminates the effects of false dependencies that would otherwise be generated by intervening instructions that simply reorder data between architectural registers.
  • Processor 106 also includes a mechanism to copy (i.e., pipeline flush copy operation) the contents of the VID registers associated with the physical data registers into the VID-PID mapping registers in the early pipeline stage (e.g., decode stage 210 ) that contains the initial VID-PID mapping mechanism (e.g., mapping register 251 ). This is done in order to reset the VID-PID mapping to that of the last instruction successfully completed, in the event that intervening instructions in the pipeline are canceled due to their incorrect speculative execution.
  • a mechanism to copy i.e., pipeline flush copy operation
  • the contents of the VID registers associated with the physical data registers into the VID-PID mapping registers in the early pipeline stage e.g., decode stage 210
  • the initial VID-PID mapping mechanism e.g., mapping register 251
  • FIG. 3 depicts flow chart 300 , which illustrates the operation of exemplary pipelined processor 106 according to one embodiment of the present invention.
  • mapping register 251 contains VID-PID mapping data for the last instruction decoded by decode stage 210 .
  • the processing of the next instruction begins when decode stage 210 receives the next instruction from instruction fetch stage 205 and decodes it (process step 305 ).
  • Decode stage 210 decodes the new instruction and determines the new VID-PID mapping data based on two factors: 1) the operation being performed by the decoded new instruction and 2) the old VID-PID mapping data in mapping register 251 (process step 310 ).
  • Decode stage 210 then stores the new VID-PID mapping data in mapping register 251 (process step 315 ).
  • the new decoded instruction is shifted from decode stage 250 into operand fetch stage 215 and the new VID-PID mapping data is shifted from mapping register 251 to mapping register 252 (process step 320 ).
  • the processing of the new instruction continues as the decoded instruction is shifted from operand fetch stage 215 to execute stage 220 and then to write-back stage 225 .
  • the VID-PID mapping data associated with the new instruction is shifted from mapping register 252 to mapping register 253 and then to mapping register 254 (process step 325 ). If no branch prediction error occurs (or if no branch prediction was associated with the new instruction), write-back stage 225 writes the VID-PID mapping register from mapping register 254 to mapping register 231 in register stack 230 (process step 330 ). If a branch prediction error did occur, processor 106 transfers the VID-PID mapping data of the last correctly executed instruction from mapping register 231 to mapping register 251 and flushes the pending instructions that are in the instruction pipeline (process step 335 ).
  • the present invention has numerous advantages over the prior art. Since after a single translation stage, all register names are converted to fixed, physical register names, it is simple to determine the source and destination operands of each instruction and any dependencies between instructions. Additionally, using a single translation stage to perform the VID-PID register mapping means that all other pipeline stages handle the on-chip registers in a conventional fashion, using just the physical register names. This makes it easy to adapt an existing micro-architecture or micro-architecture concepts for a conventional non-stack-based processor for use in a register-stack based machine, hence gaining the leverage of all the conventional micro-architecture innovations.

Abstract

There is disclosed a data processor comprising 1) a register stack comprising a plurality of architectural registers that stores operands required by instructions executed by the data processor; 2) an instruction execution pipeline comprising N processing stages, where each processing stage performs one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline; and 3) at least one mapping register associated with at least one of the N processing stages, wherein the at least one mapping register stores mapping data that may be used to determine a physical register associated with an architectural stack register accessed by the pending instruction.

Description

TECHNICAL FIELD OF THE INVENTION
The present invention is directed, in general, to data processing systems and, more specifically, to a system for handling data dependencies in a stack-based pipelined processor.
BACKGROUND OF THE INVENTION
The demand for high performance computers requires that state-of-the-art microprocessors execute instructions in the minimum amount of time. A number of different approaches have been taken to decrease instruction execution time, thereby increasing processor throughput. One way to increase processor throughput is to use a pipeline architecture in which the processor is divided into separate processing stages that form the pipeline. Instructions are broken down into elemental steps that are executed in different stages in an assembly line fashion.
A pipelined processor is capable of executing several different machine instructions concurrently. This is accomplished by breaking down the processing steps for each instruction into several discrete processing phases, each of which is executed by a separate pipeline stage. Hence, each instruction must pass sequentially through each pipeline stage in order to complete its execution. In general, a given instruction is processed by only one pipeline stage at a time, with one clock cycle being required for each stage. Since instructions use the pipeline stages in the same order and typically only stay in each stage for a single clock cycle, an “n” stage pipeline is capable of simultaneously processing “n” instructions. When filled with instructions, a processor with “n” pipeline stages completes one instruction each clock cycle.
The execution rate of a pipeline processor is theoretically “n” times faster than an equivalent non-pipelined processor. A non-pipelined processor is a processor that completes execution of one instruction before proceeding to the next instruction. Typically, pipeline overheads and other factors decrease somewhat the execution advantage rate that a pipelined processor has over a non-pipelined processor.
A simplified five stage processor pipeline may consist of an instruction fetch (IF) stage, a decode (DCD) stage, an operand fetch (OF) stage, an execute (EXE) stage, and a write-back (WBK) stage. In addition, the processor may have an instruction cache that stores program instructions for execution, a data cache that temporarily stores data operands that otherwise are stored in processor memory, and a register stack that also temporarily stores data operands.
The instruction fetch stage fetches an instruction for execution from the instruction cache and stores it into an instruction fetch buffer (IFB). The decode stage takes the instruction from the instruction fetch buffer in the instruction cache and decodes the instruction into a set of signals that can be directly used for executing subsequent pipeline stages. The operand fetch stage fetches required operands from the data cache or registers in the register stack. The execute stage performs the actual programmed operation (e.g., add, multiply, divide, and the like) on the operands fetched by the operand fetch stage and generates the result. The write-back stage then writes the result generated by the execute stage back into the data cache or the register stack.
Assuming that each pipeline stage completes its operation in one clock cycle, the described five stage processor pipeline takes five clocks cycles to process one instruction. As previously described, once the pipeline is full, an instruction can theoretically be completed every clock cycle.
A typical pipeline program instruction sequence may have several instructions with dependencies on the results and effects of preceding instructions. As a result, there is normally some degree of interaction between instructions which occupy different stages of the pipeline. For example, a given instruction may need to use the data result from an earlier instruction as its operands.
Consider the previously described five stage pipeline with three registers (A, B, C) in the register file and a hypothetical program sequence with three instructions. The first two instructions load one operand each from memory into registers A and B, respectively. The third instruction increments the contents of register A. The program may be represented as follows:
1) Ld Mem1, A (load contents of Mem. location 1 into Reg. A)
2) Ld Mem2, B (load contents of Mem. location 2 into Reg. B)
3) Inc A (increment the contents of Reg. A)
For this example, the increment instruction has a dependency on the first instruction. The increment instruction must wait until the first instruction loads register A with the content of memory location 1 before it can increment the content of register A.
In the prior art, there are generally three ways of dealing with such data dependencies. First, there may not be a problem and no special action may be required. It is possible that the dependent instruction (increment, for example) is not affected. This is the case if the pipeline has processed the first instruction to the point that the memory data is loaded into register A by the time the third instruction is ready to increment data in register A. This would be the case if two or more clock cycles provide enough time for the first instruction to proceed through the execute and write-back stages and to write the result into register A before the third instruction needs the new value of register A when it enters the operand fetch stage.
Second, it may be possible to delay processing of one or more stages so that data is available when required. For example, the increment instruction requires the result of the first load instruction by the time the increment instruction is in the operand fetch stage. By holding the increment instruction in the decode stage for two clock cycles instead of one, the first instruction can proceed through the execute and write-back stages, which results in register A being loaded with the required operand data by the time the increment instruction is in the operand fetch stage. Thus, a one clock cycle delay is incurred for the increment instruction.
Third, it may be possible to transfer data directly between pipeline stages by eliminating or bypassing selected operations. For example, the increment instruction requires the result of the first instruction when the increment instruction is in the operand fetch stage and the first instruction is in the write-back stage. Under these conditions, the load instruction is about to write the required data from memory into register A. However, the data from memory that is destined for register A is actually still in temporary registers in the write-back stage, ready for transfer to register A. At this point, the contents of the temporary registers may be sent directly to the operand fetch stage for use by the increment instruction, thereby bypassing register A. This bypass prevents the increment instruction from incurring any delay.
The described delay and bypass scenarios require logic that detects when one instruction depends upon the result of a previous one. For simple pipeline processors such as the one described, the detection of data dependence between instructions is performed via a mechanism generally known as a register scoreboard. A register scoreboard comprises logic that tracks which of the processor registers (A, B, C in the example) are about to be updated by instructions that are active in the pipeline. The register scoreboard also identifies which pipeline stage is occupied by the respective instructions during any given clock cycle. Thus, a subsequent instruction can check the register scoreboard to determine whether its required source operands (A, B, or C) are in the process of being generated by preceding instructions in the pipeline. If the source operands are being generated, the dependent instruction may then perform a stalling (delay) operation or a bypassing operation to obtain the required data.
This process works well in the most common forms of microprocessor architectures which have on-chip registers with fixed names that are referenced by fixed allocated codes embedded in the instructions. For these architectures, it is relatively simple to check whether a source register requested by an instruction in an early pipeline stage is also the destination (target) register of an instruction in a later pipeline stage. An instruction in a later pipeline stage precedes an instruction in an earlier pipeline stage. The processor may perform this analysis by examining source register and storage (target) register addresses of each instruction in the pipeline for a match. When a match is found, appropriate delay or bypass actions are taken.
Pipeline processors implemented with a register-stack based architecture have a more complex problem when addressing data dependencies between pipelined instructions. This problem is caused by the fact that the addresses of architectural registers which store the data results of particular operations (i.e., those registers seen by the program) are no longer fixed, but dynamically change in response to instruction execution.
For example, a register-stack based architecture is generally based on the premise that the architectural registers are organized as a first-in-first-out (FIFO) stack. Instructions requiring source operands in a register-stack architecture implicitly use the data from the top of the stack by first popping it from the top of the stack and then by pushing any result to the top of the stack when execution is completed. Thus, all stack entries move toward the top of the stack when dependent data is removed from the stack and toward the bottom of the stack when result data is added to the stack.
To illustrate this problem, consider the previous instruction series as implemented for a register-stack based processor. For this example, registers A, B, and C are organized as a register-stack, with register A always being at the top of the stack, register B in the middle, and register C at the bottom.
1) Ld Mem1, A (load contents of Mem. location 1 into Reg. A)
2) Ld Mem2, A (push old contents of Reg. A into Reg. B, then store data
from Mem. location 2 into Reg. A)
3) Inc B (explicitly increment the contents of Reg. B)
The fundamental difference between this example and the previous example is that, although the data in memory 1 was originally loaded into register A, it is in register B by the time the increment B instruction is executed. Therefore, the first and third instructions of both examples have the same dependency even though the explicitly-named source and destination registers are different.
Thus, the register stack-based architecture adds complexity to the pipeline data dependency problem, since the architectural registers (i.e., those registers seen by the program) dynamically change as each subsequent instruction is executed in the pipeline. In fact, the architectural register in which the required data result resides can be changed by any or all intervening instructions between the instruction creating the data and the instruction requiring the data.
Therefore, there is a need in the art for improved pipelined processors that are less susceptible to data dependency problems between different stages of the instruction pipeline. In particular, there is a need for an improved register stack-based architecture for pipelined processors that does not incur a performance penalty when data dependencies exist between different stages of the instruction pipeline. More particularly, there is a need for a register stack-based, pipelined processor in which the addresses of architectural registers may be dynamically changed which is capable of handling data dependencies without incurring a performance penalty.
SUMMARY OF THE INVENTION
To address the above-discussed deficiencies of the prior art, it is a primary object of the present invention to provide a data processor comprising 1) a register stack comprising a plurality of architectural registers capable of storing operands required by instructions executed by the data processor; 2) an instruction execution pipeline comprising N processing stages, each of the N processing stages capable of performing one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline; and 3) at least one mapping register associated with at least one of the N processing stages, wherein the at least one mapping register is capable of storing mapping data that may be used to determine a physical register associated with an architectural stack register accessed by the pending instruction.
According to an advantageous embodiment of the present invention, the mapping data comprises a physical identifier code identifying the physical register.
According to one embodiment of the present invention, the mapping data comprises a virtual identifier identifying the architectural register.
According to another embodiment of the present invention, the physical register is one of: 1) a source register containing a first operand to be retrieved by the pending instruction and 2) a target register in which the first operand is to be stored by the pending instruction.
According to still another embodiment of the present invention, the at least one mapping register comprises a first mapping register associated a first one of the N processing stages and a second mapping register associated with the second one of the N processing stages.
According to yet another embodiment of the present invention, the first mapping register is capable of storing first mapping data that may be used to determine a first physical register associated with a first architectural stack register accessed by a first instruction being processed in the first processing stage and wherein the second mapping register is capable of storing second mapping data that may be used to determine a second physical register associated with a second architectural stack register accessed by a second instruction being processed in the second processing stage.
According to a further embodiment of the present invention, the first mapping register is capable of transferring the first mapping data to the second mapping register when the first instruction is transferred from the first processing stage to the second processing stage.
According to a still further embodiment of the present invention, the data processor further comprises a third mapping register associated with the register stack capable of storing third mapping data that may be used to determine third physical register associated with third architectural stack register accessed by a last executed instruction.
According to a yet further embodiment of the present invention, the data processor is capable of transferring the third mapping data from the third mapping register to at least one of the first mapping register and the second mapping register.
The foregoing has outlined rather broadly the features and technical advantages of the present invention so that those skilled in the art may better understand the detailed description of the invention that follows. Additional features and advantages of the invention will be described hereinafter that form the subject of the claims of the invention. Those skilled in the art should appreciate that they may readily use the conception and the specific embodiment disclosed as a basis for modifying or designing other structures for carrying out the same purposes of the present invention. Those skilled in the art should also realize that such equivalent constructions do not depart from the spirit and scope of the invention in its broadest form.
Before undertaking the DETAILED DESCRIPTION OF THE INVENTION below, it may be advantageous to set forth definitions of certain words and phrases used throughout this patent document: the terms “include” and “comprise,” as well as derivatives thereof, mean inclusion without limitation; the term “or,” is inclusive, meaning and/or; the phrases “associated with” and “associated therewith,” as well as derivatives thereof, may mean to include, be included within, interconnect with, contain, be contained within, connect to or with, couple to or with, be communicable with, cooperate with, interleave, juxtapose, be proximate to, be bound to or with, have, have a property of, or the like; and the term “controller” means any device, system or part thereof that controls at least one operation, such a device may be implemented in hardware, firmware or software, or some combination of at least two of the same. It should be noted that the functionality associated with any particular controller may be centralized or distributed, whether locally or remotely. Definitions for certain words and phrases are provided throughout this patent document, those of ordinary skill in the art should understand that in many, if not most instances, such definitions apply to prior, as well as future uses of such defined words and phrases.
BRIEF DESCRIPTION OF THE DRAWINGS
For a more complete understanding of the present invention, and the advantages thereof, reference is now made to the following descriptions taken in conjunction with the accompanying drawings, wherein like numbers designate like objects, and in which:
FIG. 1 illustrates an isometric view of an exemplary processing system, namely a personal computer, that contains a register stack-based, pipelined processor in accordance with the principles of the present invention;
FIG. 2 illustrates in greater detail the exemplary pipelined processor according to one embodiment of the present invention; and
FIG. 3 is a flow chart illustrating the operation of the exemplary pipelined processor according to one embodiment of the present invention.
DETAILED DESCRIPTION OF THE INVENTION
FIGS. 1 through 3, discussed below, and the various embodiments used to describe the principles of the present invention in this patent document are by way of illustration only and should not be construed in any way to limit the scope of the invention. Those skilled in the art will understand that the principles of the present invention may be implemented in any suitably arranged data processor.
FIG. 1 illustrates an isometric view of an exemplary processing system, namely personal computer 100, that contains register stack-based, pipelined processor 106 in accordance with the principles of the present invention. Personal computer 100 comprises chassis 101, monitor 102 and keyboard 103. Monitor 102 and keyboard 103 may be replaced by, or combined with, other input/output (I/O) devices. Chassis 101 is illustrated with a cutaway view that shows floppy disk drive 104 and hard disk drive 105. Floppy disk drive 104 is capable of reading and writing to removable floppy diskettes. Hard disk drive 105 provides fast access data storage and retrieval.
In an exemplary embodiment of the present invention, processor 106 may comprise an on-board two level cache system, including a Level 1 (L1) cache and a Level 2 (L2) cache. The two level cache is a system in which a small, fast cache (the L1 cache) is connected to a slower, larger cache (the L2 cache). When the CPU core logic of processor 106 reads or writes data to or from a memory location, the cache system first tests to see if the data belonging to that location is in the L1 cache. If the data is in the L1 cache, then the data is provided or updated quickly by the L1 cache. If the data is not in the L1 cache, then an L1 cache read “miss” or an L1 cache write “miss” has occurred. The data is then provided or updated to the CPU core logic by the L2 cache. In the case of an L1 cache read miss, the line containing the requested data is also transferred from the L2 cache to the L1 cache, so that the data may be provided more quickly the next time processor 106 accesses the data. This is known as an L1 cache line fill. If the data is also not in the L2 cache, then an L2 cache miss has occurred and the line containing the requested data is fetched from main memory and then loaded into the L2 cache for faster access the next time the data is requested. This is known as an L2 cache line fill.
FIG. 2 illustrates in greater detail exemplary pipelined processor 106 according to one embodiment of the present invention. Processor 106 contains an instruction pipeline comprising instruction fetch (IF) stage 205, decode stage 210, operand fetch stage 215, execute stage 220, and write-back stage 225. Processor 106 also comprises register stack 230, instruction cache 235, data cache 240 and mapping registers 251-254. Instruction cache 235 and data cache 240 are the portions of the L1 cache that hold instructions and data, respectively.
Processor 106 is a central processing unit (CPU) capable of fetching and interpreting instructions, retrieving data, executing instructions, and storing results. The illustrated pipeline is a mechanism capable of executing several different operations concurrently. The pipeline does this by breaking down the processing steps for each major task into several discrete processing phases, each of which is executed by a separate pipeline stage. Each task must pass sequentially through each processing phase, and hence each pipeline stage, to complete its execution.
Instruction fetch stage 205 fetches an instruction for execution from instruction cache 235 and transfers it into an instruction fetch buffer (IFB). Decode stage 210 takes the instruction from the instruction fetch buffer and decodes the instruction into sets of signals that can be used directly for execution by subsequent pipeline stages. Operand fetch stage 215 fetches operands from data cache 240 or register stack 230. Execute stage 220 executes the instruction specified operation on the operands fetched in operand fetch stage 215 (e.g., add, multiply, divide, and the like) and generates the results. Write-back stage 225 writes the results generated by execute stage 220 back into data cache 240 or into register stack 230.
In accordance with the principles of the present invention, each of mapping registers 251-254 stores a logical mapping between a physical register and an architectural name of a physical register. Each of mapping registers 251-254 is associated with a particular stage in the execution pipeline. In the illustrated embodiment, mapping register 251 is associated with decode stage 210, mapping register 252 is associated with operand fetch stage 215, mapping register 253 is associated with execute stage 220, and mapping register 254 is associated with write-back stage 225. When an instruction is fetched and decoded by decode stage 210, decode stages 210 determines the mapping between the architectural name of a register in an instruction and the physical register that actually holds the data needed by that instruction. This mapping is placed in mapping register 251. As the instruction flows into subsequent pipeline stages, the mapping flows along with the instruction through mapping register 252, mapping register 253, and mapping register 254.
Each physical register in register stack 230 is designated by two different identifiers. The first identifier is known as the physical identifier (PID). The PID is a fixed binary code that identifies a specific on-chip physical register in register stack 230. Thus, each PID is hardwired as part of the design and is unchangeable. The second identifier is known as the virtual identifier (VID). The VID represents the architectural name (e.g., A, B, C) of the physical register seen by programs. Thus, a VID may change as instructions reorder entries in register stack 230. Each VID is stored in a separate binary VID field associated with each physical register.
Once write-back stage 225 writes a result generated by execute stage 220 into a physical register with a particular VID in register stack 230, the result remains in the physical register until write-back stage 225 overwrites the result with a new result designated for the same physical register. If a subsequent instruction causes an existing result to alter its position (i.e., change its architectural register) in register stack 230, the position change is reflected by writing the VID representing the new architectural register into the VID field of the physical register in which the result resides.
As each instruction entering the pipeline is decoded, decode stage 210 determines the new mapping between VIDS and PIDS for that instruction. All instruction references to architectural (virtual) registers are replaced with their equivalent physical register name (PID). As an instruction flows further down the pipeline, the PIDs of the source and target registers of the instruction and the VID-PID mapping of the instruction are sent along with the instruction. This is accomplished by shifting the PID information and the VID-PID mapping information through mapping registers 251-254.
The VID-PID mapping for each instruction must take into account the effects of all preceding instructions. Therefore, when a new instruction enters decode stage 210, decode stage 210 creates the new VID-PID mapping by taking into account the VID-PID mapping of the previous instructions as well as the effect of the new instruction on the VID-PID mapping. Once the source register and/or target register associated with an instruction have been converted from VIDs into PIDs, the register scoreboarding logic may directly compare the source and target PIDs of different instructions in the pipeline to determine whether stalling or bypassing is required for any given instruction. This is a straight forward process because the PIDs are always absolute, unambiguous references to physical registers.
By way of example, three architectural registers A, B, and C (i.e., VIDS) may be mapped to three physical registers R0, R1, R2 (i.e., PIDS). For the sample instruction sequence described above in the BACKGROUND OF THE INVENTION, the new source and destination registers as well as the new VID-PID mapping computed by decode stage 210 becomes:
[starting map] R0 = A, R1 = B, R2 = C
1) Load Mem1, R2 R0 = B, R1 = C, R2 = A (= mem1)
2) Load Mem2, R1 R0 = C, R1 = A, (= mem2), R2 = B (= mem1)
3) Inc R2 R0 = C, R1 = A, (= mem2), R2 = B (= mem1 + 1)

The data dependency (on physical register R2) between instruction 1 and instruction 3 is now explicitly revealed after replacing the architectural register name with the physical register name.
The VID-PID mapping in decode stage 210 may become inaccurate if a pipeline flush occurs. This can occur when some instructions in the pipeline are executed speculatively, depending on the result of a previous instruction. For example, if instructions are speculatively executed from a predicted branch path and the branch prediction is not correct, then the effects of the speculatively executed instructions must be annulled. In part, this involves correcting the VID-PID mapping in decode stage 210 to remove the effects of canceled instructions. This is, in part, why the VID-PID mapping for each instruction is sent through mapping registers 251-254 along with the instruction itself. The mapping for the last instruction to execute is stored in register stack 230 itself. When incorrectly executed speculative instructions are flushed from the pipeline, the VID-PID mapping associated with the last correctly-executed instruction (which is still in the mapping registers of register stack 230) is copied into the VID-PID mapping held in mapping register 251 for decode stage 210.
Thus, the present invention overcomes the data dependency problems associated with register stack-based pipelined processor architectures through the following steps:
1. For a pipelined, register stack-based machine, decode stage 210 determines which on-chip physical register is mapped to which architectural (program-visible) register using a virtual identifier (VID) associated with the physical identifier (PID) of each physical register.
2. Decode stage 210 converts architectural register names (designated by VIDs) into physical register names (designated by PIDs) in the current VID-PID mapping in mapping register 251, which changes with each instruction flowing through decode stage 210.
3. As each new instruction enters decode stage 210, decode stage 210 replaces the architectural source and target register names with the physical source and target register names (PIDs) Decode stage 210 sends the VID-PID mapping associated with each instruction down the pipeline along with the instruction using mapping registers 251-254.
4. Each stage of the pipeline compares the PIDs of different instructions in the pipeline to determine the absolute source of target dependencies and to determine whether stalling or bypassing is required.
5. In the instruction pipeline is flushed to cancel incorrect speculatively-executed instructions, processor 106 rolls back the VID-PID mapping in decode stage 210 by overwriting it with the VID-PID mapping of the last correctly executed instruction, which is held in mapping register 231 associated with register stack 230.
As FIG. 2 illustrates, processor 106 may be more generally described as an N stage pipelined CPU, the final stage of which writes results to one of M physical data registers. Each of the M physical data registers has a fixed physical register name, given by a Physical Identifier (PID), and a variable architectural register name, given by a Virtual Identifier (VID), that is held in a VID register. One VID register is associated with each physical data register.
Processor 106 uses an instruction set architecture (ISA) that permits each instruction either to write new results to architectural registers or to reorder existing results between architectural registers (such as in a stack-based architecture), or both. An architectural-register reordering mechanism associated with each stage allows instructions to symbolically, rather than physically, reorder results between architectural registers by changing the contents of the VID registers associated with each physical data register. This eliminates the transfer of data between physical registers for operations that simply reorder data between registers, and hence eliminates potential data dependencies caused by such transfers.
Processor 106 also comprises an architectural register name (VID) to physical data register name (PID) mapping mechanism that is associated with an early pipeline stage (e.g., decode sage 210). The VID-PID mapping mechanism uses a VID-PID mapping table to convert the architectural register names (VIDs) used by the CPU instruction entering that pipeline stage into physical register names (PIDs). The VID-PID mapping mechanism then tracks the generated VID-PID mapping associated with that instruction along each subsequent pipeline stage until it ultimately updates the final VID fields associated with the physical data registers at the end of the pipeline.
In this way, register-based data dependencies between instructions in pipeline stages which follow the pipeline stage containing the mapping mechanism may be detected by directly comparing the PIDs of registers used as sources by instructions in earlier pipeline stages with the PIDs of registers written as destinations by instructions in later pipeline stages. This eliminates the effects of false dependencies that would otherwise be generated by intervening instructions that simply reorder data between architectural registers.
Processor 106 also includes a mechanism to copy (i.e., pipeline flush copy operation) the contents of the VID registers associated with the physical data registers into the VID-PID mapping registers in the early pipeline stage (e.g., decode stage 210) that contains the initial VID-PID mapping mechanism (e.g., mapping register 251). This is done in order to reset the VID-PID mapping to that of the last instruction successfully completed, in the event that intervening instructions in the pipeline are canceled due to their incorrect speculative execution.
FIG. 3 depicts flow chart 300, which illustrates the operation of exemplary pipelined processor 106 according to one embodiment of the present invention. Initially, mapping register 251 contains VID-PID mapping data for the last instruction decoded by decode stage 210. The processing of the next instruction begins when decode stage 210 receives the next instruction from instruction fetch stage 205 and decodes it (process step 305). Decode stage 210 decodes the new instruction and determines the new VID-PID mapping data based on two factors: 1) the operation being performed by the decoded new instruction and 2) the old VID-PID mapping data in mapping register 251 (process step 310). Decode stage 210 then stores the new VID-PID mapping data in mapping register 251 (process step 315).
The new decoded instruction is shifted from decode stage 250 into operand fetch stage 215 and the new VID-PID mapping data is shifted from mapping register 251 to mapping register 252 (process step 320). The processing of the new instruction continues as the decoded instruction is shifted from operand fetch stage 215 to execute stage 220 and then to write-back stage 225. At the same time, the VID-PID mapping data associated with the new instruction is shifted from mapping register 252 to mapping register 253 and then to mapping register 254 (process step 325). If no branch prediction error occurs (or if no branch prediction was associated with the new instruction), write-back stage 225 writes the VID-PID mapping register from mapping register 254 to mapping register 231 in register stack 230 (process step 330). If a branch prediction error did occur, processor 106 transfers the VID-PID mapping data of the last correctly executed instruction from mapping register 231 to mapping register 251 and flushes the pending instructions that are in the instruction pipeline (process step 335).
The present invention has numerous advantages over the prior art. Since after a single translation stage, all register names are converted to fixed, physical register names, it is simple to determine the source and destination operands of each instruction and any dependencies between instructions. Additionally, using a single translation stage to perform the VID-PID register mapping means that all other pipeline stages handle the on-chip registers in a conventional fashion, using just the physical register names. This makes it easy to adapt an existing micro-architecture or micro-architecture concepts for a conventional non-stack-based processor for use in a register-stack based machine, hence gaining the leverage of all the conventional micro-architecture innovations.
Although the present invention has been described in detail, those skilled in the art should understand that they can make various changes, substitutions and alterations herein without departing from the spirit and scope of the invention in its broadest form.

Claims (15)

1. A data processor wherein comprising:
a register stack comprising a plurality of physical registers operable to store operands required by instructions executed by the data processor, wherein the plurality of physical registers appear as a plurality of architectural registers to the instructions;
an instruction execution pipeline comprising a plurality of processing stages, each of the processing stages operable to perform one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline; and
a first mapping register associated with a first one of the processing stages and a second mapping register associated with a second one of the processing stages,
wherein the first mapping register is operable to store first mapping data used to determine a first physical register associated with a first architectural register accessed by a first instruction being processed in the first processing stage,
wherein the first mapping register is operable to transfer the mapping data stored therein to the second mapping register when the pending instruction is transferred from the first processing stage to the second processing stage; and
wherein the second mapping register is operable to store second mapping data used to determine a second physical register associated with a second architectural register accessed by a second instruction being processed in the second processing stage.
2. The data processor as set forth in claim 1 wherein the first mapping data comprises a physical identifier code identifying the first physical register associated with the first architectural registers to be accessed by the first instruction.
3. The data processor as set forth in claim 2 wherein the mapping data comprises a virtual identifier identifying the first architectural register to be accessed by the first instruction.
4. The data processor as set forth in claim 3 wherein the first physical register associated with the first architectural registers to be accessed by the first instruction is one of: 1) a source register containing a first operand to be retrieved by the first instruction and 2) a target register in which the first operand is to be stored by the first instruction.
5. The data processor as set forth in claim 1 wherein the data processor further comprises a third mapping register associated with the register stack, the third mapping register operable to store third mapping data used to determine a third physical register associated with a third architectural register accessed by a last executed instruction.
6. The data processor as set forth in claim 5 wherein the data processor is operable to transfer the third mapping data from the third mapping register to at least one of the first mapping register and the second mapping register.
7. The data processor as set forth in claim 1 wherein the first mapping registers comprises:
a virtual identifier-physical identifier (VID-PID) mapping register associated with a the first one of the processing stages that converts an architectural register name used by the first instruction entering the first one of the processing stages into a physical register name for the first physical register, wherein the data processor tracks a generated VID-PID mapping associated with the first instruction through subsequent ones of the processing stages, and wherein register-based data dependencies between instructions in subsequent ones of the processing stages are detected by comparing a PID of a source register used by the first instruction in one of the processing stages with a PID of a destination register written by an instruction in a subsequent one of the processing stages.
8. The data processor as set forth in claim 7 further comprising:
an apparatus operable to copy contents of a virtual identifier (VID) registers associated with the first physical registers into the VID-PID mapping register associated with the first one of the processing stages.
9. The data processor of claim 1, wherein the first physical registers has a fixed physical register name given by a physical identifier (PID) and a variable architectural register name given by a virtual identifier (VID), and wherein the VID for the first physical register is stored in a VID register associated with the first physical register.
10. The data processor of claim 9, further comprising an architectural-register reordering mechanism operable to virtually reorder results between the first architectural register associated with the first physical data register and the second architectural register associated with the second physical data register, the virtual reordering comprising modifying a data value in a first VID register associated with the first physical data register and modifying a data value in a second VID register associated with the second physical data register.
11. The method of claim 1, wherein the first mapping data comprises:
a physical identifier code identifying the first physical register associated with the first architectural register to be accessed by the first instruction; and
a virtual identifier identifying the first architectural register to be accessed by the first instruction.
12. A processing system comprising:
a memory operable to store data and executable programs; and
a data processor comprising:
a register stack comprising a plurality of physical registers operable to store operands required by instructions executed by the data processor, wherein the plurality of physical registers appear as a plurality of architectural registers to the instructions;
an instruction execution pipeline comprising a plurality of processing stages, each of the processing stages operable to perform one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline; and
a first mapping register associated with a first one of the processing stages and a second mapping register associated with a second one of the processing stages,
wherein the first mapping register is operable to store first mapping data used to determine a first physical register associated with a first architectural register accessed by a first instruction being processed in the first processing stage,
wherein the first mapping register is operable to transfer the mapping data stored therein to the second mapping register when the pending instruction is transferred from the first processing stage to the second processing stage, and
wherein the second mapping register is operable to store second mapping data used to determine a second physical register associated with a second architectural register accessed by a second instruction being processed in the second processing stage.
13. The processing system as set forth in claim 12 wherein the data processor further comprises a third mapping register associated with the register stack, the third mapping register operable to store third mapping data used to determine a third physical register associated with a third architectural register accessed by a last executed instruction.
14. The processing system as set forth in claim 13 wherein the data processor is operable to transfer the third mapping data from the third mapping register to at least one of the first mapping register and the second mapping register.
15. For use in a data processor comprising a plurality of physical registers arranged in a register stack operable to store operands required by instructions executed by the data processor and an instruction execution pipeline comprising a plurality of processing stages, the plurality of physical registers appearing as a plurality of architectural registers to the instructions, each of the processing stages operable to perform one of a plurality of execution steps associated with a pending instruction being executed by the instruction execution pipeline, a method of handling data dependencies between ones of the instructions, the method comprising:
retrieving and decoding a first instruction;
determining first mapping data used to determine one of the physical registers associated with one of the architectural registers accessed by the first instruction based on previous mapping data associated with a previously fetched instruction and based on an operation performed by the first instruction affecting the register stack;
storing the first mapping data in a first mapping register associated with a first one of the processing stages; and
transferring the first mapping data stored in the first mapping register to a second mapping register associated with a second one of the processing stages when the first instruction is transferred from the first processing stage to the second processing stage.
US09/561,241 2000-04-28 2000-04-28 System and method for handling register dependency in a stack-based pipelined processor Expired - Fee Related US7496734B1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US09/561,241 US7496734B1 (en) 2000-04-28 2000-04-28 System and method for handling register dependency in a stack-based pipelined processor
EP01303827A EP1150203A3 (en) 2000-04-28 2001-04-26 System and method for handling register dependency in a stack-based pipelined processor
JP2001130880A JP2001356905A (en) 2000-04-28 2001-04-27 System and method for handling register dependency in pipeline processor based on stack

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US09/561,241 US7496734B1 (en) 2000-04-28 2000-04-28 System and method for handling register dependency in a stack-based pipelined processor

Publications (1)

Publication Number Publication Date
US7496734B1 true US7496734B1 (en) 2009-02-24

Family

ID=24241195

Family Applications (1)

Application Number Title Priority Date Filing Date
US09/561,241 Expired - Fee Related US7496734B1 (en) 2000-04-28 2000-04-28 System and method for handling register dependency in a stack-based pipelined processor

Country Status (3)

Country Link
US (1) US7496734B1 (en)
EP (1) EP1150203A3 (en)
JP (1) JP2001356905A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090006905A1 (en) * 2007-06-27 2009-01-01 David Arnold Luick In Situ Register State Error Recovery and Restart Mechanism
US20090327653A1 (en) * 2007-04-19 2009-12-31 Masaki Maeda Reconfigurable computing circuit
CN110532030A (en) * 2019-08-01 2019-12-03 安凯(广州)微电子技术有限公司 Optimize the method for register access in a kind of CPU

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6694420B2 (en) * 2001-12-05 2004-02-17 Stmicroelectronics, Inc. Address range checking circuit and method of operation
US7624254B2 (en) * 2007-01-24 2009-11-24 Qualcomm Incorporated Segmented pipeline flushing for mispredicted branches
US7853827B2 (en) 2008-08-29 2010-12-14 International Business Machines Corporation Isotropic processor

Citations (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4112489A (en) * 1976-02-06 1978-09-05 International Computers Limited Data processing systems
US4974158A (en) * 1987-06-10 1990-11-27 Mitsubishi Denki Kabushiki Kaisha Multiple sequentially transferrable stackpointers in a data processor in a pipelining system
US4989138A (en) * 1988-09-02 1991-01-29 Tektronix, Inc. Single bus graphics data processing pipeline with decentralized bus arbitration
US5142635A (en) * 1989-04-07 1992-08-25 Intel Corporation Method and circuitry for performing multiple stack operations in succession in a pipelined digital computer
US5471626A (en) * 1992-05-06 1995-11-28 International Business Machines Corporation Variable stage entry/exit instruction pipeline
US5522051A (en) * 1992-07-29 1996-05-28 Intel Corporation Method and apparatus for stack manipulation in a pipelined processor
US5548736A (en) * 1991-03-14 1996-08-20 Fujitsu Limited Method and apparatus overcoming delay introduced by instruction interlocking in pipelined instruction execution
US5574871A (en) * 1994-01-04 1996-11-12 Intel Corporation Method and apparatus for implementing a set-associative branch target buffer
US5687336A (en) * 1996-01-11 1997-11-11 Exponential Technology, Inc. Stack push/pop tracking and pairing in a pipelined processor
US5701508A (en) * 1995-12-19 1997-12-23 Intel Corporation Executing different instructions that cause different data type operations to be performed on single logical register file
EP0851343A2 (en) 1996-12-31 1998-07-01 Metaflow Technologies, Inc. System for processing floating point operations
US5852726A (en) * 1995-12-19 1998-12-22 Intel Corporation Method and apparatus for executing two types of instructions that specify registers of a shared logical register file in a stack and a non-stack referenced manner
US5857089A (en) * 1994-06-01 1999-01-05 Advanced Micro Devices, Inc. Floating point stack and exchange instruction
US5905881A (en) * 1995-11-30 1999-05-18 Unisys Corporation Delayed state writes for an instruction processor
US5913047A (en) 1997-10-29 1999-06-15 Advanced Micro Devices, Inc. Pairing floating point exchange instruction with another floating point instruction to reduce dispatch latency
US5974531A (en) 1998-02-17 1999-10-26 Industrial Technology Research Institute Methods and systems of stack renaming for superscalar stack-based data processors
US5987596A (en) 1996-12-13 1999-11-16 Advanced Micro Devices, Inc. Register rename stack for a microprocessor
US5996068A (en) * 1997-03-26 1999-11-30 Lucent Technologies Inc. Method and apparatus for renaming registers corresponding to multiple thread identifications
US6119223A (en) * 1998-07-31 2000-09-12 Advanced Micro Devices, Inc. Map unit having rapid misprediction recovery
US6122727A (en) * 1998-08-24 2000-09-19 Advanced Micro Devices, Inc. Symmetrical instructions queue for high clock frequency scheduling
US6122656A (en) * 1998-07-31 2000-09-19 Advanced Micro Devices, Inc. Processor configured to map logical register numbers to physical register numbers using virtual register numbers
US6134573A (en) * 1998-04-20 2000-10-17 Ip-First, L.L.C. Apparatus and method for absolute floating point register addressing
US6212622B1 (en) * 1998-08-24 2001-04-03 Advanced Micro Devices, Inc. Mechanism for load block on store address generation
US6212623B1 (en) * 1998-08-24 2001-04-03 Advanced Micro Devices, Inc. Universal dependency vector/queue entry
US6591359B1 (en) * 1998-12-31 2003-07-08 Intel Corporation Speculative renaming of data-processor registers

Patent Citations (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4112489A (en) * 1976-02-06 1978-09-05 International Computers Limited Data processing systems
US4974158A (en) * 1987-06-10 1990-11-27 Mitsubishi Denki Kabushiki Kaisha Multiple sequentially transferrable stackpointers in a data processor in a pipelining system
US5566307A (en) * 1987-06-10 1996-10-15 Mitsubishi Denki Dabushiki Kaisha Multiple sequentially transferrable stackpointers in a data processor in a pipelining system
US4989138A (en) * 1988-09-02 1991-01-29 Tektronix, Inc. Single bus graphics data processing pipeline with decentralized bus arbitration
US5142635A (en) * 1989-04-07 1992-08-25 Intel Corporation Method and circuitry for performing multiple stack operations in succession in a pipelined digital computer
US5548736A (en) * 1991-03-14 1996-08-20 Fujitsu Limited Method and apparatus overcoming delay introduced by instruction interlocking in pipelined instruction execution
US5471626A (en) * 1992-05-06 1995-11-28 International Business Machines Corporation Variable stage entry/exit instruction pipeline
US5522051A (en) * 1992-07-29 1996-05-28 Intel Corporation Method and apparatus for stack manipulation in a pipelined processor
US5574871A (en) * 1994-01-04 1996-11-12 Intel Corporation Method and apparatus for implementing a set-associative branch target buffer
US5857089A (en) * 1994-06-01 1999-01-05 Advanced Micro Devices, Inc. Floating point stack and exchange instruction
US5905881A (en) * 1995-11-30 1999-05-18 Unisys Corporation Delayed state writes for an instruction processor
US5852726A (en) * 1995-12-19 1998-12-22 Intel Corporation Method and apparatus for executing two types of instructions that specify registers of a shared logical register file in a stack and a non-stack referenced manner
US5701508A (en) * 1995-12-19 1997-12-23 Intel Corporation Executing different instructions that cause different data type operations to be performed on single logical register file
US5687336A (en) * 1996-01-11 1997-11-11 Exponential Technology, Inc. Stack push/pop tracking and pairing in a pipelined processor
US5987596A (en) 1996-12-13 1999-11-16 Advanced Micro Devices, Inc. Register rename stack for a microprocessor
EP0851343A2 (en) 1996-12-31 1998-07-01 Metaflow Technologies, Inc. System for processing floating point operations
US5996068A (en) * 1997-03-26 1999-11-30 Lucent Technologies Inc. Method and apparatus for renaming registers corresponding to multiple thread identifications
US5913047A (en) 1997-10-29 1999-06-15 Advanced Micro Devices, Inc. Pairing floating point exchange instruction with another floating point instruction to reduce dispatch latency
US5974531A (en) 1998-02-17 1999-10-26 Industrial Technology Research Institute Methods and systems of stack renaming for superscalar stack-based data processors
US6134573A (en) * 1998-04-20 2000-10-17 Ip-First, L.L.C. Apparatus and method for absolute floating point register addressing
US6119223A (en) * 1998-07-31 2000-09-12 Advanced Micro Devices, Inc. Map unit having rapid misprediction recovery
US6122656A (en) * 1998-07-31 2000-09-19 Advanced Micro Devices, Inc. Processor configured to map logical register numbers to physical register numbers using virtual register numbers
US6122727A (en) * 1998-08-24 2000-09-19 Advanced Micro Devices, Inc. Symmetrical instructions queue for high clock frequency scheduling
US6212622B1 (en) * 1998-08-24 2001-04-03 Advanced Micro Devices, Inc. Mechanism for load block on store address generation
US6212623B1 (en) * 1998-08-24 2001-04-03 Advanced Micro Devices, Inc. Universal dependency vector/queue entry
US6591359B1 (en) * 1998-12-31 2003-07-08 Intel Corporation Speculative renaming of data-processor registers

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
InstantWeb Online Computing Dictionary. http://www.instantweb.com/D/dictionary/foldoc.cig?Free+On-line+Dictionary. (c) 1994-1999 InforStreet, Inc. Search Items: "central processing unit", "computer", "first in first out", "stack", and "virtual memory". *
Microsoft Press(R). "Computer Dictionary: The Comprehensive Standard for Business, Scholl, Library, and Home". Second Edition. Redmond, Washington: Microsoft Press (C)1994. p. 371. *
Stevens, Mark A. ed. "Marriam-Webster's Collegiate(R) Dictionary". Tenth Edition. Springfield, Mass.: Marriam-Webster, Inc. (C)1997. p. 1143. *
Weiss, Mark Aleen. "Data Structures and Algorithm Analysis in C++". Second Edition. Reading, Mass.: Addison Wesley Longman, Inc. (C)1999. pp. 93-115. *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090327653A1 (en) * 2007-04-19 2009-12-31 Masaki Maeda Reconfigurable computing circuit
US7996657B2 (en) * 2007-04-19 2011-08-09 Panasonic Corporation Reconfigurable computing circuit
US20090006905A1 (en) * 2007-06-27 2009-01-01 David Arnold Luick In Situ Register State Error Recovery and Restart Mechanism
US7865769B2 (en) * 2007-06-27 2011-01-04 International Business Machines Corporation In situ register state error recovery and restart mechanism
CN110532030A (en) * 2019-08-01 2019-12-03 安凯(广州)微电子技术有限公司 Optimize the method for register access in a kind of CPU
CN110532030B (en) * 2019-08-01 2023-07-07 广州安凯微电子股份有限公司 Method for optimizing register access in CPU

Also Published As

Publication number Publication date
EP1150203A2 (en) 2001-10-31
JP2001356905A (en) 2001-12-26
EP1150203A3 (en) 2005-12-07

Similar Documents

Publication Publication Date Title
US5758112A (en) Pipeline processor with enhanced method and apparatus for restoring register-renaming information in the event of a branch misprediction
US6665776B2 (en) Apparatus and method for speculative prefetching after data cache misses
US7711929B2 (en) Method and system for tracking instruction dependency in an out-of-order processor
US6009512A (en) Mechanism for forwarding operands based on predicated instructions
US5751983A (en) Out-of-order processor with a memory subsystem which handles speculatively dispatched load operations
US8635437B2 (en) Pipelined microprocessor with fast conditional branch instructions based on static exception state
KR100953856B1 (en) System and method wherein conditional instructions unconditionally provide output
US5517657A (en) Segment register file read and write pipeline
EP3301566A1 (en) Pipelined processor with multi-issue microcode unit having local branch decoder
US20080177988A1 (en) Partial Load/Store Forward Prediction
US20020091915A1 (en) Load prediction and thread identification in a multithreaded microprocessor
EP0381444A2 (en) Branch prediction
JPH0334024A (en) Method of branch prediction and instrument for the same
JPH02234248A (en) Processing of memory access exception by instruction fetched previously within instruction pipeline of digital computer with virtual memory system as base
US10310859B2 (en) System and method of speculative parallel execution of cache line unaligned load instructions
JP2012230687A (en) Segmented pipeline flushing for mispredicted branches
KR100368166B1 (en) Methods for renaming stack references in a computer processing system
US6381691B1 (en) Method and apparatus for reordering memory operations along multiple execution paths in a processor
JPH08292886A (en) Method and apparatus for implementation of non-folding load instruction
JP3866920B2 (en) A processor configured to selectively free physical registers during instruction retirement
US7496734B1 (en) System and method for handling register dependency in a stack-based pipelined processor
US5841999A (en) Information handling system having a register remap structure using a content addressable table
US6175909B1 (en) Forwarding instruction byte blocks to parallel scanning units using instruction cache associated table storing scan block boundary information for faster alignment
US6829702B1 (en) Branch target cache and method for efficiently obtaining target path instructions for tight program loops
EP0912927B1 (en) A load/store unit with multiple pointers for completing store and load-miss instructions

Legal Events

Date Code Title Description
STCF Information on status: patent grant

Free format text: PATENTED CASE

FPAY Fee payment

Year of fee payment: 4

FPAY Fee payment

Year of fee payment: 8

FEPP Fee payment procedure

Free format text: MAINTENANCE FEE REMINDER MAILED (ORIGINAL EVENT CODE: REM.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

LAPS Lapse for failure to pay maintenance fees

Free format text: PATENT EXPIRED FOR FAILURE TO PAY MAINTENANCE FEES (ORIGINAL EVENT CODE: EXP.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

STCH Information on status: patent discontinuation

Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362

FP Lapsed due to failure to pay maintenance fee

Effective date: 20210224