Physical register file read port allocation method, processor and electronic device

By assigning age attributes to instructions to be issued and dynamically allocating read ports, the problems of instruction starvation and low read port utilization efficiency in high-performance processors are solved, achieving more efficient resource allocation and improved processor performance.

CN123137722APending Publication Date: 2026-11-20CHENGDU QUNXIN MICROELECTRONICS TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611464174.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In high-performance processor design, the access latency and leakage current power consumption of physical register files are becoming increasingly prominent. How to efficiently support multiple concurrent read requests under limited area and power budget has become a key challenge. In addition, traditional arbitrators may suffer from instruction starvation and low read port utilization.

Method used

By maintaining an age attribute for each instruction to be launched, reflecting its duration from generation to retirement, and using this as the priority basis for read port allocation, read ports are dynamically allocated to ensure that older instructions are processed first. Priority is determined by combining dependencies and operand numbers, thereby improving the fairness and efficiency of resource allocation.

Benefits of technology

It solves the instruction starvation problem, improves the fairness of instruction processing and the efficiency of resource allocation, shortens the wake-up latency of critical data dependency chains, maximizes the utilization of out-of-order execution windows, reduces the risk of issue queue backlog, and improves the overall performance of the processor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137722A_ABST
    Figure CN123137722A_ABST
Patent Text Reader

Abstract

The application provides a physical register file read port allocation method, a processor and an electronic device, and relates to the technical field of processors. The method comprises the following steps: acquiring the priorities of all to-be-transmitted instructions in a current clock cycle; the priority of each to-be-transmitted instruction is determined according to the age of the to-be-transmitted instruction; the age of the to-be-transmitted instruction represents the time length from generation to retirement; and the read port of the physical register file is sequentially allocated to the operand read request in each to-be-transmitted instruction according to the priority order of each to-be-transmitted instruction. The scheme of the application can solve the problem of instruction "starvation" that may occur in the traditional fixed priority arbitration to a certain extent, improve the fairness of instruction processing and resource allocation, and improve the utilization efficiency of the read port of the physical register file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of processor technology, and more specifically, to a method for allocating read ports of a physical register file, a processor, and an electronic device. Background Technology

[0002] In the field of high-performance processor design, superscalar architecture has become the mainstream choice for improving ILP (Instruction Level Parallelism). To maintain a high-throughput instruction pipeline, the processor must issue multiple instructions and fetch the corresponding operands simultaneously in each clock cycle.

[0003] The Physical Register File (PRF) serves as a crucial hub connecting the instruction decoding, issuing, and execution phases. Located adjacent to core processor units such as the ALU (Arithmetic Logic Unit), FPU (Floating Point Unit), and Load / Store unit, it allows these units to read operands for processing. Therefore, the read / write performance of the PRF directly determines the processor's critical path latency and overall power consumption. With the miniaturization of process technology, the access latency and leakage current power consumption of the physical register file have become increasingly prominent. Efficiently supporting multiple concurrent read requests within limited area and power budgets has become a key challenge in modern processor design.

[0004] In superscalar processors, to support the simultaneous operand acquisition by multiple functional units (such as ALU, FPU, and Load / Store units) within a single cycle, the register file is designed with a multi-read-port structure. However, as the number of read ports increases, the physical register file faces significant area expansion and timing issues caused by complex wiring. Therefore, modern high-performance processors often employ bank splitting technology, dividing a large register file into multiple independent, smaller physical register files, and distributing register addresses through interleaving to improve the probability of parallel access. Summary of the Invention

[0005] The purpose of this application is to provide a method for allocating read ports of a physical register file, a processor, and an electronic device, so as to improve the fairness of instruction processing of the processor, reduce the risk of instruction starvation, and improve the utilization efficiency of physical register file read ports.

[0006] In a first aspect, embodiments of this application provide a method for allocating read ports of a physical register file, applied in an arbitrator of a processor, the arbitrator being connected to the physical register file of the processor; the method includes: obtaining the priority of all instructions to be issued in the current clock cycle; wherein, the priority of each instruction to be issued is determined according to the age of the instruction to be issued; the age of the instruction to be issued represents the duration from the generation of the instruction to retirement; and allocating read ports of the physical register file sequentially for operand read requests in each instruction to be issued according to the priority order of each instruction to be issued.

[0007] In the above implementation, by maintaining an "age" attribute for each instruction to be issued, reflecting its duration from generation to retirement (which can reflect the instruction's waiting time), and using this as the priority basis for read port allocation, the impact of age on whether an instruction should be processed first can be considered when determining the priority of each instruction to be issued. Instructions with older ages have a higher probability of being processed first, thus solving the instruction "starvation" problem that may occur in traditional fixed-priority arbitration to some extent, and improving the fairness of instruction processing and resource allocation. Furthermore, through this method, as long as the operand read requests in the remaining instructions to be issued are greater than or equal to the number of read ports in the physical register file, each read port in the physical register file can be allocated an operand read request. This avoids read ports being idle due to being bound to fixed operands, thereby improving the utilization efficiency of the physical register file's read ports and thus improving the overall performance of the processor.

[0008] Optionally, the priority of each instruction to be launched is represented by the age of each instruction to be launched; the older the instruction to be launched, the higher its priority.

[0009] In the above implementation, age is directly used as the priority. During processor physical register access, older instructions are typically located at the front of the program's dependency chain. By directly using instruction age as the instruction priority, the simplest and most efficient arbitration logic can be implemented while increasing the probability that instructions at the front of the program's dependency chain are executed first. This reduces the wakeup latency of critical data dependency chains, allowing subsequent dependent instructions to be woken up and scheduled earlier, thereby maximizing the effective utilization of the out-of-order execution window (ROB window). Furthermore, since older instructions are typically located at the front of the program's dependency chain, this method increases the probability that instructions on the critical path complete operand reading first and enter the execution phase, effectively reducing the risk of long-term lag in the issue queue due to resource contention and maintaining high throughput of the instruction issuance logic. Furthermore, since older instructions are usually located at the front of the program's dependency chain, prioritizing the read port requirements of these older instructions to be issued can enable them to complete execution as soon as possible and enter the commit phase of the reorder buffer (ROB). This can accelerate the release of old physical register mappings and the update of the free list, reducing the allocation pressure on the physical register file.

[0010] Optionally, the priority of each of the commands to be launched is determined based on the age of the command to be launched and the dependencies that the command to be launched has.

[0011] In the above implementation, the priority of instructions to be issued is determined directly based on their age and dependencies. This allows instructions at the forefront of the program's dependency chain to have higher priority and be executed earlier. This shortens the wake-up delay of critical data dependency chains, enabling subsequent dependent instructions to be woken up and scheduled earlier, thus maximizing the effective utilization of the out-of-order execution window. Furthermore, it allows instructions on the critical path to prioritize operand reading and enter the execution phase, effectively reducing the risk of long-term delays in the issuance queue due to resource contention and maintaining high throughput of the instruction issuance logic. In addition, it accelerates the release of old physical register mappings and the updating of the free list, reducing the allocation pressure on the physical register file.

[0012] Optionally, the priority of the first type of instruction is higher than that of the second type of instruction; and among the first type of instructions: the older the instruction, the higher the priority of the instruction; among the second type of instructions: the older the instruction, the higher the priority of the instruction; the first type of instructions are instructions to be issued that have a dependency relationship, and the second type of instructions are instructions to be issued that do not have a dependency relationship.

[0013] In the above implementation, dependency is used as the highest priority judgment dimension, and further priority distinction is made based on the age of the instruction. This allows instructions with dependencies to be issued to obtain resources for processing first, and to be processed according to age priority, so as to wake up their subsequent instructions as soon as possible and maximize pipeline execution efficiency.

[0014] Optionally, if the instruction to be transmitted has multiple operand read requests, the priority of the multiple operand requests is determined according to the operand number; the priority of the multiple operand requests is positively correlated with the operand number of the multiple operand requests; or, the priority of the multiple operand requests is negatively correlated with the operand number of the multiple operand requests.

[0015] In the above implementation scheme, for the case where a command to be issued has multiple operand read requests, a clear priority can be set for the multiple operand read requests within the command to be issued, ensuring the determinism and predictability of the read port allocation process.

[0016] Optionally, according to the priority order of each instruction to be transmitted, read ports of the physical register file are allocated sequentially for operand read requests in each instruction to be transmitted, including: allocating a read port of the physical register file to each operand read request sequentially according to the priority order of each operand read request in each instruction to be transmitted, until all operand read requests are allocated to read ports of the physical register file, or the read ports of the physical register file are all allocated; wherein, the priority of the operand read request is positively correlated with the priority of the instruction to be transmitted to which it belongs; and different read ports are allocated to different operand read requests.

[0017] In the above implementation, by allocating read ports to operand read requests one by one according to their priority, read port utilization can be maximized. Even if all operand read requests of a high-priority instruction to be issued cannot be satisfied, it can still allocate some read ports to execute some operand read requests first, and then allocate read ports and execute them together with other instructions to be issued in the next clock cycle. This avoids wasting read ports and maximizes read port utilization.

[0018] Optionally, according to the priority order of each instruction to be issued, read ports of the physical register file are allocated sequentially for operand read requests in each instruction to be issued, including: determining the current instruction to be allocated from the instructions to be issued according to the priority order of each instruction to be issued; determining whether the number of operand read requests in the current instruction to be allocated is less than or equal to the number of unallocated read ports in the physical register file; if the number of operand read requests in the current instruction to be allocated is less than or equal to the number of unallocated read ports in the physical register file, then one read port of the physical register file is allocated to each operand read request in the current instruction to be allocated; different read ports are allocated to different operand read requests; if the number of operand read requests in the current instruction to be allocated is greater than the number of unallocated read ports in the physical register file, then the next instruction to be issued is determined as the new current instruction to be allocated according to the priority order of each instruction to be issued.

[0019] In the above implementation, the number of operand read requests for the currently pending instruction is determined to be less than or equal to the number of unallocated read ports in the physical register file. Only if the number of operand read requests for the currently pending instruction is less than or equal to the number of unallocated read ports in the physical register file is a physical register file read port allocated to each operand read request in the currently pending instruction. If the number of operand read requests for the currently pending instruction is greater than the number of unallocated read ports in the physical register file, the next pending instruction is treated as the new currently pending instruction and the above operation is re-executed. In this way, pending instructions that meet the number of unallocated read ports in the physical register file are allocated to read ports, ensuring that each time a read port is allocated, the pending instructions allocated to a read port are complete, thereby improving read port utilization.

[0020] Optionally, the method further includes: if there are multiple target operand read requests with the same requested physical register address among the operand read requests in each of the instructions to be issued, then record the association relationship of the multiple target operand read requests, and do not allocate a read port of the physical register file to the first target operand read request; the first target operand read request is: each target operand read request other than the second target operand read request among the multiple target operand read requests; the second target operand read request is: the target operand read request with the highest priority among the multiple target operand read requests.

[0021] In the above implementation, by identifying and merging multiple target operand read requests to the same physical register address, and allocating a physical register file read port only for the highest-priority second target operand read request, the occupation of valuable read port resources can be reduced, improving read port utilization efficiency. Furthermore, since it is the reserved highest-priority second target operand read request, it will have the highest competitiveness during read port contention, preventing situations where operand read requests that should be processed first are delayed due to insufficient priority.

[0022] Optionally, the target read port of the physical register file is configured to: return the read operands to the respective source ends of the plurality of target operand read requests according to the association relationship; the target read port is: the read port in the physical register file that is allocated the second target operand read request.

[0023] In the above implementation scheme, after obtaining the operand through the target read port that is assigned the second target operand read request, the read operand is returned to the source end of each of the multiple target operand read requests by using the recorded association relationship. In this way, efficient reuse of the target read port can be achieved.

[0024] Optionally, the method further includes: determining a preset value in a mode register before obtaining the priority of all instructions to be transmitted in the current clock cycle.

[0025] In the above implementation, by setting a mode register and using the value in the mode register to control whether to adopt the scheme provided in this application embodiment, a flexible configuration of the read port allocation mode of the physical register file in the processor can be achieved, which has higher flexibility.

[0026] Secondly, embodiments of this application also provide a processor, including an arbitrator and a physical register file; the arbitrator is configured to execute any of the above-described physical register file read port allocation methods.

[0027] Thirdly, embodiments of this application also provide an electronic device, including the processor described above. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1Example diagram of a scenario for the first related technology provided in the embodiments of this application; Figure 2 Example diagram of a second related technology provided in the embodiments of this application; Figure 3 An example diagram illustrating a wasted read port in the second related technology provided in this application embodiment; Figure 4 A flowchart illustrating a method for allocating read ports in a physical register file, as provided in an embodiment of this application. Figure 5 A schematic diagram of an exemplary processor architecture provided for an embodiment of this application; Figure 6 A schematic diagram of an optional read port allocation process provided for an embodiment of this application; Figure 7 This is a schematic diagram of the basic structure of a processor provided in an embodiment of this application. Detailed Implementation

[0030] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0031] As described in the background section, modern high-performance processors often employ bank splitting technology, dividing a large register file into multiple independent, smaller physical register files and distributing register addresses through interleaving to increase the probability of parallel access. However, this method still cannot avoid read port contention when multiple read requests attempt to access the same physical register file.

[0032] Therefore, in related technologies, one solution is to allocate a fixed read port for each operand, and each read port is not shared with other operands. For example, see [link to relevant documentation]. Figure 1 As shown, Figure 1 The diagram shows that the physical register file has six read ports: rd_port0, rd_port1, rd_port2, rd_port3, rd_port4, and rd_port5, which can satisfy the reading of six operands. However, as the number of instructions issued by the core unit increases, the actual number of read ports required often exceeds the physical implementation capacity. Furthermore, since each port is not shared across all operands, some read ports may be frequently accessed while others remain idle, failing to fully utilize the read port hardware resources.

[0033] In related technologies, another solution is to still allocate each read port to a fixed number of operands, but to distribute the same number of operand read requests evenly across each port. If multiple operand read requests fall on the same physical register file, the arbitrator allows one operand read request to pass based on a preset fixed priority, while blocking the others. The blocked operand read requests wait to retry in the next clock cycle. However, in this solution, because the arbitrator always arbitrates according to a preset fixed priority, low-priority operand read requests may be repeatedly blocked. If the oldest instruction operand is assigned a low priority, the instruction itself and instructions that depend on its result may not be issued quickly, leading to issue queue congestion, pipeline bubbles, and a significant reduction in the processor's IPC (instructions per clock cycle). Furthermore, since each read port is only allocated to a fixed number of operands, even when the number of operand read requests requiring physical register access is less than or equal to the number of read ports in the physical register file, some operand read requests may still not be allocated to a physical register file read port, resulting in underutilization of read port hardware resources.

[0034] For example, see Figure 2As shown, the physical register file has four read ports: rd_port0, rd_port1, rd_port2, and rd_port3. Assume the arbiter allocates three operand read requests to each read port: rd_port0 is allocated read request0, read request1, and read request2; rd_port1 is allocated read request3, read request4, and read request5; rd_port2 is allocated read request6, read request7, and read request8; and rd_port3 is allocated read request9, read request10, and read request11. Assume read request0, read request3, read request6, and read request9 have very low priority. In the current cycle, assuming rd_port0 selects read request2 for processing, rd_port1 selects read request5, rd_port2 selects read request8, and rd_port1 selects read request11, and the next clock cycle adds an operand read request to rd_port0, rd_port1, rd_port2, and rd_port3 respectively, with a higher priority than their corresponding read requests0, 3, 6, and 9, then in the next clock cycle, read requests0, 3, 6, and 9 will still not be selected. This continues, and read requests0, 3, 6, and 9 will remain unselected, thus being starved.

[0035] For example, see Figure 3As shown, assume that read ports rd_port0, rd_port1, and rd_port2 each have three corresponding operand read requests: rd_port0 is allocated read request0, read request1, and read request2; rd_port1 is allocated read request3, read request4, and read request5; and rd_port2 is allocated read request6, read request7, and read request8. However, each read port is only allocated to a specific operand. If there are currently no operand read requests for rd_port3, then rd_port3 is idle, and clearly the read port hardware resources are not being fully utilized.

[0036] To address the aforementioned issues, improve the fairness of processor instruction processing, reduce the risk of instruction starvation, and enhance the utilization efficiency of physical register file read ports, this application provides a method for allocating physical register file read ports on an arbitrator.

[0037] See also Figure 4 As shown, the methods for allocating read ports in the physical register file include: S401: Get the priority of all pending commands in the current clock cycle.

[0038] In this embodiment, the priority of a launch command is determined based on its age. The age of the launch command represents the duration from its generation to its retirement.

[0039] In the embodiments of this application, such as Figure 5 As shown, the age of the command to be launched can be determined by upstream modules, such as the renaming module, which writes the commands to be launched into the launch queues corresponding to each type according to the command type. Figure 5 The diagram shows the corresponding launch queues (Branch IQ, ALU IQ, LSU IQ, and Vector IQ) for Branch, ALU, LSU, and Vector. The age of each instruction to be launched is written into the corresponding launch queue as one of the attributes of the instruction to be launched, and can then be obtained by the arbitrator.

[0040] As we can understand, the physical register file is part of the processor core, serving as the storage unit immediately adjacent to the processor's core unit. The processor's core unit retrieves operands from the physical register file for processing. Therefore, theoretically, for the processor's core unit, its operand retrieval requests do not exhibit differences in importance due to different computational tasks. Thus, a longer age of a pending instruction means a longer unprocessed time, increasing the risk of pipeline congestion and pipelining bubbles, but its importance is not significantly different from other pending instructions. Therefore, determining the priority of pending instructions based on their age allows us to consider the impact of the longest waiting time on whether the instruction with the longest waiting time should be processed first. This gives instructions with longer waiting times a higher probability of being processed first, thus mitigating the "starvation" problem that may occur in traditional fixed-priority arbitration and improving the fairness of instruction processing and resource allocation.

[0041] In the embodiments of this application, the core unit of the processor refers to the functional unit in the processor used to implement operand processing, including but not limited to ALU, FPU, Load / Store, Branch, Vector unit, etc.

[0042] S402: Based on the priority order of each instruction to be issued, allocate the port of the physical register file for the operand read request in each instruction to be issued in turn.

[0043] In this embodiment, the arbitrator processes operand read requests in each instruction to be issued in descending order of priority. Each instruction to be issued may contain one or more operand read requests. Each operand read request requires operands to be read from the physical register file. Therefore, the arbitrator allocates physical register file read ports to these operand read requests sequentially according to the priority of the instruction to be issued. If all read ports are allocated, lower-priority operand read requests will continue to be allocated read ports in subsequent cycles. Thus, as long as the number of operand read requests in the remaining instructions to be issued is greater than or equal to the number of read ports in the physical register file, each read port in the physical register file can be allocated an operand read request. This avoids situations where read ports are idle due to being bound to fixed operands, thereby improving the utilization efficiency of the physical register file read ports and thus enhancing the overall performance of the processor.

[0044] In one optional embodiment of this application, the priority of each instruction to be transmitted can be determined solely by its age. For example, the age of each instruction to be transmitted can be directly used to characterize its priority, with a higher age indicating a higher priority. This allows for the implementation of the simplest and most efficient arbitration logic, and the simpler the arbitration logic, the lower the timing requirements in the physical implementation.

[0045] Furthermore, during processor physical register access, older instructions are typically located at the front of the program execution dependency chain. Therefore, based on the above implementation, the probability of instructions at the front of the program execution dependency chain being executed first can be increased, the wake-up latency of critical data dependency chains can be shortened, and subsequent dependent instructions can be woken up and scheduled earlier, thereby maximizing the effective utilization of the out-of-order execution window. Moreover, since older instructions are typically located at the front of the program execution dependency chain, the above method can increase the probability of instructions on the critical path completing operand reading and entering the execution phase first, effectively reducing the risk of long-term lag in the issue queue due to resource contention and maintaining high throughput of the instruction issue logic. Additionally, again because older instructions are typically located at the front of the program execution dependency chain, prioritizing the read port requirements of these older instructions to be issued allows them to complete execution as quickly as possible and enter the reorder buffer commit phase, thereby accelerating the release of old physical register mappings and the update of the free list, reducing the allocation pressure on the physical register file.

[0046] In another optional embodiment of this application, the priority of each command to be launched may also be determined based on the age of the command to be launched and the dependencies between the commands.

[0047] For example, instructions to be emitted can be divided into two categories based on whether they have dependencies: Category 1 instructions (with dependencies) and Category 2 instructions (without dependencies). In this case, the priority of Category 1 instructions can be set to be higher than that of Category 2 instructions overall, and within each category, instructions can be further sorted by age, with older instructions having higher priority. This allows for more accurate identification of instructions on the critical path, ensuring that instructions at the front of the program's dependency chain have higher priority and are executed earlier.

[0048] For example, scores can be obtained by normalizing the age of the instruction to be launched and the length of its dependency chain, then weighting and summing the scores to determine the priority order of the instructions to be launched from highest to lowest. For example, one could use... Calculate the score, where and The preset weight values, Let i be the age of the command to be launched. The maximum age among all pending launch commands. Let i be the length of the dependency chain of the instruction to be issued. Let be the maximum dependency chain length among all commands to be issued, and let the length of the dependency chain be the score of command i to be issued.

[0049] The length of the dependency chain of a pending instruction refers to the number of other pending instructions that depend on the execution result of the pending instruction, starting from the pending instruction itself. For example, if pending instruction B depends on pending instruction A, pending instruction C depends on pending instruction B, and pending instruction D depends on pending instruction C, then the dependency chain length of pending instruction A is 3.

[0050] The above are merely two examples of implementation methods shown in the embodiments of this application, and are not intended to limit the embodiments of this application.

[0051] In one optional embodiment of this application, when the instruction to be transmitted has multiple operand read requests, the priority of the multiple operand requests can be determined according to the operand number.

[0052] For example, the priority among multiple operand requests can be positively correlated with the operand numbers of the requests. For instance, suppose the instruction A to be issued has two operand read requests, a and b, corresponding to operand numbers 0 and 1 respectively. Then, operand read request a can be set to have a higher priority than operand read request b.

[0053] For example, the priority among multiple operand requests is negatively correlated with the operand numbers of the requests. For instance, suppose the instruction A to be issued has two operand read requests, a and b, corresponding to operand numbers 0 and 1 respectively. Then, operand read request b can be set to have a higher priority than operand read request a.

[0054] It is understandable that the priority of operand requests in different pending commands is still arranged according to the priority order of the respective pending commands.

[0055] In one optional embodiment of this application, a physical register file read port can be allocated to each operand read request in order of priority according to the operand read requests in each instruction to be transmitted, until all operand read requests are allocated to the physical register file read port, or the physical register file read ports are all allocated.

[0056] The priority of operand read requests is positively correlated with the priority of the instruction to be transmitted, and different operand read requests are assigned different read ports.

[0057] For example, suppose the priority order of the instructions to be issued is: instruction A to be issued (including operand read requests A0 and A1, with A0 > A1 as the priority between A0 and A1) > instruction B to be issued (including operand read request B0). Assume the physical register file has two read ports.

[0058] The arbitrator sorts all operand requests by priority: A0 > A1 > B0. First, read port 0 is allocated to A0, and read port 1 is allocated to A1; B0 waits for reassignment in the next cycle.

[0059] By allocating read ports to operand read requests one by one according to their priority, the utilization of read ports can be maximized. Even if all operand read requests of a high-priority instruction to be issued cannot be satisfied, it can still allocate some read ports to execute some operand read requests first, and then allocate read ports and execute them together with other instructions to be issued in the next clock cycle. This avoids wasting read ports and maximizes read port utilization.

[0060] In another alternative embodiment of this application, see [link to relevant documentation]. Figure 6 As shown, it includes: S601: Determine the currently assigned instruction from among the instructions to be transmitted according to their priority order.

[0061] S602: Determine whether the number of operand read requests in the current instruction to be allocated is less than or equal to the number of unallocated read ports in the physical register file. If the number of operand read requests in the current instruction to be allocated is less than or equal to the number of unallocated read ports in the physical register file, then transpose step S603. If the number of operand read requests in the current instruction to be allocated is greater than the number of unallocated read ports in the physical register file, then transpose step S604.

[0062] S603: Allocate a physical register file read port for each operand read request in the currently pending instruction.

[0063] S604: Determine the next instruction to be transmitted as the new currently assigned instruction based on the priority order of each instruction to be transmitted, and then return to S602.

[0064] For example, suppose the priority order of the instructions to be allocated is: instruction A (requires 3 ports) > instruction B (requires 2 ports) > instruction C (requires 1 port). The physical register file has 4 read ports.

[0065] The arbitrator first checks the highest priority instruction A to be allocated. Instruction A requires 3 read ports. At this time, none of the 4 read ports in the physical register file are allocated. Therefore, the 3 read ports in the physical register file are allocated to the three operand read requests of instruction A.

[0066] Then, the instruction B to be allocated is checked. The instruction B to be allocated requires 2 read ports. At this time, there is still 1 read port in the physical register file that has not been allocated, which does not meet the requirements of the instruction B to be allocated. Therefore, the instruction B to be allocated is skipped, and the instruction C to be allocated is checked.

[0067] The instruction C to be allocated requires 1 read port. At this time, there is still 1 read port in the physical register file that has not been allocated. At this time, the remaining read port of the physical register is allocated to the operand read request of the instruction C to be allocated.

[0068] In this way, both instruction A and C can be sent completely. Compared to sending instruction A completely and an operand read request for instruction B completely, this method can complete the processing of two instruction assignments (sending instruction A completely and an operand read request for instruction B completely can only complete the processing of one instruction assignment, and instruction B still needs to be processed in the next cycle). Therefore, it can improve IPC (instruction per cycle).

[0069] In this embodiment of the application, if after traversing all instructions to be allocated there is no instruction whose number of operand read requests is less than or equal to the number of unallocated read ports in the physical register file, then read ports can be allocated for some operand read requests in the instructions to be allocated according to the priority order of the instructions to be allocated.

[0070] For example, suppose the priority order of the instructions to be allocated is: Instruction A (requires 3 ports) > Instruction B (requires 2 ports) > Instruction C (requires 2 ports). The physical register file has 4 read ports.

[0071] The arbitrator first checks the highest priority instruction A to be allocated. Instruction A requires 3 read ports. At this time, none of the 4 read ports in the physical register file are allocated. Therefore, the 3 read ports in the physical register file are allocated to the three operand read requests of instruction A.

[0072] Then, the instruction B to be allocated is checked. The instruction B to be allocated requires 2 read ports. At this time, there is still 1 read port in the physical register file that has not been allocated, which does not meet the requirements of the instruction B to be allocated. Therefore, the instruction B to be allocated is skipped, and the instruction C to be allocated is checked.

[0073] The instruction C to be allocated requires 2 read ports. At this time, there is still 1 read port in the physical register file that has not been allocated, which does not meet the requirements of the instruction C to be allocated.

[0074] Since there are no subsequent instructions to be allocated, the remaining read port can be assigned to one of the operand read requests of instruction B to make full use of the read port resources.

[0075] In an optional embodiment of this application, if there are multiple target operand read requests with the same requested physical register address among the operand read requests in each instruction to be issued, the association relationship of these multiple target operand read requests can be recorded, and a physical register file read port is not allocated to the first target operand read request.

[0076] The first target operand read request is any target operand read request other than the second target operand read request among the multiple target operand read requests; the second target operand read request is the target operand read request with the highest priority among the multiple target operand read requests.

[0077] Accordingly, the target read port of the physical register file can be configured to return the read operands to the respective source ends of multiple target operand read requests, based on the association relationships. The target read port is the read port in the physical register file that has a second target operand read request allocated to it.

[0078] In this way, multiple target operand read requests requesting the same physical register address only need to occupy one read port, which can improve read port utilization. Furthermore, since it is the reserved, highest-priority second target operand read request, it will also have the highest competitiveness during read port contention, preventing situations where operand read requests that should be processed first are delayed due to insufficient priority. It also allows the first target operand read request, which should have been allocated a read port in a later cycle, to be processed earlier, improving processing efficiency.

[0079] For example, suppose there are two operand read requests, A0 and B0, for instruction A and instruction B respectively, both requesting the same physical register address, P_reg_5. When allocating read ports, the arbitrator finds that these two operand read requests request the same physical register address. Operand read request A0 has higher priority than B0. The arbitrator identifies A0 as the second target operand read request and participates in the read port contention; it identifies B0 as the first target operand read request and does not participate in the read port contention. Simultaneously, the arbitrator internally records an association, indicating that "B0 is associated with A0, and B0's data source is the same as A0's." Subsequently, assuming A0 wins read port 0, after obtaining the operand a0 requested by A0, read port 0 returns operand a0 to both the core unit corresponding to A0 and the core unit corresponding to B0 based on this association. This achieves efficient reuse of read ports, improving the overall energy efficiency of the system.

[0080] For example Figure 5 For example, assuming that A0 is the request for the corresponding ALU and B0 is the request for the corresponding Branch, after obtaining operand a0, operand a0 will be sent to both the ALU and the Branch to avoid repeated access to the physical register file.

[0081] In this embodiment of the application, the association relationship can be recorded through a preset register.

[0082] In one optional embodiment of this application, a mode register can also be set, and multiple port allocation modes can be pre-configured by means of software definition, etc., and then the applicable port allocation mode can be selected according to the value written in the mode register.

[0083] For example, the modes corresponding to the port allocation method provided in this application embodiment, as well as the modes corresponding to one or two port allocation schemes in related technologies, can be pre-set, and the corresponding register values ​​can be configured. Engineers can configure the arbitrator by writing setting values ​​to the mode register, thereby enabling the arbitrator to execute the corresponding mode. In this way, flexible configuration of the read port allocation mode for the physical register file in the processor can be achieved, providing greater flexibility.

[0084] To facilitate understanding of the solutions in this application, a specific exemplary embodiment will be used as an example to illustrate the solutions in this embodiment: The arbitrator can be configured according to the following rules: 1. When multiple operand read requests from multiple instructions awaiting issuance require reading the physical register file of the same bank, the read port is no longer fixedly assigned to a specific type of instruction. Instead, the age of the instruction awaiting issuance is used to dynamically allocate ports. First, the ages of the instructions to be issued are compared, and the read ports are allocated sequentially according to age to the oldest / second oldest / third oldest operand in the current cycle. If a single instruction awaiting issuance has multiple operand read requests, they are sorted by operand number and then allocated based on priority (either from largest to smallest or smallest to largest).

[0085] Based on the above rules, when the number of operand read requests that need to read the physical register file in a single cycle is less than or equal to the number of read ports, it can be guaranteed that all operand read requests can be successfully allocated to read ports. When the number of operand read requests that need to read the physical register file in a single cycle is greater than the number of read ports, this scheme can guarantee that all read ports are preferentially allocated to the operand read requests of the oldest pending instruction, thereby maintaining the fluidity and high throughput of the launch queue.

[0086] 2. When allocating read ports according to the age of the instruction to be transmitted, if multiple operand read requests request the same physical register address, only one read port will be allocated to the oldest operand read request, and the data read from it can be simultaneously allocated to all operand read requests with the same physical register address.

[0087] Based on the above rules, when the number of operations that need to read the physical register file in a single cycle is less than or equal to the number of read ports, the allocation of read ports can be saved, thereby saving the dynamic power consumption of reading the physical register file.

[0088] For example, suppose there are 4 instructions to be issued in a given timeframe, resulting in a total of 6 operand read requests that read the physical register file. The addresses of the registers requested by the instructions to be issued and the operand read requests are compared in parallel. Assuming the physical register address of operand read request inst1 src1 is the same as that of operand read request inst0 src0, and the physical register address of operand read request inst3 src0 is the same as that of operand read request inst2 src0, it is confirmed that only 4 read ports need to be allocated. These ports are then connected sequentially from port0 to port3, ordered by age. In this scenario, the 6 operand read requests complete the data reading using only 4 read ports, reducing the dynamic power consumption of reading the physical register file.

[0089] When the number of operations that need to read the physical register file in a single cycle is greater than the number of read ports, the saved ports can be allocated to operand read requests of younger instructions to be issued, thereby increasing the number of instructions to be issued in a single cycle and thus improving the processor's IPC.

[0090] 3. When the number of operand read requests that need to read the physical register file in a single cycle exceeds the number of remaining unallocated read ports, and when there are few unallocated read ports remaining, the allocation priority can be dynamically adjusted based on the number of operands carried by the instructions to be issued that have not yet been allocated a port. That is, when the number of operand read requests of the instructions to be issued that are currently awaiting allocation of read ports exceeds the number of unallocated read ports, the priority of subsequent instructions to be issued with a number of operand read requests less than or equal to the number of unallocated read ports can be increased to allocate unallocated read ports to those instructions to be issued.

[0091] For example, suppose there is only one unallocated read port. Among the pending instructions on the unallocated port, the oldest pending instruction has two operand read requests requiring the read port, while a younger pending instruction only has one operand read request. In this case, the read port is preferentially allocated to the younger pending instruction. Because there is only one port left, and the older pending instruction requires two operand read requests, there is not enough space, and the pending instruction cannot be successfully issued, wasting the remaining port. If the port is allocated to the younger pending instruction, it can be successfully issued, increasing the number of pending instructions to be issued per week. This allocation maximizes read port utilization. Even if the older pending instruction is delayed for one cycle due to resource conflicts, the pipeline continues to move forward because the oldest pending instruction is successfully issued, preventing starvation.

[0092] For example, suppose there are 6 instructions to be issued, and a total of 10 operand read requests to read the physical register file, which has 6 read ports (ports 0-5). The age of the instructions to be issued is compared in parallel with the read register addresses requested by the operand read requests. It is found that the physical register address of operand read request inst1 src1 is the same as that of operand read request inst0 src0, and the physical register address of operand read request inst3 src0 is the same as that of operand read request inst2 src0. This design allows the saved ports to be allocated to younger instruction operands. To ensure all instruction operands successfully retrieve data, 8 read ports need to be allocated, which is greater than the total number of read ports (6). Ports 0-4 are preferentially allocated to instructions with relatively older current age. In this scenario, it is necessary to ensure as many instructions as possible are successfully issued; therefore, when allocating the last port (port 5), it is necessary to check the operands carried by instructions that have not yet been allocated a port. It was found that if port5 is assigned to the older instruction inst5, and inst5 carries two operand read requests, it cannot be successfully issued, resulting in only 4 instructions being issued successfully in that cycle. However, if port5 is preferentially assigned to instruction inst4, and inst4 has only one operand read request, then 5 instructions can be successfully issued in that cycle, increasing the number of instructions issued per cycle and thus improving the processor's IPC.

[0093] It is understandable that the read ports of the physical register file are used and released periodically.

[0094] The above exemplary solutions offer several advantages. First, they alleviate head-of-line congestion in the issue queue: by assigning absolute priority to the read port allocation of the oldest instruction in the physical registers, instructions on the critical path can prioritize source operand reading and enter the execution phase, reducing the risk of long-term delays in issue queue entries due to resource contention and maintaining high throughput of the instruction issue logic. Second, they accelerate physical register file resource reclamation: the oldest instruction is typically located at the front of the program's dependency chain; prioritizing its read port requirements allows it to complete execution quickly and enter the reorder buffer's commit phase, thereby accelerating the release of old physical register mappings and the update of the free list, reducing the allocation pressure on the physical register file. Third, they improve instruction-level parallelism and pipeline IPC: by eliminating resource starvation and pipeline pauses during the register read phase of the oldest instruction, they shorten the wake-up latency of critical data dependency chains, enabling subsequent dependent instructions to be woken up and scheduled earlier, thus maximizing the effective utilization of the out-of-order execution window.

[0095] Based on the same inventive concept, this application also provides a processor, see [link to relevant documentation]. Figure 7As shown, it includes a core unit, an arbitrator, and a physical register file. The physical register file is connected to both the core unit and the arbitrator. The arbitrator is configured to execute the read port allocation method for the physical register file provided in the embodiments of this application.

[0096] In the embodiments of this application, the processor can be a superscalar processor, such as a CPU, GPU, AI accelerator, neural network processor, etc.

[0097] This application also provides an electronic device that includes the processor provided in this application.

[0098] In this application embodiment, the electronic device can be an electronic component with the aforementioned system-on-a-chip, such as a control module, data processing module, graphics card, circuit board, motherboard, etc. Furthermore, the electronic device can also be a server or terminal (such as a mobile phone, computer, smart wearable device, etc.) capable of providing complete services to the outside world.

[0099] It is understood that electronic devices may also include more components. For example, they may also have memory (such as RAM, hard disk, etc.) and an internal communication bus, which is used to realize communication between the processor and the memory; they may also have external communication interfaces, such as USB (Universal Serial Bus) interface, CAN (Controller Area Network) bus interface, etc.; and they may also have information display components such as a display screen, but this is not a limitation.

[0100] In the embodiments of this application, various implementation methods, examples, or embodiments can be freely combined to obtain new technical solutions without conflict.

[0101] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0102] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer-to-be-launched instructions. When the computer-to-be-launched instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated.

[0103] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the connections shown or discussed between each other can be through some interfaces, indirect connections between devices or units, and can be electrical, mechanical, or other forms.

[0104] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0105] In this article, "multiple" refers to two or more.

[0106] In this article, the symbol " / " represents the relationship "or".

[0107] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for allocating read ports in a physical register file, characterized in that, An arbitrator applied to a processor, the arbitrator being connected to the processor's physical register file; the method includes: Obtain the priority of all instructions to be launched within the current clock cycle; wherein, the priority of each instruction to be launched is determined according to the age of the instruction to be launched; the age of the instruction to be launched represents the duration from the generation of the instruction to its retirement. According to the priority order of each instruction to be launched, the read port of the physical register file is allocated sequentially for the operand read request in each instruction to be launched.

2. The method for allocating read ports of the physical register file as described in claim 1, characterized in that, The priority of each of the commands to be launched is represented by the age of each command to be launched; The older the command to be launched, the higher its priority.

3. The method for allocating read ports of the physical register file as described in claim 1, characterized in that, The priority of each command to be launched is determined based on the age of the command and the dependencies it has.

4. The method for allocating read ports of the physical register file as described in claim 3, characterized in that, The first type of instruction has a higher priority than the second type of instruction; Furthermore, among the first type of instructions: the older the instruction, the higher its priority; among the second type of instructions: the older the instruction, the higher its priority. The first type of instruction is a dependent instruction to be issued, and the second type of instruction is a non-dependent instruction to be issued.

5. The method for allocating read ports of the physical register file as described in claim 1, characterized in that, In the case where the instruction to be launched has multiple operand read requests, the priority of the multiple operand requests is determined according to the operand number; The priority among the multiple operand requests is positively correlated with the operand numbers of the multiple operand requests; Alternatively, the priority among the multiple operand requests is negatively correlated with the operand numbers of the multiple operand requests.

6. The method for allocating read ports of the physical register file as described in claim 1, characterized in that, According to the priority order of each instruction to be transmitted, the read ports of the physical register file are allocated sequentially for the operand read requests in each instruction to be transmitted, including: According to the priority order of the operand read requests in each of the commands to be sent, a read port of the physical register file is allocated to each operand read request in turn, until all operand read requests are allocated to the read ports of the physical register file, or the read ports of the physical register file are all allocated. The priority of the operand read request is positively correlated with the priority of the instruction to be transmitted; and different operand read requests are assigned different read ports.

7. The method for allocating read ports of the physical register file as described in claim 1, characterized in that, According to the priority order of each instruction to be transmitted, the read ports of the physical register file are allocated sequentially for the operand read requests in each instruction to be transmitted, including: Based on the priority order of each of the commands to be launched, the command to be assigned is determined from the commands to be launched. Determine whether the number of operand read requests in the currently pending instruction is less than or equal to the number of unallocated read ports in the physical register file; If the number of operand read requests in the current instruction to be allocated is less than or equal to the number of unallocated read ports in the physical register file, then one read port of the physical register file is allocated to each operand read request in the current instruction to be allocated; different read ports are allocated to different operand read requests. If the number of operand read requests in the currently pending instruction is greater than the number of unallocated read ports in the physical register file, then the next pending instruction is determined as the new currently pending instruction according to the priority order of the pending instructions.

8. The method for allocating read ports for a physical register file as described in any one of claims 1-7, characterized in that, The method further includes: If there are multiple target operand read requests with the same physical register address among the operand read requests in each of the instructions to be issued, then the association relationship of the multiple target operand read requests is recorded, and the read port of the physical register file is not allocated to the first target operand read request. The first target operand read request is: each target operand read request other than the second target operand read request among the plurality of target operand read requests; The second target operand read request is the target operand read request with the highest priority among the plurality of target operand read requests.

9. The method for allocating read ports of the physical register file as described in claim 8, characterized in that, The target read port of the physical register file is configured to return the read operands to the respective source ends of the multiple target operand read requests according to the association relationship. The target read port is the read port in the physical register file that is allocated for the second target operand read request.

10. The method for allocating read ports of a physical register file as described in any one of claims 1-7, characterized in that, The method further includes: Before obtaining the priority of all instructions to be issued in the current clock cycle, the value set in the preset mode register is determined to be the set value.

11. A processor, characterized in that, It includes an arbitrator and a physical register file; the arbitrator is configured to perform the read port allocation method for the physical register file as described in any one of claims 1-9.

12. An electronic device, characterized in that, Includes the processor as described in claim 11.