Control method and apparatus, electronic device
By generating different types of encoded data packets and sending them when the storage section is not full, the problem of data overflow in multi-channel kernel retirement instruction processing is solved, improving the accuracy and efficiency of data processing and ensuring the orderly execution of retirement instructions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ESWIN COMPUTING TECH CO LTD
- Filing Date
- 2023-01-30
- Publication Date
- 2026-05-01
AI Technical Summary
During the retirement instruction processing of a multi-channel kernel, the downstream device failed to receive the encoded data packet in time, resulting in data overflow in the storage section, causing data loss and discontinuous processing.
The control section generates different types of encoded data packets. Based on the overflow status of the storage section and the storage location of retirement instructions, the generation and transmission process of encoded data packets is optimized. This includes sending encoded data packets when the storage section is not full and caching data in the storage subsection to reduce the possibility of data overflow and loss.
It improves the accuracy of encoded data packets and the efficiency of storage, ensures the orderly execution of retirement instructions, reduces the probability of data overflow and loss, and improves the accuracy and integrity of processing.
Smart Images

Figure CN116126247B_ABST
Abstract
Description
Control methods and devices, electronic equipment Technical Field
[0001] This disclosure relates to, but is not limited to, the field of computer technology, and in particular to a control method and apparatus, and electronic equipment. Background Technology
[0002] In related technologies, since the kernel retirement instructions are multi-channel, at least one instruction may retire simultaneously within a cycle. If the downstream device cannot receive the encoded data packets generated based on the retirement instructions in a timely manner, the encoded data packets will accumulate in the storage part of the trace encoder (TE), resulting in data overflow in the storage part. Summary of the Invention
[0003] This disclosure provides at least one control method, apparatus, and electronic device.
[0004] The technical solution of this disclosure embodiment is implemented as follows:
[0005] This disclosure provides a control device, which includes a control section and a storage section electrically connected together, wherein:
[0006] The control section is configured to receive and store at least one retirement instruction; for each retirement instruction, based on the overflow state of the storage section and the retirement instruction, generate an encoded data packet corresponding to the retirement instruction, and send the encoded data packet to the storage section if the storage state of the storage section is not full;
[0007] The storage section is used to receive and store at least one of the encoded data packets sent by the control section.
[0008] In some embodiments, the control unit is further configured to: generate a first coded data packet corresponding to the retirement instruction based on the retirement instruction when the overflow state of the storage portion is non-overflow, or the overflow state of the storage portion is overflow and the storage location of the retirement instruction meets a preset condition; and generate a second coded data packet corresponding to the retirement instruction when the overflow state of the storage portion is overflow and the storage location of the retirement instruction does not meet the preset condition; wherein the type of the second coded data packet is different from the type of the first coded data packet.
[0009] In this embodiment of the disclosure, generating different types of encoded data packets based on the overflow state of the storage section and the storage location of the retirement instruction can not only improve the accuracy of the encoded data packets, but also reduce the possibility of data overflow blocking, thereby improving the utilization efficiency of the storage section.
[0010] In some embodiments, the control section includes a storage subsection; the control section is further configured to: update the encoded data packet corresponding to each retirement instruction to the storage subsection, and send the encoded data packet in the storage subsection to the storage section when the storage state of the storage section is not full.
[0011] In this embodiment of the disclosure, on the one hand, caching the encoded data packets in the storage sub-part can reduce the possibility of lost encoded data packets, thereby improving the integrity and accuracy of the encoded data packets; on the other hand, when the storage state of the storage part is not full, sending the encoded data packets to the storage part can not only reduce the possibility of data overflow in the storage part, thereby reducing the probability of lost data packets, but also improve the accuracy of subsequent retirement instruction execution, thereby ensuring the orderly retirement of each retirement instruction.
[0012] In some embodiments, the control section includes a shift section; the shift section is configured to receive and store each retirement instruction; the control section is further configured to: for each retirement instruction in the shift section, if the retirement instruction meets the generation conditions, generate an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage section and the retirement instruction.
[0013] In this embodiment of the disclosure, on the one hand, by caching each retirement instruction through a shift portion, the possibility of losing retirement instructions can be reduced, thereby improving the integrity and accuracy of retirement instructions; on the other hand, by setting generation conditions to generate coded data packets, the accuracy of coded data packets can be improved.
[0014] In some embodiments, the shifting portion includes at least one storage location; the shifting portion is further configured to: receive each retirement instruction; determine a target storage location corresponding to each retirement instruction from each storage location, and store each retirement instruction into the corresponding target storage location.
[0015] In this embodiment of the disclosure, storing different retirement instructions in different storage locations decouples the different retirement instructions, allowing subsequent use of different locations to distinguish between different retirement instructions, thereby improving the accuracy of instruction execution.
[0016] In some embodiments, the shifting portion is further configured to: sort each retirement instruction according to the reception time of each retirement instruction to obtain a sorting result for each retirement instruction; and determine the target storage location corresponding to each retirement instruction from each storage location based on the sorting result of each retirement instruction.
[0017] In this embodiment of the disclosure, determining the target storage location for each retirement instruction by receiving the time improves the accuracy of the target storage location, thereby improving the accuracy of the retirement instructions.
[0018] In some embodiments, the control unit is further configured to: when the storage state of the storage unit is full, acquire a new storage state of the storage unit in real time, and when the new storage state is not full, send the encoded data packet to the storage unit.
[0019] In this embodiment of the disclosure, when the storage state of the storage section is full, the encoded data packet is not stored in the storage section until the storage state of the storage section is not full, which can reduce the possibility of storage section overflow and thus reduce the probability of data packet loss.
[0020] In some embodiments, the storage section is further configured to: detect the overflow state in real time; and, if the overflow state is an overflow, send the overflow state to the control section.
[0021] In this embodiment of the disclosure, on the one hand, by obtaining the overflow status of the storage section in real time, the accuracy of the overflow status can be improved; on the other hand, when the overflow status is overflow, the control section is notified in real time so that the control section can generate coded data packets corresponding to different retirement instructions based on the overflow status, thereby improving the accuracy of the coded data packets.
[0022] This disclosure provides a control method, which is applied to any of the above-described control devices, and the method includes:
[0023] The control unit receives and stores at least one retirement instruction;
[0024] For each retirement instruction, the control unit generates an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage unit and the retirement instruction, and sends the encoded data packet to the storage unit when the storage state of the storage unit is not full.
[0025] The storage section receives and stores at least one of the encoded data packets sent by the control section.
[0026] This disclosure provides an electronic device including any of the control devices described above.
[0027] In this embodiment, the control unit receives and stores at least one retirement instruction. For each retirement instruction, based on the overflow state of the storage unit and the retirement instruction, an encoded data packet corresponding to the retirement instruction is generated. If the storage unit is not full, the encoded data packet is sent to the storage unit. The storage unit receives and stores at least one encoded data packet sent by the control unit. Thus, on the one hand, generating the encoded data packet based on the overflow state of the storage unit improves the accuracy of the encoded data packet corresponding to the retirement instruction; on the other hand, storing the encoded data packet only when the storage unit is not full reduces the possibility of data overflow in the storage unit, thereby reducing the probability of data packet loss, and also improves the accuracy of subsequent retirement instruction execution, thus ensuring the orderly retirement of each retirement instruction.
[0028] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0029] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.
[0030] Figure 1A is a schematic diagram of the composition structure of a control device provided in an embodiment of this disclosure;
[0031] Figure 1B is a schematic diagram of the composition structure of a control device provided in an embodiment of this disclosure;
[0032] Figure 2 is a schematic diagram of the implementation flow of a control method provided in an embodiment of this disclosure;
[0033] Figure 3A is a schematic diagram of the composition structure of a control device provided in an embodiment of this disclosure;
[0034] Figure 3B is a schematic diagram of the implementation flow of a control method provided in an embodiment of this disclosure;
[0035] Figure 4 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this disclosure. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this disclosure clearer, the disclosure will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this disclosure. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0037] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0038] In the following description, the terms “first, second, third” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first, second, third” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used herein is for the purpose of describing embodiments of this disclosure only and is not intended to be limiting of this disclosure.
[0040] E-Trace is a highly efficient processor tracing method that uses branch tracing and is well-suited for debugging any type of application, from tiny embedded designs to ultra-powerful computers. E-Trace specifies the signals between the RISC-V core and the encoder, the compressed branch tracing algorithm, and the data packet format for encapsulating compressed branch tracing information.
[0041] The RISC-V TE generates encoded data packets from the addresses of retired instructions according to the Efficient Trace for RISC-V protocol and outputs them to downstream devices. In related technologies, the retirement instructions for a 64-bit RISC-V core are multi-channel; a core may retire multiple instructions simultaneously in one cycle (e.g., N, where N is a positive integer). If the downstream device cannot receive these encoded data packets in time, encoded data packets will accumulate in the TE's FIFO (First In First Out) memory, leading to data overflow in the FIFO memory.
[0042] The control device provided in this disclosure can be an electronic device, which can be a laptop, tablet, desktop computer, set-top box, mobile device (e.g., mobile phone, portable music player, personal digital assistant, dedicated messaging device, portable gaming device), or other types of terminal. It can also be implemented as a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0043] The technical solutions in the embodiments of this disclosure will now be clearly and completely described with reference to the accompanying drawings.
[0044] Figure 1A is a schematic diagram of the implementation flow of a control device provided in an embodiment of this disclosure. As shown in Figure 1A, the control device 10 includes a control part 11 and a storage part 12 electrically connected, wherein:
[0045] The control unit 11 is used to receive and store at least one retirement instruction; for each retirement instruction, based on the overflow state of the storage unit and the retirement instruction, it generates an encoded data packet corresponding to the retirement instruction, and sends the encoded data packet to the storage unit when the storage state of the storage unit is not full.
[0046] The storage section 12 is used to receive and store at least one of the encoded data packets sent by the control section.
[0047] Here, the control section 11 can be any part capable of implementing the control function. For example, a processor, controller, control circuit, etc. In implementation, those skilled in the art can choose the implementation method of the control section according to the actual situation, and the embodiments disclosed herein are not limited thereto.
[0048] A retirement instruction signifies an instruction that has been normally executed and completed. The instruction can be any suitable executable instruction, such as a load instruction or a store instruction; this disclosure does not limit the scope of the embodiments. In implementation, the entire execution process of an instruction may include, but is not limited to, extraction, decoding, execution, and result writing.
[0049] The storage section 12 can be any part capable of implementing storage functions. For example, registers, memory, stacks, queues, etc. In implementation, those skilled in the art can independently determine the implementation method of the storage section according to actual needs, and the embodiments disclosed herein are not limited thereto.
[0050] The state of the storage section may include, but is not limited to, overflow state and storage state. The overflow state indicates whether the storage section is currently overflowing. The storage state indicates the current storage status of the storage section. In implementation, the overflow state / storage state of the storage section is monitored in real time. In some embodiments, the storage section monitors its state in real time and reports the detected state to the control section. In some embodiments, the storage section monitors and stores its state in real time, and the control section actively retrieves it from the storage section.
[0051] The overflow state of the storage portion can include, but is not limited to, overflow and non-overflow. In implementation, the overflow state of the storage portion can be represented in any suitable way. For example, "1" can represent overflow, and "0" can represent non-overflow. Alternatively, "yes" can indicate the existence of overflow, and "no" can indicate the absence of overflow. In implementation, those skilled in the art can choose the implementation method of the overflow state according to actual needs; this disclosure does not limit such implementation.
[0052] The storage state of the storage section can include, but is not limited to, not full, full, and empty. Not full indicates that there is still some remaining space in the storage section, which can be used to store new encoded data packets; full indicates that the storage space is full and cannot store new encoded data packets; empty indicates that the storage space is unused and can be used to store new encoded data packets. In implementation, the storage state of the storage section can be represented in any suitable way. For example, "1" can represent not full, "0" can represent empty, and "-1" can represent full. Another example is using "yes" to represent full and "no" to represent that the current storage state is not full. In implementation, those skilled in the art can choose the implementation method of the storage state according to actual needs, and the embodiments disclosed in this disclosure are not limited thereto.
[0053] The encoded data packet can be generated in any suitable way. For example, the retirement instruction can be obtained from the address of the retirement instruction stored in the program counter (PC), and the corresponding encoded data packet can be generated using a preset encoding protocol. In implementation, those skilled in the art can choose the method of generating the encoded data packet according to actual needs, and the embodiments disclosed herein are not limited thereto.
[0054] In some implementations, the type of encoded data packet may include, but is not limited to, a first type of encoded data packet, a second type of encoded data packet, etc. The first type of encoded data packet represents an encoded data packet generated based on an encoding protocol. The second type of encoded data packet represents an encoded data packet indicating an overflow situation. For example, a Support Packet and a Sync Packet, where the Support Packet indicates that an overflow occurred in the storage section prior to the overflow, and the Sync Packet uses the first retirement instruction after the overflow as the starting point. In implementation, the Support Packet and the Sync Packet can be combined into a single data packet.
[0055] In this embodiment, the control unit receives and stores at least one retirement instruction. For each retirement instruction, based on the overflow state of the storage unit and the retirement instruction, an encoded data packet corresponding to the retirement instruction is generated. If the storage unit is not full, the encoded data packet is sent to the storage unit. The storage unit receives and stores at least one encoded data packet sent by the control unit. Thus, on the one hand, generating the encoded data packet based on the overflow state of the storage unit improves the accuracy of the encoded data packet corresponding to the retirement instruction; on the other hand, storing the encoded data packet only when the storage unit is not full reduces the possibility of data overflow in the storage unit, thereby reducing the probability of data packet loss, and also improves the accuracy of subsequent retirement instruction execution, thus ensuring the orderly retirement of each retirement instruction.
[0056] In some embodiments, the control unit 11 is further configured to: generate an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage unit and the retirement instruction, provided that the retirement instruction meets the conditions for generating an encoded data packet.
[0057] Here, the generation conditions can be any suitable conditions capable of generating coded data packets. For example, the retirement order has not expired, or there were no previous abnormal retirement orders. In implementation, those skilled in the art can set the generation conditions according to actual needs; this disclosure does not impose limitations. In implementation, if the retirement order does not meet the generation conditions, no coded data packet is generated.
[0058] In this embodiment, when the retirement instruction meets the conditions for generating an encoded data packet, an encoded data packet corresponding to the retirement instruction is generated based on the overflow state of the storage portion and the retirement instruction. Thus, by setting the generation conditions, the accuracy of the encoded data packet corresponding to the retirement instruction can be improved.
[0059] In some embodiments, the control unit 11 is further configured to: when the storage state of the storage unit is full, acquire the new storage state of the storage unit in real time, and when the new storage state is not full, send the encoded data packet to the storage unit.
[0060] Here, the new storage state can include, but is not limited to, not full, full, empty, etc. In implementation, when a downstream device retrieves the encoded data packets from the storage section, the storage state of the storage section changes. Thus, by acquiring the storage state of the storage section in real time, and storing the encoded data packets in the storage section when it is not full, the system can effectively store the data packets.
[0061] In this embodiment, when the storage section is full, a new storage state of the storage section is obtained in real time. When the new storage state is not full, the encoded data packet is sent to the storage section. Thus, when the storage section is full, the encoded data packet is not stored until the storage section is not full, reducing the possibility of storage overflow and thus lowering the probability of data packet loss.
[0062] In some embodiments, the storage section 12 is further configured to: detect the overflow state in real time; and, if the overflow state is an overflow, send the overflow state to the control section.
[0063] Here, the storage unit monitors its overflow status in real time and promptly notifies the control unit in the event of an overflow.
[0064] In this embodiment, the overflow state is detected in real time; if the overflow state is overflowing, the overflow state is sent to the control unit. This improves the accuracy of the overflow state by obtaining the overflow state of the storage unit in real time, and also improves the accuracy of the encoded data packets by informing the control unit in real time when the overflow state is overflowing, allowing the control unit to generate encoded data packets corresponding to different retirement instructions based on the overflow state.
[0065] In some embodiments, the control section 11 is further configured to perform at least one of the following:
[0066] If the overflow state of the storage portion is non-overflow, or if the overflow state of the storage portion is overflow and the storage location of the retirement instruction meets the preset conditions, a first encoded data packet corresponding to the retirement instruction is generated based on the retirement instruction.
[0067] If the storage portion is in an overflow state and the storage location of the retirement instruction does not meet the preset conditions, a second encoded data packet corresponding to the retirement instruction is generated.
[0068] Here, the type of the second encoded data packet is different from the type of the first encoded data packet. Specifically, the first encoded data packet can be a first type of encoded data packet, and the second encoded data packet can be a second type of encoded data packet.
[0069] The preset conditions may include, but are not limited to, the storage location identifier not being the minimum, the storage location identifier not being the maximum, or the storage location identifier being a non-specified identifier. The identifier may include, but is not limited to, name, number, and storage address. In implementation, those skilled in the art can set the preset conditions independently according to actual needs; this disclosure does not impose such limitations.
[0070] For example, the condition that the storage location number is not the smallest is used as a preset condition. That is, firstly, it is determined whether the overflow state of the storage part is overflow. If the overflow state of the storage part is not overflow, the corresponding first encoded data packet is generated based on the retirement instruction. If the overflow state of the storage part is overflow, it is determined whether the storage location of the retirement instruction is the smallest. If the storage location of the retirement instruction is not the smallest, the corresponding first encoded data packet is generated based on the retirement instruction. If the storage location of the retirement instruction is the smallest, the second encoded data packet corresponding to the retirement instruction is generated.
[0071] In this embodiment, when the overflow state of the storage portion is non-overflow, or when the overflow state of the storage portion is overflow and the storage location of the retirement instruction meets a preset condition, a first encoded data packet corresponding to the retirement instruction is generated based on the retirement instruction; and / or, when the overflow state of the storage portion is overflow and the storage location of the retirement instruction does not meet the preset condition, a second encoded data packet corresponding to the retirement instruction is generated; wherein the type of the second encoded data packet is different from the type of the first encoded data packet. Thus, generating different types of encoded data packets based on the overflow state of the storage portion and the storage location of the retirement instruction not only improves the accuracy of the encoded data packets but also reduces the possibility of data overflow blocking, thereby improving the utilization efficiency of the storage portion.
[0072] In some embodiments, the control section 11 includes a storage subsection; the control section 11 is further configured to: update the encoded data packet corresponding to each retirement instruction to the storage subsection, and send the encoded data packet in the storage subsection to the storage section when the storage state of the storage section is not full.
[0073] Here, the encoded data packet may include, but is not limited to, at least one of the first encoded data packet and the second encoded data packet.
[0074] The storage sub-part can be any part capable of implementing storage functions, such as registers, memory, stacks, queues, etc. In implementation, those skilled in the art can independently determine the implementation method of the storage sub-part according to actual needs, and this disclosure does not impose any limitations. For example, a register can be used as the storage sub-part, storing several coded data packets. In implementation, if the overflow state of the storage part is non-overflow, the first coded data packet corresponding to the retirement instruction is updated to the register; if the overflow state of the storage part is overflow, and the storage location of the retirement instruction is not the smallest numbered storage location, the first coded data packet corresponding to the retirement instruction is updated to the register; if the overflow state of the storage part is overflow, and the storage location of the retirement instruction is the smallest numbered storage location, the second coded data packet corresponding to the retirement instruction is updated to the register. The updating method can include, but is not limited to, replacement, addition, etc. In implementation, those skilled in the art can independently choose the updating method according to actual needs, and this disclosure does not impose any limitations. For example, the first coded data packet corresponding to the retirement instruction can replace the previously stored coded data packet.
[0075] In this embodiment, the encoded data packet corresponding to each retirement instruction is updated in the storage sub-part, and the encoded data packet in the storage sub-part is sent to the storage part when the storage part is not full. This has two advantages: firstly, caching the encoded data packet in the storage sub-part reduces the possibility of data packet loss, thereby improving the integrity and accuracy of the encoded data packet; secondly, sending the encoded data packet to the storage part when it is not full not only reduces the possibility of data overflow in the storage part, thus reducing the probability of data packet loss, but also improves the accuracy of subsequent retirement instruction execution, thereby ensuring the orderly retirement of each retirement instruction.
[0076] In some embodiments, the control section 11 includes a shift section for receiving and storing each retirement instruction; the control section 11 is further configured to: for each retirement instruction in the shift section, if the retirement instruction meets the generation conditions, generate an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage section and the retirement instruction.
[0077] Here, the shifting section has shifting and storage functions. In implementation, the shifting section can be any part capable of implementing this function. For example, it can be several shift slots, a queue, a stack, etc. In implementation, those skilled in the art can choose the implementation method of the shifting section according to actual needs, and this disclosure does not limit it. For example, the shifting section consists of several shift slots, and in implementation, at least one received retirement instruction is stored in the target shift slot. In some embodiments, the number of shift slots in the shifting section can be obtained based on preset rules. These preset rules may include, but are not limited to, random, custom, the number of processor cores, the number of processor channels, etc. In implementation, those skilled in the art can set the preset rules according to actual needs, and this disclosure does not limit it. For example, the number of shift slots is N more than the number of core channels, where N is a positive integer. For example, the number of shift slots is 1 more than the number of processor channels. Or, for example, the number of shift slots is 2 more than the number of processor channels.
[0078] In some implementations, when N retirement instructions are received simultaneously, the retirement instructions originally stored in each shift slot are moved forward by N shift slots, so that the last N shift slots are empty, and the N retirement instructions are stored in the N shift slots in sequence, where N is a positive integer.
[0079] In this embodiment, each retirement instruction is received and stored through the shifting section; for each retirement instruction in the shifting section, if the retirement instruction meets the generation conditions, the control section generates an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage section and the retirement instruction. Thus, on the one hand, by caching each retirement instruction through the shifting section, the possibility of retirement instruction loss can be reduced, thereby improving the integrity and accuracy of the retirement instructions; on the other hand, by setting generation conditions to generate the encoded data packet, the accuracy of the encoded data packet can be improved.
[0080] In some embodiments, the shifting portion includes at least one storage location, and the shifting portion is further configured to: receive each retirement instruction; determine a target storage location corresponding to each retirement instruction from each storage location, and store each retirement instruction into the corresponding target storage location.
[0081] Here, each storage location has identification information. This identification information may include, but is not limited to, a number and storage address. In implementation, the identification information for each storage location has sequential information. For example, each storage location may be numbered in descending order. For instance, the shift section includes 6 storage locations, each numbered from 5 to 0. Alternatively, each storage location may be numbered in ascending order. For instance, the shift section includes 4 storage locations, each numbered from 0 to 3.
[0082] The methods for determining the target storage location may include, but are not limited to, the time, order, custom, or random selection of retirement instructions received. In implementation, those skilled in the art can choose the method for determining the target storage location according to actual needs, and this disclosure does not impose limitations. For example, the target storage location for each retirement instruction can be determined based on its reception time. For instance, the latest retirement instruction can be stored in the last storage location. Or, for example, the latest retirement instruction can be stored in the first storage location.
[0083] In this embodiment, each retirement instruction is received; a target storage location corresponding to each retirement instruction is determined from each storage location; and each retirement instruction is stored in the corresponding target storage location. By storing different retirement instructions in different storage locations, the different retirement instructions can be decoupled, allowing for subsequent differentiation of different retirement instructions using different locations, thereby improving the accuracy of instruction execution.
[0084] In some embodiments, the shifting portion is further configured to: sort each retirement instruction according to the reception time of each retirement instruction to obtain a sorting result for each retirement instruction; and determine the target storage location corresponding to each retirement instruction from each storage location based on the sorting result of each retirement instruction.
[0085] Here, the sorting method can include, but is not limited to, from front to back or from back to front. In some implementations, the target storage location corresponding to the earliest retirement instruction can be either the last storage location or the first storage location. In implementation, those skilled in the art can choose the method of target storage location according to actual needs, and this disclosure does not limit this choice. For example, the target storage location corresponding to the most recent retirement instruction can be set as the last storage location.
[0086] In this embodiment, each retirement instruction is sorted according to its reception time to obtain a sorting result. Based on the sorting result, a target storage location corresponding to each retirement instruction is determined from each storage location. Thus, determining the target storage location of each retirement instruction based on its reception time improves the accuracy of the target storage location, thereby enhancing the accuracy of the retirement instructions.
[0087] Figure 1B is a schematic diagram of the composition structure of a control device provided in an embodiment of this disclosure. As shown in Figure 1B, the control device 10 includes a control section 11 and a storage section 12. The control section 11 includes at least a shift section 111 and a storage sub-section 112. The shift section 111 includes four shift slots (corresponding to the aforementioned storage positions), namely, shift slots 0 to 3, for receiving and storing at least one retirement instruction. The storage sub-section 112 is used to buffer at least one coded data packet. In implementation:
[0088] The control section 11 is used to update the shift section 111 when a retirement instruction is detected, freeing up a preset number of shift slots to store the retirement instruction; determine whether the retirement instructions in each shift slot of the shift section 111 meet the generation conditions of the encoded data packet; if the retirement instructions in the shift slots do not meet the generation conditions, no encoded data packet is generated; if the shift slots meet the generation conditions, determine whether the overflow state of the storage section is non-overflow; if the overflow state of the storage section is non-overflow, generate the first encoded data packet corresponding to the retirement instruction using a preset encoding protocol, and cache the first encoded data packet in the storage subsection 112; if the overflow state of the storage section is overflow, generate the first encoded data packet for the retirement instruction in the shift slot with the smallest number that meets the generation conditions. The second encoded data packet corresponding to the retirement instruction is cached in the storage sub-section 112. For retirement instructions in shift slots with other numbers that meet the generation conditions, a first encoded data packet corresponding to the retirement instruction is generated using a preset encoding protocol, and the first encoded data packet is cached in the storage sub-section 112. It is determined whether the storage state of the storage section 12 is not full. If the storage state of the storage section 12 is not full, the encoded data packet in the storage sub-section 112 is sent to the storage section 12. If the storage state of the storage section 12 is full, the storage state of the storage section 12 is obtained in real time until the storage state of the storage section 12 changes to not full, at which point the encoded data packet in the storage sub-section 112 is sent to the storage section 12.
[0089] Storage section 12 is used to receive and store at least one encoded data packet.
[0090] Based on the above embodiments, this disclosure provides a control method, which can be executed by a control device. Figure 2 is a schematic flowchart of the implementation of a control method provided by this disclosure. As shown in Figure 2, the method includes steps S21 to S23, wherein:
[0091] Step S21: The control unit receives and stores at least one retirement instruction.
[0092] Here, the control device includes at least a control section and a storage section. The control section can be any component capable of implementing the control function, such as a processor, controller, or control circuit. The storage section can be any component capable of implementing storage functions, such as a register, memory, stack, or queue.
[0093] Retirement instructions are those that have been successfully executed and completed. These instructions can be any suitable executable instruction, such as load instructions or store instructions.
[0094] Step S22: For each retirement instruction, the control unit generates an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage unit and the retirement instruction, and sends the encoded data packet to the storage unit if the storage state of the storage unit is not full.
[0095] Here, the overflow state of the storage section can include, but is not limited to, overflow, non-overflow, etc. The storage state of the storage section can include, but is not limited to, not full, full, empty, etc. The encoded data packet can be generated in any suitable way. For example, the encoded data packet corresponding to the retirement instruction can be generated using a preset encoding protocol.
[0096] Step S23: The storage part receives and stores at least one of the encoded data packets sent by the control part.
[0097] In this embodiment, the control unit receives and stores at least one retirement instruction. For each retirement instruction, the control unit generates an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage unit and the retirement instruction. If the storage unit is not full, the control unit sends the encoded data packet to the storage unit. The storage unit receives and stores at least one encoded data packet sent by the control unit. Thus, on the one hand, generating the encoded data packet based on the overflow state of the storage unit improves the accuracy of the encoded data packet corresponding to the retirement instruction; on the other hand, storing the encoded data packet only when the storage unit is not full reduces the possibility of data overflow in the storage unit, thereby reducing the probability of data packet loss, and also improves the accuracy of subsequent retirement instruction execution, thus ensuring the orderly retirement of each retirement instruction.
[0098] In some implementations, step S22, "generating an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage portion and the retirement instruction," includes steps S221 and / or S222, wherein:
[0099] Step S221: When the overflow state of the storage part is non-overflow, or the overflow state of the storage part is overflow and the storage location of the retirement instruction meets the preset conditions, generate a first encoded data packet corresponding to the retirement instruction based on the retirement instruction.
[0100] Step S222: If the overflow state of the storage portion is overflow and the storage location of the retirement instruction does not meet the preset conditions, generate a second encoded data packet corresponding to the retirement instruction.
[0101] Here, the type of the second encoded data packet is different from the type of the first encoded data packet. Preset conditions may include, but are not limited to, the storage location identifier being non-minimum, the storage location identifier being non-maximum, or the storage location identifier being a non-specified identifier.
[0102] In some embodiments, the control section includes a storage subsection, and step S22, "based on the overflow state of the storage section and the retirement instruction, generating an encoded data packet corresponding to the retirement instruction, and sending the encoded data packet to the storage section when the storage state of the storage section is not full," includes step S231, wherein:
[0103] Step S231: Update the encoded data packet corresponding to the retirement instruction to the storage sub-part, and if the storage state of the storage sub-part is not full, send the encoded data packet in the storage sub-part to the storage part.
[0104] Here, the encoded data packet can be, but is not limited to, at least one of a first encoded data packet, a second encoded data packet, etc. The storage sub-part can be any part capable of implementing storage functionality, such as a register, memory, stack, queue, etc. The update method can include, but is not limited to, replacement, addition, etc.
[0105] In some embodiments, the control section includes a shifting section, and step S21 includes step S211, wherein:
[0106] Step S211: The shifting portion receives and stores each retirement instruction;
[0107] Here, the shifting section has both shifting and storage functions. In implementation, the shifting section can be any part capable of performing this function. For example, several shift slots, a queue, a stack, etc.
[0108] Correspondingly, step S22, "the control part generates an encoded data packet corresponding to each retirement instruction based on the overflow state of the storage part and the retirement instruction," includes step S241, wherein:
[0109] Step S241: For each retirement instruction in the shift section, if the retirement instruction meets the generation conditions, the control section generates an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage section and the retirement instruction.
[0110] In some embodiments, the shifting portion includes at least one storage location, and step 211 includes steps S251 to S252, wherein:
[0111] Step S251: The shifting portion receives each of the retirement instructions;
[0112] Step S252: The shifting part determines the target storage location corresponding to each retirement instruction from each of the storage locations, and stores each retirement instruction into the corresponding target storage location.
[0113] Here, each storage location has identification information. The methods for determining the target storage location can include, but are not limited to, the time, order, custom, or random selection of retirement instructions received. For example, the target storage location for each retirement instruction can be determined based on its reception time.
[0114] In some embodiments, step S252, "the shift portion determines the target storage location corresponding to each retirement instruction from each of the storage locations," includes steps S2521 to S2522, wherein:
[0115] Step S2521: The shifting part sorts each retirement instruction according to the reception time of each retirement instruction to obtain the sorting result of each retirement instruction;
[0116] Step S2522: The shifting part determines the target storage location corresponding to each retirement instruction from each storage location based on the sorting result of each retirement instruction.
[0117] Here, the sorting method can include, but is not limited to, from front to back, from back to front, etc.
[0118] In some embodiments, the method further includes step S24, wherein:
[0119] Step S24: When the storage state of the storage part is full, the control part obtains the new storage state of the storage part in real time. When the new storage state is not full, the control part sends the encoded data packet to the storage part.
[0120] Here, the new storage state can include, but is not limited to, not full, full, empty, etc.
[0121] In some embodiments, the method further includes steps S25 to S26, wherein:
[0122] Step S25: The storage section detects the overflow status in real time;
[0123] Step S26: When the overflow state is overflow, the storage part sends the overflow state to the control part.
[0124] Here, the storage unit monitors its overflow status in real time and promptly notifies the control unit in the event of an overflow.
[0125] The descriptions of the above method embodiments are similar to those of the above device embodiments, and have similar beneficial effects. For technical details not disclosed in the method embodiments of this disclosure, please refer to the descriptions of the device embodiments of this disclosure for understanding.
[0126] The following describes the application of the control method provided in the embodiments of this disclosure in a real-world scenario, using a processor based on the RISC-CV architecture as an example.
[0127] In related technologies, for 64-bit RISC-V architecture processors, the retirement instructions of the core are multi-channel. The core may retire multiple instructions at the same time in one cycle. If the downstream device cannot receive these encoded data packets in time, it will cause the encoded data packets to accumulate in the TE's FIFO memory, resulting in data overflow in the FIFO memory.
[0128] This disclosure provides a control method in which at least one retirement instruction is received and stored through the control part of the TE. For each retirement instruction, based on the overflow state of the TE's FIFO memory (corresponding to the aforementioned storage part) and the retirement instruction, an encoded data packet corresponding to the retirement instruction is generated, and if the storage state of the FIFO memory is not full, the encoded data packet is stored in the FIFO memory.
[0129] Figure 3A is a schematic diagram of the composition structure of a control device provided in an embodiment of this disclosure. As shown in Figure 3A, the device 30 includes a control section 11 and a FIFO memory 12 (corresponding to the aforementioned storage section). The control section 11 includes a shift section 111 and a register 112 (corresponding to the aforementioned storage sub-section). The shift section 111 includes shift slots 0 to 5, and each shift slot can be used to store retirement instructions. In implementation:
[0130] Control section 11 is used to update the shift slots when a new retirement instruction (e.g., retirement instruction 0 to retirement instruction 3) is detected, so that the last preset number of shift slots are empty to cache the new retirement instruction; for each retirement instruction in shift section 111, it is determined whether the retirement instruction meets the generation conditions of the encoded data packet; if not, no encoded data packet is generated; if it meets the conditions, it is determined whether the overflow state of the FIFO memory is overflow; if not, a corresponding first encoded data packet is generated using a preset encoding protocol and cached in register 112; if overflow occurs, for... For retirement instructions in shift slots with the smallest number that meet the generation conditions, a second encoded data packet (supporting both data packets and synchronization data packets) is generated to indicate the overflow situation, and the second encoded data packet is cached in register 112. For retirement instructions in shift slots with non-smallest numbers that meet the generation conditions, a corresponding first encoded data packet is generated, and the first encoded data packet is cached in register 112. The storage status of FIFO register 12 is obtained in real time. If the storage status of FIFO register 12 is not full, the first encoded data packet stored in register 112 is sent to FIFO memory 12.
[0131] The FIFO memory 12 is used to receive and store the first encoded data packet sent by the control unit 11; to detect the overflow status in real time, and to send the overflow status to the control unit 11 when the overflow status is overflow.
[0132] Figure 3B is a schematic flowchart of a control method provided in an embodiment of this disclosure. As shown in Figure 3B, the method includes steps S311 to S319, wherein:
[0133] Step S311: When a new retirement instruction is detected, update the shift section so that the last preset number of shift slots are empty, which is used to cache the new retirement instruction;
[0134] Step S312: Determine whether the retirement instruction in each shift slot meets the conditions for generating the encoded data packet. If none of them meet the conditions, proceed to step S313; otherwise, proceed to step S314.
[0135] Step S313: No encoded data packet is generated; End.
[0136] Step S314: Determine whether the FIFO memory (corresponding to the aforementioned storage portion) has overflowed. If yes, proceed to step S315; otherwise, proceed to step S316.
[0137] Step S315: For the retirement instruction in the shift slot with the smallest number that meets the generation conditions, generate a second encoded data packet and update the second encoded data packet to the register (corresponding to the aforementioned storage sub-part). For the retirement instruction in the shift slot with other numbers that meet the generation conditions, generate the corresponding first encoded data packet and update the first encoded data packet to the register.
[0138] Step S316: For each retirement instruction that meets the generation conditions, generate the corresponding first encoded data packet and update the first encoded data packet in the register;
[0139] Step S317: Determine whether the FIFO memory is full. If it is, proceed to step S318; otherwise, proceed to step S319.
[0140] Step S318: The encoded data packet is still stored in the register, proceed to step S317;
[0141] Here, the encoded data packet may include, but is not limited to, the first encoded data packet, the second encoded data packet, etc.
[0142] Step S319: Store the encoded data packet in the FIFO memory.
[0143] In some implementations, when performing step S317, if no new encoded data packet is generated, the encoded data packet in the register is stored in the FIFO memory if the FIFO memory is not full, or the encoded data packet is retained in the register if the FIFO memory is full; if a new encoded data packet is generated, the new encoded data packet needs to be updated in the register to replace the old encoded data packet in the register, and the new encoded data packet is stored in the FIFO memory if the FIFO memory is not full, or the new encoded data packet is retained in the register if the FIFO memory is full.
[0144] In this embodiment, firstly, by caching each retirement instruction through a shift function, the possibility of retirement instruction loss can be reduced, thereby improving the integrity and accuracy of retirement instructions. Furthermore, when an overflow state is detected, the control unit is notified in real time, allowing it to generate coded data packets corresponding to different retirement instructions based on the overflow state, thus improving the accuracy of the coded data packets. Secondly, by obtaining the overflow state of the storage unit in real time, the accuracy of the overflow state can be improved. Finally, coded data packets are only stored in the storage unit when the storage unit is not full. This not only reduces the possibility of data overflow in the storage unit, thereby reducing the probability of data packet loss, but also improves the accuracy of subsequent retirement instruction execution, thus ensuring the orderly retirement of each retirement instruction.
[0145] It should be noted that, in the embodiments of this disclosure, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this disclosure, or the parts that contribute to related technologies, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this disclosure are not limited to any specific hardware and software combination.
[0146] This disclosure provides an electronic device including a processor and a memory, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement any of the methods described above.
[0147] This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the methods described above. The computer-readable storage medium may be transient or non-transient.
[0148] This disclosure provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a processor, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied as a computer storage medium; in another optional embodiment, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0149] It should be noted that Figure 4 is a schematic diagram of a hardware entity of an electronic device in an embodiment of this disclosure. As shown in Figure 4, the hardware entity of the electronic device 400 includes: a processor 401, a communication interface 402, and a memory 403, wherein:
[0150] The processor 401 typically controls the overall operation of the electronic device 400.
[0151] Communication interface 402 enables electronic devices to communicate with other terminals or servers via a network.
[0152] The memory 403 is configured to store instructions and applications executable by the processor 401, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 401 and various modules in the electronic device 400. It can be implemented using flash memory or random access memory (RAM). Data transfer between the processor 401, the communication interface 402, and the memory 403 can be performed via bus 404.
[0153] It should be noted that the descriptions of the storage medium and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.
[0154] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this disclosure. Therefore, "in one embodiment" or "one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this disclosure, the sequence numbers of the above-described processes do not imply a sequential 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 disclosure. The sequence numbers of the above-described embodiments are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0155] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0156] In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0157] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0158] In addition, each functional unit in the embodiments of this disclosure can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0159] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0160] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.
[0161] The above description is merely an embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A control device, characterized in that, The device includes an electrically connected control section and a storage section, wherein: the control section is configured to receive and store at least one retirement instruction, the retirement instruction being an instruction that has been normally executed and completed; for each retirement instruction, based on the overflow state of the storage section and the retirement instruction, generate an encoded data packet corresponding to the retirement instruction, and send the encoded data packet to the storage section when the storage state of the storage section is not full; the storage section is configured to receive and store at least one encoded data packet sent by the control section; the control section is further configured to, when the overflow state of the storage section is overflowing and the storage location of the retirement instruction meets a preset condition, generate a first encoded data packet corresponding to the retirement instruction based on the retirement instruction; when the overflow state of the storage section is overflowing and the storage location of the retirement instruction does not meet the preset condition, generate a second encoded data packet corresponding to the retirement instruction, the type of the second encoded data packet being different from the type of the first encoded data packet.
2. The apparatus according to claim 1, characterized in that, The control unit is further configured to: when the overflow state of the storage unit is non-overflow, generate a first encoded data packet corresponding to the retirement instruction based on the retirement instruction.
3. The apparatus according to claim 1, characterized in that, The control section includes a storage subsection; the control section is further configured to: update the encoded data packet corresponding to each retirement instruction to the storage subsection, and send the encoded data packet in the storage subsection to the storage section when the storage state of the storage section is not full.
4. The apparatus according to claim 1, characterized in that, The control section includes a shift section; the shift section is used to receive and store each retirement instruction; the control section is also used to: for each retirement instruction in the shift section, if the retirement instruction meets the generation conditions, generate an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage section and the retirement instruction.
5. The apparatus according to claim 4, characterized in that, The shifting section includes at least one storage location; the shifting section is further configured to: receive each retirement instruction; determine the target storage location corresponding to each retirement instruction from each storage location, and store each retirement instruction into the corresponding target storage location.
6. The apparatus according to claim 5, characterized in that, The shifting portion is further configured to: sort each retirement instruction according to the reception time of each retirement instruction to obtain a sorting result for each retirement instruction; and determine the target storage location corresponding to each retirement instruction from each storage location based on the sorting result of each retirement instruction.
7. The apparatus according to claim 1, characterized in that, The control unit is further configured to: when the storage state of the storage unit is full, acquire the new storage state of the storage unit in real time, and when the new storage state is not full, send the encoded data packet to the storage unit.
8. The apparatus according to any one of claims 1 to 7, characterized in that, The storage section is further configured to: detect the overflow state in real time; and, if the overflow state is an overflow, send the overflow state to the control section.
9. A control method, characterized in that, In the apparatus of any one of claims 1 to 8, the method comprises: the control portion receiving and storing at least one retirement instruction; for each retirement instruction, the control portion generating an encoded data packet corresponding to the retirement instruction based on the overflow state of the storage portion and the retirement instruction, and sending the encoded data packet to the storage portion if the storage state of the storage portion is not full; the storage portion receiving and storing at least one encoded data packet sent by the control portion.
10. An electronic device, characterized in that, The apparatus comprising any one of claims 1 to 8.
Citation Information
Patent Citations
FIFO device and method thereof
CN103677732A
Systems, methods, and apparatuses for improving performance of status dependent computations
CN106293628A