WO2015165017A1 - 一种数据处理装置及方法 - Google Patents

一种数据处理装置及方法 Download PDF

Info

Publication number
WO2015165017A1
WO2015165017A1 PCT/CN2014/076406 CN2014076406W WO2015165017A1 WO 2015165017 A1 WO2015165017 A1 WO 2015165017A1 CN 2014076406 W CN2014076406 W CN 2014076406W WO 2015165017 A1 WO2015165017 A1 WO 2015165017A1
Authority
WO
WIPO (PCT)
Prior art keywords
register
module
source
register number
physical
Prior art date
Application number
PCT/CN2014/076406
Other languages
English (en)
French (fr)
Inventor
陈云
蔡卫光
宋昆鹏
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/076406 priority Critical patent/WO2015165017A1/zh
Priority to CN201480000412.3A priority patent/CN105308557B/zh
Publication of WO2015165017A1 publication Critical patent/WO2015165017A1/zh

Links

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/38Concurrent instruction execution, e.g. pipeline, look ahead

Definitions

  • the present invention relates to the field of computers, and in particular, to a data processing apparatus and method. Background technique
  • Superscalar general purpose processors generally include
  • IFU Instruction Fetch Unit
  • Pre-decoder IB
  • IB Instruction Buffer
  • Decoder Decoder
  • Rename module RF (Register File, Register) module
  • Exe Executecute Unit
  • WB Write Back
  • the Rename module can use the renaming technique to map the register number of an architecture register to the physical
  • the register number of the register the physical register is any one of a plurality of free physical registers
  • the architecture register is an integral part of the processor instruction architecture
  • the RF module is used to store intermediate results during the operation of the instruction and the super-scalar universal The operating state of the processor.
  • RF generally includes the RFC (Register File Cache) submodule and the MRF (Main Register File) submodule.
  • RFC sub-modules generally contain the most recently used physical mail Is, all the sub-module comprises MRF physical registers, RFC submodule physical registers is a subset of physical registers MRF submodule.
  • the IFU module reads an instruction from a memory or a cache memory, and transmits the instruction to a Pre-decoder module, and the Pre-decoder module pre-decodes the instruction to obtain an instruction type, a source register number, and a destination register number. And transfer the source register number and the destination register number to the IB module.
  • the IB module stores the source register number and the destination register number, and then registers the source register number and destination through the Decoder module.
  • the device number is transferred to the Rename module, and then the Rename module maps the source register number to the register number of the first physical register, the destination register number to the register number of the second physical register, and the register number of the first physical register And a register number of the second physical register is transmitted to the RF module, the source register number is a register number of an architectural register of the source operand of the instruction, and the destination register number is an architectural register of the destination operand of the instruction a register number, the instruction includes a register number of an architectural register of the source operand and a register number of an architectural register of the destination operand, the first physical register being a plurality of free physical registers in the RFC submodule or the MRF submodule
  • the second physical register is any one of a plurality of free physical registers in the RFC submodule or the MRF submodule, and the register number of the first physical register is different from the register number of the second physical register.
  • the RFC sub-module has fast read/write speed and supports multi-port simultaneous read and write, but the storage capacity is limited.
  • the MRF sub-module has large storage capacity, but the read-write port is limited and the read-write speed is slow.
  • the RFC sub-module obtains the source operand from the first physical register according to the register number of the first physical register, and the RFC sub-module transmits the source operand to the Exe module, and the Exe module computes the source operand.
  • the destination operand, the WB module writes the destination operand back to the second physical register according to the register number of the second physical register transmitted by the RFC submodule, where the first physical register is a physical register in the RFC submodule.
  • the RFC sub-module cannot obtain the source operand in the RFC sub-module according to the register number of the first physical register, and the MRF sub-module needs to be based on the register number of the first physical register.
  • the source operand is obtained from the first physical register, and the MRF sub-module backfills the first physical register into the RFC sub-module, causing the first physical register to cover the physical registers needed by other instructions in the RFC sub-module. Therefore, there is a problem that the use efficiency of the RFC sub-module is low.
  • Embodiments of the present invention provide a data processing apparatus and method, which can effectively improve
  • a data processing apparatus includes an instruction pre-decode Pre-decoder module, an instruction cache IB module, and a register file control RF.
  • the register file control module is configured to obtain N source register numbers and N destinations from the instruction pre-decoding module, or the instruction cache module, or the instruction pre-decoding module and the instruction cache module. Register number
  • the register file control module is further configured to:
  • the register number of the i-th target When the register number of the i-th target satisfies the first preset condition, the register number of the i-th destination is marked, and the 1 is an integer greater than or equal to 1 and less than or equal to N, and the N is an integer greater than or equal to 2;
  • the renaming module is configured to map the first destination register number of the tag to a register number of a first physical register in the register file buffer submodule, where the first physical register is the register file buffer Any of a number of free physical registers in the module.
  • the first preset condition is that the register number of the i-th destination is equal to at least one source register number of the i+1 source register number to the Nth source register number, and the i+1 is an integer less than N.
  • the instruction pre-decoding module is configured to pre-decode at least one instruction to obtain N source register numbers and N destination register numbers, each of the instructions including at least one source register number and at least one destination register number;
  • the instruction cache module is configured to store the instruction.
  • the register file control module is specifically configured to:
  • N-1 source register numbers and N-1 destination register numbers are obtained from the instruction cache module, and the Nth source register number and the Nth directory register number are obtained from the instruction precoding module.
  • the register file control module is further configured to:
  • the i+1th source register number When the i+1th source register number satisfies the second preset condition, the i+1th source register number is marked, and the 1+1 is an integer less than or equal to N;
  • the rename module is also used to:
  • the register file buffer submodule is configured to read a first source operand from the physical register according to a register number of the physical register.
  • the second preset condition is that the i+1th source register number is equal to any one of a first destination register number and a first destination register number. a destination register number, wherein the i+1 is an integer less than or equal to N, or the i+1th source register number is equal to two or more source register numbers of the N source register numbers.
  • the renaming module is specifically configured to:
  • the register file buffer submodule is specifically configured to:
  • the first source operand is read from the first physical register based on a register number of the first physical register.
  • the register file control module is further configured to:
  • the i+1 destination register number is equal to at least one source register number of the i+2th source register number to the Nth source register number, the i+1th destination register number is marked, and the i+2 is an integer less than or equal to N ;
  • the rename module is also used to:
  • the data processing apparatus further includes an execution unit Exe module and a write back WB module, where
  • the execution unit module is configured to acquire the register numbers of the first source operand and the second physical register, and obtain the first destination operand according to the first source operand operation;
  • the write back module is configured to write the first destination operand back to the second physical register according to a register number of the second physical register.
  • the rename module is also used to:
  • the i-th destination register number is mapped to a register number of a third physical register in the main register file sub-module, the third physical register being any one of a plurality of free physical registers in the main register file sub-module.
  • the rename module is also used to:
  • the i+1th source register number is not equal to any one of the i-th destination register number to the first destination register number, or the first +1 source register number is not equal to the N source register numbers
  • the main register file submodule is configured to read a second source operand from the fourth physical register according to a register number of the fourth physical register.
  • the rename module is also used to:
  • the execution unit module is configured to acquire register numbers of the first source operand and the fifth physical register, according to the a source operand operation to obtain a first destination operand;
  • the write back module is configured to use the register number of the fifth physical register The first destination operand is written back to the fifth physical register.
  • the execution unit module is further configured to:
  • the writeback module is further configured to:
  • the second destination operand is written back to the fifth physical register based on the register number of the fifth physical register.
  • a data processing method for a data processing apparatus, the data processing apparatus comprising an instruction pre-decode Pre-decoder module, an instruction cache IB module, a register file control RF-Ctl module, a rename Rename module, a register file RF module, the RF module including a register file buffer RFC submodule and a main register file MRF submodule, wherein
  • N source register numbers and N destination register numbers from the instruction pre-decoding module, or the instruction cache module, or the instruction pre-decoding module and the instruction cache module;
  • the register number of the i-th target When the register number of the i-th target satisfies the first preset condition, the register number of the i-th destination is marked, and the i is an integer greater than or equal to 1 and less than or equal to N, and the N is an integer greater than or equal to 2;
  • the first preset condition is that the i-th destination register number is equal to at least one source register number of the i+1th source register number to the Nth source register number,
  • the i+ 1 is an integer less than or equal to N.
  • the method further includes:
  • the acquiring the N source register numbers and the N destination register numbers from the instruction pre-decoding module, or the instruction cache module, or the instruction pre-decoding module and the instruction cache module includes:
  • N-1 source register numbers and N-1 destination register numbers are obtained from the instruction cache module, and the Nth source register number and the Nth directory register number are obtained from the instruction precoding module.
  • the method further includes: when the i-th source register number satisfies the second pre- When the condition is set, the first + 1 source register number is marked, and the i+ 1 is an integer less than or equal to N;
  • the second preset condition is that the i+1th source register number is equal to any one of an i-th destination register number and a first destination register number. a destination register number, wherein the i+1 is an integer less than or equal to N, or the i+1th source register number is equal to two or more source register numbers of the N source register numbers.
  • mapping of the i+1 source register number of the tag to a physical register of the register file buffer submodule includes:
  • the first source operand is read from the first physical register based on a register number of the first physical register.
  • the method further includes:
  • the i+1 destination register number is equal to at least one source register number of the i+2th source register number to the Nth source register number, the i+1th destination register number is marked, and the i+2 is an integer less than or equal to N ;
  • the data processing apparatus further includes an execution unit Exe module and a write back WB module, where the i+1th destination register number to be marked is mapped to After the register file buffers the register number of the second physical register in the sub-module, the method further includes: Obtaining the first source operand and the register number of the second physical register, and obtaining a first destination operand according to the first source operand operation;
  • the first destination operand is written back to the second physical register based on the register number of the second physical register.
  • the slave instruction precoding module, or the instruction cache module, or the instruction precoding module and the instruction cache module After obtaining the N source register numbers and the N destination register numbers, the method further includes:
  • mapping the i-th destination register number to the main register file sub-module a register number of the third physical register, the third physical register being any one of a plurality of free physical registers in the main register file sub-module.
  • the instruction precoding module, or the instruction cache module, or the instruction precoding module and the instruction cache module After obtaining the N source register numbers and the N destination register numbers, the method further includes:
  • the i+1th source register number is not equal to any one of the i-th destination register number to the first destination register number, or the i+1th source register number is not equal to the N source register numbers
  • the source register number is any one
  • the i+1th source register number is mapped to a register number of a fourth physical register in the main register file submodule, and the fourth physical register is in the main register file submodule Any of a number of free physical registers.
  • the eleventh implementation after the mapping the i+1th source register number to the register number of the fourth physical register in the main register file submodule, The method further includes:
  • Reading from the fourth physical register according to the register number of the fourth physical register Take the second source operand.
  • the method further includes:
  • the method further includes:
  • the first destination operand is written back to the fifth physical register based on the register number of the fifth physical register.
  • the fourteenth implementation after the second source operand is read from the fourth physical register according to the register number of the fourth physical register, the method also includes:
  • the method after the mapping the i+1th destination register number to the register number of the fifth physical register in the main register file submodule, The method also includes: Obtaining the second source operand and the register number of the fifth physical register, and obtaining a second destination operand according to the second source operand operation;
  • the second destination operand is written back to the fifth physical register based on the register number of the fifth physical register.
  • An embodiment of the present invention provides a data processing apparatus and method, the data processing apparatus including: the data processing apparatus includes an instruction pre-decode Pre-decoder module, an instruction cache IB module, a register file control RF-Ctl module, Renaming a Rename module, a register file RF module, the RF module comprising a register file buffer RFC sub-module and a main register file MRF sub-module, wherein the register file control module is configured to use the instruction pre-decoding module, or The instruction cache module, or the instruction pre-decoding module and the instruction cache module acquire N source register numbers and N destination register numbers; the register file control module is further configured to: when the ith destination register number When the first preset condition is met, the ith destination register number is marked, the i is an integer greater than or equal to 1 and less than or equal to N, and the N is an integer greater than or equal to 2; the renaming module is configured to The first i-th register number of the tag is mapped to the first physical register of the register file buffer
  • the ith destination register number obtained by the register file control module satisfies the first preset condition
  • the ith destination register number is marked, and the rename module maps the ith destination register number to the register file buffer submodule.
  • the physical register number can effectively improve the use efficiency of the register file buffer sub-module relative to the prior art.
  • FIG. 1 is a schematic structural diagram of a prior art data processing apparatus according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a data processing method according to an embodiment of the present invention
  • FIG. 4 is a flowchart of another data processing method according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 6 is a flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 7 is a flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 9 is still another data processing according to an embodiment of the present invention. Method flow chart.
  • the data processing apparatus 10 includes an instruction reading unit (IFU) module 101, an instruction pre-decoder module 102, an instruction buffer (IB) module 103, and instruction decoding ( Decoder) module 104, rename (Rename) module 105, register file (RF) module 106, execution unit (Exe) module 107, and write back (WB) module 108, wherein register file (RF) module 106 includes register file cache (RFC) sub-module 1061 and main register file (MRF) sub-module 1062.
  • the data processing device 10 can be a superscalar general purpose processor.
  • the instruction read unit module 101 is connected to the instruction pre-decoding module 102, the instruction pre-decoding module 102 is connected to the instruction cache module 103, the instruction cache module 103 is connected to the instruction decoding module 104, and the instruction decoding module 104 is renamed.
  • the module 105 is connected, the rename module 105 is connected to the register file buffer sub-module 1061, and the register stack is slowed down.
  • the memory module 1061 is connected to the main register file sub-module 1062, the main register file sub-module 1062 is connected to the execution unit module 107, the execution unit module 107 is connected to the write-back module 108, and the write-back module 108 is connected to the register file buffer sub-module 1061 and The main register file sub-module 1062, the register file buffer sub-module 1061 is further connected to the execution unit module 107.
  • the embodiment of the present invention provides a data processing apparatus 20, as shown in FIG. 2, including an instruction reading unit (IFU) module 201, an instruction pre-decode module 202, an instruction buffer (IB) module 203, and a register. Heap control (RF-Ctl) module 204, instruction decode (Decoder) module 205, rename (Rename) module 206, register file
  • IFU instruction reading unit
  • IB instruction buffer
  • RF-Ctl Heap control
  • Decoder instruction decode
  • Rename rename
  • RF register file stack
  • the data processing device 20 can be a superscalar general purpose processor.
  • the (Pre-decoder) module 202 is connected, the pre-decoder module 202 is connected to the instruction buffer (IB) module 203, and the instruction buffer (IB) module 203 is connected to the instruction decoder (Decoder) module 205.
  • the Decoder module 205 is coupled to the Rename module 206, and the Rename module 206 is coupled to the Register Heap Cache (RFC) sub-module 2071, the Register Heap Cache (RFC) sub-module 2071 and the main register file ( MRF) module 2072 is connected, main register file (MRF) sub-module 2072 is connected to execution unit (Exe) module 208, execution unit (Exe) module 208 is connected to write back (WB) module 209, and write back (WB) module 209 is respectively
  • a Register Register Heap (RFC) sub-module 2071 is connected to a main register file (MRF) sub-module 2072, and a register file buffer (RFC) sub-module 2071 is coupled to an Exe module 208, a register-stack control (RF-Ctl) module.
  • 204 is connected to an instruction pre-decoder module 202, an instruction cache (IB) module 203, and a rename
  • the register file control module 204 is configured to obtain N source registers from the instruction pre-decoding module 202, or the instruction cache module 203, or the instruction pre-decoding module 202 and the instruction cache module 203. Number and N destination register numbers.
  • the register file control module 204 is further configured to: when the first i-th register number satisfies the first preset condition, mark the i-th destination register number, where i is an integer greater than or equal to 1 and less than or equal to N, the N Is an integer greater than or equal to 2.
  • the first preset condition is that the register number of the i-th destination is equal to at least one source register number of the i+1 source register number to the Nth source register number, and the 1+1 is an integer less than N.
  • the renaming module 206 is configured to map the i-th destination register number of the tag to a register number of a first physical register in the register file buffer sub-module 2071, and the first physical register is the register file buffer Any one of a plurality of free physical registers in submodule 2071.
  • the renaming module maps the i-th destination register number to the register file buffer sub-module.
  • the physical register number can effectively improve the use efficiency of the register file buffer sub-module relative to the prior art.
  • the instruction pre-decoding module 202 is configured to pre-decode at least one instruction to obtain N source register numbers and N destination register numbers, each of the instructions including at least one source register number and at least one destination register number.
  • the instruction cache module 203 is configured to store the instructions.
  • the register file control module 204 is specifically configured to:
  • N source register numbers and N destination register numbers directly from the instruction pre-decoding module 202;
  • the N-th source register number and the N-th destination register number are acquired from the instruction cache module 203, and the N-th source register number and the N-th destination register number are acquired from the instruction pre-decoding module 202.
  • the register file control module 204 is further configured to:
  • the i+1 source register number When the i+1 source register number satisfies the second preset condition, the i+1th source register number is marked, and the i+1 is an integer less than or equal to N.
  • the second preset condition is that the i+1th source register number is equal to any one of the i-th destination register number to the first destination register number, and the i+1 is an integer less than or equal to N, or The i+1 source register number is equal to two or more source register numbers of the N source register numbers.
  • the rename module 206 is further configured to:
  • the register file buffer sub-module 207 1 is configured to read a first source operand from the physical register according to a register number of the physical register.
  • the renaming module 206 is specifically configured to:
  • the i+1th source register number of the tag is mapped to the register number of the first physical register in the register file buffer sub-module 2071.
  • the register file buffer sub-module 2071 is specifically configured to:
  • the first source operand is read from the first physical register based on a register number of the first physical register.
  • the register file control module 204 is further configured to:
  • marking the i+1 destination register number, i+2 is an integer less than or equal to N.
  • the rename module 206 is further configured to:
  • the execution unit module 208 is configured to acquire the first source operand and the register number of the second physical register, and obtain the first destination operand according to the first source operand operation.
  • the write back module 209 is configured to write the first destination operand back to the second physical register according to the register number of the second physical register.
  • the rename module 206 is further configured to:
  • mapping the i-th destination register number to the main register file sub-module a register number of the third physical register, the third physical register being any one of a plurality of free physical registers in the main register file sub-module.
  • the rename module 206 is further configured to:
  • the i+1th source register number is not equal to any one of the i-th destination register number to the first destination register number, or the i+1th source register number is not equal to the N source register numbers
  • the main register file sub-module 2072 is configured to read a second source operand from the fourth physical register according to a register number of the fourth physical register.
  • the rename module 206 is further configured to:
  • the i+1th destination register number is not equal to the i+2 source register number to the Nth source
  • the i+1th destination register number is mapped to a register number of a fifth physical register in the main register file submodule, and the fifth physical register is the main register file Any of a number of free physical registers in a submodule.
  • the execution unit module 208 is configured to acquire the first source operand and the register number of the fifth physical register, and obtain the first destination operand according to the first source operand operation.
  • the write back module 209 is configured to write the first destination operand back to the fifth physical register according to the register number of the fifth physical register.
  • the execution unit module 208 is further configured to:
  • the write back module 209 is also used to:
  • the second destination operand is written back to the fifth physical register based on the register number of the fifth physical register.
  • the instruction read unit (IFU) module 201 reads two instructions from the cache or the cache and transfers the two instructions to the instruction pre-
  • the pre-decode module 202 is the first instruction and the second instruction, respectively.
  • the pre-decode module 202 pre-decodes the first instruction and the second instruction to obtain an instruction type, a source register number, and a destination register number of each of the instructions, where
  • the first instruction includes a first instruction type, three source register numbers, and three destination register numbers, and the three source register numbers are a first source register number, a second source register number, a third source register number, and three destination registers, respectively.
  • the numbers are the first destination register number, the second destination register number, and the third destination register number
  • the second instruction includes the second instruction type, three source register numbers, and three destination register numbers
  • the three source register numbers are respectively Four source register number, fifth source register number, sixth source
  • the register number and the three destination register numbers are the fourth destination register number, the fifth destination register number, and the sixth destination register number, respectively.
  • the instruction pre-decode module 202 then transfers the six source register numbers and the six destination register numbers to the instruction cache (IB) module 203.
  • the instruction cache (IB) module 203 stores the six source register numbers and the six destination register numbers.
  • the register file control (RF-Ctl) module 204 retrieves the six source register numbers and the six destination register numbers from the instruction cache (IB) module 203. Register file control
  • the (RF-Ctl) module 204 analyzes the correlation between the six source register numbers and the six destination register numbers. Specifically, it is assumed that the six source register numbers are respectively a first source register number to a sixth source register number, and the six destination register numbers are respectively a first register number to a sixth register number.
  • the register file control (RF-Ctl) module can also obtain six source register numbers and six destination register numbers from the instruction predecode module or from the instruction predecode module and the instruction cache module.
  • the register file control (RF-Ctl) module can obtain five source register numbers and five destination register numbers from the instruction cache module.
  • the code module acquires a source register number and a destination register number.
  • the register file control (RF- The C204) module 204 marks the first source register number and the first destination register number, and transmits the first source register number of the tag and the first destination register number of the tag to the Rename module 206.
  • Rename module 206 maps the first source register number of the tag to the register number of the first physical register in register file buffer (RFC) sub-module 2071, mapping the first destination register number of the tag to The register number of the second physical register in the register file buffer (RFC) sub-module 2071, and the first physical register The register number of the device and the register number of the second physical register are transferred to the register file buffer
  • the register number of the first physical register is any one of a plurality of free physical registers in the register file buffer sub-module, and the register number of the second physical register is multiple idle in the register file buffer sub-module Any one of the physical registers, the register number of the first physical register being different from the register number of the second physical register.
  • the register file buffer (RFC) sub-module 2071 reads the first source operand from the first physical register according to the register number of the first physical register, and transfers the register number of the first source operand and the second physical register to execution Unit (Exe) module 208.
  • the Exe module (Exe) module 208 operates on the first source operand to obtain the first operand, and then transfers the first destination operand and the second physical register register number to the write back (WB) module 209.
  • the Write Back (WB) module 209 writes the first destination operand back to the second physical register in the Register Heap Cache (RFC) sub-module 2071 based on the register number of the second physical register.
  • RRC Register Heap Cache
  • the register file control (RF-Ctl) module 204 marks the second source register number and the second The destination register number, and the marked second source register number and the marked second destination register number are transferred to the rename (Rename) module 206.
  • the second source register number may also be equal to the first source register number and the fifth source register number, and the register file control (RF-Ctl) module 204 may also mark the second source register number and mark the The second source register number is transferred to the Rename module 206.
  • RF-Ctl register file control
  • Rename module 206 maps the second source register number of the tag to the register number of the second physical register in register file buffer (RFC) sub-module 2071, the register number of the second physical register is The first destination register number The register number of the physical register that was shot. Mapping the second destination register number of the tag to the register number of the third physical register in the register file buffer (RFC) sub-module 2071, and transmitting the register number of the second physical register and the register number of the third physical register to Register Heap Cache (RFC) sub-module 2071.
  • RRC register file buffer
  • the register file buffer (RFC) sub-module 2071 reads the second source operand from the second physical register according to the register number of the second physical register, and transfers the register number of the second source operand and the third physical register to execution Unit (Exe) module 208.
  • Execution unit (Exe) module 208 operates on the second source operand to obtain the second operand, and transmits the second destination operand and the third physical register register number to write back (WB) module 209.
  • WB Write back (WB) module 209 writes the second operand to the third physical register in register file buffer (RFC) sub-module 2071 based on the register number of the third physical register.
  • RRC register file buffer
  • the register file control (RF-Ctl) module 204 transfers the third source register number and the third destination register number to the rename (Rename) module 206 when any one of the register number, the fifth source register number, and the sixth source register number. .
  • the Rename module 206 maps the third source register number to the register number of the first physical register in the main register file (MRF) sub-module 2072, and maps the third destination register number to the main register file (MRF) sub-module.
  • a register number of the second physical register in 2072 and transferring the register number of the first physical register and the register number of the second physical register to a register file buffer (RFC) sub-module 2071, a register file buffer (RFC) Sub-module 2071 then transfers the register number of the first physical register and the register number of the second physical register to a main register file (MRF) sub-module 2072.
  • the main register file (MRF) sub-module 2072 reads the third source operand from the first physical register according to the register number of the first physical register, and transmits the third source operand and the register number of the second physical register To the Exe unit (Exe) module 208.
  • MRF main register file
  • the Exe module (Exe) module 208 operates on the third source operand to obtain the operand of the third destination, and then transfers the third destination operand and the register number of the second physical register to the write back (WB) module 209.
  • WB Write back
  • MRF main register file
  • the register file control (RF-Ctl) module 204 marks the fourth destination register number and transfers the fourth source register number and the marked fourth destination register number to the rename (Rename) module. 206.
  • Rename module 206 maps the fourth destination register number of the tag to the register number of the fourth physical register in register file buffer (RFC) sub-module 2071, and maps the fourth source register number to the main register file ( MRF) a register number of a third physical register in the submodule 2072, and transferring the register number of the fourth physical register and the register number of the third physical register to a register file buffer (RFC) sub-module 2071, a register file
  • the cache (RFC) sub-module 2071 then transfers the register number of the fourth physical register and the register number of the third physical register to the main register file (MRF) sub-module 2072.
  • the main register file (MRF) sub-module 2072 reads the fourth source operand from the third physical register according to the register number of the third physical register, and transmits the register number of the fourth source operand and the fourth physical register To the Exe unit (Exe) module 208.
  • Execution unit (Exe) module 208 obtains fourth according to the fourth source operand operation
  • the destination operand, the fourth destination operand and the register number of the fourth physical register are transferred to the write back (WB) module 209.
  • the Write Back (WB) module 209 writes the fourth-order operand back to the fourth physical register in the Register Heap Cache (RFC) sub-module 2071 based on the register number of the fourth physical register.
  • RRC Register Heap Cache
  • the register file control (RF-Ctl) module 204 marks the fifth source register number, The marked fifth source register number and fifth destination register number are transferred to the Rename module 206.
  • the fifth source register number may also be equal to the first source register number and the second source register number, and the register file control (RF-Ctl) module 204 may also mark the fifth source register number and mark the fifth number.
  • the source register number is transferred to the Rename module 206.
  • Rename module 206 maps the fifth source register number of the tag to the register number of the fourth physical register in register file buffer (RFC) sub-module 2071, the register number of said fourth physical register is The register number of the physical register to which the fourth destination register number is mapped. Mapping the fifth destination register number to the register number of the fourth physical register in the main register file (MRF) sub-module 2072, and registering the register number of the fourth physical register in the register file buffer (RFC) sub-module 2071 The register number of the fourth physical register in the main register file (MRF) sub-module 2072 is transferred to the register file buffer (RFC) sub-module 2071.
  • the register file buffer (RFC) sub-module 2071 reads the source operand from the fourth physical register fifth according to the register number of the fourth physical register, and then the fifth source operand and the main register file (MRF) sub-module
  • the register number of the fourth physical register in 2072 is transferred to a main register file (MRF) sub-module 2072, and the main register file (MRF) sub-module 2072 re-registers the fifth source operand and the fourth physical register register number. Transfer to the Exe unit 208.
  • the Exe module 208 operates to obtain a fifth destination operand based on the fifth source operand, and transmits the fifth destination operand and the register number of the fourth physical register to the write back (WB) module 209.
  • the Write Back (WB) module 209 writes the fifth-order operand back to the fourth physical register in the main register file (MRF) sub-module 2072 based on the register number of the fourth physical register.
  • MRF main register file
  • the register file control (RF-Ctl) module 204 marks the sixth source register number and transmits the marked sixth source register number and the sixth destination register number to Rename module 206.
  • Rename module 206 maps the sixth source register number of the tag to the register number of the third physical register in register file buffer (RFC) sub-module 2071, the register number of said third physical register is The register number of the physical register to which the second destination register number is mapped. Mapping the sixth destination register number to the register number of the fifth physical register in the main register file (MRF) sub-module 2072, and registering the register number of the third physical register in the register file buffer (RFC) sub-module 2071 The register number of the fifth physical register in the main register file (MRF) sub-module 2072 is transferred to the register file buffer (RFC) sub-module 2071.
  • a register file buffer (RFC) sub-module 2071 reads a sixth source operand from a third physical register based on a register number of the third physical register, and then the sixth source operand and a main register file (MRF) sub-module The register number of the fifth physical register in 2072 is transferred to a main register file (MRF) sub-module 2072, and the main register file (MRF) sub-module 2072 re-registers the sixth source operand and the fifth physical register register number. Transfer to the Exe unit 208.
  • RRC register file buffer
  • the Exe module 208 operates on the sixth source operand to obtain the sixth operand, and then transfers the sixth operand and the fifth physical register register number to the write back (WB) module 209.
  • WB write back
  • Write back (WB) module 209 will refer to the number according to the register number of the fifth physical register The six-destination operand is written back to the fifth physical register in the main register file (MRF) sub-module 2072.
  • MRF main register file
  • each thread of the instruction cache (IB) module in the embodiment of the present invention may be 32 bits, and each thread may cache 8 to 16 instructions.
  • the six source register numbers and the six destination register numbers described in the embodiments of the present invention are not limited to the source register number and the destination register number of the two instructions, and may be three instructions or other numbers of instructions, and the source register numbers of different instructions may be The destination register number mapped to the same physical register number or different instructions can be mapped to the same physical register number, and the mapping relationship described in the present invention is only a schematic description. In practice, N source register numbers and N destination registers are used. There may be other mapping relationships between the numbers, which are not limited by the present invention.
  • the data processing apparatus analyzes the correlation between the N source register numbers and the N destination register numbers after the register file control module acquires the N source register numbers and the N destination register numbers, when the i
  • the rename module maps the i-th destination register number to the physical register number of the register file buffer submodule, when the i+1 source The register number is equal to any one of the destination register number of the i-th destination register number to the first destination register number, or the i+1th source register number is equal to two or more source register numbers of the N source register numbers
  • the rename module maps the i+1th source register number to the physical register number of the register heap buffer submodule, when the i-th destination register number is not equal to any one of the i+1 source register number to the Nth source register number
  • the rename module maps the i-th destination register number to the physical register number of the main register file sub-
  • the embodiment of the present invention provides a data processing method.
  • the data processing apparatus includes an instruction pre-decode Pre-decoder module, an instruction cache IB module, and a register file control RF-
  • the Ctl module, the Rename module, and the register file RF module, the RF module includes a register file buffer RFC sub-module and a main register file MRF sub-module, the method comprising:
  • Step 301 Obtain N source register numbers and N destination register numbers from the instruction pre-decoding module, or the instruction cache module, or the instruction pre-decoding module and the instruction cache module.
  • At least one instruction is pre-decoded to obtain N source register numbers and N destination register numbers, each of the instructions including at least one source register number and at least one destination register number, and then storing the instructions.
  • N source register numbers and N destination register numbers can be obtained from the instruction cache module
  • N source register numbers and N destination register numbers can be obtained directly from the instruction pre-decoding module
  • N-1 source register numbers and N-1 destination register numbers may be obtained from the instruction cache module, and the Nth source register number and the Nth directory register number are obtained from the instruction precoding module.
  • Step 302 When the register number of the i-th target satisfies the first preset condition, mark the register number of the first object, where 1 is an integer greater than or equal to 1 and less than or equal to N, and the N is an integer greater than or equal to 2.
  • the first preset condition is that the register number of the i-th destination is equal to at least one source register number of the i+1 source register number to the Nth source register number, and the i+1 is an integer less than N.
  • Step 303 Mapping the first i-th register number of the tag to a register number of a first physical register in the register file buffer sub-module, the first physical register Any one of a plurality of free physical registers in the sub-module buffer sub-module.
  • the ith destination register number obtained by the register file control module satisfies the first preset condition
  • the ith destination register number is marked, and the rename module maps the ith destination register number to the register file buffer submodule.
  • the physical register number can effectively improve the use efficiency of the register file buffer sub-module relative to the prior art.
  • the data processing apparatus includes an instruction reading unit (IFU) module 201 and an instruction pre-decoding (Pre- Decode) module 202, instruction cache (IB) module 203, register file control (RF-Ctl) module 204, instruction decode (Decoder) module 205, rename (Rename) module 200, register file (RF) module 207, execution
  • the unit (Exe) module 208, the write back (WB) module 209, the register file (RF) module 207 includes a register file buffer (RFC) sub-module 2071 and a main register file (MRF) sub-module 2072, the method comprising:
  • Step 401 The instruction reading unit module reads the instruction.
  • the Instruction Read Unit (IFU) module can read instructions from the cache or cache and transfer the instructions to the instruction pre-decode module.
  • Embodiments of the present invention assume that an instruction read unit (IFU) module reads two instructions from a cache or cache and transfers the two instructions to an instruction pre-decode module, the two The instructions are the first instruction and the second instruction, respectively.
  • IFU instruction read unit
  • Step 402 The instruction pre-decoding module pre-decodes the first instruction and the second instruction.
  • the module pre-decoding pre-decodes the first instruction and the second instruction to obtain an instruction type and a source of each of the instructions.
  • a register number and a destination register number wherein the first instruction includes a first instruction type, three source register numbers, and three destination register numbers, and the three source register numbers are a first source register number, a second source register number, and a first
  • the three source register numbers, the three destination register numbers are the first destination register number, the second destination register number, and
  • the second instruction includes a second instruction type, three source register numbers, and three destination register numbers, and the three source register numbers are a fourth source register number, a fifth source register number, and a sixth source register, respectively.
  • the three destination register numbers are the fourth destination register number, the fifth destination register number, and the sixth destination register number, respectively.
  • the (Pre-decode) module transfers the six source register numbers and the six destination register numbers to the Instruction Cache (IB) module.
  • Step 403 The instruction cache module stores six source register numbers and six destination register numbers.
  • instruction cache (IB) module After the instruction cache (IB) module receives the six source register numbers and the six destination register numbers, the six source register numbers and the six destination register numbers are stored.
  • Step 404 The register file control module acquires six source register numbers and six destination register numbers.
  • the register file control (RF-Ctl) module fetches six source register numbers and six destination register numbers from the instruction cache (IB) module.
  • the register file control (RF-Ctl) module can also obtain six source register numbers and six destination register numbers from the instruction predecode module or from the instruction predecode module and the instruction cache module.
  • the register file control (RF-Ctl) module can obtain five source register numbers and five destination register numbers from the instruction cache module.
  • the code module acquires a source register number and a destination register number.
  • the register file control (RF-Ctl) module analyzes the correlation between the six source register numbers and the six destination register numbers. It is assumed that the six source register numbers are the first source register number to the sixth source register number, respectively, and the six destination register numbers are the register numbers of the first destination register number to the sixth destination, respectively.
  • Step 405 The register file control module marks the first source register number and the first destination register number.
  • the register file control (RF-Ctl) module marks the first source register number and transfers the marked first source register number to the rename (Rename) module.
  • the (RF-Ctl) module marks the first destination register number and transfers the first register number of the tag to the Rename module.
  • Step 406 The rename module maps the first source register number and the first destination register number to the register file buffer submodule.
  • a Rename module maps the first source register number of the tag to a register number of a first physical register in a register file cache (RFC) sub-module, and maps the first destination register number of the tag to a register file
  • the register number of the second physical register in the buffer (RFC) sub-module and transfers the register number of the first physical register and the register number of the second physical register to a register-stack cache (RFC) sub-module.
  • the register number of the first physical register is any one of a plurality of free physical registers in the register file buffer sub-module, and the register number of the second physical register is multiple idle in the register file buffer sub-module Any one of the physical registers, the register number of the first physical register being different from the register number of the second physical register.
  • Step 407 The register file buffer submodule reads the first source operand.
  • the register file buffer (RFC) submodule reads the first source operand from the first physical register according to the register number of the first physical register, and transfers the register number of the first source operand and the second physical register to the execution unit (Exe) module.
  • Step 408 The execution unit module obtains the operand of the first destination according to the first source operand operation.
  • the first destination operand and the register number of the second physical register are then transferred to the Write Back (WB) module.
  • WB Write Back
  • Step 409 The write back module writes back the first operand.
  • the data processing method further includes steps 4010 to 4014.
  • Step 4010 The register file control module marks the second source register number and the second destination register number.
  • the register file control (RF-Ctl) module marks the second source register number and transfers the marked second source register number to the rename (Rename) module.
  • the (RF-Ctl) module marks the second-order register number and transfers the marked second-order register number to the rename (Rename) module.
  • the second source register number may also be equal to the first source register number and the fifth source register number
  • the register file control (RF-Ctl) module may also mark the second source register number, and mark the The two source register numbers are transferred to the Rename module.
  • Step 401 The rename module maps the second source register number and the second destination register number to the register file buffer submodule.
  • a Rename module maps the second source register number of the tag to a register number of a second physical register in a register file cache (RFC) submodule, the register number of the second physical register being the first The register number of the physical register to which the destination register number is mapped, and the register number of the second physical register is transferred to the register file buffer (RFC) submodule.
  • RRC register file cache
  • the Rename module maps the second destination register number of the tag to the register number of the third physical register in the register file buffer (RFC) submodule, and transfers the register number of the third physical register to the register file buffer. (RFC) submodule.
  • the register number of the third physical register is in the register file buffer submodule Any one of a plurality of free physical registers, wherein a register number of the second physical register is any one of a plurality of free physical registers in the register file buffer sub-module, and a register number of the third physical register and the second The physical register has a different register number.
  • Step 4012 The register file buffer submodule reads the second source operand.
  • a register file buffer (RFC) submodule reads a second source operand from the second physical register according to a register number of the second physical register, and transmits the register number of the second source operand and the third physical register to the execution unit (Exe) module.
  • RRC register file buffer
  • Step 4013 The execution unit module obtains the operand of the second destination according to the second source operand operation.
  • the second destination operand and the register number of the third physical register are then transferred to the write back (WB) module.
  • Step 4014 the write back module writes back the second destination operand.
  • the Write Back (WB) module writes the second destination operand back to the third physical register in the Register Heap Cache (RFC) sub-module based on the register number of the third physical register.
  • RRC Register Heap Cache
  • the data processing method further includes steps 4015 to 4020.
  • Step 4015 The register file control module transmits the third source register number and the third destination register number to the rename module.
  • the register file control (RF-Ctl) module will be the third source register when the third source register number is not equal to any of the six source register numbers and is not equal to any of the second destination register number and the first destination register number. The number is transferred to the rename module.
  • the register file control (RF-Ctl) module transfers the third destination register number to the rename ( Rename ) module.
  • Step 4016 Renaming the module to the third source register number and the third destination register The number is mapped to the main register file submodule.
  • the Rename module maps the third source register number to the register number of the first physical register in the main register file (MRF) submodule and transfers the register number of the first physical register to the register file buffer (RFC) ) Submodule.
  • the Rename module maps the third destination register number to the register number of the second physical register in the main register file (MF) submodule, and transfers the register number of the second physical register to the register file buffer (RFC) ) Submodule.
  • Step 4017 The register file buffer submodule further transfers the register number of the first physical register and the register number of the second physical register to the main register file submodule.
  • Step 4018 The main register file submodule reads the third source operand.
  • a main register file (MRF) submodule reads a third source operand from the first physical register according to a register number of the first physical register, and transmits the third source operand and a register number of the second physical register to Execution unit (Exe) module.
  • MRF main register file
  • Step 4019 The execution unit module obtains the third-order operand according to the third source operand operation.
  • the third destination operand and the register number of the second physical register are then transferred to the write back (WB) module.
  • Step 4020 The write back module writes back the operand of the third destination.
  • a write back (WB) module writes the third destination operand back to the second physical register in the main register file (MRF) submodule based on the register number of the second physical register.
  • the data processing method further includes steps 4021 to 4026.
  • Step 4011 The register file control module transmits the fourth source register number to the renaming module.
  • the register file control (RF-Ctl) module transfers the fourth source register number to the Rename module when any of the third destination register number, the second destination register number, and the first destination register number.
  • Step 4022 The register file control module marks the register number of the fourth destination.
  • the register file control modulates the fourth destination register number, and transfers the fourth source register number and the marked fourth destination register number to the rename ( Rename) module.
  • Step 4023 The rename module maps the fourth source register number to the main register file module, and maps the fourth destination register number to the register file buffer sub-module.
  • the Rename module maps the fourth source register number to the register number of the third physical register in the main register file (MRF) submodule and transfers the register number of the third physical register to the register file buffer (RFC)
  • the Rename module maps the fourth destination register number of the tag to the register number of the fourth physical register in the register file buffer (RFC) submodule, and transfers the register number of the fourth physical register to the register Heap Cache (RFC) submodule.
  • the register number of the third physical register to which the second destination register number is mapped and the fourth destination register number are mapped.
  • the register number of the fourth physical register may be different; if the fourth destination register number and the second destination register number are register numbers included in different instructions, the second destination register number is mapped to the third physical register register number and The register number of the fourth physical register to which the four-purpose register number is mapped may be the same.
  • the register number of the third physical register is any one of a plurality of free physical registers in the main register file sub-module, and the register number of the fourth physical register Storing any one of a plurality of free physical registers in the sub-module for the register file, the register number of the third physical register being different from the register number of the fourth physical register.
  • Step 4024 The main register file submodule reads the fourth source operand.
  • the main register file (MRF) submodule reads the fourth source operand from the third physical register according to the register number of the third physical register, and transmits the register number of the fourth source operand and the fourth physical register to Execution unit (Exe) module.
  • Step 4025 The execution unit module obtains the operand of the fourth destination according to the fourth source operand operation.
  • the fourth-order operand and the register number of the fourth physical register are transferred to the write-back (WB) module.
  • Step 4026 the write back module writes back the operand of the fourth destination.
  • the Write Back (WB) module writes the fourth destination operand back to the fourth physical register in the Register Heap Cache (RFC) sub-module based on the register number of the fourth physical register.
  • RRC Register Heap Cache
  • the data processing method further includes steps 4027 to 4032.
  • Step 4027 The register file control module marks the fifth source register number.
  • the register file control (RF-Ctl) module marks the fifth source register number and transfers the marked fifth source register number to the rename (Rename) module.
  • the fifth source register number may also be equal to the first source register number and the second source register number, and the register file control (RF-Ctl) module may also mark the fifth source register number and mark the fifth source.
  • the register number is transferred to the Rename module.
  • Step 4028 The register file control module transmits the fifth destination register number to the rename module.
  • the fifth destination register number is not equal to the sixth source register number, the fifth destination register number is transferred to the rename (Rename) module.
  • Step 4029 The rename module maps the marked fifth source register number to the register heap buffer submodule, and maps the fifth destination register number to the main register file module.
  • a Rename module maps the fifth source register number of the tag to a register number of a fourth physical register in a register file buffer (RFC) submodule, the register number of the fourth physical register being the fourth The register number of the physical register to which the destination register number is mapped, and the register number of the fourth physical register in the register file buffer (RFC) sub-module is transferred to the register file buffer (RFC) sub-module.
  • RRC register file buffer
  • the Rename module maps the fifth destination register number to the register number of the fourth physical register in the main register file ( MRF ) submodule and the fourth physical register in the main register file ( MRF ) submodule
  • the register number is transferred to the Register Heap Cache (RFC) submodule.
  • the register number of the fourth physical register is any one of a plurality of free physical registers in the main register file sub-module, and the register number of the fourth physical register is multiple idle in the register file buffer sub-module Any one of the physical registers, the register number of the fourth physical register may be different from the register number of the fourth physical register, or may be the same.
  • Step 4030 The register file buffer submodule reads the fifth source operand.
  • a register file buffer (RFC) sub-module reads a fifth source operand from the fourth physical register according to a register number of the fourth physical register, and then the fifth source operand and the main register file (MRF) sub-module The register number of the fourth physical register is transferred to a main register file (MRF) sub-module, and the main register file (MRF) sub-module transmits the register numbers of the fifth source operand and the fourth physical register to the execution unit (Exe) module.
  • RRC register file buffer
  • Step 4031 The execution unit module obtains the fifth destination operand according to the fifth source operand operation. The fifth destination operand and the register number of the fourth physical register are then transferred to the write back (WB) module.
  • WB write back
  • Step 4032 The writeback module writes back the operand of the fifth destination.
  • the write back (WB) module writes the operand of the fifth destination back to the fourth physical register in the main register file (MRF) submodule according to the register number of the fourth physical register.
  • the data processing method further includes steps 4033 to 4038.
  • Step 4033 The register file control module marks the sixth source register number.
  • the register file control (RF-Ctl) module marks the sixth source register number and transfers the marked sixth source register number to the rename (Rename) module.
  • Step 4034 The register file control module transfers the register number of the sixth directory to the rename module.
  • Step 4035 The rename module maps the marked sixth source register number to the register heap buffer submodule, and maps the sixth destination register number to the main register file module.
  • a Rename module maps the sixth source register number of the tag to a register number of a third physical register in a register file cache (RFC) submodule, and the register number of the third physical register is the second The register number of the physical register to which the destination register number is mapped, and the register number of the third physical register in the register file buffer (RFC) submodule is transferred to the register file buffer (RFC) submodule.
  • RRC register file cache
  • the Rename module maps the sixth destination register number to the register number of the fifth physical register in the main register file ( MRF ) submodule and the fifth physical register in the main register file ( MF ) submodule
  • the register number is transferred to the Register Heap Cache (RFC) submodule.
  • Step 4036 The register file buffer submodule reads the sixth source operand.
  • Register register cache (RFC) submodule registers according to the third physical register
  • the device number reads the sixth source operand from the third physical register, and transfers the six source operand and the register number of the fifth physical register in the main register file (MRF) submodule to the main register file (MRF)
  • Step 4037 The execution unit module obtains the operand of the sixth object according to the sixth source operand operation.
  • the operand of the sixth destination and the register number of the fifth physical register are then transferred to the write back (WB) module.
  • Step 4038 The write back module writes back the operand of the sixth object.
  • a write back (WB) module writes the operand of the sixth destination back to the fifth physical register in the main register file (MRF) submodule based on the register number of the fifth physical register.
  • each thread of the instruction cache (IB) module in the embodiment of the present invention may be 32 bits, and each thread may cache 8 to 16 instructions.
  • the six source register numbers and the six destination register numbers described in the embodiments of the present invention are not limited to the source register number and the destination register number of the two instructions, and may be three instructions or other numbers of instructions, and the source register numbers of different instructions may be The destination register number mapped to the same physical register number or different instructions can be mapped to the same physical register number, and the mapping relationship described in the present invention is only a schematic description. In practice, N source register numbers and N destination registers are used. There may be other mapping relationships between the numbers, which are not limited by the present invention.
  • the data processing apparatus analyzes the correlation between the N source register numbers and the N destination register numbers after the register file control module acquires the N source register numbers and the N destination register numbers, when the i
  • the rename module maps the i-th destination register number to the physical register number of the register file buffer submodule, when The i+1 source register number is equal to any one of the i-th destination register number to the first destination register number, or the i+th source register number is equal to two or more of the N source register numbers.
  • the rename module maps the i+1th source register number to the physical register number of the register file buffer submodule, and when the i-th destination register number is not equal to any of the i+1 source register number to the Nth source register number
  • the rename module maps the i-th destination register number to the physical register number of the main register file sub-module, when the i+1 source register number is not equal to any one of the i-th destination register number to the first destination register number.
  • the destination register number, or the i+1 source register number is not equal to any one of the N source register numbers, the rename module maps the i+1th source register number to the physical register of the main register file submodule No.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment. of.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

Abstract

本发明的实施例提供一种数据处理装置及方法,涉及计算机领域,能够有效提高寄存器堆缓存子模块的使用效率。所述数据处理装置,包括:指令预译码模块、指令缓存模块、寄存器堆控制模块、重命名模块、寄存器堆缓存子模块,获取N个源寄存器号和N个目的寄存器号;当第i目的寄存器号满足第一预设条件时,标记所述第i目的寄存器号,将标记的所述第i目的寄存器号映射到寄存器堆缓存子模块中的第一物理寄存器的寄存器号。本发明实施例提供的数据处理装置及方法用于处理数据。

Description

一种数据处理装置及方法 技术领域
本发明涉及计算机领域, 尤其涉及一种数据处理装置及方法。 背景技术
随着超标量技术和多线程技术的发展, 超标量通用处理器成为 处理器体系架构的一个重要组成部分。 超标量通用处理器一般包括
IFU ( Instruction Fetch Unit , 指令读取单元 ) 模块、 指令预译码 ( Pre-decoder ) 模块、 IB ( Instruction Buffer , 指令緩存) 模块、 指 令译码( Decoder )模块、 重命名( Rename )模块、 RF( Register File , 寄存器堆)模块、 Exe ( Execute Unit , 执行单元)模块和 WB ( Write Back , 写回 )等模块, 其中, Rename模块可以采用重命名技术将一 个体系结构寄存器的寄存器号映射到物理寄存器的寄存器号, 所述 物理寄存器为多个空闲的物理寄存器中任意一个, 所述体系结构寄 存器是处理器指令架构的组成部分, RF 模块用于存储指令运行过 程中的中间结果及超标量通用处理器的运行状态, 随着现代处理器 中使用的物理寄存器越来越多 , RF —般包含 RFC ( Register File Cache , 寄存器堆緩存) 子模块和 MRF ( Main Register File , 主寄存 器堆) 子模块, RFC 子模块一般包含最近使用的物理寄存器, MRF 子模块包括所有物理寄存器, RFC子模块中的物理寄存器是 MRF子 模块中的物理寄存器的一个子集。
现有技术中, 首先 IFU模块从存储器或高速緩沖存储器中读取 指令, 并将指令传输至 Pre-decoder 模块, Pre-decoder 模块对指令 进行预译码得到指令类型、 源寄存器号和目 的寄存器号, 并将源寄 存器号和目 的寄存器号传输至 IB 模块, IB 模块中存储了源寄存器 号和目 的寄存器号, 再通过 Decoder 模块将源寄存器号和目 的寄存 器号传输至 Rename模块, 然后, Rename模块将源寄存器号映射到 第一物理寄存器的寄存器号, 将目 的寄存器号映射到第二物理寄存 器的寄存器号, 并将所述第一物理寄存器的寄存器号和所述第二物 理寄存器的寄存器号传输至 RF 模块, 所述源寄存器号为指令的源 操作数的体系结构寄存器的寄存器号, 所述目 的寄存器号为指令的 目 的操作数的体系结构寄存器的寄存器号, 所述指令包括源操作数 的体系结构寄存器的寄存器号和目 的操作数的体系结构寄存器的寄 存器号, 所述第一物理寄存器为 RFC 子模块或 MRF 子模块中多个 空闲的物理寄存器中任意一个, 所述第二物理寄存器为 RFC子模块 或 MRF 子模块中多个空闲的物理寄存器中任意一个, 所述第一物 理寄存器的寄存器号和所述第二物理寄存器的寄存器号不同。
在 RF 模块中, RFC 子模块读写速度快, 支持多端口 同时读 写, 但存储容量有限, MRF子模块存储容量大, 但读写端口有限和 读写速度慢。 首先 RFC子模块根据第一物理寄存器的寄存器号从所 述第一物理寄存器中获取源操作数, RFC 子模块再将所述源操作数 传输至 Exe 模块, Exe 模块对该源操作数进行运算得到 目 的操作 数, WB模块再根据 RFC子模块传输的第二物理寄存器的寄存器号 将所述目 的操作数写回到第二物理寄存器, 所述第一物理寄存器为 RFC子模块中的物理寄存器。
但是, 当第一物理寄存器不在 RFC子模块中时, RFC子模块根 据第一物理寄存器的寄存器号在 RFC子模块中获取不到源操作数, 则需要 MRF 子模块根据第一物理寄存器的寄存器号从所述第一物 理寄存器获取源操作数, 同时 MRF 子模块将第一物理寄存器回填 到 RFC子模块中, 导致第一物理寄存器可能覆盖 RFC子模块中其他 指令需要用的物理寄存器。 因此, 出现了 RFC子模块的使用效率较 低的问题。
发明内容 本发明的实施例提供一种数据处理装置及方法, 能够有效提高
RFC子模块的使用效率。
为达到上述目 的, 本发明的实施例采用如下技术方案: 第一方面, 提供一种数据处理装置, 所述数据处理装置包括指 令预译码 Pre-decoder 模块、 指令緩存 IB 模块、 寄存器堆控制 RF-Ctl模块、 重命名 Rename模块、 寄存器堆 RF模块, 所述 RF模 块包括寄存器堆緩存 RFC 子模块和主寄存器堆 MRF 子模块, 其 中,
所述寄存器堆控制模块, 用于从所述指令预译码模块, 或者所 述指令緩存模块, 或者所述指令预译码模块和所述指令緩存模块中 获取 N个源寄存器号和 N个目 的寄存器号;
所述寄存器堆控制模块还用于:
当第 i 目 的寄存器号满足第一预设条件时, 标记所述第 i 目 的 寄存器号, 所述 1为大于等于 1且小于等于 N的整数, 所述 N为大 于等于 2 的整数;
所述重命名模块, 用于将标记的所述第 1 目 的寄存器号映射到 所述寄存器堆緩存子模块中的第一物理寄存器的寄存器号, 所述第 一物理寄存器为所述寄存器堆緩存子模块中多个空闲的物理寄存器 中任意一个。
结合第一方面, 在第一种可实现方式中,
所述第一预设条件为所述第 i 目 的寄存器号等于第 i+ 1 源寄存 器号至第 N源寄存器号中至少一个源寄存器号, 所述 i+ 1 为小于等 于 N的整数。
结合第一种可实现方式, 在第二种可实现方式中,
所述指令预译码模块, 用于预译码至少一条指令, 得到 N个源 寄存器号和 N个目 的寄存器号, 每一个所述指令包括至少一个源寄 存器号和至少一个目 的寄存器号; 所述指令緩存模块用于存储所述指令。
结合第二种可实现方式, 在第三种可实现方式中,
所述寄存器堆控制模块具体用于:
从所述指令緩存模块获取 N 个源寄存器号和 N 个目 的寄存器 号;
或者, 直接从所述指令预译码模块获取 N个源寄存器号和 N个 目 的寄存器号;
或者, 从所述指令緩存模块获取 N- 1个源寄存器号和 N- 1个目 的寄存器号, 从所述指令预译码模块获取第 N源寄存器号和第 N 目 的寄存器号。
结合第三种可实现方式, 在第四种可实现方式中,
所述寄存器堆控制模块还用于:
当第 i+ 1 源寄存器号满足第二预设条件时, 标记所述第 i+ 1 源 寄存器号, 所述 1+ 1 为小于等于 N的整数;
所述重命名模块还用于:
将标记的所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模 块中的物理寄存器的寄存器号, 所述物理寄存器的寄存器号为与所 述第 i+ 1 源寄存器号相等的目 的寄存器号被映射到的所述寄存器堆 緩存子模块中的物理寄存器的寄存器号;
所述寄存器堆緩存子模块, 用于根据所述物理寄存器的寄存器 号从所述物理寄存器读取第一源操作数。
结合第四种可实现方式, 在第五种可实现方式中, 所述第二预 设条件为所述第 i+1源寄存器号等于第 1目 的寄存器号至第 1 目 的寄 存器号中的任意一个目 的寄存器号, 所述 i+ 1 为小于等于 N 的整 数, 或, 所述第 i+ 1 源寄存器号等于所述 N个源寄存器号中两个或 两个以上的源寄存器号。
结合第五种可实现方式, 在第六种可实现方式中, 所述重命名模块具体用于:
当所述第 i+ 1 源寄存器号等于第 1 目 的寄存器号时, 将标记的 所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模块中的所述第 一物理寄存器的寄存器号;
所述寄存器堆緩存子模块具体用于:
根据所述第一物理寄存器的寄存器号从所述第一物理寄存器读 取所述第一源操作数。
结合第五种可实现方式, 在第七种可实现方式中,
所述寄存器堆控制模块还用于:
当第 i+ 1 目 的寄存器号等于第 i+2 源寄存器号至第 N源寄存器 号中至少一个源寄存器号时, 标记所述第 i+ 1 目 的寄存器号, 所述 i+2为小于等于 N的整数;
所述重命名模块还用于:
将标记的所述第 i+ 1 目 的寄存器号映射到所述寄存器堆緩存子 模块中的第二物理寄存器的寄存器号, 所述第二物理寄存器为所述 寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
结合第七种可实现方式, 在第八种可实现方式中, 所述数据处 理装置还包括执行单元 Exe模块和写回 WB模块, 其中,
所述执行单元模块, 用于获取所述第一源操作数和所述第二物 理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操 作数;
所述写回模块, 用于根据所述第二物理寄存器的寄存器号将所 述第一目 的操作数写回到所述第二物理寄存器。
结合第三种可实现方式, 在第九种可实现方式中,
所述重命名模块还用于:
当所述第 i 目 的寄存器号不等于第 i+1 源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i 目 的寄存器号映射到 所述主寄存器堆子模块中的第三物理寄存器的寄存器号, 所述第三 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
结合第九种可实现方式, 在第十种可实现方式中,
所述重命名模块还用于:
当所述第 i+ 1 源寄存器号不等于第 i 目 的寄存器号至第 1 目 的 寄存器号中的任意一个目 的寄存器号, 或, 所述第 1+ 1 源寄存器号 不等于所述 N 个源寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 源寄存器号映射到所述主寄存器堆子模块中的第四物理寄存器 的寄存器号, 所述第四物理寄存器为所述主寄存器堆子模块中多个 空闲的物理寄存器中任意一个。
结合第十种可实现方式, 在第十一种可实现方式中,
所述主寄存器堆子模块, 用于根据所述第四物理寄存器的寄存 器号从所述第四物理寄存器读取第二源操作数。
结合第五种可实现方式或第十一种可实现方式中的任意一种, 在第十二种可实现方式中,
所述重命名模块还用于:
当所述第 i+ 1 目 的寄存器号不等于第 i+2 源寄存器号至第 N源 寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映 射到所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述 第五物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器 中任意一个。
结合第十二种可实现方式, 在第十三种可实现方式中, 所述执行单元模块, 用于获取所述第一源操作数和所述第五物 理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操 作数;
所述写回模块, 用于根据所述第五物理寄存器的寄存器号将所 述第一目 的操作数写回到所述第五物理寄存器。
结合第十二种可实现方式, 在第十四种可实现方式中, 所述执行单元模块还用于:
获取所述第二源操作数和所述第五物理寄存器的寄存器号, 根 据所述第二源操作数运算得到第二目 的操作数;
所述写回模块还用于:
根据所述第五物理寄存器的寄存器号将所述第二目 的操作数写 回到所述第五物理寄存器。
第二方面, 提供一种数据处理方法, 用于数据处理装置, 所述 数据处理装置包括指令预译码 Pre-decoder 模块、 指令緩存 IB 模 块、 寄存器堆控制 RF-Ctl模块、 重命名 Rename模块、 寄存器堆 RF 模块, 所述 RF 模块包括寄存器堆緩存 RFC 子模块和主寄存器堆 MRF子模块, 其中,
从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指 令预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄存器号;
当第 i 目 的寄存器号满足第一预设条件时, 标记所述第 i 目 的 寄存器号, 所述 i为大于等于 1且小于等于 N的整数, 所述 N为大 于等于 2 的整数;
将标记的所述第 i 目 的寄存器号映射到所述寄存器堆緩存子模 块中的第一物理寄存器的寄存器号, 所述第一物理寄存器为所述寄 存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
结合第二方面, 在第一种可实现方式中, 所述第一预设条件为 所述第 i 目 的寄存器号等于第 i+1 源寄存器号至第 N 源寄存器号中 至少一个源寄存器号, 所述 i+ 1 为小于等于 N的整数。
结合第一种可实现方式, 在第二种可实现方式中,
在所述从所述指令预译码模块, 或者所述指令緩存模块, 或者 所述指令预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄存器号之前, 所述方法还包括:
预译码至少一条指令, 得到 N个源寄存器号和 N个目 的寄存器 号, 每一个所述指令包括至少一个源寄存器号和至少一个目 的寄存 器号;
存储所述指令。
结合第二种可实现方式, 在第三种可实现方式中,
所述从所述指令预译码模块, 或者所述指令緩存模块, 或者所 述指令预译码模块和所述指令緩存模块中获取所述 N个源寄存器号 和 N个目 的寄存器号包括:
从所述指令緩存模块获取 N 个源寄存器号和 N 个目 的寄存器 号;
或者, 直接从所述指令预译码模块获取 N个源寄存器号和 N个 目 的寄存器号;
或者, 从所述指令緩存模块获取 N- 1个源寄存器号和 N- 1个目 的寄存器号, 从所述指令预译码模块获取第 N源寄存器号和第 N 目 的寄存器号。
结合第三种可实现方式, 在第四种可实现方式中,
在所述将标记的所述第 i 目 的寄存器号映射到所述寄存器堆緩 存子模块中的第一物理寄存器的寄存器号之后, 所述方法还包括: 当第 i+ 1 源寄存器号满足第二预设条件时, 标记所述第 1+ 1 源 寄存器号, 所述 i+ 1 为小于等于 N的整数;
将标记的所述第 i+1 源寄存器号映射到所述寄存器堆緩存子模 块中的物理寄存器的寄存器号, 所述物理寄存器的寄存器号为与所 述第 i+ 1 源寄存器号相等的目 的寄存器号被映射到的所述寄存器堆 緩存子模块中的物理寄存器的寄存器号;
根据所述物理寄存器的寄存器号从所述物理寄存器读取第一源 操作数。
结合第四种可实现方式, 在第五种可实现方式中, 所述第二预 设条件为所述第 i+1源寄存器号等于第 i目 的寄存器号至第 1 目 的寄 存器号中的任意一个目 的寄存器号, 所述 i+ 1 为小于等于 N 的整 数, 或, 所述第 i+ 1 源寄存器号等于所述 N个源寄存器号中两个或 两个以上的源寄存器号。
结合第五种可实现方式, 在第六种可实现方式中, 所述将标记 的所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模块中的物理 寄存器的寄存器号包括:
当所述第 i+ 1 源寄存器号等于第 i 目 的寄存器号时, 将标记的 所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模块中的所述第 一物理寄存器的寄存器号;
根据所述第一物理寄存器的寄存器号从所述第一物理寄存器读 取所述第一源操作数。
结合第五种可实现方式, 在第七种可实现方式中, 在所述将标 记的所述第 i 目 的寄存器号映射到所述寄存器堆緩存子模块中的第 一物理寄存器的寄存器号之后, 所述方法还包括:
当第 i+ 1 目 的寄存器号等于第 i+2 源寄存器号至第 N源寄存器 号中至少一个源寄存器号时, 标记所述第 i+ 1 目 的寄存器号, 所述 i+2为小于等于 N的整数;
将标记的所述第 i+1 目 的寄存器号映射到所述寄存器堆緩存子 模块中的第二物理寄存器的寄存器号, 所述第二物理寄存器为所述 寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
结合第七种可实现方式, 在第八种可实现方式中, 所述数据处 理装置还包括执行单元 Exe模块和写回 WB模块, 在所述将标记的 所述第 i+ 1 目 的寄存器号映射到所述寄存器堆緩存子模块中的第二 物理寄存器的寄存器号之后, 所述方法还包括: 获取所述第一源操作数和所述第二物理寄存器的寄存器号, 根 据所述第一源操作数运算得到第一目 的操作数;
根据所述第二物理寄存器的寄存器号将所述第一目 的操作数写 回到所述第二物理寄存器。
结合第三种可实现方式, 在第九种可实现方式中, 在所述从所 述指令预译码模块, 或者所述指令緩存模块, 或者所述指令预译码 模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄存器 号之后, 所述方法还包括:
当所述第 i 目 的寄存器号不等于第 i+1 源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i 目 的寄存器号映射到 所述主寄存器堆子模块中的第三物理寄存器的寄存器号, 所述第三 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
结合第九种可实现方式, 在第十种可实现方式中, 在所述从所 述指令预译码模块, 或者所述指令緩存模块, 或者所述指令预译码 模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄存器 号之后, 所述方法还包括:
当所述第 i+ 1 源寄存器号不等于第 i 目 的寄存器号至第 1 目 的 寄存器号中的任意一个目 的寄存器号, 或, 所述第 i+ 1 源寄存器号 不等于所述 N 个源寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 源寄存器号映射到所述主寄存器堆子模块中的第四物理寄存器 的寄存器号, 所述第四物理寄存器为所述主寄存器堆子模块中多个 空闲的物理寄存器中任意一个。
结合第十种可实现方式, 在第十一种可实现方式中, 在所述将 所述第 i+ 1 源寄存器号映射到所述主寄存器堆子模块中的第四物理 寄存器的寄存器号之后, 所述方法还包括:
根据所述第四物理寄存器的寄存器号从所述第四物理寄存器读 取第二源操作数。
结合第五种可实现方式, 在第十二种可实现方式中, 在所述根 据所述物理寄存器的寄存器号从所述物理寄存器读取第一源操作数 之后, 所述方法还包括:
当所述第 i+ 1 目 的寄存器号不等于第 i+2 源寄存器号至第 N源 寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映 射到所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述 第五物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器 中任意一个。
结合第十二种可实现方式, 在第十三种可实现方式中, 在所述 将所述第 i+ 1 目 的寄存器号映射到所述主寄存器堆子模块中的第五 物理寄存器的寄存器号之后, 所述方法还包括:
获取所述第一源操作数和所述第五物理寄存器的寄存器号, 根 据所述第一源操作数运算得到第一目 的操作数;
根据所述第五物理寄存器的寄存器号将所述第一目 的操作数写 回到所述第五物理寄存器。
结合第十一种可实现方式, 在第十四种可实现方式中, 在所述 根据所述第四物理寄存器的寄存器号从所述第四物理寄存器读取第 二源操作数之后, 所述方法还包括:
当所述第 i+ 1 目 的寄存器号不等于第 i+2 源寄存器号至第 N源 寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映 射到所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述 第五物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器 中任意一个。
结合第十四现方式, 在第十五种可实现方式中, 在所述将所述 第 i+ 1 目 的寄存器号映射到所述主寄存器堆子模块中的第五物理寄 存器的寄存器号之后, 所述方法还包括: 获取所述第二源操作数和所述第五物理寄存器的寄存器号, 根 据所述第二源操作数运算得到第二目 的操作数;
根据所述第五物理寄存器的寄存器号将所述第二目 的操作数写 回到所述第五物理寄存器。
本发明的实施例提供一种数据处理装置及方法, 所述数据处理 装置, 包括: 所述数据处理装置包括指令预译码 Pre-decoder模块、 指令緩存 IB 模块、 寄存器堆控制 RF-Ctl模块、 重命名 Rename模 块、 寄存器堆 RF模块, 所述 RF模块包括寄存器堆緩存 RFC子模块 和主寄存器堆 MRF 子模块, 其中, 所述寄存器堆控制模块, 用于 从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指令预 译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄 存器号; 所述寄存器堆控制模块还用于: 当第 i 目 的寄存器号满足 第一预设条件时, 标记所述第 i 目 的寄存器号, 所述 i为大于等于 1 且小于等于 N的整数, 所述 N为大于等于 2的整数; 所述重命名模 块, 用于将标记的所述第 i 目 的寄存器号映射到所述寄存器堆緩存 子模块中的第一物理寄存器的寄存器号, 所述第一物理寄存器为所 述寄存器堆缓存子模块中多个空闲的物理寄存器中任意一个。 这样 一来, 当寄存器堆控制模块获取到的第 i 目 的寄存器号满足第一预 设条件时, 标记第 i目 的寄存器号, 重命名模块将所述第 i目 的寄存 器号映射到寄存器堆緩存子模块的物理寄存器号, 相对于现有技 术, 能够有效地提高寄存器堆緩存子模块的使用效率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下 面将对实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于 本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以 根据这些附图获得其他的附图。 图 1 为本发明实施例提供一种现有技术的数据处理装置结构示 意图;
图 2为本发明实施例提供一种数据处理装置结构示意图; 图 3为本发明实施例提供一种数据处理方法流程图;
图 4为本发明实施例提供另一种数据处理方法流程图;
图 5为本发明实施例提供又一种数据处理方法流程图;
图 6为本发明实施例提供再一种数据处理方法流程图;
图 7为本发明实施例提供另再一种数据处理方法流程图; 图 8为本发明实施例提供又再一种数据处理方法流程图; 图 9为本发明实施例提供再再一种数据处理方法流程图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术 方案进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明 一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本 领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他 实施例, 都属于本发明保护的范围。
现有技术中, 如图 1所示, 数据处理装置 10包括指令读取单元 ( IFU ) 模块 101、 指令预译码 ( Pre-decoder ) 模块 102、 指令緩存 ( IB ) 模块 103、 指令译码 ( Decoder )模块 104、 重命名 ( Rename ) 模块 105、 寄存器堆 ( RF ) 模块 106、 执行单元 ( Exe ) 模块 107和 写回 ( WB ) 模块 108, 其中, 寄存器堆 ( RF ) 模块 106 包括寄存器 堆緩存 ( RFC ) 子模块 1061和主寄存器堆 ( MRF ) 子模块 1062。 所 述数据处理装置 10可以是超标量通用处理器。
其中, 指令读取单元模块 101 与指令预译码模块 102连接, 指 令预译码模块 102与指令緩存模块 103 连接, 指令緩存模块 103 与 指令译码模块 104 连接, 指令译码模块 104 与重命名模块 105 连 接, 重命名模块 105与寄存器堆緩存子模块 1061连接, 寄存器堆緩 存子模块 1061 与主寄存器堆子模块 1062连接, 主寄存器堆子模块 1062与执行单元模块 107连接, 执行单元模块 107与写回模块 108 连接, 写回模块 108分别连接寄存器堆緩存子模块 1061和主寄存器 堆子模块 1062, 寄存器堆緩存子模块 1061 再与执行单元模块 107 连接。
本发明实施例提供一种数据处理装置 20, 如图 2所示, 包括指 令读取单元( IFU)模块 201、 指令预译码 ( Pre-decode)模块 202、 指令緩存 ( IB ) 模块 203、 寄存器堆控制 ( RF-Ctl) 模块 204、 指令 译码 ( Decoder) 模块 205、 重命名 (Rename) 模块 206、 寄存器堆
( RF)模块 207、 执行单元( Exe )模块 208、 写回( WB )模块 209, 所述寄存器堆( RF)模块 207包括寄存器堆緩存( RFC)子模块 2071 和主寄存器堆 ( MRF) 子模块 2072。 所述数据处理装置 20 可以是 超标量通用处理器。
其 中 , 指令读取单元 ( IFU ) 模块 201 与指令预译码
( Pre-decoder)模块 202连接, 指令预译码( Pre-decoder)模块 202 与指令緩存 ( IB ) 模块 203连接, 指令緩存 ( IB ) 模块 203 与指令 译码 ( Decoder) 模块 205 连接, 指令译码 ( Decoder) 模块 205 与 重命名 ( Rename )模块 206连接, 重命名 ( Rename )模块 206与寄 存器堆緩存 ( RFC ) 子模块 2071连接, 寄存器堆緩存 ( RFC ) 子模 块 2071与主寄存器堆子( MRF )模块 2072连接, 主寄存器堆( MRF ) 子模块 2072与执行单元 ( Exe)模块 208连接, 执行单元 ( Exe)模 块 208与写回 ( WB ) 模块 209连接, 写回 ( WB ) 模块 209分别连 接寄存器堆緩存 ( RFC) 子模块 2071与主寄存器堆 ( MRF) 子模块 2072, 寄存器堆緩存 ( RFC) 子模块 2071 再与执行单元 ( Exe) 模 块 208 连接, 寄存器堆控制 (RF-Ctl) 模块 204分别连接指令预译 码 ( Pre-decoder) 模块 202、 指令緩存 ( IB ) 模块 203 和重命名
( Rename ) 模块 206。 所述寄存器堆控制模块 204, 用 于从所述指令预译码模块 202 , 或者所述指令緩存模块 203 , 或者所述指令预译码模块 202和 所述指令緩存模块 203 中获取 N 个源寄存器号和 N 个目 的寄存器 号。
所述寄存器堆控制模块 204还用于当第 i 目 的寄存器号满足第 一预设条件时, 标记所述第 i 目 的寄存器号, 所述 i 为大于等于 1 且小于等于 N的整数, 所述 N为大于等于 2的整数。
所述第一预设条件为所述第 i 目 的寄存器号等于第 i+ 1 源寄存 器号至第 N源寄存器号中至少一个源寄存器号, 所述 1+ 1 为小于等 于 N的整数。
所述重命名模块 206用于将标记的所述第 i 目 的寄存器号映射 到所述寄存器堆緩存子模块 2071 中的第一物理寄存器的寄存器 号, 所述第一物理寄存器为所述寄存器堆緩存子模块 2071 中多个 空闲的物理寄存器中任意一个。
这样一来, 当寄存器堆控制模块获取到的第 i 目 的寄存器号满 足第一预设条件时, 标记第 1 目 的寄存器号, 重命名模块将所述第 i 目 的寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 相对于 现有技术, 能够有效地提高寄存器堆緩存子模块的使用效率。
所述指令预译码模块 202 , 用于预译码至少一条指令, 得到 N 个源寄存器号和 N个目 的寄存器号, 每一个所述指令包括至少一个 源寄存器号和至少一个目 的寄存器号。
所述指令緩存模块 203用于存储所述指令。
所述寄存器堆控制模块 204具体用于:
从所述指令緩存模块 203获取 N个源寄存器号和 N个目 的寄存 器号;
或者, 直接从指令预译码模块 202获取 N个源寄存器号和 N个 目 的寄存器号; 或者, 从指令緩存模块 203获取 N- 1个源寄存器号和 N- 1个目 的寄存器号, 从指令预译码模块 202获取第 N源寄存器号和第 N 目 的寄存器号。
所述寄存器堆控制模块 204还用于:
当第 i+ 1 源寄存器号满足第二预设条件时, 标记所述第 i+ 1 源 寄存器号, 所述 i+ 1 为小于等于 N的整数。
所述第二预设条件为所述第 i+ 1 源寄存器号等于第 i 目 的寄存 器号至第 1 目 的寄存器号中的任意一个目 的寄存器号, 所述 i+ 1 为 小于等于 N的整数, 或, 所述第 i+ 1 源寄存器号等于所述 N个源寄 存器号中两个或两个以上的源寄存器号。
所述重命名模块 206还用于:
将标记的所述第 i+1 源寄存器号映射到所述寄存器堆緩存子模 块中的物理寄存器的寄存器号, 所述物理寄存器的寄存器号为与所 述第 i+ 1 源寄存器号相等的目 的寄存器号被映射到的所述寄存器堆 緩存子模块中的物理寄存器的寄存器号。
所述寄存器堆緩存子模块 207 1 , 用于根据所述物理寄存器的 寄存器号从所述物理寄存器读取第一源操作数。
所述重命名模块 206具体用于:
当所述第 i+ 1 源寄存器号等于第 i 目 的寄存器号时, 将标记的 所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模块 2071 中的所 述第一物理寄存器的寄存器号。
所述寄存器堆緩存子模块 2071具体用于:
根据所述第一物理寄存器的寄存器号从所述第一物理寄存器读 取所述第一源操作数。
所述寄存器堆控制模块 204还用于:
当第 i+ 1 目 的寄存器号等于第 i+2 源寄存器号至第 N源寄存器 号中至少一个源寄存器号时, 标记所述第 i+ 1 目 的寄存器号, 所述 i+2为小于等于 N的整数。
所述重命名模块 206还用于:
将标记的所述第 i+1 目 的寄存器号映射到所述寄存器堆緩存子 模块中的第二物理寄存器的寄存器号, 所述第二物理寄存器为所述 寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
所述执行单元模块 208, 用于获取所述第一源操作数和所述第 二物理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操作数。
所述写回模块 209 , 用于根据所述第二物理寄存器的寄存器号 将所述第一目 的操作数写回到所述第二物理寄存器。
所述重命名模块 206还用于:
当所述第 i 目 的寄存器号不等于第 i+1 源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i 目 的寄存器号映射到 所述主寄存器堆子模块中的第三物理寄存器的寄存器号, 所述第三 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
所述重命名模块 206还用于:
当所述第 i+1 源寄存器号不等于第 i 目 的寄存器号至第 1 目 的 寄存器号中的任意一个目 的寄存器号, 或, 所述第 i+ 1 源寄存器号 不等于所述 N 个源寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 源寄存器号映射到所述主寄存器堆子模块中的第四物理寄存器 的寄存器号, 所述第四物理寄存器为所述主寄存器堆子模块中多个 空闲的物理寄存器中任意一个。
所述主寄存器堆子模块 2072 , 用于根据所述第四物理寄存器 的寄存器号从所述第四物理寄存器读取第二源操作数。
所述重命名模块 206还用于:
当所述第 i+ 1 目 的寄存器号不等于第 i+2 源寄存器号至第 N源 寄存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映 射到所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述 第五物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器 中任意一个。
所述执行单元模块 208 , 用于获取所述第一源操作数和所述第 五物理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操作数。
所述写回模块 209 , 用于根据所述第五物理寄存器的寄存器号 将所述第一目 的操作数写回到所述第五物理寄存器。
所述执行单元模块 208还用于:
获取所述第二源操作数和所述第五物理寄存器的寄存器号, 根 据所述第二源操作数运算得到第二目 的操作数;
所述写回模块 209还用于:
根据所述第五物理寄存器的寄存器号将所述第二目 的操作数写 回到所述第五物理寄存器。
示例的, 假设数据处理装置 20 为超标量通用处理器, 首先, 指令读取单元( IFU )模块 201从緩存或高速緩冲存储器读取两条指 令, 并将所述两条指令传输至指令预译码 ( Pre-decode ) 模块 202 , 该两条指令分别为第一指令和第二指令。
然后, 指令预译码 ( Pre-decode ) 模块 202 对所述第一指令和 所述第二指令进行预译码, 得到每个所述指令的指令类型、 源寄存 器号和目 的寄存器号, 其中, 第一指令包括第一指令类型、 三个源 寄存器号和三个目 的寄存器号, 三个源寄存器号分别为第一源寄存 器号、 第二源寄存器号、 第三源寄存器号, 三个目 的寄存器号分别 为第一目 的寄存器号、 第二目 的寄存器号和第三目 的寄存器号, 第 二指令包括第二指令类型、 三个源寄存器号和三个目 的寄存器号, 三个源寄存器号分别为第四源寄存器号、 第五源寄存器号、 第六源 寄存器号, 三个目 的寄存器号分别为第四目 的寄存器号、 第五目 的 寄存器号和第六目 的寄存器号。 指令预译码 ( Pre-decode ) 模块 202 再将六个源寄存器号和六个目 的寄存器号传输至指令緩存 ( IB ) 模 块 203。
指令緩存 ( IB ) 模块 203存储所述六个源寄存器号和所述六个 目 的寄存器号。
寄存器堆控制 ( RF-Ctl ) 模块 204 从指令緩存 ( IB ) 模块 203 获取所述六个源寄存器号和所述六个目 的寄存器号。 寄存器堆控制
( RF-Ctl ) 模块 204 分析所述六个源寄存器号和所述六个目 的寄存 器号之间的相关性。 具体的, 假设所述六个源寄存器号分别为第一 源寄存器号至第六源寄存器号, 所述六个目 的寄存器号分别为第一 目 的寄存器号至第六目 的寄存器号。
需要说明的是, 寄存器堆控制 ( RF-Ctl ) 模块还可以从指令预 译码模块, 或者从指令预译码模块和指令緩存模块中获取六个源寄 存器号和六个目 的寄存器号。 当指令緩存模块中存储五个源寄存器 号和五个目 的寄存器号, 寄存器堆控制 ( RF-Ctl ) 模块可以从指令 緩存模块中获取五个源寄存器号和五个目 的寄存器号, 从指令预译 码模块获取一个源寄存器号和一个目 的寄存器号。
进一步的, 当第一源寄存器号等于第二源寄存器号, 且第一源 寄存器号等于第五源寄存器号时, 当第一目 的寄存器号等于第二源 寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块 204 标记所述第一源寄 存器号和第一目 的寄存器号, 并将标记的所述第一源寄存器号和标 记的所述第一目 的寄存器号传输至重命名 ( Rename ) 模块 206。
重命名 ( Rename ) 模块 206将标记的所述第一源寄存器号映射 到寄存器堆緩存 ( RFC ) 子模块 2071 中的第一物理寄存器的寄存器 号, 将标记的所述第一目 的寄存器号映射到寄存器堆緩存 ( RFC ) 子模块 2071 中的第二物理寄存器的寄存器号, 并将第一物理寄存 器的寄存器号和第二物理寄存器的寄存器号传输至寄存器堆緩存
( RFC ) 子模块 2071。 所述第一物理寄存器的寄存器号为所述寄存 器堆緩存子模块中多个空闲的物理寄存器中任意一个, 所述第二物 理寄存器的寄存器号为所述寄存器堆緩存子模块中多个空闲的物理 寄存器中任意一个, 该第一物理寄存器的寄存器号与该第二物理寄 存器的寄存器号不同。
寄存器堆緩存 ( RFC ) 子模块 2071根据第一物理寄存器的寄存 器号从第一物理寄存器读取第一源操作数, 并将所述第一源操作数 和第二物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块 208。
执行单元( Exe )模块 208根据所述第一源操作数运算得到第一 目 的操作数, 再将所述第一目 的操作数和第二物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回 ( WB )模块 209根据第二物理寄存器的寄存器号将所述第 一目 的操作数写回到寄存器堆緩存 ( RFC ) 子模块 2071 中的所述第 二物理寄存器。
再者, 当第二源寄存器号等于第一目 的寄存器号时, 当第二目 的寄存器号等于第六源寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块 204 标记第二源寄存器号和第二目 的寄存器号, 并将标记的所述第 二源寄存器号和标记的所述第二 目 的寄存器号传输至重命名 ( Rename ) 模块 206。
需要说明的是, 第二源寄存器号还可以等于第一源寄存器号和 第五源寄存器号, 寄存器堆控制 ( RF-Ctl ) 模块 204 也可以标记第 二源寄存器号, 并将标记的所述第二源寄存器号传输至重命名 ( Rename ) 模块 206。
重命名 ( Rename ) 模块 206将标记的所述第二源寄存器号映射 到寄存器堆緩存 ( RFC ) 子模块 2071 中的第二物理寄存器的寄存器 号, 所述第二物理寄存器的寄存器号为所述第一目 的寄存器号所映 射的物理寄存器的寄存器号。 将标记的所述第二目 的寄存器号映射 到寄存器堆緩存 ( RFC) 子模块 2071 中的第三物理寄存器的寄存器 号, 并将第二物理寄存器的寄存器号和第三物理寄存器的寄存器号 传输至寄存器堆緩存 ( RFC) 子模块 2071。
寄存器堆緩存 ( RFC) 子模块 2071根据第二物理寄存器的寄存 器号从第二物理寄存器读取第二源操作数, 并将所述第二源操作数 和第三物理寄存器的寄存器号传输至执行单元 ( Exe) 模块 208。
执行单元 ( Exe)模块 208根据所述第二源操作数运算得到第二 目 的操作数, 再将所述第二目 的操作数和第三物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回( WB )模块 209根据第三物理寄存器的寄存器号将所述第 二目 的操作数写回到寄存器堆緩存 ( RFC) 子模块 2071 中的所述第 三物理寄存器。
进一步的, 当第三源寄存器号不等于六个源寄存器号中任意一 个, 且不等于第二目 的寄存器号和第一目 的寄存器号中任意一个 时, 当第三目 的寄存器号不等于第四源寄存器号、 第五源寄存器号 和第六源寄存器号中任意一个时, 寄存器堆控制 ( RF-Ctl)模块 204 将第三源寄存器号和第三目 的寄存器号传输至重命名 ( Rename) 模 块 206。
重命名 ( Rename) 模块 206将第三源寄存器号映射到主寄存器 堆( MRF)子模块 2072 中的第一物理寄存器的寄存器号, 将第三目 的寄存器号映射到主寄存器堆( MRF) 子模块 2072 中的第二物理寄 存器的寄存器号, 并将所述第一物理寄存器的寄存器号和所述第二 物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块 2071, 寄存器堆緩存 ( RFC ) 子模块 2071再将所述第一物理寄存器的寄存 器号和所述第二物理寄存器的寄存器号传输至主寄存器堆 ( MRF ) 子模块 2072。 主寄存器堆( MRF )子模块 2072根据所述第一物理寄存器的寄 存器号从第一物理寄存器读取第三源操作数, 并将所述第三源操作 数和第二物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块 208。
执行单元( Exe )模块 208根据所述第三源操作数运算得到第三 目 的操作数, 再将所述第三目 的操作数和第二物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回( WB )模块 209根据第二物理寄存器的寄存器号将所述第 三目 的操作数写回到主寄存器堆 ( MRF ) 子模块 2072 中的所述第二 物理寄存器。
又进一步的, 当第四源寄存器号不等于六个源寄存器号中任意 一个, 且不等于第三目 的寄存器号、 第二目 的寄存器号和第一目 的 寄存器号中任意一个时, 当第四目 的寄存器号等于第五源寄存器号 时, 寄存器堆控制 ( RF-Ctl ) 模块 204 标记第四目 的寄存器号, 并 将第 四 源寄存器号和标记的第 四 目 的寄存器号传输至重命名 ( Rename ) 模块 206。
重命名 ( Rename ) 模块 206将标记的所述第四目 的寄存器号映 射到寄存器堆緩存 ( RFC ) 子模块 2071 中的第四物理寄存器的寄存 器号, 将第四源寄存器号映射到主寄存器堆 ( MRF ) 子模块 2072 中 的第三物理寄存器的寄存器号, 并将所述第四物理寄存器的寄存器 号和所述第三物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块 2071 , 寄存器堆緩存( RFC )子模块 2071再将所述第四物理 寄存器的寄存器号和所述第三物理寄存器的寄存器号传输至主寄存 器堆 ( MRF ) 子模块 2072。
主寄存器堆( MRF )子模块 2072根据所述第三物理寄存器的寄 存器号从第三物理寄存器读取第四源操作数, 并将所述第四源操作 数和第四物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块 208。
执行单元( Exe )模块 208根据所述第四源操作数运算得到第四 目 的操作数, 再将所述第四目 的操作数和第四物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回 ( WB )模块 209根据第四物理寄存器的寄存器号将所述第 四目 的操作数写回到寄存器堆緩存 ( RFC) 子模块 2071 中的所述第 四物理寄存器。
再进一步的, 当第五源寄存器号等于第四 目 的寄存器号时, 当 第五 目 的寄存器号不等于第六源寄存器号时 , 寄存器堆控制 ( RF-Ctl) 模块 204 标记第五源寄存器号, 并将标记的第五源寄存 器号和第五目 的寄存器号传输至重命名 ( Rename) 模块 206。
需要说明的是, 第五源寄存器号还可以等于第一源寄存器号和 第二源寄存器号, 寄存器堆控制 ( RF-Ctl) 模块 204 也可以标记第 五 源 寄存器号 , 并将标记的 第 五 源 寄存器号传输至重命名 ( Rename ) 模块 206。
重命名 ( Rename) 模块 206将标记的所述第五源寄存器号映射 到寄存器堆緩存 ( RFC) 子模块 2071 中的第四物理寄存器的寄存器 号, 所述第四物理寄存器的寄存器号为所述第四 目 的寄存器号所映 射的物理寄存器的寄存器号。 将第五目 的寄存器号映射到主寄存器 堆( MRF)子模块 2072 中的第四物理寄存器的寄存器号, 并将寄存 器堆緩存 ( RFC ) 子模块 2071 中的所述第四物理寄存器的寄存器号 和主寄存器堆 ( MRF) 子模块 2072 中的所述第四物理寄存器的寄存 器号传输至寄存器堆緩存 ( RFC ) 子模块 2071。
寄存器堆緩存 ( RFC) 子模块 2071根据所述第四物理寄存器的 寄存器号从第四物理寄存器第五读取源操作数, 再将所述第五源操 作数和主寄存器堆( MRF) 子模块 2072 中的所述第四物理寄存器的 寄存器号传输至主寄存器堆( MRF )子模块 2072, 主寄存器堆( MRF) 子模块 2072 再将所述第五源操作数和第四物理寄存器的寄存器号 传输至执行单元 ( Exe) 模块 208。 执行单元( Exe)模块 208根据所述第五源操作数运算得到第五 目 的操作数, 再将所述第五目 的操作数和第四物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回( WB )模块 209根据第四物理寄存器的寄存器号将所述第 五目 的操作数写回到主寄存器堆 ( MRF ) 子模块 2072 中的所述第四 物理寄存器。
最后, 当第六源寄存器号等于第二目 的寄存器号时, 寄存器堆 控制 ( RF-Ctl) 模块 204 标记第六源寄存器号, 并将标记的第六源 寄存器号和第六目 的寄存器号传输至重命名 ( Rename) 模块 206。
重命名 ( Rename ) 模块 206将标记的所述第六源寄存器号映射 到寄存器堆緩存 ( RFC) 子模块 2071 中的第三物理寄存器的寄存器 号, 所述第三物理寄存器的寄存器号为所述第二目 的寄存器号所映 射的物理寄存器的寄存器号。 将第六目 的寄存器号映射到主寄存器 堆( MRF) 子模块 2072 中的第五物理寄存器的寄存器号, 并将寄存 器堆緩存 ( RFC ) 子模块 2071 中的所述第三物理寄存器的寄存器号 和主寄存器堆 ( MRF) 子模块 2072 中的所述第五物理寄存器的寄存 器号传输至寄存器堆緩存 ( RFC ) 子模块 2071。
寄存器堆緩存 ( RFC ) 子模块 2071根据所述第三物理寄存器的 寄存器号从第三物理寄存器读取第六源操作数, 再将所述第六源操 作数和主寄存器堆( MRF )子模块 2072 中的所述第五物理寄存器的 寄存器号传输至主寄存器堆( MRF)子模块 2072, 主寄存器堆( MRF) 子模块 2072 再将所述第六源操作数和第五物理寄存器的寄存器号 传输至执行单元 ( Exe) 模块 208。
执行单元( Exe)模块 208根据所述第六源操作数运算得到第六 目 的操作数, 再将所述第六目 的操作数和第五物理寄存器的寄存器 号传输至写回 ( WB ) 模块 209。
写回( WB )模块 209根据第五物理寄存器的寄存器号将所述第 六目 的操作数写回到主寄存器堆 ( MRF ) 子模块 2072 中的所述第五 物理寄存器。
需要说明的是, 本发明实施例所述的指令缓存 ( IB ) 模块的每 个线程可以是 32位, 每个线程可以緩存 8到 16条指令。 本发明实 施例所述的六个源寄存器号与六个目 的寄存器号不限于两条指令的 源寄存器号和目 的寄存器号, 还可以是三条指令或其他数量的指 令, 不同指令的源寄存器号可以映射到同一个物理寄存器号, 或不 同指令的目 的寄存器号可以映射到同一个物理寄存器号, 且本发明 所述的映射关系只是示意性说明, 实际应用中 N个源寄存器号和 N 个目 的寄存器号之间还可以有其他的映射关系, 本发明对此不作限 定。
本发明实施例所述的数据处理装置, 在寄存器堆控制模块获取 到 N个源寄存器号与 N个目 的寄存器号后, 分析 N个源寄存器号与 N个目 的寄存器号的相关性, 当第 i目 的寄存器号等于第 i+ 1源寄存 器号至第 N源寄存器号中至少一个源寄存器号时, 重命名模块将第 i 目 的寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 当第 i+ 1源寄存器号等于第 i 目 的寄存器号至第 1 目 的寄存器号中的任意 一个目 的寄存器号, 或者所述第 i+ 1 源寄存器号等于所述 N个源寄 存器号中两个或两个以上的源寄存器号时, 重命名模块将第 i+ 1 源 寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 当第 i 目 的 寄存器号不等于第 i+ 1 源寄存器号至第 N源寄存器号中任意一个源 寄存器号时, 重命名模块将第 i 目 的寄存器号映射到主寄存器堆子 模块的物理寄存器号, 当第 i+ 1源寄存器号不等于第 i目 的寄存器号 至第 1 目 的寄存器号中的任意一个目 的寄存器号, 或者所述第 i+ 1 源寄存器号不等于所述 N个源寄存器号中任意一个源寄存器号时, 重命名模块将第 i+ 1 源寄存器号映射到主寄存器堆子模块的物理寄 存器号, 相对于现有技术, 能够有效地提高寄存器堆緩存子模块的 使用效率。
本发明实施例提供一种数据处理方法, 如图 3 所示, 假设用于 数据处理装置 20 , 所述数据处理装置包括指令预译码 Pre-decoder 模块、 指令緩存 IB 模块、 寄存器堆控制 RF-Ctl 模块、 重命名 Rename模块、 寄存器堆 RF模块, 所述 RF模块包括寄存器堆緩存 RFC子模块和主寄存器堆 MRF子模块, 所述方法包括:
步骤 301、 从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指令预译码模块和所述指令緩存模块中获取 N个源寄存器 号和 N个目 的寄存器号。
首先, 预译码至少一条指令, 得到 N个源寄存器号和 N个目 的 寄存器号, 每一个所述指令包括至少一个源寄存器号和至少一个目 的寄存器号, 然后, 存储所述指令。
可以从所述指令緩存模块获取 N个源寄存器号和 N个目 的寄存 器号;
或者, 可以直接从所述指令预译码模块获取 N个源寄存器号和 N个目 的寄存器号;
或者, 可以从所述指令緩存模块获取 N- 1 个源寄存器号和 N- 1 个目 的寄存器号, 从所述指令预译码模块获取第 N源寄存器号和第 N 目 的寄存器号。
步骤 302、 当第 i 目 的寄存器号满足第一预设条件时, 标记所 述第 1 目 的寄存器号, 所述 1为大于等于 1 且小于等于 N 的整数, 所述 N为大于等于 2的整数。
所述第一预设条件为所述第 i 目 的寄存器号等于第 i+ 1 源寄存 器号至第 N源寄存器号中至少一个源寄存器号, 所述 i+ 1 为小于等 于 N的整数。
步骤 303、 将标记的所述第 i 目 的寄存器号映射到所述寄存器 堆緩存子模块中的第一物理寄存器的寄存器号, 所述第一物理寄存 器为所述寄存器堆緩存子模块中多个空闲的物理寄存器中任意一 个。
这样一来, 当寄存器堆控制模块获取到的第 i 目 的寄存器号满 足第一预设条件时, 标记第 i 目 的寄存器号, 重命名模块将所述第 i 目 的寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 相对于 现有技术, 能够有效地提高寄存器堆緩存子模块的使用效率。
本发明实施例提供一种数据处理方法, 如图 4所示, ^^设用于 数据处理装置 20, 所述数据处理装置包括指令读取单元 ( IFU) 模 块 201、 指令预译码 ( Pre-decode) 模块 202、 指令緩存 ( IB ) 模块 203、 寄存器堆控制 ( RF-Ctl) 模块 204、 指令译码 ( Decoder) 模块 205、 重命名 ( Rename ) 模块 200、 寄存器堆 ( RF ) 模块 207、 执行 单元 ( Exe) 模块 208、 写回 ( WB ) 模块 209, 所述寄存器堆 ( RF ) 模块 207 包括寄存器堆緩存( RFC )子模块 2071和主寄存器堆( MRF ) 子模块 2072, 所述方法包括:
步骤 401、 指令读取单元模块读取指令。
指令读取单元 ( IFU) 模块可以从緩存或高速緩沖存储器读取 指令, 并将所述指令传输至指令预译码 ( Pre-decode) 模块。
本发明实施例假设指令读取单元 ( IFU) 模块从緩存或高速緩 冲存储器读取了 两条指令, 并将所述两条指令传输至指令预译码 ( Pre-decode) 模块, 该两条指令分别为第一指令和第二指令。
步骤 402、 指令预译码模块预译码第一指令和第二指令。
指令预译码 ( pre-decode ) 模块接收到第一指令和第二指令之 后, 对所述第一指令和所述第二指令进行预译码, 得到每个所述指 令的指令类型、 源寄存器号和目 的寄存器号, 其中, 第一指令包括 第一指令类型、 三个源寄存器号和三个目 的寄存器号, 三个源寄存 器号分别为第一源寄存器号、 第二源寄存器号、 第三源寄存器号, 三个目 的寄存器号分别为第一目 的寄存器号、 第二目 的寄存器号和 第三目 的寄存器号, 第二指令包括第二指令类型、 三个源寄存器号 和三个目 的寄存器号, 三个源寄存器号分别为第四源寄存器号、 第 五源寄存器号、 第六源寄存器号, 三个目 的寄存器号分别为第四目 的寄存器号、 第五目 的寄存器号和第六目 的寄存器号。 指令预译码
( Pre-decode )模块再将六个源寄存器号和六个目 的寄存器号传输至 指令緩存 ( IB ) 模块。
步骤 403、 指令緩存模块存储六个源寄存器号和六个目 的寄存 器号。
指令緩存 ( IB ) 模块接收到六个源寄存器号和六个目 的寄存器 号之后, 存储所述六个源寄存器号和所述六个目 的寄存器号。
步骤 404、 寄存器堆控制模块获取六个源寄存器号和六个目 的 寄存器号。
寄存器堆控制 ( RF-Ctl ) 模块从指令緩存 ( IB ) 模块获取六个 源寄存器号和六个目 的寄存器号。
需要说明的是, 寄存器堆控制 ( RF-Ctl ) 模块还可以从指令预 译码模块, 或者从指令预译码模块和指令緩存模块中获取六个源寄 存器号和六个目 的寄存器号。 当指令缓存模块中存储五个源寄存器 号和五个目 的寄存器号, 寄存器堆控制 ( RF-Ctl ) 模块可以从指令 緩存模块中获取五个源寄存器号和五个目 的寄存器号, 从指令预译 码模块获取一个源寄存器号和一个目 的寄存器号。
寄存器堆控制 ( RF-Ctl ) 模块分析所述六个源寄存器号和所述 六个目 的寄存器号之间的相关性。 假设所述六个源寄存器号分别为 第一源寄存器号至第六源寄存器号, 所述六个目 的寄存器号分别为 第一目 的寄存器号至第六目 的寄存器号。
步骤 405、 寄存器堆控制模块标记第一源寄存器号和第一目 的 寄存器号。
假设当第一源寄存器号等于第二源寄存器号, 且第一源寄存器 号等于第五源寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块标记所述 第一源寄存器号, 并将标记的所述第一源寄存器号传输至重命名 ( Rename ) 模块。
当第一目 的寄存器号等于第二源寄存器号时, 寄存器堆控制
( RF-Ctl ) 模块标记所述第一目 的寄存器号, 并将标记的所述第一 目 的寄存器号传输至重命名 ( Rename ) 模块。
步骤 406、 重命名模块将第一源寄存器号和第一目 的寄存器号 映射到寄存器堆緩存子模块。
重命名 ( Rename ) 模块将标记的所述第一源寄存器号映射到寄 存器堆緩存 ( RFC ) 子模块中的第一物理寄存器的寄存器号, 将标 记的所述第一目 的寄存器号映射到寄存器堆緩存 ( RFC ) 子模块中 的第二物理寄存器的寄存器号, 并将第一物理寄存器的寄存器号和 第二物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块。 所述第一物理寄存器的寄存器号为所述寄存器堆緩存子模块中多个 空闲的物理寄存器中任意一个, 所述第二物理寄存器的寄存器号为 所述寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个, 该 第一物理寄存器的寄存器号与该第二物理寄存器的寄存器号不同。
步骤 407、 寄存器堆緩存子模块读取第一源操作数。
寄存器堆緩存 ( RFC ) 子模块根据第一物理寄存器的寄存器号 从第一物理寄存器读取第一源操作数, 并将所述第一源操作数和第 二物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块。
步骤 408、 执行单元模块根据所述第一源操作数运算得到第一 目 的操作数。
再将所述第一目 的操作数和第二物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 409、 写回模块将第一目 的操作数写回。
写回( WB )模块根据第二物理寄存器的寄存器号将所述第二目 的操作数写回到寄存器堆緩存 ( RFC ) 子模块中的所述第二物理寄 存器。
如图 5 所示, 本发明实施例提供一种数据处理方法还包括步骤 4010至步骤 4014。
步骤 4010、 寄存器堆控制模块标记第二源寄存器号和第二目 的寄存器号。
当第二源寄存器号等于第一目 的寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块标记第二源寄存器号, 并将标记的所述第二源寄存 器号传输至重命名 ( Rename ) 模块。
当第二目 的寄存器号等于第六源寄存器号时, 寄存器堆控制
( RF-Ctl ) 模块标记第二目 的寄存器号, 并将标记的所述第二目 的 寄存器号传输至重命名 ( Rename ) 模块。
需要说明的是, 第二源寄存器号还可以等于第一源寄存器号和 第五源寄存器号, 寄存器堆控制 ( RF-Ctl ) 模块也可以标记第二源 寄存器号 , 并将标记的 所述第 二源 寄存器号传输至重命名 ( Rename ) 模块。
步骤 401 1、 重命名模块将第二源寄存器号和第二目 的寄存器 号映射到寄存器堆緩存子模块。
重命名 ( Rename ) 模块将标记的所述第二源寄存器号映射到寄 存器堆緩存 ( RFC ) 子模块中的第二物理寄存器的寄存器号, 所述 第二物理寄存器的寄存器号为所述第一目 的寄存器号所映射的物理 寄存器的寄存器号, 并将第二物理寄存器的寄存器号传输至寄存器 堆緩存 ( RFC ) 子模块。
重命名 ( Rename ) 模块将标记的所述第二目 的寄存器号映射到 寄存器堆緩存 ( RFC ) 子模块中的第三物理寄存器的寄存器号, 并 将第三物理寄存器的寄存器号传输至寄存器堆緩存( RFC )子模块。
所述第三物理寄存器的寄存器号为所述寄存器堆緩存子模块中 多个空闲的物理寄存器中任意一个, 所述第二物理寄存器的寄存器 号为所述寄存器堆緩存子模块中多个空闲的物理寄存器中任意一 个, 该第三物理寄存器的寄存器号与该第二物理寄存器的寄存器号 不同。
步骤 4012、 寄存器堆緩存子模块读取第二源操作数。
寄存器堆緩存 ( RFC ) 子模块根据第二物理寄存器的寄存器号 从第二物理寄存器读取第二源操作数, 并将所述第二源操作数和第 三物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块。
步骤 4013、 执行单元模块根据所述第二源操作数运算得到第 二目 的操作数。
再将所述第二目 的操作数和第三物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 4014、 写回模块将第二目 的操作数写回。
写回( WB )模块根据第三物理寄存器的寄存器号将所述第二目 的操作数写回到寄存器堆緩存 ( RFC ) 子模块中的所述第三物理寄 存器。
如图 6所示, 本发明实施例提供一种数据处理方法还包括步骤 4015至步骤 4020。
步骤 4015、 寄存器堆控制模块将第三源寄存器号和第三目 的 寄存器号传输至重命名模块。
当第三源寄存器号不等于六个源寄存器号中任意一个, 且不等 于第二目 的寄存器号和第一目 的寄存器号中任意一个时, 寄存器堆 控制 ( RF-Ctl ) 模块将第三源寄存器号传输至重命名模块。
当第三目 的寄存器号不等于第四源寄存器号、 第五源寄存器号 和第六源寄存器号中任意一个时, 寄存器堆控制 ( RF-Ctl ) 模块将 第三目 的寄存器号传输至重命名 ( Rename ) 模块。
步骤 4016、 重命名模块将第三源寄存器号和第三目 的寄存器 号映射到主寄存器堆子模块。
重命名 ( Rename ) 模块将第三源寄存器号映射到主寄存器堆 ( MRF ) 子模块中的第一物理寄存器的寄存器号, 并将所述第一物 理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块。
重命名 ( Rename) 模块将第三目 的寄存器号映射到主寄存器堆 ( M F ) 子模块中的第二物理寄存器的寄存器号, 并将所述第二物 理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块。
步骤 4017、 寄存器堆緩存子模块再将所述第一物理寄存器的 寄存器号和所述第二物理寄存器的寄存器号传输至主寄存器堆子模 块。
步骤 4018、 主寄存器堆子模块读取第三源操作数。
主寄存器堆 ( MRF ) 子模块根据所述第一物理寄存器的寄存器 号从第一物理寄存器读取第三源操作数, 并将所述第三源操作数和 第二物理寄存器的寄存器号传输至执行单元 ( Exe) 模块。
步骤 4019、 执行单元模块根据所述第三源操作数运算得到第 三目 的操作数。
再将所述第三目 的操作数和第二物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 4020、 写回模块将第三目 的操作数写回。
写回( WB )模块根据第二物理寄存器的寄存器号将所述第三目 的操作数写回到主寄存器堆 ( MRF ) 子模块中的所述第二物理寄存 器。
如图 7 所示, 本发明实施例提供一种数据处理方法还包括步骤 4021 至步骤 4026。
步驟 4021、 寄存器堆控制模块将第四源寄存器号传输至重命 名模块。
当第四源寄存器号不等于六个源寄存器号中任意一个, 且不等 于第三目 的寄存器号、 第二目 的寄存器号和第一目 的寄存器号中任 意一个时, 寄存器堆控制 ( RF-Ctl) 模块将第四源寄存器号传输至 重命名 ( Rename) 模块。
步骤 4022、 寄存器堆控制模块标记第四目 的寄存器号。
当第四目 的寄存器号等于第五源寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模标记第四目 的寄存器号, 并将第四源寄存器号和标记 的第四目 的寄存器号传输至重命名 ( Rename) 模块。
步骤 4023、 重命名模块将第四源寄存器号映射到主寄存器堆 模块, 将第四目 的寄存器号映射到寄存器堆緩存子模块。
重命名 ( Rename ) 模块将第四源寄存器号映射到主寄存器堆 ( MRF ) 子模块中的第三物理寄存器的寄存器号, 并将所述第三物 理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块, 寄存器 堆緩存 ( RFC ) 子模块再将所述第四物理寄存器的寄存器号和所述 第三物理寄存器的寄存器号传输至主寄存器堆 ( MRF) 子模块。
重命名 ( Rename) 模块将标记的所述第四目 的寄存器号映射到 寄存器堆緩存 ( RFC ) 子模块中的第四物理寄存器的寄存器号, 并 将所述第四物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子 模块。
需要说明的是, 若第四目 的寄存器号与第二目 的寄存器号为同 一条指令包括的寄存器号, 第二目 的寄存器号被映射到的第三物理 寄存器的寄存器号和第四目 的寄存器号被映射到的第四物理寄存器 的寄存器号可以不同; 若第四目 的寄存器号与第二目 的寄存器号为 不同指令包括的寄存器号, 第二目 的寄存器号被映射到的第三物理 寄存器的寄存器号和第四目 的寄存器号被映射到的第四物理寄存器 的寄存器号可以相同。
所述第三物理寄存器的寄存器号为所述主寄存器堆子模块中多 个空闲的物理寄存器中任意一个, 所述第四物理寄存器的寄存器号 为所述寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个, 该第三物理寄存器的寄存器号与该第四物理寄存器的寄存器号不 同。
步骤 4024、 主寄存器堆子模块读取第四源操作数。
主寄存器堆 ( MRF ) 子模块根据所述第三物理寄存器的寄存器 号从第三物理寄存器读取第四源操作数, 并将所述第四源操作数和 第四物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块。
步骤 4025、 执行单元模块根据所述第四源操作数运算得到第 四目 的操作数。
再将所述第四目 的操作数和第四物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 4026、 写回模块将第四目 的操作数写回。
写回 ( WB )模块根据第四物理寄存器的寄存器号将所述第四目 的操作数写回到寄存器堆緩存 ( RFC ) 子模块中的所述第四物理寄 存器。
如图 8 所示, 本发明实施例提供一种数据处理方法还包括步骤 4027至步骤 4032。
步骤 4027、 寄存器堆控制模块标记第五源寄存器号。
当第五源寄存器号等于第四 目 的寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块标记第五源寄存器号, 并将标记的第五源寄存器号 传输至重命名 ( Rename ) 模块。
需要说明的是, 第五源寄存器号还可以等于第一源寄存器号和 第二源寄存器号, 寄存器堆控制 ( RF-Ctl ) 模块也可以标记第五源 寄存器号, 并将标记的第五源寄存器号传输至重命名 ( Rename ) 模 块。
步骤 4028、 寄存器堆控制模块将第五目 的寄存器号传输至重 命名模块。 当第五目 的寄存器号不等于第六源寄存器号时, 将第五目 的寄 存器号传输至重命名 ( Rename) 模块。
步骤 4029、 重命名模块将标记的第五源寄存器号映射到寄存 器堆緩存子模块, 将第五目 的寄存器号映射到主寄存器堆模块。
重命名 ( Rename) 模块将标记的所述第五源寄存器号映射到寄 存器堆緩存 ( RFC ) 子模块中的第四物理寄存器的寄存器号, 所述 第四物理寄存器的寄存器号为所述第四目 的寄存器号所映射的物理 寄存器的寄存器号, 并将寄存器堆緩存 ( RFC ) 子模块中的所述第 四物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC) 子模块。
重命名 ( Rename) 模块将第五目 的寄存器号映射到主寄存器堆 ( MRF ) 子模块中的第四物理寄存器的寄存器号, 并将主寄存器堆 ( MRF ) 子模块中的所述第四物理寄存器的寄存器号传输至寄存器 堆緩存 ( RFC ) 子模块。
所述第四物理寄存器的寄存器号为所述主寄存器堆子模块中多 个空闲的物理寄存器中任意一个, 所述第四物理寄存器的寄存器号 为所述寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个, 该第四物理寄存器的寄存器号与该第四物理寄存器的寄存器号可以 不同, 也可以相同。
步骤 4030、 寄存器堆緩存子模块读取第五源操作数。
寄存器堆緩存 ( RFC ) 子模块根据所述第四物理寄存器的寄存 器号从第四物理寄存器读取第五源操作数, 再将所述第五源操作数 和主寄存器堆 ( MRF ) 子模块中的所述第四物理寄存器的寄存器号 传输至主寄存器堆 ( MRF ) 子模块, 主寄存器堆 ( MRF ) 子模块再 将所述第五源操作数和第四物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块。
步骤 4031、 执行单元模块根据所述第五源操作数运算得到第 五目 的操作数。 再将所述第五目 的操作数和第四物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 4032、 写回模块将第五目 的操作数写回。
写回( WB )模块根据第四物理寄存器的寄存器号将所述第五目 的操作数写回到主寄存器堆 ( MRF ) 子模块中的所述第四物理寄存 哭
如图 9 所示, 本发明实施例提供一种数据处理方法还包括步骤 4033 至步骤 4038
步骤 4033、 寄存器堆控制模块标记第六源寄存器号。
当第六源寄存器号等于第二目 的寄存器号时, 寄存器堆控制 ( RF-Ctl ) 模块标记第六源寄存器号, 并将标记的第六源寄存器号 传输至重命名 ( Rename ) 模块。
步骤 4034、 寄存器堆控制模块将第六目 的寄存器号传输至重 命名模块。
步骤 4035、 重命名模块将标记的第六源寄存器号映射到寄存 器堆緩存子模块, 将第六目 的寄存器号映射到主寄存器堆模块。
重命名 ( Rename ) 模块将标记的所述第六源寄存器号映射到寄 存器堆緩存 ( RFC ) 子模块中的第三物理寄存器的寄存器号, 所述 第三物理寄存器的寄存器号为所述第二目 的寄存器号所映射的物理 寄存器的寄存器号, 并将寄存器堆緩存 ( RFC ) 子模块中的所述第 三物理寄存器的寄存器号传输至寄存器堆緩存 ( RFC ) 子模块。
重命名 ( Rename ) 模块将第六目 的寄存器号映射到主寄存器堆 ( MRF ) 子模块中的第五物理寄存器的寄存器号, 并将主寄存器堆 ( M F ) 子模块中的所述第五物理寄存器的寄存器号传输至寄存器 堆緩存 ( RFC ) 子模块。
步骤 4036、 寄存器堆緩存子模块读取第六源操作数。
寄存器堆緩存 ( RFC ) 子模块根据所述第三物理寄存器的寄存 器号从第三物理寄存器读取第六源操作数, 再将所述六源操作数和 主寄存器堆 ( MRF ) 子模块中的所述第五物理寄存器的寄存器号传 输至主寄存器堆 ( MRF ) 子模块, 主寄存器堆 ( MRF ) 子模块再将 所述第六源操作数和第五物理寄存器的寄存器号传输至执行单元 ( Exe ) 模块。
步骤 4037、 执行单元模块根据所述第六源操作数运算得到第 六目 的操作数。
再将所述第六目 的操作数和第五物理寄存器的寄存器号传输至 写回 ( WB ) 模块。
步骤 4038、 写回模块将第六目 的操作数写回。
写回( WB )模块根据第五物理寄存器的寄存器号将所述第六目 的操作数写回到主寄存器堆 ( MRF ) 子模块中的所述第五物理寄存 器。
需要说明的是, 本发明实施例所述的指令緩存 ( IB ) 模块的每 个线程可以是 32位, 每个线程可以緩存 8到 16条指令。 本发明实 施例所述的六个源寄存器号与六个目 的寄存器号不限于两条指令的 源寄存器号和目 的寄存器号, 还可以是三条指令或其他数量的指 令, 不同指令的源寄存器号可以映射到同一个物理寄存器号, 或不 同指令的目 的寄存器号可以映射到同一个物理寄存器号, 且本发明 所述的映射关系只是示意性说明, 实际应用中 N个源寄存器号和 N 个目 的寄存器号之间还可以有其他的映射关系, 本发明对此不作限 定。
本发明实施例所述的数据处理装置, 在寄存器堆控制模块获取 到 N个源寄存器号与 N个目 的寄存器号后, 分析 N个源寄存器号与 N个目 的寄存器号的相关性, 当第 i目 的寄存器号等于第 i+ 1源寄存 器号至第 N源寄存器号中至少一个源寄存器号时, 重命名模块将第 i 目 的寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 当第 i+ 1源寄存器号等于第 i 目 的寄存器号至第 1 目 的寄存器号中的任意 一个目 的寄存器号, 或者所述第 i+ 1 源寄存器号等于所述 N个源寄 存器号中两个或两个以上的源寄存器号时, 重命名模块将第 i+ 1 源 寄存器号映射到寄存器堆緩存子模块的物理寄存器号, 当第 i 目 的 寄存器号不等于第 i+ 1 源寄存器号至第 N源寄存器号中任意一个源 寄存器号时, 重命名模块将第 i 目 的寄存器号映射到主寄存器堆子 模块的物理寄存器号, 当第 i+ 1源寄存器号不等于第 i目 的寄存器号 至第 1 目 的寄存器号中的任意一个目 的寄存器号, 或者所述第 i+ 1 源寄存器号不等于所述 N个源寄存器号中任意一个源寄存器号时, 重命名模块将第 i+ 1 源寄存器号映射到主寄存器堆子模块的物理寄 存器号, 相对于现有技术, 能够有效地提高寄存器堆緩存子模块的 使用效率。
所属领域的技术人员可以清楚地了解到, 为描述的方便和简 洁, 上述描述的装置和单元的具体工作过程, 可以参考前述方法实 施例中的对应过程, 在此不再贅述。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的装置 和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施 例仅仅是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能 划分, 实际实现时可以有另外的划分方式, 例如多个单元或组件可 以结合或者可以集成到另一个系统, 或一些特征可以忽略, 或不执 行。 另一点, 所显示或讨论的相互之间的耦合或直接耦合或通信连 接可以是通过一些接口 , 装置或单元的间接耦合或通信连接, 可以 是电性, 机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分 开的, 作为单元显示的部件可以是或者也可以不是物理单元, 即可 以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实 际的需要选择其中的部分或者全部单元来实现本实施例方案的 目 的。
另外, 在本发明各个实施例中的各功能单元可以集成在一个处 理单元中, 也可以是各个单元单独物理包括, 也可以两个或两个以 上单元集成在一个单元中。 上述集成的单元既可以采用硬件的形式 实现, 也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或 部分步驟可以通过程序指令相关的硬件来完成, 前述的程序可以存 储于一计算机可读取存储介质中, 该程序在执行时, 执行包括上述 方法实施例的步骤; 而前述的存储介质包括: ROM、 RAM , 磁碟 或者光盘等各种可以存储程序代码的介质。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围 并不局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技 术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围 之内 。 因此, 本发明的保护范围应以所述权利要求的保护范围为

Claims

权 利 要 求 书
1、 一种数据处理装置, 其特征在于, 所述数据处理装置包括指 令预译码 Pre-decoder模块、 指令緩存 IB模块、 寄存器堆控制 RF-Ctl 模块、 重命名 Rename模块、 寄存器堆 RF模块, 所述 RF模块包括寄 存器堆緩存 RFC子模块和主寄存器堆 MRF子模块, 其中,
所述寄存器堆控制模块, 用于从所述指令预译码模块, 或者所 述指令緩存模块, 或者所述指令预译码模块和所述指令緩存模块中 获取 N个源寄存器号和 N个目的寄存器号;
所述寄存器堆控制模块还用于:
当第 i 目 的寄存器号满足第一预设条件时, 标记所述第 i 目的寄 存器号, 所述 i为大于等于 1且小于等于 N的整数, 所述 N为大于等 于 2的整数;
所述重命名模块, 用于将标记的所述第 i目 的寄存器号映射到所 述寄存器堆緩存子模块中的第一物理寄存器的寄存器号, 所述第一 物理寄存器为所述寄存器堆緩存子模块中多个空闲的物理寄存器中 任意一个。
2、 根据权利要求 1 所述的数据处理装置, 其特征在于, 所述第 一预设条件为所述第 i 目的寄存器号等于第 i+ 1 源寄存器号至第 N源 寄存器号中至少一个源寄存器号, 所述 i+1 为小于等于 N的整数。
3、 根据权利要求 2所述的数据处理装置, 其特征在于, 所述指令预译码模块, 用于预译码至少一条指令, 得到 N 个源 寄存器号和 N 个目 的寄存器号, 每一个所述指令包括至少一个源寄 存器号和至少一个目 的寄存器号;
所述指令緩存模块用于存储所述指令。
4、 根据权利要求 3所述的数据处理装置, 其特征在于, 所述寄存器堆控制模块具体用于:
从所述指令緩存模块获取 N 个源寄存器号和 N 个目 的寄存器 号;
或者, 直接从所述指令预译码模块获取 N个源寄存器号和 N个 目的寄存器号;
或者, 从所述指令緩存模块获取 N- 1个源寄存器号和 N- 1个目 的 寄存器号, 从所述指令预译码模块获取第 N 源寄存器号和第 N 目 的 寄存器号。
5、 根据权利要求 4所述的数据处理装置, 其特征在于, 所述寄存器堆控制模块还用于:
当第 i+ 1 源寄存器号满足第二预设条件时, 标记所述第 i+1源寄 存器号, 所述 i+ 1 为小于等于 N的整数;
所述重命名模块还用于:
将标记的所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模 块中的物理寄存器的寄存器号, 所述物理寄存器的寄存器号为与所 述第 i+1源寄存器号相等的目 的寄存器号被映射到的所述寄存器堆緩 存子模块中的物理寄存器的寄存器号;
所述寄存器堆緩存子模块, 用于根据所述物理寄存器的寄存器 号从所述物理寄存器读取第一源操作数。
6、 根据权利要求 5 所述的数据处理装置, 其特征在于, 所述第 二预设条件为所述第 i+1 源寄存器号等于第 i 目 的寄存器号至第 1 目 的寄存器号中的任意一个目 的寄存器号, 所述 i+ 1为小于等于 N的整 数, 或, 所述第 i+1源寄存器号等于所述 N个源寄存器号中两个或两 个以上的源寄存器号。
7、 根据权利要求 6所述的数据处理装置, 其特征在于, 所述重命名模块具体用于:
当所述第 i+1 源寄存器号等于第 i 目 的寄存器号时, 将标记的所 述第 i+1源寄存器号映射到所述寄存器堆緩存子模块中的所述第一物 理寄存器的寄存器号;
所述寄存器堆緩存子模块具体用于:
根据所述第一物理寄存器的寄存器号从所述第一物理寄存器读 取所述第一源操作数。
8、 根据权利要求 6所述的数据处理装置, 其特征在于, 所述寄存器堆控制模块还用于:
当第 i+ 1 目的寄存器号等于第 i+2源寄存器号至第 N源寄存器号 中至少一个源寄存器号时, 标记所述第 i+1 目的寄存器号, 所述 i+2 为小于等于 N的整数;
所述重命名模块还用于:
将标记的所述第 i+ 1 目 的寄存器号映射到所述寄存器堆緩存子 模块中的第二物理寄存器的寄存器号, 所述第二物理寄存器为所述 寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
9、 根据权利要求 8所述的数据处理装置, 其特征在于, 所述数 据处理装置还包括执行单元 Exe模块和写回 WB模块, 其中,
所述执行单元模块, 用于获取所述第一源操作数和所述第二物 理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操 作数;
所述写回模块, 用于根据所述第二物理寄存器的寄存器号将所 述第一目的操作数写回到所述第二物理寄存器。
10、 根据权利要求 4所述的数据处理装置, 其特征在于, 所述重命名模块还用于:
当所述第 i 目的寄存器号不等于第 i+1源寄存器号至第 N源寄存 器号中任意一个源寄存器号时, 将所述第 i 目 的寄存器号映射到所述 主寄存器堆子模块中的第三物理寄存器的寄存器号, 所述第三物理 寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任意一 个。
1 1、 根据权利要求 10所述的数据处理装置, 其特征在于, 所述重命名模块还用于:
当所述第 i+1 源寄存器号不等于第 i 目 的寄存器号至第 1 目的寄 存器号中的任意一个目 的寄存器号, 或, 所述第 i+1源寄存器号不等 于所述 N个源寄存器号中任意一个源寄存器号时, 将所述第 i+1源寄 存器号映射到所述主寄存器堆子模块中的第四物理寄存器的寄存器 号, 所述第四物理寄存器为所述主寄存器堆子模块中多个空闲的物 理寄存器中任意一个。
12、 根据权利要求 1 1所述的数据处理装置, 其特征在于, 所述主寄存器堆子模块, 用于根据所述第四物理寄存器的寄存 器号从所述第四物理寄存器读取第二源操作数。
13、 根据权利要求 6或 12所述的数据处理装置, 其特征在于, 所述重命名模块还用于:
当所述第 i+1 目 的寄存器号不等于第 i+2源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映射到 所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述第五 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
14、 根据权利要求 13所述的数据处理装置, 其特征在于, 所述执行单元模块, 用于获取所述第一源操作数和所述第五物 理寄存器的寄存器号, 根据所述第一源操作数运算得到第一目 的操 作数;
所述写回模块, 用于根据所述第五物理寄存器的寄存器号将所 述第一目的操作数写回到所述第五物理寄存器。
15、 根据权利要求 13所述的数据处理装置, 其特征在于, 所述执行单元模块还用于:
获取所述第二源操作数和所述第五物理寄存器的寄存器号, 根 据所述第二源操作数运算得到第二目 的操作数;
所述写回模块还用于:
根据所述第五物理寄存器的寄存器号将所述第二目 的操作数写 回到所述第五物理寄存器。
16、 一种数据处理方法, 其特征在于, 用于数据处理装置, 所 述数据处理装置包括指令预译码 Pre-decoder模块、指令緩存 IB模块、 寄存器堆控制 RF-Ctl模块、 重命名 Rename模块、 寄存器堆 RF模块, 所述 RF模块包括寄存器堆緩存 RFC子模块和主寄存器堆 MRF子模 块, 其中, 从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指 令预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的寄存器号;
当第 i 目 的寄存器号满足第一预设条件时, 标记所述第 i 目的寄 存器号, 所述 i为大于等于 1且小于等于 N的整数, 所述 N为大于等 于 2的整数;
将标记的所述第 i目 的寄存器号映射到所述寄存器堆緩存子模块 中的第一物理寄存器的寄存器号, 所述第一物理寄存器为所述寄存 器堆緩存子模块中多个空闲的物理寄存器中任意一个。
17、 根据权利要求 16所述的数据处理方法, 其特征在于, 所述 第一预设条件为所述第 i 目 的寄存器号等于第 i+ 1 源寄存器号至第 N 源寄存器号中至少一个源寄存器号, 所述 i + 1为小于等于 N的整数。
18、 根据权利要求 17所述的数据处理方法, 其特征在于, 在所 述从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指令 预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的 寄存器号之前, 所述方法还包括:
预译码至少一条指令, 得到 N个源寄存器号和 N个目 的寄存器 号, 每一个所述指令包括至少一个源寄存器号和至少一个目 的寄存 器号;
存储所述指令。
19、 根据权利要求 18所述的数据处理方法, 其特征在于, 所述 从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指令预 译码模块和所述指令緩存模块中获取所述 N个源寄存器号和 N个目 的寄存器号包括:
从所述指令緩存模块获取 N 个源寄存器号和 N 个目 的寄存器 号;
或者, 直接从所述指令预译码模块获取 N个源寄存器号和 N个 目的寄存器号;
或者, 从所述指令緩存模块获取 N- 1个源寄存器号和 N- 1个目 的 寄存器号, 从所述指令预译码模块获取第 N 源寄存器号和第 N 目 的 寄存器号。
20、 根据权利要求 19所述的数据处理方法, 其特征在于, 在所 述将标记的所述第 i 目 的寄存器号映射到所述寄存器堆緩存子模块中 的第一物理寄存器的寄存器号之后, 所述方法还包括:
当第 i+ 1 源寄存器号满足第二预设条件时, 标记所述第 i+1源寄 存器号, 所述 i+ 1 为小于等于 N的整数;
将标记的所述第 i+ 1 源寄存器号映射到所述寄存器堆緩存子模 块中的物理寄存器的寄存器号, 所述物理寄存器的寄存器号为与所 述第 i+1源寄存器号相等的目 的寄存器号被映射到的所述寄存器堆緩 存子模块中的物理寄存器的寄存器号;
根据所述物理寄存器的寄存器号从所述物理寄存器读取第一源 操作数。
21、 根据权利要求 20所述的数据处理方法, 其特征在于, 所述 第二预设条件为所述第 i+ 1 源寄存器号等于第 i 目 的寄存器号至第 1 目的寄存器号中的任意一个目 的寄存器号, 所述 i+1为小于等于 N的 整数, 或, 所述第 i+1源寄存器号等于所述 N个源寄存器号中两个或 两个以上的源寄存器号。
22、 根据权利要求 21 所述的数据处理方法, 其特征在于, 所述 将标记的所述第 i+ 1源寄存器号映射到所述寄存器堆緩存子模块中的 物理寄存器的寄存器号包括:
当所述第 i+ 1 源寄存器号等于第 i 目 的寄存器号时, 将标记的所 述第 i+1源寄存器号映射到所述寄存器堆緩存子模块中的所述第一物 理寄存器的寄存器号;
根据所述第一物理寄存器的寄存器号从所述第一物理寄存器读 取所述第一源操作数。
23、 根据权利要求 21 所述的数据处理方法, 其特征在于, 在所 述将标记的所述第 i 目 的寄存器号映射到所述寄存器堆緩存子模块中 的第一物理寄存器的寄存器号之后, 所述方法还包括: 当第 i+ 1 目的寄存器号等于第 i+2源寄存器号至第 N源寄存器号 中至少一个源寄存器号时, 标记所述第 i+1 目的寄存器号, 所述 i+2 为小于等于 N的整数;
将标记的所述第 i+ 1 目 的寄存器号映射到所述寄存器堆緩存子 模块中的第二物理寄存器的寄存器号, 所述第二物理寄存器为所述 寄存器堆緩存子模块中多个空闲的物理寄存器中任意一个。
24、 根据权利要求 23 所述的数据处理方法, 其特征在于, 所述 数据处理装置还包括执行单元 Exe模块和写回 WB模块, 在所述将标 记的所述第 i+1 目 的寄存器号映射到所述寄存器堆缓存子模块中的第 二物理寄存器的寄存器号之后, 所述方法还包括:
获取所述第一源操作数和所述第二物理寄存器的寄存器号, 根 据所述第一源操作数运算得到第一目 的操作数;
根据所述第二物理寄存器的寄存器号将所述第一目 的操作数写 回到所述第二物理寄存器。
25、 根据权利要求 19所述的数据处理方法, 其特征在于, 在所 述从所述指令预译码模块, 或者所述指令缓存模块, 或者所述指令 预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的 寄存器号之后, 所述方法还包括:
当所述第 i 目的寄存器号不等于第 i+1源寄存器号至第 N源寄存 器号中任意一个源寄存器号时, 将所述第 i 目 的寄存器号映射到所述 主寄存器堆子模块中的第三物理寄存器的寄存器号, 所述第三物理 寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任意一 个。
26、 根据权利要求 25 所述的数据处理方法, 其特征在于, 在所 述从所述指令预译码模块, 或者所述指令緩存模块, 或者所述指令 预译码模块和所述指令緩存模块中获取 N个源寄存器号和 N个目 的 寄存器号之后, 所述方法还包括:
当所述第 i+1 源寄存器号不等于第 i 目 的寄存器号至第 1 目的寄 存器号中的任意一个目 的寄存器号, 或, 所述第 i+1源寄存器号不等 于所述 N个源寄存器号中任意一个源寄存器号时, 将所述第 i+1源寄 存器号映射到所述主寄存器堆子模块中的第四物理寄存器的寄存器 号, 所述第四物理寄存器为所述主寄存器堆子模块中多个空闲的物 理寄存器中任意一个。
27、 根据权利要求 26所述的数据处理方法, 其特征在于, 在所 述将所述第 i+1源寄存器号映射到所述主寄存器堆子模块中的第四物 理寄存器的寄存器号之后, 所述方法还包括:
根据所述第四物理寄存器的寄存器号从所述第四物理寄存器读 取第二源操作数。
28、 根据权利要求 21 所述的数据处理方法, 其特征在于, 在所 述根据所述物理寄存器的寄存器号从所述物理寄存器读取第一源操 作数之后, 所述方法还包括:
当所述第 i+1 目 的寄存器号不等于第 i+2源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i+ 1 目的寄存器号映射到 所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述第五 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
29、 根据权利要求 28所述的数据处理方法, 其特征在于, 在所 述将所述第 i+1 目 的寄存器号映射到所述主寄存器堆子模块中的第五 物理寄存器的寄存器号之后, 所述方法还包括:
获取所述第一源操作数和所述第五物理寄存器的寄存器号, 根 据所述第一源操作数运算得到第一目 的操作数;
根据所述第五物理寄存器的寄存器号将所述第一目 的操作数写 回到所述第五物理寄存器。
30、 根据权利要求 27所述的数据处理方法, 其特征在于, 在所 述根据所述第四物理寄存器的寄存器号从所述第四物理寄存器读取 第二源操作数之后, 所述方法还包括:
当所述第 i+1 目 的寄存器号不等于第 i+2源寄存器号至第 N源寄 存器号中任意一个源寄存器号时, 将所述第 i+ 1 目 的寄存器号映射到 所述主寄存器堆子模块中的第五物理寄存器的寄存器号, 所述第五 物理寄存器为所述主寄存器堆子模块中多个空闲的物理寄存器中任 意一个。
3 1、 根据权利要求 30所述的数据处理方法, 其特征在于, 在所 述将所述第 i+1 目 的寄存器号映射到所述主寄存器堆子模块中的第五 物理寄存器的寄存器号之后, 所述方法还包括:
获取所述第二源操作数和所述第五物理寄存器的寄存器号, 根 据所述第二源操作数运算得到第二目 的操作数;
根据所述第五物理寄存器的寄存器号将所述第二目 的操作数写 回到所述第五物理寄存器。
PCT/CN2014/076406 2014-04-28 2014-04-28 一种数据处理装置及方法 WO2015165017A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/076406 WO2015165017A1 (zh) 2014-04-28 2014-04-28 一种数据处理装置及方法
CN201480000412.3A CN105308557B (zh) 2014-04-28 2014-04-28 一种数据处理装置及方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/076406 WO2015165017A1 (zh) 2014-04-28 2014-04-28 一种数据处理装置及方法

Publications (1)

Publication Number Publication Date
WO2015165017A1 true WO2015165017A1 (zh) 2015-11-05

Family

ID=54357982

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/076406 WO2015165017A1 (zh) 2014-04-28 2014-04-28 一种数据处理装置及方法

Country Status (2)

Country Link
CN (1) CN105308557B (zh)
WO (1) WO2015165017A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11579885B2 (en) 2018-08-14 2023-02-14 Advanced New Technologies Co., Ltd. Method for replenishing a thread queue with a target instruction of a jump instruction

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6035394A (en) * 1998-02-17 2000-03-07 International Business Machines Corporation System for providing high performance speculative processing of complex load/store instructions by generating primitive instructions in the load/store unit and sequencer in parallel
WO2005013118A2 (en) * 2003-07-31 2005-02-10 Intel Corporation Renaming for register with multiple bit fields
CN101169710A (zh) * 2006-10-26 2008-04-30 中国科学院计算技术研究所 对状态寄存器进行重命名的方法和使用该方法的处理器
CN101447911A (zh) * 2007-11-27 2009-06-03 上海高性能集成电路设计中心 一种通过分布控制扩展访存队列容量的装置
CN102306092A (zh) * 2011-07-29 2012-01-04 北京北大众志微系统科技有限责任公司 超标量处理器实现指令缓存路选择的方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6035394A (en) * 1998-02-17 2000-03-07 International Business Machines Corporation System for providing high performance speculative processing of complex load/store instructions by generating primitive instructions in the load/store unit and sequencer in parallel
WO2005013118A2 (en) * 2003-07-31 2005-02-10 Intel Corporation Renaming for register with multiple bit fields
CN101169710A (zh) * 2006-10-26 2008-04-30 中国科学院计算技术研究所 对状态寄存器进行重命名的方法和使用该方法的处理器
CN101447911A (zh) * 2007-11-27 2009-06-03 上海高性能集成电路设计中心 一种通过分布控制扩展访存队列容量的装置
CN102306092A (zh) * 2011-07-29 2012-01-04 北京北大众志微系统科技有限责任公司 超标量处理器实现指令缓存路选择的方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11579885B2 (en) 2018-08-14 2023-02-14 Advanced New Technologies Co., Ltd. Method for replenishing a thread queue with a target instruction of a jump instruction

Also Published As

Publication number Publication date
CN105308557A (zh) 2016-02-03
CN105308557B (zh) 2018-06-15

Similar Documents

Publication Publication Date Title
US10467012B2 (en) Apparatus and method for accelerating operations in a processor which uses shared virtual memory
US20170097891A1 (en) System, Method, and Apparatus for Improving Throughput of Consecutive Transactional Memory Regions
US20190012171A1 (en) Read and Write Masks Update Instruction for Vectorization of Recursive Computations Over Independent Data
US9823925B2 (en) Instruction and logic for a logical move in an out-of-order processor
US9558127B2 (en) Instruction and logic for a cache prefetcher and dataless fill buffer
GB2522137A (en) Instructions and logic to provide advanced paging capabilities for secure enclave page caches
US9652234B2 (en) Instruction and logic to control transfer in a partial binary translation system
US20160092227A1 (en) Robust and High Performance Instructions for System Call
US20140189306A1 (en) Enhanced loop streaming detector to drive logic optimization
US10324852B2 (en) System and method to increase availability in a multi-level memory configuration
US20210200552A1 (en) Apparatus and method for non-speculative resource deallocation
US10146691B2 (en) System and method for performing partial cache line writes without fill-reads or byte enables
US9886318B2 (en) Apparatuses and methods to translate a logical thread identification to a physical thread identification
US9552169B2 (en) Apparatus and method for efficient memory renaming prediction using virtual registers
JP5798650B2 (ja) 短整数の乗算の数を減らすためのシステム、装置、および方法
WO2015165017A1 (zh) 一种数据处理装置及方法
EP3497558B1 (en) System and method for load and store queue allocations at address generation time
US9710389B2 (en) Method and apparatus for memory aliasing detection in an out-of-order instruction execution platform
US9330020B2 (en) System, apparatus, and method for transparent page level instruction translation
US20160224348A1 (en) Apparatus and method for architectural performance monitoring in binary translation systems
US11275588B2 (en) Context save with variable save state size
US20160378497A1 (en) Systems, Methods, and Apparatuses for Thread Selection and Reservation Station Binding

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480000412.3

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14890963

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14890963

Country of ref document: EP

Kind code of ref document: A1