Bit-width conversion device, method, chip and storage medium
By using the adjustment unit and conversion unit of the bit-width conversion device, the problems of atomicity failure and data parsing errors caused by atomic operation packet splitting during bus bit-width switching are solved, ensuring the integrity of atomic operations and data security, and realizing normal business logic execution.
Patent Information
- Application Number
- CN202611266561.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-17
AI Technical Summary
In on-chip systems, when the bus width is switched, the splitting of atomic operation packets can lead to atomicity failure and data parsing errors, causing abnormalities in the system's business logic.
A bit-width conversion device is provided, including an adjustment unit, a conversion unit, and an output unit. The adjustment unit concentrates the valid elements into the target field, the conversion unit performs bit-width conversion, and the output unit outputs the target sequence, ensuring that the atomic operation is executed only once and is indivisible.
During the hardware bit width adaptation process, the constraint that atomic operations are single, indivisible, and uninterruptible is preserved, avoiding atomicity failures and data mask errors, and ensuring data security and the normal execution of business logic.
Smart Images

Figure CN123115044A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip technology, and in particular to a bit-width conversion device, method, chip, and storage medium. Background Technology
[0002] In the system-on-a-chip, each hardware component transmits atomic operation packets via a bus. During transmission, the atomic operation packets undergo bit-width conversion to adapt to the bit-width requirements of different hardware components.
[0003] Currently, when the bus width is switched from wide to narrow, the original sequence in the atomic operation packet will be evenly split into multiple independent sequences adapted to the narrow width and transmitted in multiple transmissions.
[0004] However, this violates the single-execution constraint of atomic operations, which can lead to subsequent data parsing errors and cause abnormal execution of business logic within the system. Summary of the Invention
[0005] This application provides a bit-width conversion device, method, chip, and storage medium that retains the constraints of uninterrupted atomic operations and single-execution, ensuring data security and the normal execution of business logic. The technical solution is as follows: On the one hand, a bit-width conversion device is provided, the device including an adjustment unit, a conversion unit and an output unit, the adjustment unit being connected to the conversion unit, and the conversion unit being connected to the output unit; The adjustment unit is used to swap the positions of valid elements distributed in multiple fields in the original sequence with invalid elements in the target field to obtain an intermediate sequence. The original sequence is the data participating in the atomic operation. The valid elements in the intermediate sequence are all distributed in the target field. The intermediate sequence is sent to the conversion unit. The conversion unit is used to convert the intermediate sequence into at least one target sequence with a preset bit width, the preset bit width being smaller than the bit width of the intermediate sequence, and to send at least one target sequence to the output unit; The output unit is used to output a first sequence from the at least one target sequence, the first sequence including the target field.
[0006] In some embodiments, the adjustment unit is used for: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; Obtain the operation type of the atomic operation from the data packet, wherein the operation type is a single-operand type or a double-operand type; The target field is determined based on the operation type of the atomic operation.
[0007] In some embodiments, the adjustment unit is used for: When the operation type is a single operand type, the first preset field is determined as the target field; When the operation type is a two-operand type, the second preset field is determined as the target field; Wherein, the length of the first preset field is not greater than the length of the second preset field.
[0008] In some embodiments, the adjustment unit is further connected to the output unit; the adjustment unit is further configured to: Based on the operation type, the distribution of valid elements in the intermediate sequence is verified to obtain the verification result; If the verification result indicates that all valid elements are within the target bit range corresponding to the operation type, an output signal is generated and sent to the output unit; The output unit is also used for: Based on the output signal, the first sequence is output.
[0009] In some embodiments, the adjustment unit is further connected to the output unit; the adjustment unit is further configured to: Obtain the original mask corresponding to the original sequence from the data packet; the original mask is used to indicate the distribution of valid elements in the original sequence. Based on the mapping relationship corresponding to the operation type and the intermediate sequence, the original mask is remapped to obtain an intermediate mask. The intermediate mask is used to indicate the distribution of valid elements in the intermediate sequence. The intermediate mask is then sent to the output unit. The output unit is also used for: Output the portion of the intermediate mask that corresponds to the first sequence.
[0010] In some embodiments, the adjustment unit is further configured to: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; The original control information is obtained from the data packet, the original control information is used to control the transmission of the data packet, and the original control information is sent to the conversion unit; The conversion unit is also used for: Based on the original control information, target control information corresponding to each target sequence is generated. Each target control information is used to control the transmission of the corresponding target sequence, and the target control information is sent to the output unit.
[0011] In some embodiments, the output unit is used for: Detect whether the target control information corresponding to the first sequence and the first sequence have been output, and obtain the detection result; If the detection result indicates that the target control information corresponding to the first sequence and the first sequence have been output, then target sequences other than the first sequence are filtered out.
[0012] On the other hand, a bit-width conversion method is provided, applied to a bit-width conversion device, the method comprising: The valid elements distributed across multiple fields in the original sequence are swapped with the invalid elements in the target field to obtain an intermediate sequence. The original sequence is the data participating in the atomic operation, and the valid elements in the intermediate sequence are all distributed in the target field. The intermediate sequence is converted into a target sequence with at least one preset bit width, wherein the preset bit width is smaller than the bit width of the intermediate sequence; Output the first sequence of the at least one target sequence, the first sequence including the target field.
[0013] In some embodiments, the method further includes: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; Obtain the operation type of the atomic operation from the data packet, wherein the operation type is a single-operand type or a double-operand type; The target field is determined based on the operation type of the atomic operation.
[0014] In some embodiments, determining the target field based on the operation type of the atomic operation includes: When the operation type is a single operand type, the first preset field is determined as the target field; When the operation type is a two-operand type, the second preset field is determined as the target field; Wherein, the length of the first preset field is not greater than the length of the second preset field.
[0015] In some embodiments, the method further includes: Based on the operation type, the distribution of valid elements in the intermediate sequence is verified to obtain the verification result; If the verification result indicates that all valid elements are within the target bit range corresponding to the operation type, an output signal is generated; The step of outputting the first sequence in the at least one target sequence includes: Based on the output signal, the first sequence is output.
[0016] In some embodiments, the method further includes: Obtain the original mask corresponding to the original sequence from the data packet; the original mask is used to indicate the distribution of valid elements in the original sequence. Based on the mapping relationship corresponding to the operation type and the intermediate sequence, the original mask is remapped to obtain an intermediate mask, which is used to indicate the distribution of valid elements in the intermediate sequence; Output the portion of the intermediate mask that corresponds to the first sequence.
[0017] In some embodiments, the method further includes: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; Obtain raw control information from the data packet, the raw control information being used to control the transmission of the data packet; Based on the original control information, target control information corresponding to each target sequence is generated, and each target control information is used to control the transmission of the corresponding target sequence.
[0018] In some embodiments, outputting the first sequence in the at least one target sequence includes: Detect whether the target control information corresponding to the first sequence and the first sequence have been output, and obtain the detection result; If the detection result indicates that the target control information corresponding to the first sequence and the first sequence have been output, then target sequences other than the first sequence are filtered out.
[0019] On the other hand, a chip is provided that includes the bit-width conversion device in the above embodiments. When the chip is running on an electronic device, it is used to implement the bit-width conversion method in the above embodiments.
[0020] On the other hand, an electronic device is provided, which includes a processor and a memory. The processor includes a chip configured with the bit-width conversion device in the above embodiments, and the memory stores a computer program that is loaded and executed by the processor to implement the bit-width conversion method in the above embodiments.
[0021] On the other hand, a computer-readable storage medium is provided for storing at least one computer program for performing the bit-width conversion method in the above embodiments.
[0022] On the other hand, a computer program product is provided, including a computer program that is executed by a processor to implement the bit-width conversion method in the above embodiments.
[0023] This application provides a bit-width conversion device. Through the cooperation of an adjustment unit, a conversion unit, and an output unit, the original sequence corresponding to an atomic operation is regularized in terms of field positions. This concentrates the scattered valid elements into the target field to form an intermediate sequence. After being split into multiple target sequences through bit-width conversion, the first sequence including the target field is output. This avoids the problem of traditional bit-width conversion splitting complete atomic transactions. Therefore, during hardware bit-width adaptation, the constraints of atomic operations—single transmission, indivisibility, and uninterruptibility—are preserved. This avoids atomicity failures, data mask errors, and business parsing anomalies caused by bit-width conversion, ensuring data security and the normal execution of business logic. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of a conventional data transmission architecture provided according to an embodiment of this application; Figure 2 This is a schematic diagram of a conventional interface signal phase waveform provided according to an embodiment of this application; Figure 3 This is a schematic diagram illustrating a mapping relationship of a conventional mask signal according to an embodiment of this application; Figure 4 This is a schematic diagram of a bit-width conversion device according to an embodiment of this application; Figure 5 This is a schematic diagram of another bit-width conversion device provided according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating an operation type classification according to an embodiment of this application; Figure 7 This is a schematic diagram of a mapping subunit provided according to an embodiment of this application; Figure 8 This is a schematic diagram of an AXI handshake timing logic provided according to an embodiment of this application; Figure 9 This is a schematic diagram of an output unit provided according to an embodiment of this application; Figure 10 This is a flowchart of a bit-width conversion method provided according to an embodiment of this application; Figure 11 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0026] In this application, the terms "first", "second", "third" and other similar terms are used to distinguish between identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity or execution order.
[0027] In this application, the term "at least one" means one or more, and "multiple" means two or more.
[0028] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0029] The following is an introduction to the technical terms used in this application.
[0030] DMA (Direct Memory Access): A hardware data transfer mechanism that allows peripherals to directly read and write data to memory without the full involvement of the CPU.
[0031] AXI (Advanced Xtensible Interface): A core protocol for on-chip bus standards used in high-performance SoC chips. It employs separate read / write channels, pipelined transmission, and supports out-of-order transfers and multiple outstanding transactions, making it widely used for high-speed module interconnects.
[0032] SDP (Spilt Command / Response Data Transaction Protocol): A split bus transaction protocol that separates command issuance, response return, and data transmission into independent transmissions; the hardware integrates 8 physical transmission channels, supports multi-channel concurrent data interaction, and improves bus throughput.
[0033] DF (Scalable Data Fabric): An on-chip scalable high-speed data interconnect architecture that replaces the traditional single bus. It supports flexible interconnection of multiple nodes and modules, and can expand bandwidth and ports as needed. It is the core architecture for internal data communication in high-performance SoCs, AI chips, etc.
[0034] NIC400 (Bus Matrix IP Core): It has two core functions: first, arbitration interconnection between multiple master and slave devices; second, data bit width conversion between buses with different bit widths.
[0035] PCIe (Peripheral Component Interconnect Express) is a high-speed serial computer expansion bus standard. It uses a differential serial link, offering high bandwidth, low latency, and strong scalability. The PCIe controller on the chip side is used to connect various high-speed peripherals and is the core of the chip's high-speed external interface.
[0036] The system management center module inside the SYSTEM HUB SoC is used to collect and summarize various hardware requests initiated by all downstream System Hub Clients, schedule and distribute them for processing, centrally manage underlying system affairs, and simplify the interaction logic between multiple modules.
[0037] NBIF (New PCIE Bus Interface): A new type of on-chip bus interface IP designed for the PCIE protocol. It serves as a bridge between the PCIE controller and internal buses such as AXI / DF, and completes the conversion between external PCIE protocols and internal bus protocols, as well as the packet splitting and reassembly.
[0038] IO HUB (IO Hub / Input / Output Hub): A management module for chip IO peripherals, which unifies the arbitration of IO access requests, manages IO clock, power, and interrupts, and centrally manages all external input and output devices.
[0039] Ringbuf (Ring Buffer): A circularly reused memory data caching structure consisting of a contiguous block of memory, read pointers, and write pointers. Data is written to the end and read from the beginning, reusing space cyclically without frequent memory allocation and deallocation.
[0040] UMD (User Mode Driver): A hardware driver that runs in the user space of the operating system. It does not directly access low-level hardware registers or manipulate kernel resources, offering high security due to permission isolation. It is typically used in conjunction with kernel drivers and is responsible for upper-layer business logic, data encapsulation, and application interaction. It cannot directly handle hardware interrupts.
[0041] KMD (Kernel Mode Driver): A low-level hardware driver that runs in the operating system kernel mode. It has the highest hardware access privileges and can directly read and write hardware registers, handle hardware interrupts, operate physical memory, and manage hardware resources such as DMA / PCIe. It is the underlying core for interaction between the operating system and hardware, providing hardware operation interfaces for the upper-level UMD.
[0042] In an on-chip system, various hardware components transmit atomic operation packets (i.e., atomic operation requests and atomic write requests) via a bus. During transmission, the atomic operation packets undergo bit-width conversion to adapt to the bit-width requirements of different hardware. For a clearer description of this process, see [link to documentation]. Figure 1 As shown, Figure 1 This diagram illustrates a conventional data transmission architecture according to an embodiment of this application. Essentially, it shows the bidirectional data path between peripherals, memory, and DMA in an x86 SoC system, primarily including three core data links: PCIe device-to-memory data transfer and DMA-active memory read / write.
[0043] The entire architecture uses the DF data exchange network of the SDP protocol as the main on-chip data transmission channel. The external PCIEBUS on the right connects to the DF through the NBIF protocol conversion module and the IOHUB relay hub. The DF connects to the MEMORYCTRL memory controller and the Framebuffer frame buffer via the Sdp2axi protocol bridge to complete data reading and writing between peripherals and memory. The DMA module on the left serves as the core of high-speed data transfer. It integrates DMACORE and NIC400 bit-width conversion IP. After connecting to the MMHUB memory hub through the AXI4 bus, it connects to the DF to realize autonomous memory reading and writing. All system control and configuration commands are uniformly scheduled and distributed by SYSTEMHUB.
[0044] In simple terms, the entire architecture uses two on-chip transmission protocols, AXI4 and SDP, to carry data transmission and system control services. Relying on NIC400, various hubs, and protocol bridges, it enables data forwarding, protocol conversion, and request arbitration between modules with different bit widths, protocols, and functions, ensuring the efficiency and stability of system data transmission.
[0045] DMA uses command packets to facilitate data exchange between memory and other on-chip IPs. The atomic operation packet, a dedicated data transfer packet, possesses the atomic characteristics of being uninterruptible, indivisible, and executed in a single, complete operation, making it crucial for ensuring data operation consistency. This atomic operation packet primarily originates from two scenarios: first, atomic operation requests issued by other functional IPs within the SoC; and second, atomic operation requests from the upper-layer user-mode driver (UMD) to write to the ring buffer.
[0046] For example, combining Figure 1From the perspective of the hardware architecture, various peripherals connected to the external PCIEBUS will continuously generate various types of atomic operation requests. The atomic request messages transmitted on the PCIE side will be forwarded step by step through the NBIF protocol conversion interface, IOHUB hub, and DF scalable data exchange network, and finally delivered to the DMA module to complete the parsing, calculation and processing of atomic operations. After the DMA processing is completed, the final data is written to memory through the AXI4 bus and MMHUB to complete the closed loop of the entire atomic operation data flow.
[0047] More specifically, after receiving an atomic packet, the DMA distinguishes between single-operand and double-operand atomic operation types, and parses the corresponding valid parameters and transmission rules according to the operation type. When the DMA pushes the parsed atomic operation request to the AXI bus for transmission, it automatically generates and fills in the complete channel timing information of the AXI bus: not only adapting the mask information required for regular non-atomic transmission, but also configuring key parameters such as the AWUSER user attribute and AWLEN transmission length for the AW address channel, and completing core information such as the WLAST transmission end marker and WSTRB data valid bit mask for the W data channel. By fully constructing compliant transaction information for the AXI read / write channel, atomic operation transactions can be transmitted completely and in a standardized manner through the on-chip bus.
[0048] Because SoC architectures need to adapt to different performance, bandwidth, and power consumption requirements, the AXI bus width between the DMA and MMHUB is flexibly configurable, making bus width mismatch a common problem. To solve this, a NIC400 bus IP is typically integrated within the DMA to handle data splicing, splitting, and width adaptation between upstream and downstream buses, ensuring normal communication between modules with different widths. However, the NIC400 only provides pure data path conversion and bus arbitration functions; it cannot identify, parse, or intervene in the DMA's atomic operations, only performing transparent transmission of atomic data packets. This characteristic leads to the following two types of problems in the current architecture during atomic operation transmission.
[0049] Question 1: NIC400 bit-width conversion destroys the atomicity of DMA atomic operations.
[0050] The core constraint of DMA's atomic operations is that a single write request must be sent completely in one go, without any splitting. However, in bus width adaptation scenarios, transmission splitting issues arise when converting from a wide to a narrow bus width. For example, when a DMA's original 512-bit wide atomic write request is converted to a 256-bit narrow bus width by the NIC400, the NIC400 will evenly split the originally single, complete atomic write request into two independent transmission transactions for separate sending. This splitting behavior violates the core constraint of atomic operations—"single execution, uninterruptible"—causing the atomic operation semantics to fail.
[0051] For a clear comparison of the bus timing differences between the two transmission states during bit width conversion, please refer to [link / reference]. Figure 2 As shown, Figure 2 This is a schematic diagram of a conventional interface signal phase waveform according to an embodiment of this application. The horizontal axis of the waveform represents the synchronous clock clk, and the vertical axis represents the key control signals for the AXI address and data channels, including signals such as awuser, awvalid, awready, awlength, wvalid, wready, wlast, awready_pluse, and wready_pluse. Figure 2 Figure (a) shows the timing waveform after the NIC400 bit width conversion, which destroys atomicity: In this scenario, awlength is configured as 1, representing a single atomic operation. However, due to the bit width splitting, the wready_pluse handshake pulse corresponding to the same atomic operation is split into two independent timing segments. The wlast signal is pulled high twice. The original single and complete atomic write transaction is split into multiple transmission segments, which violates the requirement that atomic operations cannot be split. Figure 2 Figure (b) shows a standard timing waveform without bit-width splitting and with intact atomicity: In this scenario, awlength is configured to 0, a complete atomic operation generates only one set of continuous handshake timings, the wready_pluse handshake pulse is triggered completely in one go, the wlast signal is pulled high only once, a whole atomic write request is completed within a single transmission cycle, there is no transaction splitting, it is a standard waveform that conforms to the atomic operation specification, and can be used as a reference standard for correct transmission.
[0052] Question 2: The mapping difference between AXI and SDP protocols causes abnormal matching of WDATA data signals and WSTRB mask signals in atomic operations.
[0053] DMA atomic operation requests can originate from user drivers or PCIe peripherals. PCIe-side transfers are based on the SDP protocol, while DMA-memory interaction is based on the AXI protocol. These two protocols have fundamentally different definitions and mapping rules for WDATA and WSTRB in atomic operations. During NIC400 bit-width conversion, they cannot automatically adapt, easily leading to data parsing errors. Specifically, in the AXI protocol, regardless of whether it's a single-operand or double-operand atomic operation, the positions of WSTRB and WDATA correspond one-to-one, and the mapping rules are regular and uniform. However, under the SDP protocol, there is no fixed one-to-one correspondence between WSTRB and WDATA, and various special mapping conditions exist (cond1, cond2).
[0054] To visually demonstrate the differences in the mapping of the two protocol masks and data bits, see [link / reference]. Figure 3 As shown, Figure 3 This is a schematic diagram illustrating the mapping relationship of a conventional mask signal according to an embodiment of this application. In the table, the horizontal axis represents the data bit numbers, and the gray-filled area represents the valid element bits of the atomic operation and their corresponding mask bits. Figure 3 Figure (a) shows the WDATA and WSRRB mapping relationship of the AXI protocol, SDP protocol cond1, and SDP protocol cond2 in the atomic double operand scenario: As can be seen from the figure, the valid element bits and mask bits of the AXI protocol match one by one; however, in the two cond1 and cond2 conditions of the SDP protocol, the position of the mask F and the position of the valid element 1 are misaligned, and the mask and data bits cannot correspond one by one. Figure 3 Figure (b) illustrates the WDATA and WSRRB mapping relationships among the AXI, SDP cond1, and SDP cond2 protocols in an atomic single-operand scenario. In this scenario, protocol differences are also evident. The mask and data bit positions of the AXI protocol are perfectly aligned, while the mask positions and valid element distributions of the two SDP protocol scenarios show a significant offset from the AXI protocol, indicating that their mapping logic is incompatible. When the atomic operation message undergoes bit-width conversion via the NIC400, the module cannot recognize and convert the mask-data mapping relationships of the two protocols, causing WDATA and WSTRB mismatch. Ultimately, errors occur when the system parses the atomic operation data, leading to business logic anomalies.
[0055] Based on this, this application proposes a bit-width conversion device that retains the constraints of non-interruptible and single-execution atomic operations, ensuring data security and the normal execution of business logic. The structure of the bit-width conversion device is described below; see [link to relevant documentation]. Figure 4 As shown, Figure 4 This is a schematic diagram of a bit-width conversion device according to an embodiment of this application. It is easy to see that this bit-width conversion device is used to replace the aforementioned... Figure 1The NIC400 bit-width conversion module is described. This bit-width conversion device includes an adjustment unit, a conversion unit, and an output unit. The adjustment unit is connected to the conversion unit, and the conversion unit is also connected to the output unit.
[0056] The adjustment unit swaps the positions of valid elements distributed across multiple fields in the original sequence with invalid elements in the target field to obtain an intermediate sequence, which is then sent to the conversion unit. The original sequence contains the data participating in the atomic operations, while the valid elements in the intermediate sequence are all distributed within the target field. In other words, the adjustment unit concentrates all valid elements from the original sequence into the target field, achieving centralized and regularized processing of valid elements for atomic operations. This avoids the problem of scattered valid elements and data incompleteness after splitting in traditional bit-width conversions, and provides a foundation and data support for subsequent output of sequence slices containing only the target field.
[0057] The conversion unit converts the intermediate sequence into at least one target sequence with a preset bit width, where the preset bit width is smaller than the bit width of the intermediate sequence, and sends at least one target sequence to the output unit. The conversion unit performs high-to-low bit-width adaptation, splitting the complete high-bit-width intermediate sequence into multiple sequence slices adapted to the low-bit-width transmission specifications of the system. The bit width of the target sequence is the preset bit width, and the bit width of the target field is no greater than the preset bit width.
[0058] The intermediate sequence can be split to obtain one or more target sequences, and this application embodiment does not limit this. For example, the splitting can be stopped after splitting out a target sequence that includes the target field from the intermediate sequence. For example, a 256-bit target sequence containing the target field can be split out from a 512-bit intermediate sequence. There is no restriction on the start and end positions of the target sequence, and there is no need to pay attention to or transmit the remaining invalid sequence. Alternatively, the intermediate sequence can be evenly split into multiple target sequences according to the hardware transmission rules, and one of the target sequences includes the target field. For example, the 512-bit intermediate sequence can be evenly split into two 256-bit target sequences, and one of the target sequences includes the target field.
[0059] The output unit is used to output at least one first sequence from the target sequence, the first sequence including the target field. In this way, while completing bus width adaptation and meeting the hardware's low-width transmission requirements, this device selectively outputs only the first sequence carrying complete and valid elements, filtering out redundant split sequences that do not contain valid elements. This avoids the defect of traditional NIC400 bit-width conversion that forcibly splits a single atomic request into multiple transmissions. Therefore, during the hardware bit-width adaptation process, the constraints of atomic operations—single transmission, indivisibility, and uninterruptionability—are preserved, avoiding problems such as atomicity failure, data mask corruption, and service parsing anomalies caused by bit-width conversion.
[0060] The adjustment unit, conversion unit, and output unit in the device will be further described below through sections 1.1 to 1.3.
[0061] 1.1 Adjustment Unit For example, the adjustment unit includes an identification subunit, a mapping subunit, and a cache subunit. The identification unit is connected to both the mapping subunit and the cache subunit, and the mapping subunit is connected to the cache subunit. In addition, the identification subunit and the mapping subunit are also connected to the output unit, and the cache subunit is also connected to the transformation unit. For clarity on this relationship, see [link to documentation]. Figure 5 As shown, Figure 5 This is a schematic diagram of another bit-width conversion device provided according to an embodiment of this application. It should be noted that the internal structure of the adjustment unit is only illustrative and does not constitute a limitation. Even if other division methods are used inside the adjustment unit, the processing performed by the following sub-units can still be completed.
[0062] The following sections (1)-(3) describe the processes performed by the identification subunit, the mapping subunit, and the cache subunit, respectively.
[0063] (1) Identify sub-units (also known as atomic_capture) The identification subunit is used to receive data packets for atomic operations. These data packets indicate the execution of atomic operations on the original sequence and are also known as atomic operation packets / atomic operation requests / atomic write requests. They can exist in the form of DMA command packets.
[0064] The identification subunit is used to obtain the operation type of the atomic operation from the received data packet and send the operation type of the atomic operation to the mapping subunit. The operation type is either a single-operand type or a double-operand type. For example, the identification subunit parses the atomic flag bit in the data packet that represents the atomic instruction to distinguish the operation type of the atomic operation.
[0065] For example, the AXI address channel user-defined signal AWUSER has a [30:24] bit segment specifically storing opcode (atomic operation code). The opcode can distinguish 26 different atomic instructions. The identification sub-unit can classify various atomic instructions into single-operand type and double-operand type according to the optype (atomic operation type identifier) corresponding to the opcode.
[0066] To clearly distinguish between the two types of operations, please refer to [link / reference]. Figure 6 As shown, Figure 6 This is a schematic diagram illustrating an operation type classification according to an embodiment of this application. All atomic operations corresponding to a 32-bit width are classified as single-operand types, and atomic operations corresponding to a 64-bit width are classified as double-operand types.
[0067] The identification subunit is used to obtain the original mask corresponding to the original sequence from the received data packet and send the original mask to the mapping subunit. The original mask is used to indicate the distribution of valid elements in the original sequence. For example, if the original sequence is wdata (write data, atomic operation data), the original mask is wstrb (write byte mask, marking valid elements inside wdata). The SDP protocol side names this mask WSRRB.
[0068] The identification subunit is used to obtain the original control information from the received data packet and send the original control information to the conversion unit (implemented through the buffer subunit). The original control information is used to control the transmission of data packets, such as controlling the transmission timing and rules on the bus.
[0069] For example, the original control information consists of AXI bus transmission-related signals, including but not limited to: awaddr (write address), awlen (AXI burst transmission length), awsize (single transmission data bit width), awvalid (address valid signal, pulled high when the master initiates address transmission), awready (slave address ready signal, slave completes address handshake acknowledgment), awready_pluse (address handshake success pulse), wdata (bus payload data), wstrb (write byte mask), wvalid (data valid signal, pulled high when the master sends data), wready (slave data ready signal, slave completes data handshake acknowledgment), wready_pluse (data handshake success pulse), wlast (last data flag of W channel), and other transmission control signals.
[0070] (2) Mapping subunit (also known as atomic_mask_remapping) The mapping subunit is used to determine the target field based on the operation type of the atomic operation. For example, the mapping subunit is used to determine a first preset field as the target field when the operation type is a single operand type, and to determine a second preset field as the target field when the operation type is a double operand type.
[0071] The length of the first preset field is no greater than the length of the second preset field. Since the number of valid elements corresponding to a single-operand atomic operation is typically less than the number of valid elements corresponding to a two-operand atomic operation, the single-operand type requires a smaller bit width when aggregating valid elements. In actual hardware configurations, the lengths of the two preset fields can be set to be the same for convenience, or the length of the first preset field can be set to be less than the length of the second preset field according to actual needs; this embodiment does not impose any restrictions on this.
[0072] For example, if the original sequence has a bit width of 512 bits, and the intermediate sequence also has a bit width of 512 bits, the first preset field can be set to the lower 128 bits, and the second preset field can be set to the lower 256 bits. Alternatively, both the first and second preset fields can be set to the lower 256 bits, allowing for flexible configuration to adapt to different hardware transmission scenarios. It should be noted that this explanation uses the lower bit range as an example, but this is not a limitation; higher bit ranges, intermediate bit ranges, etc., can also be configured as needed, meaning there are no restrictions on the start and end bits of the preset fields.
[0073] By identifying the operation type of atomic operations, the corresponding preset fields can be dynamically matched to accurately adapt to two types of atomic business scenarios and the data characteristics of two types of atomic operations. This enables differentiated sequence adjustment processing, improves the device's compatibility and adaptability to different atomic requests, and further enhances the accuracy and processing efficiency of the original sequence adjustment.
[0074] The mapping subunit is used to swap the byte positions of valid elements scattered across multiple fields in the original sequence with invalid elements in the target field based on the operation type of the current atomic operation. This results in an intermediate sequence where all valid elements are gathered in the target field, and the intermediate sequence is sent to the conversion unit for subsequent bit-width conversion processing.
[0075] Specifically, the mapping sub-unit can adjust the wdata bus data by performing a BYTE SWAP byte swap, taking into account the actual distribution characteristics of the atomic valid elements on the AXI interface side, which are located in the high or low bits. Through this byte position rearrangement, the originally scattered and messy valid elements can be uniformly gathered into the target field, providing reliable data preprocessing support for subsequent output units to filter out redundant atomic handshake transactions caused by bit width conversion and ensure the uniqueness of atomic operations.
[0076] The mapping subunit is used to remap the original mask based on the mapping relationship corresponding to the operation type of the current atomic operation and the intermediate sequence, to obtain an intermediate mask. The intermediate mask is then sent to the conversion unit or output unit to complete the corresponding splitting of the intermediate mask. This intermediate mask is used to indicate the distribution of valid elements in the intermediate sequence. The mapping relationship is as described above. Figure 3 The mapping relationship between SDP and AXI atomic operations is shown.
[0077] In the DMA path, atomic operation requests originate from the PCIe peripheral side. The original sequence and original mask follow the SDP protocol layout rules, but backend memory interaction and bus transmission follow the AXI protocol. There is a misalignment between the two protocols for the effective byte correspondence of wdata and wstrb.
[0078] This mapping subunit, through the mapping relationship corresponding to each operation type, takes the intermediate sequence of valid elements concentrated in the target field as the benchmark, rematches the mask bits corresponding to each segment of valid elements, completes the automatic conversion from SDP protocol mask arrangement logic to AXI protocol standard mask arrangement logic, and generates standard mask information after conversion by the sdp2axi protocol, which is the intermediate mask.
[0079] This mask remapping process enables the pre-defined rules for the correspondence between data and masks, avoiding problems such as data and mask misalignment, hardware parsing atomic instruction identification errors, and abnormal business logic operation caused by the incompatibility of front-end and back-end protocols during the traditional NIC400 bit-width conversion process. It ensures that the sequence of atomic operations and the mask are synchronously adapted to the AXI bus transmission standard.
[0080] For a clearer description of the processing performed by the mapping subunit, see [link to documentation]. Figure 7 As shown, Figure 7 This is a schematic diagram of a mapping subunit provided according to an embodiment of this application. The atomic operation type selection logic block (first logic block) receives the operation type from the identification subunit, determines the target field, and passes it to two other logic blocks; the byte exchange logic block (second logic block) performs sequence adjustment to obtain an intermediate sequence; and the mask mapping logic block (third logic block) performs mask adjustment to obtain an intermediate mask. Detailed implementation processes are described above and will not be repeated here. Exemplarily, the first logic block is connected to the identification subunit, the second logic block, and the third logic block, respectively. The second logic block is also connected to the identification unit and the conversion unit (implemented through a cache subunit), and the third logic block is also connected to the identification subunit and the output unit.
[0081] (3) Buffer subunit (also known as atomic_if_buffer) The caching subunit is used to receive and store various types of data parsed from the data packets of atomic operations, such as the original sequence, original mask, and original control information. The caching subunit can also be used to store intermediate data such as the operation type output by the identification subunit and the intermediate sequence and intermediate mask processed by the mapping subunit. This application does not limit the data types stored in the cache. By caching the aforementioned atomic operation-related data, data decoupling between processing units can be achieved. When downstream units need corresponding data, the caching subunit can stably and promptly complete the data delivery, avoiding data loss and timing errors that occur during parallel processing of multiple modules.
[0082] The buffer subunit is used to verify the distribution of valid elements in the intermediate sequence based on the operation type, and obtain the verification result. If the verification result indicates that all valid elements are within the target bit range corresponding to the operation type, an output signal is generated and sent to the output unit. This output signal is used to instruct the output unit to filter and output the target sequence including the target field. It can also be used to control the output unit to filter out redundant split sequences that do not contain valid elements, thus avoiding unnecessary atomic handshake transactions from the transmission source.
[0083] By verifying whether all valid elements of the intermediate sequence fall within the corresponding target field, abnormal data can be prevented from entering the bit-width conversion link. This avoids data error output from the preprocessing stage and ensures that the output atomic sequence meets the specification requirements of the corresponding operation type.
[0084] For example, to identify atomic operations and adapt to the complete AXI handshake interaction rules, the caching subunit caches key transmission control signals of the AXI interface and generates temporary interval signals temp1, temp2, temp3, temp4, and temp5, as well as flag and flag1 flag signals based on the registered channel signals, thereby accurately dividing the transmission interval of atomic operations. Specifically, temp1, temp2, and temp3 signals are used to divide the transmission interval corresponding to two-operand type atomic operations, while temp2, temp4, and temp5 signals are used to divide the transmission interval corresponding to single-operand type atomic operations. The caching subunit then combines the aforementioned temporary interval signals to generate the flag and flag1 flag signals, thereby distinguishing between atomic operation requests and ordinary non-atomic operation requests transmitted on the bus.
[0085] The buffer subunit integrates and encapsulates the batch of temporary interval signals and flag signals into the aforementioned output signal, which is then sent to the subsequent output unit and AXI interface (which can be forwarded through the connected conversion unit) as the timing control basis for atomic data filtering and redundant sequence filtering. It should be noted that the aforementioned temporary interval signals and flag signals are only an illustrative example of obtaining the output signal, and do not constitute a limitation.
[0086] To visually demonstrate the interval partitioning and timing generation logic of cache sub-units, see [link to documentation]. Figure 8 As shown, Figure 8 This is a schematic diagram of an AXI handshake timing logic provided according to an embodiment of this application. Figure 8 Figure (a) shows the handshake timing waveforms of the AXI interface AW channel and W channel corresponding to a single operand atomic operation; Figure 8Figure (b) shows the handshake timing waveforms of the AXI interface AW and W channels corresponding to the two-operand atomic operation. The figures illustrate the timing correspondence between the clk clock, DATAINIT_awuser, DATAINIT_awvalid, DATAINIT_awready, awready_pluse, DATAINIT_wvalid, DATAINIT_wready, wready_pluse, and the temporary interval signals and flag signals, demonstrating the generation and division logic of interval signals under different types of atomic operations.
[0087] 1.2 Conversion Unit (such as the existing NIC400 bit width conversion module) The conversion unit is used to convert the intermediate sequence into a target sequence with at least one preset bit width, and send at least one target sequence to the output unit for filtering and output.
[0088] The conversion unit receives raw control information from the buffer subunit, generates target control information corresponding to each target sequence based on this raw control information, and sends the target control information to the output unit. Each (or group of) target control information is used to control the transmission of the corresponding target sequence. For example, each group of target control information is used to manage the bus transmission timing, handshake rules, and transmission attributes of the corresponding target sequence.
[0089] By generating independent target control information for each target sequence, the control signal after bit-width conversion is bound to the data sequence one-to-one, ensuring that each converted sequence has compliant transmission control information, and guaranteeing data transmission timing compliance and link stability.
[0090] The conversion unit is used to receive the intermediate mask from the mapping subunit or the buffer subunit, generate a target mask corresponding to each target sequence based on the intermediate mask, and send the target mask to the output unit. Each target mask is used to indicate the distribution of valid elements in the corresponding target sequence.
[0091] This enables synchronous adaptation and conversion between data and masks, ensuring that the effective elements and mask identifiers correspond without offset or misalignment before and after the bit-width conversion, thus avoiding atomic data parsing errors caused by mask mapping anomalies.
[0092] It should be noted that this explanation uses the separation of control information and mask by the conversion unit as an example, but this is not a limitation. In some embodiments, the process can also be completed by the output unit. The specific configuration can be flexibly adjusted according to the hardware architecture and actual needs, and will not be elaborated further. Furthermore, while the above explanation separates control information and mask, in some embodiments, the control information includes the mask; this is not a limitation.
[0093] 1.3 Output Unit (also known as atomic_filter) The output unit is used to output a first sequence based on the output signal. For example, the output unit can also be used to output relevant information about the first sequence, such as outputting the target mask corresponding to the first sequence (i.e., the portion of the intermediate mask corresponding to the first sequence), or outputting control information corresponding to the first sequence. In this way, a complete and compliant output of atomic data, a valid mask, and transmission control signals can be achieved.
[0094] In some embodiments, the output unit is used to detect whether the target control information corresponding to the first sequence and the first sequence have been output, and to obtain a detection result; if the detection result indicates that the target control information corresponding to the first sequence and the first sequence have been output, target sequences other than the first sequence are filtered out. The target control information may or may not include a target mask, and this embodiment does not impose any limitations.
[0095] For example, the first sequence and related information (such as the corresponding target control information, target mask, etc.) are output through the first handshake, which facilitates the quick shielding of subsequent invalid data transmission and improves output efficiency.
[0096] In combination with the above Figure 2 As shown in the traditional transmission defect, the traditional NIC 400 bit-width conversion splits a single atomic write request into two independent write handshake transactions, violating the semantics of atomic operations. The output unit, however, can determine the handshake progress of the current atomic operation by combining the output signal. Once the first valid write channel handshake transaction is detected as complete, the output signal can shield and filter subsequent redundant handshake information and transmission transactions, thereby ensuring that the outgoing write request is always a single, complete atomic operation.
[0097] In this way, redundant split slices can be actively removed after the output of a valid atomic transaction is completed, and only the unique and complete atomic operation transaction is retained. This solves the problem of atomic operations being broken down and atomicity failing due to bit-width splitting, and ensures data security.
[0098] For a clearer description of the processing performed by the output unit, see [link to documentation]. Figure 9 As shown, Figure 9This is a schematic diagram of an output unit provided according to an embodiment of this application. The address channel handshake detection logic block monitors the handshake interaction status of the AXI address channel AW in real time, identifies whether the current transmission is an address handshake corresponding to the first sequence (i.e., whether the target control signal corresponding to the first sequence is being transmitted), and transmits a handshake status signal indicating handshake completion to subsequent logic blocks. The data channel first handshake detection logic block monitors the handshake timing of the AXI data channel W, captures the handshake completion flag of the first valid data (i.e., the first sequence) of the atomic operation, and outputs a handshake status signal indicating handshake completion to subsequent logic blocks. The handshake signal filtering logic block receives the handshake status signals output by the first two logic blocks. After determining that the first address and data handshake of the atomic operation is complete, that is, after the first sequence and its related information are all output, it blocks and intercepts subsequent redundant handshake signals and redundant target sequences, allowing only complete single atomic write requests, while non-atomic operation handshake signals are directly bypassed.
[0099] In some embodiments, the device also includes an AXI interface (also known as axi_atomic_if_gen), see [link to documentation]. Figure 5 As shown, this AXI interface is used to generate new interface bus signals, i.e., new atomic operation write requests, based on the first sequence, the target control information corresponding to the first sequence, and the target mask corresponding to the first sequence. During the generation of this atomic operation write request, the AXI interface forcibly constrains the bus parameters, ensuring that the awlength is configured to 0 and the wlast signal is set to 1 within the atomic write transaction. This standardizes and constrains the transmission format of atomic operations at the bus level, preventing atomic operation recognition failures caused by abnormal bus parameters.
[0100] In some embodiments, the device also includes a nonatomic baypass (also known as a nonatomic baypass), see [link to documentation]. Figure 5 As shown. This non-atomic path is used to process ordinary non-atomic operations transmitted on the bus. For such transmission transactions, a bypass mechanism is used, which does not involve filtering or intervention, thereby reducing the timing delay of ordinary data transmission and improving output efficiency.
[0101] The above explanation uses cross-protocol transmission between AXI and SDP protocols as an example, but it does not constitute a limitation. It can also be used when encountering atomic operations during cross-protocol transmission between other protocols.
[0102] This application provides a bit-width conversion device. Through the cooperation of an adjustment unit, a conversion unit, and an output unit, the original sequence corresponding to an atomic operation is regularized in terms of field positions. This concentrates the scattered valid elements into the target field to form an intermediate sequence. After being split into multiple target sequences through bit-width conversion, the first sequence including the target field is output. This avoids the problem of traditional bit-width conversion splitting complete atomic transactions. Therefore, during hardware bit-width adaptation, the constraints of atomic operations—single transmission, indivisibility, and uninterruptibility—are preserved. This avoids atomicity failures, data mask errors, and business parsing anomalies caused by bit-width conversion, ensuring data security and the normal execution of business logic.
[0103] More specifically, this maintains atomicity, ensuring that a single atomic operation is transmitted as a single transaction even after arbitrary bit-width conversion; it is compatible with SDP and AXI protocols, supporting multi-protocol wstrb / data remapping via capture; it has low latency, with non-atomic operations passed through, performing only filtering, capture, and remapping operations on atomic operations to reduce transmission latency.
[0104] This application also provides a bit-width conversion method, applied to the aforementioned bit-width conversion device. See also... Figure 10 The method includes the following steps.
[0105] 1001. Swap the positions of valid elements distributed across multiple fields in the original sequence with invalid elements in the target field to obtain an intermediate sequence. The original sequence is the data that participated in the atomic operation, and the valid elements in the intermediate sequence are all distributed in the target field.
[0106] 1002. Convert the intermediate sequence into a target sequence with at least one preset bit width, where the preset bit width is smaller than the bit width of the intermediate sequence.
[0107] 1003. Output the first sequence of at least one target sequence, where the first sequence includes the target field.
[0108] In some embodiments, the method further includes: receiving a data packet of an atomic operation, the data packet indicating that an atomic operation is to be performed on the original sequence; obtaining the operation type of the atomic operation from the data packet, the operation type being either a single-operand type or a double-operand type; and determining a target field based on the operation type of the atomic operation.
[0109] In some embodiments, determining the target field based on the operation type of the atomic operation includes: determining a first preset field as the target field when the operation type is a single operand type; and determining a second preset field as the target field when the operation type is a double operand type; wherein the length of the first preset field is not greater than the length of the second preset field.
[0110] In some embodiments, the method further includes: verifying the distribution of valid elements in the intermediate sequence based on the operation type to obtain a verification result; generating an output signal if the verification result indicates that all valid elements are within the target bit range corresponding to the operation type; and outputting a first sequence in at least one target sequence, including: outputting a first sequence based on the output signal.
[0111] In some embodiments, the method further includes: obtaining an original mask corresponding to the original sequence from the data packet, the original mask being used to indicate the distribution of valid elements in the original sequence; remapping the original mask based on the mapping relationship corresponding to the operation type and the intermediate sequence to obtain an intermediate mask, the intermediate mask being used to indicate the distribution of valid elements in the intermediate sequence; and outputting a portion of the intermediate mask corresponding to the first sequence.
[0112] In some embodiments, the method further includes: receiving a data packet of atomic operations, the data packet being used to instruct the execution of atomic operations on the original sequence; obtaining original control information from the data packet, the original control information being used to control the transmission of the data packet; and generating target control information corresponding to each target sequence based on the original control information, each target control information being used to control the transmission of the corresponding target sequence.
[0113] In some embodiments, outputting a first sequence in at least one target sequence includes: detecting whether target control information and the first sequence corresponding to the first sequence have been output, and obtaining a detection result; if the detection result indicates that target control information and the first sequence corresponding to the first sequence have been output, filtering out target sequences other than the first sequence.
[0114] The specific implementation process is described in the above-mentioned device embodiments and will not be repeated here.
[0115] This application provides a bit-width conversion method that regularizes the field positions of the original sequence corresponding to an atomic operation, concentrating the scattered valid elements into the target field to form an intermediate sequence. After being split into multiple target sequences through bit-width conversion, the first sequence including the target field is output. This avoids the problem of traditional bit-width conversion splitting complete atomic transactions, thus preserving the constraints of atomic operations being single-transmission, indivisible, and uninterrupted during hardware bit-width adaptation. It avoids problems such as atomicity failure, data mask corruption, and business parsing anomalies caused by bit-width conversion, ensuring data security and the normal execution of business logic.
[0116] This application also provides a chip, which includes a bit width conversion device as described in any of the above embodiments. When the chip is running on an electronic device, it is used to implement the bit width conversion method as described in the above embodiments.
[0117] This application also provides an electronic device, which includes a processor and a memory. The processor includes a chip configured with the bit-width conversion device of any of the above embodiments, and the memory stores a computer program, which is loaded and executed by the processor to implement the bit-width conversion method described above.
[0118] Electronic devices can be configured as terminals or servers. When an electronic device is configured as a terminal, the terminal can act as the execution subject to control the bit width conversion device provided in the embodiments of this application to achieve bit width conversion. When an electronic device is configured as a server, the server can act as the execution subject to control the bit width conversion device provided in the embodiments of this application to achieve bit width conversion. The embodiments of this application do not limit this.
[0119] Figure 11 This is a schematic diagram of an electronic device 1100 according to an embodiment of this application. The electronic device 1100 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1101 and one or more memories 1102. The processor includes a chip configured with the bit-width conversion device described in any of the above embodiments. The memory 1102 stores at least one computer program, which is loaded and executed by the processor 1101 to implement the bit-width conversion method provided in the various method embodiments described above. Of course, the electronic device may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The electronic device may also include other components for implementing device functions, which will not be elaborated here.
[0120] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the bit-width conversion method described in the above embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, or optical data storage device, etc.
[0121] This application also provides a computer program product, including a computer program that is executed by a processor to implement the bit-width conversion method in this application embodiment.
[0122] The chips, devices, computer-readable storage media, computer program products, etc. provided in the embodiments of this application are all used to execute the corresponding methods provided above, including the devices mentioned above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding devices provided above, and will not be repeated here.
[0123] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0124] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.
[0125] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A bit width conversion device, characterized by, The device includes an adjustment unit, a conversion unit, and an output unit. The adjustment unit is connected to the conversion unit, and the conversion unit is also connected to the output unit. The adjustment unit is used to swap the positions of valid elements distributed in multiple fields in the original sequence with invalid elements in the target field to obtain an intermediate sequence. The original sequence is the data participating in the atomic operation. The valid elements in the intermediate sequence are all distributed in the target field. The intermediate sequence is sent to the conversion unit. The conversion unit is used to convert the intermediate sequence into at least one target sequence with a preset bit width, the preset bit width being smaller than the bit width of the intermediate sequence, and to send at least one target sequence to the output unit; The output unit is used to output a first sequence from the at least one target sequence, the first sequence including the target field.
2. The apparatus of claim 1, wherein, The adjustment unit is used for: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; Obtain the operation type of the atomic operation from the data packet, wherein the operation type is a single-operand type or a double-operand type; The target field is determined based on the operation type of the atomic operation.
3. The apparatus of claim 2, wherein, The adjustment unit is used for: When the operation type is a single operand type, the first preset field is determined as the target field; When the operation type is a two-operand type, the second preset field is determined as the target field; Wherein, the length of the first preset field is not greater than the length of the second preset field.
4. The apparatus of claim 2, wherein, The adjustment unit is also connected to the output unit; the adjustment unit is further configured to: Based on the operation type, the distribution of valid elements in the intermediate sequence is verified to obtain the verification result; If the verification result indicates that all valid elements are within the target bit range corresponding to the operation type, an output signal is generated and sent to the output unit; The output unit is also used for: Based on the output signal, the first sequence is output.
5. The apparatus of claim 2, wherein, The adjustment unit is also connected to the output unit; the adjustment unit is further configured to: Obtain the original mask corresponding to the original sequence from the data packet; the original mask is used to indicate the distribution of valid elements in the original sequence. Based on the mapping relationship corresponding to the operation type and the intermediate sequence, the original mask is remapped to obtain an intermediate mask. The intermediate mask is used to indicate the distribution of valid elements in the intermediate sequence. The intermediate mask is then sent to the output unit. The output unit is also used for: Output the portion of the intermediate mask that corresponds to the first sequence.
6. The apparatus of claim 1, wherein, The adjustment unit is also used for: Receive the data packet for the atomic operation, the data packet being used to instruct the atomic operation to be performed on the original sequence; The original control information is obtained from the data packet, the original control information is used to control the transmission of the data packet, and the original control information is sent to the conversion unit; The conversion unit is also used for: Based on the original control information, target control information corresponding to each target sequence is generated. Each target control information is used to control the transmission of the corresponding target sequence, and the target control information is sent to the output unit.
7. The apparatus of claim 6, wherein, The output unit is used for: Detect whether the target control information corresponding to the first sequence and the first sequence have been output, and obtain the detection result; If the detection result indicates that the target control information corresponding to the first sequence and the first sequence have been output, then target sequences other than the first sequence are filtered out.
8. A bit width conversion method, characterized by, Applied to a bit-width conversion device, the method includes: The valid elements distributed across multiple fields in the original sequence are swapped with the invalid elements in the target field to obtain an intermediate sequence. The original sequence is the data participating in the atomic operation, and the valid elements in the intermediate sequence are all distributed in the target field. The intermediate sequence is converted into a target sequence with at least one preset bit width, wherein the preset bit width is smaller than the bit width of the intermediate sequence; Output the first sequence of the at least one target sequence, the first sequence including the target field.
9. A chip, characterized by The chip includes a bit-width conversion device as described in any one of claims 1 to 7, which, when the chip is running on an electronic device, is used to implement the bit-width conversion method as described in claim 8.
10. An electronic device, comprising: The electronic device includes a processor and a memory, the processor including a chip configured with a bit-width conversion device according to any one of claims 1 to 7, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the bit-width conversion method according to claim 8.
11. A computer readable storage medium characterized by, The computer-readable storage medium is used to store at least one computer program for performing the bit-width conversion method as described in claim 8.
12. A computer program product, characterised in that, It includes a computer program that, when executed by a processor, implements the bit-width conversion method as described in claim 8.
