Method, device and equipment for sending instructions
By selecting instructions based on preset allocation rules in the computer processor and controlling the timing of reading source operands, the problem of large resource occupancy of register files and issue queues is solved, and the efficiency and performance of the processor are improved.
Patent Information
- Application Number
- CN202410742201.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-11
AI Technical Summary
In the computer processor architecture, the interaction between the register file, the issue queue, and the functional units takes up a lot of resources, resulting in low processor efficiency.
By selecting instructions to be executed based on preset allocation rules, reading source operands from the register file at different times according to the instruction type, reducing the number of read ports in the register file, and sending instructions to the corresponding issue queue if appropriate. Or register file to reduce the storage space occupied by the launch queue.
It effectively reduces the number of read ports in the register file and the storage space of the launch queue, increases the main frequency of the processor, reduces power consumption, and improves the efficiency of the processor.
Smart Images

Figure CN118312220B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer processor technology, and in particular to a method, device and equipment for sending instructions. Background Art
[0002] In computer processor architecture, register stack, issue queue and function unit are three core components in the process of CPU executing instructions. Register stack is used to store source operands and execution results of instructions. Issue queue is used to store instructions and send instructions to function units in a disordered order according to the readiness status of instruction source operands. Function unit is used to execute instructions and obtain the execution results of instructions.
[0003] In the related art, there is a phenomenon of large resource usage in the interaction between register files, issue queues and functional units. Summary of the invention
[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.
[0005] To this end, the purpose of the present disclosure is to provide a method, device and apparatus for sending instructions, thereby reducing the number of read ports of the register file used, while reducing the storage space of the transmission queue to store data.
[0006] The method for sending instructions proposed in the embodiment of the first aspect of the present disclosure includes: selecting the instruction to be executed based on a preset allocation rule; when the type of the instruction is the first type, reading the source operand required for the instruction from the register stack, and sending the instruction and the source operand to the first emission queue; when the type of the instruction is the second type, sending the instruction to the second emission queue.
[0007] The second aspect of the present disclosure proposes a method for sending instructions, the method comprising: a first transmission queue receives instructions of a first type and source operands required for the instructions, and after obtaining all source operands required for the instructions, sends the instructions and all source operands to the functional units; a second transmission queue receives instructions of a second type, the second transmission queue receives instructions of the second type, sends the instructions to a register stack, and then the register stack sends the instructions and the source operands required for the instructions to the functional units.
[0008] The instruction sending device proposed in the embodiment of the third aspect of the present disclosure includes: a selection module, which is used to select the instruction to be executed based on a preset allocation rule; a sending module, which is used to read the source operand required for the instruction from the register stack when the type of the instruction is a first type, and send the instruction and the source operand to the first emission queue; and a sending module, which is used to send the instruction to the second emission queue when the type of the instruction is a second type.
[0009] The fourth aspect of the present disclosure proposes an instruction sending device, which includes: a sending module, which is used for a first transmission queue to receive instructions of a first type and source operands required for the instructions, and after obtaining all source operands required for the instructions, sends the instructions and all source operands to the functional units; a sending module, which is used for a second transmission queue to receive instructions of a second type, and after sending the instructions to a register stack, the register stack sends the instructions and the source operands required for the instructions to the functional units.
[0010] The fifth aspect embodiment of the present disclosure proposes an electronic device, including a memory, a storage device, and a computer program stored in the storage device and executable on the storage device. When the storage device executes the program, the instruction sending method proposed in the first aspect embodiment of the present disclosure is implemented, or the instruction sending method proposed in the second aspect embodiment of the present disclosure is implemented.
[0011] The sixth aspect embodiment of the present disclosure proposes a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by the memory, it implements the method for sending instructions proposed in the first aspect embodiment of the present disclosure, or implements the method for sending instructions proposed in the second aspect embodiment of the present disclosure.
[0012] The seventh aspect embodiment of the present disclosure proposes a computer program product. When the instruction memory in the computer program product is executed, it executes the instruction sending method proposed in the first aspect embodiment of the present disclosure, or implements the instruction sending method proposed in the second aspect embodiment of the present disclosure.
[0013] The instruction sending method, device and equipment provided by the present disclosure have at least the following beneficial effects: the first emission queue receives the first type of instruction and the source operands required by the instruction, and after obtaining all the source operands required by the instruction, sends the instruction and all the source operands to the functional unit. The second emission queue receives the second type of operation instruction, sends the instruction to the register stack, and then sends the instruction and the source operands required by the instruction to the functional unit. After sending the operation instruction to the functional unit, the register stack obtains and sends the source operands required by the operation instruction to the functional unit. Thus, for different instructions, the source operands are read at different times. Thereby, the number of read ports of the register stack used is reduced, and at the same time, the storage space for storing data in the emission queue is reduced.
[0014] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0016] Figure 1 It is an interactive schematic diagram of sending instructions proposed in an embodiment of the present disclosure;
[0017] Figure 2 is a flowchart of a method for sending an instruction proposed in another embodiment of the present disclosure;
[0018] Figure 3 is a flowchart of a method for sending an instruction proposed in another embodiment of the present disclosure;
[0019] Figure 4 is a flowchart of a method for sending an instruction proposed in another embodiment of the present disclosure;
[0020] Figure 5 It is a structural diagram of a device for sending instructions proposed in an embodiment of the present disclosure;
[0021] Figure 6 is a structural schematic diagram of a device for sending instructions proposed in another embodiment of the present disclosure;
[0022] Figure 7 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present disclosure, and are not to be construed as limitations of the present disclosure. On the contrary, the embodiments of the present disclosure include all changes, modifications, and equivalents that fall within the spirit and connotation of the appended claims.
[0024] Figure 1 It is an interactive schematic diagram of a method for sending instructions proposed in an embodiment of the present disclosure.
[0025] In this application, three types of functional units are configured: floating-point functional units, fixed-point functional units, and memory access functional units. For the above three types of functional units, three types of emission queues are set accordingly: floating-point emission queue, fixed-point emission queue, memory access emission queue, as well as floating-point register stack and fixed-point register stack. The floating-point register stack is used to store floating-point data, and the fixed-point register stack is used to store fixed-point data.
[0026] The processor assigns the instruction to the corresponding issue queue based on the type of instruction. For example, the processor sends a floating-point instruction (an instruction whose source operand is floating-point data) to a floating-point register stack, and then the floating-point register stack prepares the source operand stored in the floating-point instruction, and sends the floating-point instruction and the prepared source operand to the floating-point functional unit after the source operand is prepared. The processor sends a fixed-point instruction (an instruction whose source operand is fixed-point data) to a fixed-point register stack, and then the fixed-point register stack prepares the source operand stored in the fixed-point instruction, and sends the fixed-point instruction and the prepared source operand to the fixed-point functional unit after the source operand is prepared. The processor sends a memory access instruction (the source operand and the destination operand may be either floating-point data or fixed-point data) to a memory access issue queue, and then the issue queue sends the memory access instruction to the floating-point register stack and / or the fixed-point register stack, and then the floating-point register stack and / or the fixed-point register stack sends the memory access instruction and the source operand to the memory access functional unit. After the functional unit executes the instruction and obtains the result, it obtains the right to use the write-back bus through write-back arbitration, and feeds the result back to the corresponding register file through the write-back bus. For example, if the destination operand of the instruction is fixed-point, it is written to the fixed-point register file, and if the destination operand of the instruction is floating-point, it is written to the floating-point register file.
[0027] In addition, multiple functional units of the same type may be provided, and a transmission queue may be provided for each functional unit.
[0028] For example, 7 fixed-point function units can be set, including: 4 fixed-point arithmetic function units and logic components (ALU, supporting addition, subtraction, logic, branch, partial bit extension and other instructions), 2 multiplication and division function units, 1 jump / control register operation / register transfer component (i.e. JAL (jump and link) / JALR (jump and link register) / CSR (status and control register operation) / fixed-point to floating-point data transfer instruction execution component). 7 fixed-point emission queues are set accordingly, and each fixed-point emission queue corresponds to a fixed-point function unit.
[0029] Six floating-point functional units can be set, including: four floating-point multiplication and addition units (FMACs), two floating-point division and square root units, and other units (including fixed-point and floating-point conversion, floating-point format conversion, etc.). Six floating-point emission queues are set accordingly.
[0030] 8 memory access functional units can be set, including 4 load units and 4 store units. 8 memory access transmission queues can be set accordingly.
[0031] It should be noted that the number and classification of the above-mentioned functional units, the functions, classifications, and number of the transmission queues are only examples and are not limitations of the present application. The number and classification of the functional units and the transmission queues can be set based on actual needs.
[0032] Figure 2 It is a flowchart of a method for sending instructions proposed in an embodiment of the present disclosure.
[0033] It should be noted that the executor of the instruction sending method of this embodiment is a device for sending instructions, which can be implemented by software and / or hardware. The device can be configured in an electronic device, which may include but is not limited to a terminal, a server, etc.
[0034] like Figure 2 As shown, the method for sending the instruction includes:
[0035] Step 201: Select instructions to be executed based on preset allocation rules.
[0036] Among them, the allocation rule may be that the number of instructions sent to each functional unit at the same time is less than a preset threshold, etc., and this application does not impose any limitation on this.
[0037] In the present application, based on the storage order of the instructions, instructions corresponding to each functional unit that are less than a preset threshold number are dispatched.
[0038] Step 202: When the instruction type is the first type, read the source operand required by the instruction from the register file, and send the instruction and the source operand to the first issue queue.
[0039] The first type corresponds to instructions whose number of source operands required for processing is greater than or equal to a threshold, such as floating-point instruction types, fixed-point instruction types, and the like.
[0040] In the present application, different types of instructions correspond to different emission queues. For example, floating point instructions, fixed point instructions, memory access instructions, etc. correspond to different emission queues. The first emission queue is a queue corresponding to the first type of instructions.
[0041] When dispatching instructions, the processor may dispatch different types of instructions to the corresponding first issue queue for processing. When the type of the dispatched instruction is the first type, the source operand required by the instruction may be read from the corresponding register file first. Then, the instruction and the read source operand are sent to the first issue queue for storage.
[0042] For example, when the instruction to be dispatched is a floating-point instruction, the processor reads the source operand of the floating-point instruction from the floating-point register file, and then sends the floating-point instruction and the read source operand to the floating-point issue queue.
[0043] It should be noted that before the issue queue sends the instruction to the functional unit, the physical register file is read to obtain the source operand. The number of register file read ports required is the dispatch width * the number of source operands, where the dispatch width is the maximum number of instructions sent to one issue queue in one beat. If the dispatch width is 6 and the source operand is 3, 6*3=18 read ports are required. After the issue queue sends the instruction to the functional unit, the physical register file is read to obtain the source operand. The number of register file read ports required is the sum of the number of source operands required for the instructions executed by each functional unit. Assuming that there are 12 functional units and the number of source operands required for the instructions executed by each functional unit is 3, 3*12=36 read ports are required. Because the processor has more functional units, the number of instructions dispatched by the dispatch component at the same time in one beat is much smaller than the number of instructions executed by the functional unit at the same time in one beat. Therefore, when the instruction type is the first type, obtaining the source operand before sending the instruction to the first issue queue can reduce the number of register file read ports.
[0044] Step 203: When the type of the instruction is the second type, send the instruction to the second issue queue.
[0045] The second type corresponds to instructions whose number of source operands required for processing is less than a threshold, such as memory access instruction type, etc. The second issue queue is a queue corresponding to the second type of instructions.
[0046] For example, when the instruction to be dispatched is a memory access instruction, the processor directly sends the memory access instruction to the memory access issue queue.
[0047] After receiving the instruction, the second emission queue sends the instruction to the register file (Physical Register File) to obtain the source operand required by the instruction. After that, the register file sends the instruction and the source operand required by the instruction to the functional unit. The emission queue does not need to store the source operand required by the instruction, which reduces the storage resource occupation of the emission queue. In addition, the write-back data of the functional unit does not need to be written to the emission queue, thereby reducing power consumption.
[0048] In the present application, after selecting the instruction to be executed based on the preset allocation rule, when the type of the instruction is the first type, the source operand required for the instruction is read from the register stack, and the instruction and the source operand are sent to the first emission queue, and when the type of the instruction is the second type, the instruction is sent to the second emission queue. Thus, for different instructions, the source operand is read at different times. Thus, the number of read ports of the register stack used is reduced, and the storage space for storing data in the emission queue is reduced.
[0049] Figure 3 It is a flowchart of a method for sending instructions proposed in another embodiment of the present disclosure.
[0050] like Figure 3 As shown, the method for sending the instruction includes:
[0051] Step 301: A first issue queue receives an instruction of a first type and source operands required by the instruction, and after obtaining all source operands required by the instruction, sends the instruction and all source operands to a functional unit.
[0052] The first type corresponds to instructions whose number of source operands required for processing is greater than or equal to a threshold, such as floating point instruction type, fixed point instruction type, etc. The first issue queue is a queue corresponding to instructions of the first type.
[0053] In the present application, the first transmit queue receives the instruction of the first type and the source operand required by the instruction at the same time. Afterwards, the instruction and the source operand required by the instruction are saved. Thus, the first transmit queue receives the source operand before sending the instruction to the functional module.
[0054] Then, when it is determined to send the instruction to its corresponding functional unit, all source operands required by the instruction can be obtained, and the source operand and all source operands required by the instruction can be sent to the functional unit, and the functional unit can execute the instruction to obtain the result.
[0055] In addition, if a source operand required by the instruction has not been calculated by the preceding instruction, or has not been loaded into the memory stack, the processor cannot obtain the source operand from the register stack, nor can it send the source operand to the first emission queue together with the instruction. At this time, the number of the register will be written to the first emission queue to mark the state of the source operand as currently unavailable (Non-available). Therefore, when the first emission queue determines that a source operand required by the instruction has not been received, the first emission queue can listen to the write-back bus, obtain the source operand and save it. After all the source operands required for the instruction are obtained, the instruction and all the source operands required by it are sent to the functional unit. As a result, the source operand is obtained by listening to the write-back bus, and the register stack read port is no longer occupied, which reduces the number of read ports of the register stack, thereby increasing the main frequency of the processor and reducing the area and power consumption of the processor.
[0056] It should be noted that before the issue queue sends the instruction to the functional unit, the physical register file is read to obtain the source operand. The number of register file read ports required is the dispatch width * the number of source operands, where the dispatch width is the maximum number of instructions sent to one issue queue in one beat. If the dispatch width is 6 and the source operand is 3, 6*3=18 read ports are required. After the issue queue sends the instruction to the functional unit, the physical register file is read to obtain the source operand. The number of register file read ports required is the sum of the number of source operands required for the instructions executed by each functional unit. Assuming that there are 12 functional units and the number of source operands required for the instructions executed by each functional unit is 3, 3*12=36 read ports are required. Because the processor has more functional units, the number of instructions dispatched by the dispatch component at the same time in one beat is much smaller than the number of instructions executed by the functional unit at the same time in one beat. Therefore, when the type of instruction is the first type, obtaining the source operand before sending the instruction to the first issue queue can reduce the number of register file read ports.
[0057] Step 302: The second issue queue receives the second type of instruction, sends the instruction to the register file, and then the register file sends the instruction and the source operand required by the instruction to the functional unit.
[0058] The second type corresponds to instructions whose number of source operands required for processing is less than a threshold, such as memory access instruction type, etc. The second issue queue is a queue corresponding to the second type of instructions.
[0059] In the present application, the second transmission queue receives the second type of instruction. Then, the instruction is saved. When it is determined to send the instruction to its corresponding functional unit, the instruction can be directly sent to the functional unit. Then, the source operand required for the instruction is obtained and sent to the functional unit.
[0060] Alternatively, when it is determined that the instruction is to be sent to the corresponding functional unit, the instruction can be sent to the register stack, and then the register stack sends the instruction and the source operand required by the instruction to the functional unit. In addition, when a source operand required by the instruction is not stored in the register stack, the second emission queue listens to the write-back bus to obtain the write-back status of the source operand, and then obtains the source operand from the write-back bus based on the write-back status, and sends the source operand to the functional unit corresponding to the instruction. Thus, by listening to the write-back bus to obtain the source operand, the register stack read port is no longer occupied, the number of register stack read ports is reduced, thereby increasing the main frequency of the processor and reducing the area and power consumption of the processor.
[0061] It should be noted that after the transmit queue issues an instruction, it reads the physical register file (Physical Register File) to obtain the source operand. The transmit queue does not need to store the source operand required by the instruction, which reduces the storage resource usage of the transmit queue. In addition, the write-back data of the functional unit does not need to be written to the transmit queue, thereby reducing power consumption.
[0062] Optionally, the process of the first transmission queue or the second transmission queue sending the instruction to the functional unit may be: sending the instruction to the functional unit based on the priority of the instruction, wherein the priority of the instruction may be pre-configured in the system, thereby improving the efficiency of instruction execution.
[0063] A possible implementation method is: the first transmit queue arbitrates and allocates the right of the instruction to use the write-back bus according to the priority of the instruction, and after the instruction obtains the right to use the write-back bus, the first transmit queue sends the instruction to the functional unit. Similarly, the second transmit queue arbitrates and allocates the right of the instruction to use the write-back bus according to the priority of the instruction, and after the instruction obtains the right to use the write-back bus, the second transmit queue sends the instruction to the functional unit.
[0064] In the present application, the first emission queue receives the first type of instruction and the source operands required by the instruction, and after obtaining all the source operands required by the instruction, sends the instruction and all the source operands to the functional unit. The second emission queue receives the second type of instruction, and after sending the instruction to the register stack, the register stack sends the instruction and the source operands required by the instruction to the functional unit. Thus, for different instructions, the source operands are read at different times. Thereby, the number of read ports of the register stack used is reduced, and at the same time, the storage space for storing data in the emission queue is reduced.
[0065] Figure 4 It is a flowchart of a method for sending instructions proposed in another embodiment of the present disclosure.
[0066] like Figure 4 As shown, the method for sending the instruction includes:
[0067] Step 401: A first transmit queue receives an instruction of a first type. The first transmit queue includes a write-back status table. The write-back status table includes the number of write-back cycles corresponding to the sent instruction.
[0068] The first type is a type corresponding to instructions whose source operands required for processing are greater than or equal to a threshold, such as a floating-point instruction type, a fixed-point instruction type, and the like.
[0069] In the present application, a write-back status table may be pre-set in the first transmission queue. As shown in Table 1, the write-back status table at least includes the number of write-back cycles corresponding to the sent instructions. The number of write-back cycles is the number of cycles between the sent instructions and the write-back results at the current moment.
[0070] Table 1
[0071]
[0072] In addition, the write-back status table may also include a valid bit, a status, etc. Among them, the status may be sent (used to indicate that the corresponding instruction has been sent to the functional unit), written back (used to indicate that the result of the corresponding instruction has been received), etc. The initial valid bit is 0, indicating that the item is invalid. After the instruction enters the transmit queue, the status corresponding to the instruction is set to 1, indicating that the item is valid.
[0073] Step 402: After obtaining all source operands required for the instruction, determine the resource sharing instructions that use the same write-back bus as the instruction among the issued instructions that have not been written back in the write-back status table.
[0074] In the present application, the type of instructions processed by each write-back bus can be pre-set in the system, and then, based on the type of instruction and the type of sent instruction, it can be determined whether to use the same write-back bus, thereby determining the sent instruction that uses the same write-back bus as the instruction as a resource sharing instruction.
[0075] For example, assuming that all multiplication instructions use the same write-back bus, the current instruction A is a multiplication instruction, and the issued instruction B is also a multiplication instruction. It can be determined that the issued instruction B uses the same write-back bus as instruction A, and the issued instruction B is determined to be a resource sharing instruction.
[0076] Step 403: When the number of execution cycles of the instruction is the same as the number of write-back cycles of the resource sharing instruction, suspend sending instructions to the functional unit in the current clock cycle.
[0077] In the present application, the number of cycles completed by each type of instruction in the write-back status table (i.e., the number of execution cycles) is fixed. Before sending the operation instruction to the functional unit, the number of execution cycles of the instruction can be compared with the number of write-back cycles of the resource sharing instruction. If the number of execution cycles of the instruction is the same as the number of write-back cycles of the resource sharing instruction, it means that the instruction and the resource sharing instruction will occupy the same write-back bus and the write-back port of the register stack at the same time when writing back, and a write-back conflict will occur. Therefore, the sending of the instruction to the functional unit is suspended in the current clock cycle, and the instruction is sent again in the next clock cycle to ensure that there will be no conflict when the instruction is written back.
[0078] Optionally, when the number of execution cycles of the instruction is different from the number of write-back cycles of the resource sharing instruction, the instruction and all source operands are sent to the functional unit, thereby ensuring that no conflict occurs when the instruction is written back.
[0079] Optionally, in each clock cycle, the write-back cycle number corresponding to each sent instruction that has not been written back in the write-back status table is reduced by 1 until the sent instruction is written back, thereby ensuring the accuracy of the write-back cycle number and further ensuring the reliability of instruction processing.
[0080] Step 404: The second issue queue receives the second type of instruction, sends the instruction to the register file, and then the register file sends the instruction and the source operand required by the instruction to the functional unit.
[0081] In the present application, a write-back status table can be pre-set in the second transmission queue. Before sending the instruction to the functional unit, the second transmission queue can determine the resource sharing instructions that use the same write-back bus as the instruction among the sent instructions that have not been written back in the write-back status table. Afterwards, when the number of execution cycles of the instruction is the same as the number of write-back cycles of the resource sharing instruction, the sending of the instruction to the functional unit in the current clock cycle is suspended. When the number of execution cycles of the instruction is different from the number of write-back cycles of the resource sharing instruction, the instruction is sent to the functional unit. This ensures that no conflict occurs when the instruction is written back.
[0082] In the present application, the first transmission queue receives the first type of instruction, the first transmission queue contains a write-back status table, the write-back status table contains the write-back cycle number corresponding to the sent instruction, after obtaining all the source operands required for the instruction, it is determined that among the sent instructions that have not been written back in the write-back status table, there are resource sharing instructions that use the same write-back bus as the instruction, and then, when the execution cycle number of the instruction is the same as the write-back cycle number of the resource sharing instruction, the sending of the instruction to the functional unit is suspended in the current clock cycle, and the second transmission queue receives the second type of instruction, after sending the instruction to the register stack, the register stack sends the instruction and the source operand required for the instruction to the functional unit. Therefore, before sending the instruction to the functional unit, it is first determined through the write-back status table whether the sent instruction has a write-back conflict with the instruction to be sent, thereby avoiding the phenomenon of write-back conflict of the instruction and improving the efficiency and reliability of the system.
[0083] In one embodiment of the present application, the first transmit queue and the second transmit queue include a write-back status table, which includes the number of instructions sent and to be written back corresponding to each write-back bus and register file write-back port in each clock cycle.
[0084] Based on the above write-back status table, the process of the first emission queue or the second emission queue sending instructions to the functional unit is as follows: query the write-back status table to determine the number of sent instructions that are not written back at the target clock cycle on the write-back bus and register stack write-back port used by the instruction, where the target clock cycle is the number of instruction execution cycles. Afterwards, if the number of sent instructions is not zero, suspend sending instructions to the functional unit in the current clock cycle. If the number of sent instructions is zero, send instructions to the functional unit in the current clock cycle.
[0085] For example, assume that instruction A and instruction B occupy the same write-back bus 1 and write-back port 1 of the register file as instruction C. Instruction C is to be sent, and both instruction A and instruction B have been sent to the functional unit. The number of clock cycles from instruction A to writing back the result is 2, and the number of clock cycles from instruction B to writing back the result is 1. That is, write-back bus 1 and write-back port 1 will be occupied by instruction B in the next clock cycle, and will be occupied by instruction A in the second clock cycle after the current clock cycle. Then, in the write-back status table, the number of instructions sent to be written back corresponding to write-back bus 1 and write-back port 1 in the first clock cycle after the current moment is 1, the number of instructions sent to be written back corresponding to the second clock cycle after the current moment is 2, and the number of instructions sent to be written back corresponding to other clock cycles is 0. Assuming that the number of execution cycles of running instruction C is 2, the target clock cycle is determined to be the second clock cycle after the current clock cycle. Before sending instruction C, query the write-back status table to determine that the number of sent instructions that have not been written back by write-back bus 1 and write-back port 1 at the second clock cycle after the current clock cycle is 1, indicating that there is 1 sent instruction that uses write-back bus 1 and write-back port 1 to write back data at the second clock cycle after the current clock cycle. Therefore, the sending of instruction C to the functional unit in the current clock cycle is suspended. When the number of sent instructions is zero, it means that the write-back bus 1 and write-back port 1 are not occupied at the second clock cycle after the current clock cycle, and instruction C can be sent to the functional unit in the current clock cycle. This avoids instruction write-back conflicts.
[0086] Figure 5 It is a structural diagram of a device for sending instructions proposed in an embodiment of the present disclosure.
[0087] like Figure 5 As shown, the sending device 500 of the instruction is characterized in that the device 500 includes:
[0088] A selection module 510, for selecting instructions to be executed based on a preset allocation rule;
[0089] A sending module 520, configured to read a source operand required for the instruction from a register file when the instruction type is a first type, and send the instruction and the source operand to a first issue queue;
[0090] The sending module 520 is used to send the instruction to the second issue queue when the type of the instruction is the second type.
[0091] In the present application, after selecting the instruction to be executed based on the preset allocation rule, when the type of the instruction is the first type, the source operand required for the instruction is read from the register stack, and the instruction and the source operand are sent to the first emission queue, and when the type of the instruction is the second type, the instruction is sent to the second emission queue. Thus, for different instructions, the source operand is read at different times. Thus, the number of read ports of the register stack used is reduced, and the storage space for storing data in the emission queue is reduced.
[0092] With the above Figure 1 , Figure 2 Corresponding to the instruction sending method provided in the embodiment, the present disclosure also provides an instruction sending device. Figure 1 , Figure 2 The instruction sending method provided in the embodiment corresponds to the instruction sending method provided in the embodiment. Therefore, the implementation of the instruction sending method is also applicable to the instruction sending device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.
[0093] Figure 6 It is a structural diagram of a device for sending instructions proposed in an embodiment of the present disclosure.
[0094] like Figure 6 As shown, the sending device 600 of the instruction is characterized in that the device 600 includes:
[0095] The sending module 610 is used for receiving the first type of instruction and the source operands required by the instruction in the first issuing queue, and after obtaining all the source operands required by the instruction, sending the instruction and all the source operands to the functional unit;
[0096] The sending module 610 is used for the second issue queue to receive the second type of instruction, and after sending the instruction to the register file, the register file sends the instruction and the source operand required by the instruction to the functional unit.
[0097] In some embodiments of the present disclosure, the apparatus further comprises:
[0098] The first monitoring module is used for, when any source operand required by the instruction is not received, the first transmitting queue monitors the write-back bus, obtains any source operand and saves it.
[0099] In some embodiments of the present disclosure, the apparatus further includes a second monitoring module, configured to:
[0100] When any source operand required by the instruction is not stored in the register file, the second issue queue monitors the write-back bus to obtain the write-back status of any source operand;
[0101] Any source operand is fetched from the write-back bus and sent to the functional unit based on the write-back status.
[0102] In some embodiments of the present disclosure, the first transmit queue and the second transmit queue include a write-back status table, the write-back status table includes the number of write-back cycles corresponding to the transmitted instruction, and the transmitting module 610 is used to:
[0103] Determine, among the issued instructions that have not been written back in the write-back status table, a resource sharing instruction that uses the same write-back bus as the instruction;
[0104] When the execution cycle number of the instruction is the same as the write-back cycle number of the resource sharing instruction, sending the instruction to the functional unit in the current clock cycle is suspended.
[0105] In some embodiments of the present disclosure, the apparatus 600 further includes an updating module, which is used to:
[0106] In each clock cycle, the write-back cycle number corresponding to each issued instruction that has not been written back in the write-back status table is reduced by 1 until the issued instruction is written back.
[0107] In some embodiments of the present disclosure, the first transmit queue and the second transmit queue include a write-back status table, and the write-back status table includes the number of instructions to be written back that have been sent corresponding to each write-back bus and each register file write-back port in each clock cycle. The sending module 610 is used to:
[0108] Querying the write-back status table to determine the number of sent instructions that are not written back at a target clock cycle for a write-back bus and a register stack write-back port used by the instruction, wherein the target clock cycle is the number of instruction execution cycles;
[0109] When the number of issued instructions is not zero, issuing instructions to the functional unit in the current clock cycle is suspended.
[0110] In some embodiments of the present disclosure, the sending module 610 is used to:
[0111] Based on the priority of the instructions, the instructions are sent to the functional units.
[0112] With the above Figure 1 , Figure 3-Figure 4 Corresponding to the instruction sending method provided in the embodiment, the present disclosure also provides an instruction sending device. Figure 1 , Figure 3-Figure 4 The instruction sending method provided in the embodiment corresponds to the instruction sending method provided in the embodiment. Therefore, the implementation of the instruction sending method is also applicable to the instruction sending device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.
[0113] In the present application, the first emission queue receives the first type of instruction and the source operands required by the instruction, and after obtaining all the source operands required by the instruction, sends the instruction and all the source operands to the functional unit. The second emission queue receives the second type of instruction, and after sending the instruction to the register stack, the register stack sends the instruction and the source operands required by the instruction to the functional unit. Thus, for different instructions, the source operands are read at different times. Thereby, the number of read ports of the register stack used is reduced, and at the same time, the storage space for storing data in the emission queue is reduced.
[0114] In order to implement the above embodiments, the present disclosure also proposes an electronic device, including: a memory, a storage, and a computer program stored in the storage and executable on the storage. When the storage executes the program, the instruction sending method proposed in the above embodiments of the present disclosure is implemented.
[0115] In order to implement the above embodiments, the present disclosure further proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a memory, the instruction sending method proposed in the above embodiments of the present disclosure is implemented.
[0116] In order to implement the above embodiments, the present disclosure further proposes a computer program product. When the instruction memory in the computer program product is executed, the instruction sending method proposed in the above embodiments of the present disclosure is executed.
[0117] Figure 7 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 7 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0118] like Figure 7 As shown, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more memories or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0119] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a memory or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (hereinafter referred to as: ISA) bus, Micro Channel Architecture (hereinafter referred to as: MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (hereinafter referred to as: VESA) local bus and Peripheral Component Interconnection (hereinafter referred to as: PCI) bus.
[0120] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0121] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 Not shown, usually called a "hard drive").
[0122] although Figure 7 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (such as a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (such as a compact disc read only memory (hereinafter referred to as: CD-ROM), a digital versatile disc read only memory (hereinafter referred to as: DVD-ROM) or other optical media) can be provided. In these cases, each drive can be connected to the bus 18 through one or more data medium interfaces. The memory 28 may include at least one program product, which has a set (for example, at least one) of program modules, which are configured to perform the functions of the various embodiments of the present disclosure.
[0123] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0124] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0125] The processing unit 16 executes various functional applications and data processing by running the programs stored in the system memory 28, such as implementing the instruction sending method mentioned in the above embodiment.
[0126] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0127] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0128] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.
[0129] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0130] It should be understood that the various parts of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof may be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0131] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0132] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0133] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0134] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0135] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.
Claims
1. A method for sending an instruction, It is characterized in that The method comprises: The first issue queue receives an instruction of a first type and source operands required by the instruction, and after obtaining all source operands required by the instruction, sends the instruction and all source operands to a functional unit, and in the case where any source operand required by the instruction is not received, the first issue queue listens to a write-back bus, obtains any source operand and saves it, wherein the first type corresponds to an instruction for which the number of source operands required for processing is greater than or equal to a threshold; The second issue queue receives instructions of the second type, sends the instructions to the register stack, and then sends the instructions and source operands required by the instructions to the functional unit, wherein the second type corresponds to instructions whose number of source operands required for processing is less than a threshold.
2. The method according to claim 1, It is characterized in that The method further comprises: In the case that any source operand required by the instruction is not stored in the register file, the second issue queue monitors the write-back bus to obtain the write-back status of any source operand; The any source operand is retrieved from the write-back bus and sent to the functional unit based on the write-back status.
3. The method according to any one of claims 1 to 2, It is characterized in that The first transmit queue and the second transmit queue include a write-back status table, the write-back status table includes a write-back cycle number corresponding to the sent instruction, and sending the instruction to the functional unit includes: Determine, among the sent instructions that have not been written back in the write-back status table, a resource sharing instruction that uses the same write-back bus as the instruction; When the number of execution cycles of the instruction is the same as the number of write-back cycles of the resource sharing instruction, sending the instruction to the functional unit in the current clock cycle is suspended.
4. The method according to claim 3, It is characterized in that The method further comprises: In each clock cycle, the number of write-back cycles corresponding to each of the sent instructions that have not been written back in the write-back status table is reduced by 1 until the sent instruction is written back.
5. The method according to any one of claims 1 to 2, It is characterized in that The first transmit queue and the second transmit queue include a write-back status table, wherein the write-back status table includes the number of instructions to be written back corresponding to each write-back bus and each register stack write-back port in each clock cycle, and the sending of the instructions to the functional unit includes: Querying the write-back status table to determine the number of sent instructions that are not written back at a target clock cycle for a write-back bus and a register stack write-back port used by the instruction, wherein the target clock cycle is the number of execution cycles of the instruction; When the number of issued instructions is not zero, suspending sending the instructions to the functional units in the current clock cycle.
6. The method according to any one of claims 1 to 2, It is characterized in that The sending the instruction to the functional unit comprises: Based on the priority of the instructions, the instructions are sent to the functional units.
7. A method for sending an instruction, It is characterized in that The method comprises: Selecting instructions to be executed based on preset allocation rules; In the case where the type of the instruction is a first type, source operands required by the instruction are read from a register file, and the instruction and the source operands are sent to a first emission queue, so that the first emission queue receives the instruction of the first type and the source operands required by the instruction, and after obtaining all the source operands required by the instruction, the instruction and all the source operands are sent to the functional unit, and in the case where any source operand required by the instruction is not received, the first emission queue listens to a write-back bus, obtains any source operand and saves it, wherein the first type corresponds to instructions for which the number of source operands required for processing is greater than or equal to a threshold; In the case where the type of the instruction is the second type, the instruction is sent to a second issue queue so that the second issue queue receives the instruction of the second type. After the instruction is sent to a register stack, the register stack sends the instruction and source operands required for the instruction to a functional unit, wherein the second type corresponds to instructions for which the number of source operands required for processing is less than a threshold.
8. A device for sending instructions, It is characterized in that The device comprises: A selection module, used for selecting instructions to be executed based on preset allocation rules; a sending module, configured to, when the type of the instruction is a first type, read a source operand required by the instruction from a register file, and send the instruction and the source operand to a first emission queue, so that the first emission queue receives the instruction of the first type and the source operand required by the instruction, and after obtaining all the source operands required by the instruction, sends the instruction and all the source operands to the functional unit, and when any source operand required by the instruction is not received, the first emission queue listens to a write-back bus, obtains any source operand and saves it, wherein the first type corresponds to instructions for which the number of source operands required for processing is greater than or equal to a threshold; The sending module is used to send the instruction to the second emission queue when the type of the instruction is the second type, so that the second emission queue receives the instruction of the second type. After the instruction is sent to the register stack, the register stack sends the instruction and the source operands required by the instruction to the functional unit, wherein the second type corresponds to instructions whose number of source operands required for processing is less than a threshold.
9. A device for sending instructions, It is characterized in that The device comprises: a sending module, configured to receive, in a first emission queue, an instruction of a first type and source operands required by the instruction, and after obtaining all source operands required by the instruction, send the instruction and all source operands to a functional unit, wherein in the case of not receiving any source operand required by the instruction, the first emission queue listens to a write-back bus, obtains any source operand and saves it, wherein the first type corresponds to an instruction for which the number of source operands required for processing is greater than or equal to a threshold; The sending module is used for receiving the second type of instructions in the second transmission queue, and after sending the instructions to the register stack, the register stack sends the instructions and the source operands required for the instructions to the functional unit, wherein the second type corresponds to instructions whose number of source operands required for processing is less than a threshold.
10. An electronic device, include: at least one memory; as well as a memory communicatively connected to the at least one memory; wherein, The memory stores instructions that can be executed by the at least one memory, and the instructions are executed by the at least one memory so that the at least one memory can execute any one of the methods of claims 1 to 6, or can execute the method of claim 7.
11. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to enable the computer to execute any one of the methods of claims 1 to 6, or to execute the method of claim 7.
Citation Information
Patent Citations
Methods and apparatus for fusing instructions to provide or-test and and-test functionality on multiple test sources
CN104049945A
Instruction transmitting processing method in transmitting unit
CN113778522A
