Circuit and method, chip and computing device for data normalization

By executing detection and shifting operations in parallel in the data normalization circuit, the delay problem caused by serial execution in the prior art is solved, and efficient data normalization is achieved.

CN117692008BActive Publication Date: 2024-09-20MOORE THREADS TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202311775869.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2024-09-20
Estimated Expiration
2043-12-21

AI Technical Summary

Technical Problem

The existing technology has a delay problem caused by serial execution during the data normalization process, and cannot achieve efficient data normalization.

Method used

A circuit including a shift control circuit and a shift circuit is designed. It is executed in parallel through an n-level detection circuit and an n-level sub-shift circuit to detect whether the first non-zero value of the initial data falls into the shift range of each level, and The shift control signal is generated based on the detection results to realize parallel operations of sub-shift circuits at all levels, thereby maximizing parallel execution.

Benefits of technology

It effectively avoids the serial execution delay of leading zero detection and left shift, improving the speed and efficiency of data normalization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117692008B
    Figure CN117692008B
Patent Text Reader

Abstract

The present disclosure relates to a circuit for data normalization, comprising: an input end, configured to receive initial data; a shift control circuit, comprising an n-stage detection circuit, wherein the i-th stage detection circuit is configured to: in response to the first non-zero value of the initial data being not within the shift range of the i-th stage shift, output a first signal value, otherwise, output a second signal value; a shift circuit, comprising an n-stage sub-shift circuit, wherein the input data of the n-th stage sub-shift circuit is the initial data, and the input data of the other stages of sub-shift circuits are the output data of the previous stage sub-shift circuit, wherein the i-th stage sub-shift circuit is configured to: in response to the first signal value from the i-th stage detection circuit, perform i-stage shift on the input data toward the first bit direction and output the shifted data, or, in response to the second signal value from the i-th stage detection circuit, output the input data; an output end, configured to: output the output data of the first stage sub-shift circuit as normalized data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of circuit technology, and in particular, to a circuit and method, a chip and a computing device for data normalization. Background Art

[0002] With the continuous development of science and technology, the demand for high processing performance of various devices such as processors in various fields is increasing day by day. In such devices, the need to normalize data is often involved. For example, floating-point numbers have the advantages of higher precision and wider calculation range than fixed-point numbers, so they have been widely used in project engineering. In the process of floating-point operations, normalizing floating-point numbers is a key link and is often on the critical path of floating-point operations. Therefore, how to achieve data normalization more quickly plays a very important role in improving the processing performance of related devices. Summary of the invention

[0003] In view of this, the present disclosure provides a circuit and method, a chip and a computing device for data normalization, which can alleviate, mitigate or even eliminate the above-mentioned problems.

[0004] According to one aspect of the present disclosure, a circuit for data normalization is provided, comprising: an input terminal configured to: receive initial data, the initial data having a bit width less than or equal to 2 n The data to be normalized is a data to be normalized, wherein n is an integer greater than 0; a shift control circuit, comprising n-stage detection circuits, wherein the i-th stage detection circuit in the n-stage detection circuits is configured to: in response to the first non-zero value of the initial data not being within the shift range of the i-stage shift, output a first signal value, or in response to the first non-zero value of the initial data being within the shift range of the i-stage shift, output a second signal value, wherein i is an integer greater than 0 and less than or equal to n; a shift circuit, comprising n-stage sub-shift circuits, wherein the n-th stage sub-shift circuit in the n-stage sub-shift circuits receives the initial data as As input data, other i-th sub-shift circuits receive the output data of the i+1-th sub-shift circuit as input data, and wherein the i-th sub-shift circuit in the n-stage sub-shift circuit is configured to: in response to a first signal value from an i-th detection circuit, perform an i-stage shift on the input data toward the first position and output the shifted data, or, in response to a second signal value from the i-th detection circuit, output the input data; the output end is configured to: output the output data of the 1st-stage sub-shift circuit in the shift circuit as normalized data corresponding to the initial data.

[0005] In some embodiments, the shift control circuit also includes an n-level encoding circuit, the i-th level encoding circuit in the n-level encoding circuit includes an i-th level partitioning circuit, the i-th level partitioning circuit is configured to: determine at least one i-level encoding area based on initial data, so that at least one i-level encoding area just covers the shift range of the i-level shift, and, wherein the i-th level detection circuit is further configured to: output a first signal value in response to the first non-zero value of the initial data not being in at least one i-level encoding area, or output a second signal value in response to the first non-zero value of the initial data being in at least one i-level encoding area.

[0006] In some embodiments, each i-level coding region in at least one i-level coding region has one of the following items as the first position: the first position of the initial data, the first position of the corresponding i+1-level coding region, the first position of the corresponding i+1-level non-coding region, and each i-level coding region has an i-level preset bit width, and wherein the shift width of the i-level shift is equal to the i-level preset bit width.

[0007] In some embodiments, the preset bit width of level i is 2 i-1 .

[0008] In some embodiments, the i-th level partition circuit is further configured to: start from the first bit of the initial data, and continuously read 2 i-1 data bits, as an i-level coding area, and iteratively performing the following steps: in response to the remaining bit width in the initial data being greater than 2 i-1 , with a spacing of 2 from the previous i-level coding region i-1 After the data bits are read, 2 i-1 data bits as an i-level coding area, otherwise, stop reading the i-level coding area.

[0009] In some embodiments, the circuit further includes: a splicing circuit configured to splice the signal values ​​output by each level of detection circuits and output spliced ​​data.

[0010] In some embodiments, the i-th level encoding circuit also includes an i-th level assignment circuit, which is configured to: for each i-th level encoding region in at least one i-th level encoding region, in response to the i-th level encoding region containing a non-zero value, determine the encoding value corresponding to the i-th level encoding region as a first value, or, in response to the i-th level encoding region not containing a non-zero value, determine the encoding value corresponding to the i-th level encoding region as a second value; and wherein the i-th level detection circuit is further configured to: in response to the encoding value of at least one encoding region among the i- to n-level encoding regions indicating that the first non-zero value of the initial data is not in the at least one i-level encoding region, output a first signal value, or, in response to the encoding value of at least one encoding region among the i- to n-level encoding regions indicating that the first non-zero value of the initial data is in the at least one i-level encoding region, output a second signal value.

[0011] In some embodiments, the i-th level assignment circuit includes at least one OR circuit, each of the at least one OR circuit corresponds to an i-level coding region in at least one i-level coding region, and is configured to: receive the value of each data bit in the corresponding i-level coding region, and output the coding value corresponding to the corresponding i-level coding region.

[0012] In some embodiments, the i-th level detection circuit includes: at least one detection logic circuit, each detection logic circuit in the at least one detection logic circuit corresponds to an i-level coding region in at least one i-level coding region, and is configured to: in response to the coding values ​​of the coding regions falling within the range from the first bit of the initial data to the corresponding i-level coding region being the second value, and the coding values ​​of the coding regions covering the adjacent i-level non-coding regions after the corresponding i-level coding region and not covering the adjacent i-level coding regions after the corresponding i-level coding region being the first value or not existing, output a first signal value; otherwise, output a second signal value; a detection output circuit is configured to: in response to the presence of the first signal value in the output signal of the at least one detection logic circuit, output the first signal value; otherwise, output the second signal value.

[0013] In some embodiments, each detection logic circuit in at least one detection logic circuit is further configured to: in response to the coding values ​​of at least one coding region that just covers the range from the first bit of the initial data to the corresponding i-level coding region and does not overlap with each other being the second value, and the coding value of the coding region that covers the adjacent i-level non-coding region after the corresponding i-level coding region and does not cover the adjacent i-level coding region after the corresponding i-level coding region is the first value or does not exist, output a first signal value; otherwise, output a second signal value.

[0014] In some embodiments, each detection logic circuit in at least one detection logic circuit includes an AND circuit, and an input end of the AND circuit is configured to receive at least one of the following two items: the negation of the coding value of at least one coding region that just covers the range from the first bit of the initial data to the corresponding i-level coding region and does not overlap with each other, and the coding value of a coding region that covers the corresponding i-level coding region and the adjacent i-level non-coding region after the corresponding i-level coding region.

[0015] In some embodiments, the first non-zero value of the initial data is the first non-zero value starting from the highest bit of the initial data, and shifting the input data toward the first bit includes: shifting the input data toward the highest bit.

[0016] According to another aspect of the present disclosure, a chip is provided, comprising the circuit described in the foregoing embodiment.

[0017] According to yet another aspect of the present disclosure, a computing device is provided, comprising the circuit described in the foregoing embodiment.

[0018] According to another aspect of the present disclosure, a method for data normalization is provided, comprising: receiving initial data, the initial data having a bit width less than or equal to 2 n data to be normalized, wherein n is an integer greater than 0; for the initial data, performing n-level detection in parallel, wherein the i-th level detection includes: in response to the first non-zero value of the initial data not being within the shift range of the i-level shift, generating an i-level first signal value, or, in response to the first non-zero value of the initial data being within the shift range of the i-level shift, generating an i-level second signal value, wherein i is an integer greater than 0 and less than or equal to n; for the initial data, performing n-level shift processing, and outputting the processed data as normalized data corresponding to the initial data, wherein the i-th level shift processing in the n-level shift processing includes: receiving i-level input data, wherein when i is equal to n, the i-level input data is the initial data, and when i is greater than 0 and less than n, the i-level input data is the output data of the i+1-th level shift processing; in response to the i-level first signal value, performing i-level shift on the i-level input data toward the first bit direction, and outputting the shifted data, or, in response to the i-level second signal value, outputting the i-level input data.

[0019] The circuit for data normalization provided by the present disclosure includes a shift control circuit and a shift circuit, wherein the shift control circuit includes an n-level detection circuit, and the shift circuit includes an n-level sub-shift circuit. The i-th level sub-shift circuit can be operated according to the signal value of the shift control signal output by the i-th level detection circuit, and the detection circuits of each level can be executed in parallel to detect whether the first non-zero value of the initial data falls within the shift range of this level, thereby outputting the corresponding signal value to indicate whether the shift of this level should be performed, and at the same time, the operation of the higher-level sub-shift circuit and the operation of the lower-level detection circuit can be executed in parallel. In this way, the parallel operation of the sub-shift circuits of each level can be achieved, thereby facilitating the maximum parallel execution of the shift control circuit and the shift circuit, and improving the speed of data normalization.

[0020] These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0022] Figure 1A and 1B An exemplary block diagram of a device for data normalization in the related art is schematically shown;

[0023] Figure 2Schematically illustrates an exemplary block diagram of a circuit for data normalization according to some embodiments of the present disclosure;

[0024] Figure 3 Schematically illustrates another exemplary block diagram of a circuit for data normalization according to some embodiments of the present disclosure;

[0025] Figure 4 Schematically illustrates examples of encoding regions at various levels according to some embodiments of the present disclosure;

[0026] Figure 5 Schematically illustrates an exemplary block diagram of a splicing circuit according to some embodiments of the present disclosure;

[0027] Figure 6 Schematically shows an exemplary block diagram of an encoding circuit according to some embodiments of the present disclosure;

[0028] Figure 7 Schematically shows an example circuit diagram of an assignment circuit according to some embodiments of the present disclosure;

[0029] Figure 8 Schematically illustrates an example circuit diagram of a detection circuit according to some embodiments of the present disclosure;

[0030] Fig. 9 Schematically illustrates an exemplary block diagram of a circuit for data normalization of 24-bit data according to some embodiments of the present disclosure;

[0031] Fig.10 Schematically illustrates examples of various levels of encoding areas for 24-bit data according to some embodiments of the present disclosure;

[0032] Fig.11 Schematically illustrates an exemplary circuit diagram of a circuit for data normalization of 24-bit data according to some embodiments of the present disclosure;

[0033] Fig.12 Schematically illustrates an exemplary block diagram of a chip according to some embodiments of the present disclosure;

[0034] Fig.13 An exemplary block diagram of a computing device according to some embodiments of the present disclosure is schematically shown;

[0035] Fig.14 An exemplary flow chart of a method for data normalization according to some embodiments of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0036] In the present disclosure, data normalization can be understood as shifting the data so that its first non-zero value becomes the first bit. Depending on the requirements of the specific application scenario, the first bit can refer to the highest bit or the lowest bit. For example, for binary floating point numbers, the commonly used format is the IEEE754 (Institute of Electrical and Electronics Engineers) standard. In this type of binary floating point normalization scenario, the first bit can refer to the highest bit. By normalizing the binary floating point number, the highest bit of its mantissa can be made 1.

[0037] By analyzing the relevant technologies, the applicant found that there are mainly two types of devices for data normalization. In the first method, Figure 1A As shown, the device 100A can be composed of a leading zero detection module 110 and a normalization shift module 120. The leading zero detection module 110 can perform leading zero detection on an unnormalized number to obtain the number of leading zeros of the unnormalized number. The normalization shift module 120 can perform a left shift operation on the unnormalized number according to the number of leading zeros obtained by the leading zero detection module 110. The number of shifts is equal to the aforementioned number of leading zeros, and the result after the left shift is the normalized number. This normalization method can only be executed serially, that is, the leading zero detection module 110 first performs a leading zero detection to obtain the number of leading zeros, and then the normalization shift module performs a left shift operation. The total normalization time of this serial normalization method is the sum of the leading zero detection time and the left shift time, which generally has a longer delay. In the second method, such as Figure 1B As shown, the device 100B may include a leading zero prediction module 130, which can predict the number of leading zeros of the unnormalized number in parallel with the unnormalized number generation module generating the unnormalized number. Exemplarily, the unnormalized number generation module 140 can generate the unnormalized number based on data A and data B, and the leading zero prediction module 130 can predict the number of leading zeros of the unnormalized number to be generated based on data A and data B. After obtaining the prediction result of the number of leading zeros, the normalization shift module 150 can perform a left shift operation on the normalized number according to the predicted number of leading zeros, and the shift amount is equal to the predicted number of leading zeros. The result after the left shift is the normalized number. In this way, the number of leading zeros can be predicted while the unnormalized number is obtained, thereby achieving the effect of reducing the delay of the entire path. However, this method is essentially a serial execution method of first detecting or predicting the number of leading zeros and then shifting.

[0038] In order to solve or at least alleviate the delay problem caused by the above-mentioned serial execution mode and improve the speed of data normalization, the present disclosure provides a new circuit for data normalization. The proposed circuit will be described below in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments described in the present disclosure are merely exemplary and not restrictive or exhaustive, and those skilled in the art can conceive other implementations by combining, modifying or adding the features therein.

[0039] Figure 2 Schematically shows an exemplary block diagram of a circuit 200 for data normalization provided according to some embodiments of the present disclosure. Figure 2 As shown, the circuit 200 may include an input terminal 210 , a shift control circuit 220 , a shift circuit 230 , and an output terminal 240 .

[0040] The input terminal 210 may be configured to receive initial data. The initial data may be data to be normalized generated by the upper circuit, such as unnormalized floating point numbers or other types of data. The initial data may have a bit width less than or equal to 2 n The data to be normalized is n, where n is an integer greater than 0.

[0041] The shift control circuit 220 can obtain the initial data received via the input terminal 210, and hierarchically generate corresponding shift control signals according to the number of leading zeros in the initial data. Specifically, the shift control circuit 220 may include n-level detection circuits, namely, the first-level detection circuit 221-1 to the n-level detection circuit 221-n as shown in the figure. The i-th (i is an integer greater than 0 and less than or equal to n)-th level detection circuit in the n-level detection circuit can be configured to generate a corresponding shift control signal according to whether the first non-zero value of the initial data is within the shift range of the i-level shift. Specifically, in response to the first non-zero value of the initial data not being within the shift range of the i-level shift, a first signal value can be output; or, in response to the first non-zero value of the initial data being within the shift range of the i-level shift, a second signal value can be output. Exemplarily, the number of levels n of the detection circuits included in the shift control circuit 220 can be determined according to the bit width of the data to be normalized that is desired to be processed, so that 2 nGreater than or equal to the bit width of the data to be normalized that is expected to be processed. For example, for data to be normalized with a bit width of 24 bits, n can be set to be equal to 5; for data to be normalized with a bit width of 53 bits, n can be set to be equal to 6. Optionally, the shift control circuit 220 may have more levels of detection circuits, and some of the detection circuits may be selected as the aforementioned n-level detection circuits according to the bit width of the initial data adaptively or according to the configuration information. The i-level shift range can be understood as the range of data bits that may be involved in the i-level shift. Exemplarily, the shift range of the i-level shift can be pre-set, each level of shift can correspond to a different shift range, and the shift range of each level of shift can include at least one shift interval. Optionally, the shift interval included in the shift range of the i-level shift (or referred to as the i-level shift interval) may have the same bit width and be smaller than the bit width of the shift interval included in the shift range of the i+1-level shift. Exemplarily, a part of the shift intervals in the i-level shift interval can be a sub-interval of the i+1-level shift interval and include the first bit of the corresponding i+1-level shift interval, and another part of the shift interval can be an interval adjacent to the last bit of the i+1-level shift interval, that is, a sub-interval of the i+1-level non-shift interval and include the first bit of the corresponding i+1-level non-shift interval.

[0042] The shift circuit 230 can obtain the initial data received via the input terminal 210, and perform a shift operation on the initial data in a hierarchical manner according to the shift control signal generated by the shift control circuit 220. Specifically, the shift circuit 230 may include n-stage sub-shift circuits, that is, the first-stage sub-shift circuit 230-1 to the n-stage sub-shift circuit 230-n as shown in the figure. The n-stage sub-shift circuits may correspond to the aforementioned n-stage detection circuits one by one and be cascaded together, wherein the n-stage sub-shift circuit receives the initial data as input data, and the remaining sub-shift circuits all receive the output data of the previous-stage sub-shift circuit as input data, that is, the i-stage sub-shift circuit receives the output data of the i+1-stage sub-shift circuit as input data. The i-stage sub-shift circuit in the n-stage sub-shift circuit may be configured to determine whether to perform the i-stage shift according to the shift control signal provided by the i-stage detection circuit. Specifically, in response to the first signal value from the i-th stage detection circuit, the aforementioned i-stage shift may be performed on the input data of the sub-shift circuit of this stage toward the first position, and the shifted data may be output; or, in response to the second signal value from the i-th stage detection circuit, the aforementioned i-stage shift may not be performed, and the input data of the sub-shift circuit of this stage may be output. Exemplarily, the i-stage shift may correspond to a preset shift width, and the preset shift width may be, for example, equal to the width of each shift interval in at least one shift interval included in the shift range of the aforementioned stages of shift. Such i-stage shift may be implemented by shifting the input data toward the first position by the preset shift width.

[0043] The output terminal 240 may be configured to output the output data of the first-stage sub-shift circuit in the shift circuit 230 as normalized data corresponding to the aforementioned initial data.

[0044] In the aforementioned circuit 200, the i-th stage sub-shift circuit can be operated according to the signal value of the shift control signal outputted from the i-th stage detection circuit, and the detection circuits of each stage can be executed in parallel to detect whether the first non-zero value of the initial data falls within the shift range of this stage, thereby outputting the corresponding signal value to indicate whether this stage shift should be executed, and at the same time, the operation of the higher-level sub-shift circuit and the operation of the lower-level detection circuit can be executed in parallel. In this way, the parallel operation of the sub-shift circuits of each stage can be realized, thereby facilitating the maximum parallel execution of the shift control circuit and the shift circuit, avoiding the problem of long delay in normalization operation caused by serial execution of leading zero detection and left shifting in the aforementioned related art device, and improving the speed of data normalization.

[0045] In some embodiments, the first non-zero value of the initial data may refer to the first non-zero value from the highest bit of the initial data, and shifting the input data in the first position may refer to shifting the input data in the direction of the highest bit. For example, the circuit 200 described in the present disclosure may be used for normalization of floating-point numbers, such as normalization according to the IEEE 754 standard. At this time, the first non-zero value of interest is the first non-zero value from the highest bit of the data, and the direction of the shift is also shifted in the direction of the highest bit of the data. However, it should be understood that this is not restrictive. In fact, the circuit 200 described in the present disclosure may also be used in other scenarios involving data normalization processing by shifting, such as various scenarios where data or a part of the data needs to be normalized to the highest bit or the lowest bit as a non-zero value (when the data bits of the data or a part of the data are all zero, the highest bit or the lowest bit after normalization is still zero). According to the needs of the specific application scenario, the first non-zero value may also refer to the first non-zero value from the lowest bit, and the shift direction may also be shifted in the direction of the lowest bit.

[0046] In some embodiments, in addition to the n-stage detection circuit, the shift control circuit 220 may also include an n-stage encoding circuit, for example Figure 3The first level coding circuit 222-1 to the nth level coding circuit 222-n shown in the figure. The i-th level coding circuit in the n-level coding circuit may include an i-th level partitioning circuit (i is an integer greater than 0 and less than or equal to n), and the i-th level partitioning circuit may be configured to: determine at least one i-level coding area based on the initial data, so that the at least one i-level coding area just covers the shift range of the i-level shift. In this embodiment, the i-th level detection circuit may be further configured to: output a first signal value in response to the first non-zero value of the initial data not being in at least one i-level coding area; or output a second signal value in response to the first non-zero value of the initial data being in at least one i-level coding area. In this way, the coding circuits at each level can determine the coding areas at each level in parallel, and the detection circuits at each level can output corresponding shift control signals in parallel based on the coding results. This helps to achieve the maximum parallel execution of the circuits at each level inside the shift control circuit, thereby helping to improve the speed of overall data normalization.

[0047] In some embodiments, the aforementioned at least one i-level coding area can be determined according to a preset rule, wherein each i-level coding area takes one of the following as the first position: the first position of the initial data, the first position of the corresponding i+1-level coding area, the first position of the corresponding i+1-level non-coding area, and each i-level coding area has an i-level preset width. Specifically, for the n-level coding area, its first position can be the first position of the initial data; for each i-level coding area in the 1st to n-1th level coding area, its first position can be the first position of the corresponding i+1-level coding area or i+1-level non-coding area, and the i+1-level coding area or i+1-level non-coding area corresponding to a certain i-level coding area can refer to the coding area or non-coding area covering the i-level coding area. In this embodiment, the shift width of the i-level shift can be equal to the i-level preset width. In this way, the width of the same-level coding area can be unified, that is, the width of the different shift intervals included in its shift range is unified in each level, which helps to simplify the judgment of whether the first non-zero value of the initial data falls into each coding area, thereby helping to achieve faster data normalization.

[0048] For example, the preset bit width of each level can be set according to application requirements, wherein the preset bit width of level n can be smaller than the total bit width of the initial data, and the remaining i-level preset bit widths can be smaller than the i+1-level preset bit width. Figure 4 As shown. Figure 4In the figure, the range between the two dotted lines is the total bit width range of the initial data, wherein the coding areas at each level are shown by solid lines, and the blank parts are non-coding areas. Optionally, each i-level coding area can cover a part of each i+1-level coding area and each i+1-level non-coding area, for example, each i-level coding area can be based on the starting point of the corresponding i+1-level coding area or non-coding area and have an i-level preset bit width, and the i-level preset bit width can be, for example, half of the i+1-level preset bit width. Alternatively, the range of each level of coding area can also be determined based on other methods.

[0049] In some embodiments, the preset bit width of level i in the above embodiments may be 2 i-1 That is, the width of an n-level coding region can be 2 n-1 , the width of an n-1 level coding region can be 2 n-2 , and so on, the width of a level 1 coding region can be 2 0 (i.e., 1). In this way, the number of required levels can be minimized, thereby helping to simplify the circuit structure and improve the efficiency of data normalization. In this embodiment, the number of i-level coding areas can be less than or equal to 2. n-i , greater than 2 n-i-1 For example, the number of n-level coding regions may be equal to 1, the number of n-1-level coding regions may be equal to 2, the number of n-2-level coding regions may be equal to 4 or 3, ..., the number of 1-level coding regions may be less than or equal to 2. n-1 , greater than 2 n-2 .

[0050] In some embodiments, the i-th level partition circuit may be further configured to: start from the first bit of the initial data, and continuously read 2 i-1 data bits, as an i-level coding area, and iteratively performing the following steps: in response to the remaining bit width in the initial data being greater than 2 i-1 , with a spacing of 2 from the previous i-level coding region i-1 After the data bits are read, 2 i-1 data bits as a level i coding area, otherwise, stop reading the level i coding area. i-1 If p is equal to p, the partitioning circuit of this level can be configured as follows: starting from the first bit of the initial data, continuously read p data bits as the first coding area of ​​this level; after an interval of p data bits, continuously read p data bits as the second coding area of ​​this level; and so on, until there are no remaining data bits or the width of the remaining data bits is less than or equal to p. In this way, the coding areas of each level that meet the preset rules can be easily obtained.

[0051] In some embodiments, the total shift width performed on the initial data, that is, the number of leading zeros of the initial data, can be determined based on the signal values ​​output by the detection circuits at each level and the preset bit widths corresponding to the shifts at each level. For example, the preset bit widths corresponding to the detection circuits at each level that output the first signal can be added to obtain the total shift width. Exemplarily, in the scenario of normalizing floating-point numbers, this total shift width can be regarded as the exponent value in the normalized floating-point number. The preset bit width at level i can be 2 i-1 In the embodiment of the present invention, the total shift width can be determined by splicing the signal values ​​output by each level of detection circuits. For example, when the first value is 1 and the second value is 0, the output signal values ​​of each detection circuit are spliced ​​in the order of the nth level detection circuit to the first level detection circuit, and the splicing result is equal to the total shift width. For example, Figure 5 As shown, the signal values ​​r[n] to r[1] output by the first-stage detection circuit 221-1 to the n-stage detection circuit 221-n can be transmitted to the splicing circuit 250, and the splicing circuit 250 can be configured to splice r[n] to r[1] and output the spliced ​​data. Optionally, the output of the splicing circuit 250 can be output through the output terminal 240, or can be output through a separate output terminal. In this way, the total number of shift bits performed on the initial data (that is, the number of leading zeros detected) can be easily obtained.

[0052] In some embodiments, Figure 6 As shown, the i-th level encoding circuit 222-i may include an i-th level partitioning circuit 2221-i and an i-th level assignment circuit 2222-i, wherein the i-th level partitioning circuit 2221-i may have the features of the various embodiments described above, and the i-th level assignment circuit 2222-i may be configured as: for each i-th level encoding region in at least one i-th level encoding region determined by the i-th level partitioning circuit 2221-i, in response to the i-th level encoding region containing a non-zero value, determining the encoding value corresponding to the i-th level encoding region as a first value, or, in response to the i-th level encoding region not containing a non-zero value, determining the encoding value corresponding to the i-th level encoding region as a second value. In this embodiment, the i-th level detection circuit 221-i can be further configured to: output a first signal value in response to the code value of at least one coding region among the i- to n-level coding regions indicating that the first non-zero value of the initial data is not in at least one i-level coding region, or output a second signal value in response to the code value of at least one coding region among the i- to n-level coding regions indicating that the first non-zero value of the initial data is in at least one i-level coding region. In this way, the coding circuits of each level can determine the code value of the corresponding level coding region in parallel, and the detection circuits of each level can determine the level shift control signal in parallel according to the code value of the relevant coding region.

[0053] For example, in Figure 4 In the example shown, there is an n-level coding area. If all data bits of the n-level coding area are zero, the n-th level assignment circuit can determine the coding value corresponding to the n-level coding area as the second value; if there is at least one non-zero value in the data bits of the n-level coding area, the n-th level assignment circuit can determine the coding value corresponding to the n-level coding area as the first value. Figure 4 In the example shown, there are 2 n-1 level coding areas. For ease of description, they are numbered as the 1st n-1 level coding area and the 2nd n-1 level coding area from left to right in the figure. Similar to the case of the nth level, the n-1th level assignment circuit can determine the coding values ​​for the 1st n-1 level coding area and the 2nd n-1 level coding area, respectively. Similarly, the remaining levels of assignment circuits can determine the coding values ​​for each coding area in the corresponding level coding area, respectively. The coding value determined in this way can reflect whether there is a non-zero value in the corresponding coding area. If the coding value of a coding area is the second value, it can at least be determined that the first non-zero value of the initial data does not fall within the range of the coding area. Therefore, the detection circuits at each level can determine whether the first non-zero value of the initial data is in the coding area of ​​that level based on the coding value of at least one coding area in the i to n level coding areas. Exemplarily, for Figure 4 In the example shown, if the code value of the n-level coding area shown is the second value, it can be determined that the first non-zero value of the initial data is not in the n-level coding area, and the n-th level detection circuit can output the first signal value; otherwise, it can be determined that the first non-zero value of the initial data is in the n-level coding area, and the n-th level detection circuit can output the second signal value; if the code value of the n-level coding area is the first value and the code value of the first n-1-level coding area is the second value, or the code value of the n-level coding area is the second value and the code value of the second n-1-level coding area is the second value, it can be determined that the first non-zero value of the initial data is not in the n-1-level coding area, and the n-1-th level detection circuit can output the first signal value; otherwise, it can be determined that the first non-zero value of the initial data is in the n-1-level coding area, and the n-1-th level detection circuit can output the second signal value; similarly, each i-level assignment circuit can determine whether the first non-zero value of the initial data is in the i-level coding area according to a combination of the code values ​​of one or more coding areas in the i- to n-level coding areas, and output the first signal value or the second signal value.

[0054] In some embodiments, the coding value of each coding region can be determined by an OR circuit. For example, the aforementioned i-th level assignment circuit may include at least one OR circuit, each of the at least one OR circuit may correspond to one i-level coding region in at least one i-level coding region, and is configured to: receive the value of each data bit in the corresponding i-level coding region, and output the coding value corresponding to the corresponding i-level coding region. The OR circuit may refer to a circuit that implements OR logic. According to the number of data bits in the corresponding coding region, the OR circuit may take different forms. For example, the OR circuit may be a multi-input OR gate, in which the number of input terminals may be equal to the number of data bits in the corresponding coding region, or such a multi-input OR gate may be implemented by a combination of 2-input OR gates; or, when the corresponding coding region contains only 1 data bit, the OR circuit may not include a gate circuit, but only a connection. With the help of the OR circuit, it is convenient to determine whether there is a non-zero value in each coding region, thereby conveniently determining the coding value for each coding region.

[0055] For example, the i-level coding region has 2 i-1 Taking the i-level preset bit width as an example, Figure 7 The OR circuits included in each level of the assignment circuit are shown, wherein the nth level assignment circuit may include k n 2 n-1 Input OR gate, the n-1th level evaluation circuit can include k n-1 2 n-2 Input OR gate, ..., the second level assignment circuit may include k2 2-input OR gates, and the n-1th level assignment circuit may include k1 lines. Figure 4 As shown, k n Can be 1, k n-1 It can be 2, and so on.

[0056] In some embodiments, each level of detection circuit can be implemented by a logic circuit. Figure 8As shown, the i-th level detection circuit 221-i may include at least one detection logic circuit 2211-i1 to 2211-im and a detection output circuit 2212-i, wherein the detection logic circuit m may be equal to the number of at least one i-level coding area, and each detection logic circuit may correspond to one i-level coding area in at least one i-level coding area. Each detection logic circuit in the detection logic circuits 2211-i1 to 2211-im may be configured to: in response to the coding values ​​of the coding areas falling within the range from the first bit of the initial data to the corresponding i-level coding area being the second value, and the coding values ​​of the coding areas covering the adjacent i-level non-coding areas after the corresponding i-level coding area and not covering the adjacent i-level coding areas after the corresponding i-level coding area being the first value or not existing, output a first signal value, otherwise, output a second signal value. The detection output circuit 2212-i may be configured to: in response to the presence of the first signal value in the output signals of the detection logic circuits 2211-i1 to 2211-im, output the first signal value, otherwise, output the second signal value. It can be understood that for each coding area, if the coding values ​​of each coding area falling within the range from the first bit of the initial data to the coding area are all the second value, it means that the first non-zero value of the initial data does not fall within the coding area and the area before the coding area. If at the same time, the coding value of the coding area covering the adjacent non-coding area after the coding area and not covering the adjacent coding area after the coding area is the first value or does not exist, it means that the first non-zero value of the initial data falls into the non-coding area after the coding area or there is no non-zero value in the initial data. Therefore, if the output of a certain level of detection logic circuit is the first signal value, it means that the first non-zero value of the initial data falls into the non-coding area of ​​the level or does not exist, that is, the first non-zero value of the initial data does not fall into the coding area of ​​the level, that is, the first non-zero value of the initial data is not within the shift range of the shift of the level. Therefore, through the above-mentioned detection logic, it is possible to accurately determine whether the first non-zero value of the initial data is within the coding area at each level, or in other words, whether it is within the shift range of each level of shift. Moreover, after the coding circuits at each level have determined the coding values ​​of the coding areas at each level, the detection circuits at each level can output the shift control signals at each level in parallel.

[0057] For example, Figure 4Taking the coding area shown as an example, the n-th level detection circuit may include one detection logic circuit, which may be configured to: in response to the coding value of the n-th level coding area being the second value, output a first signal value, otherwise, output a second signal value; the n-1-th level detection circuit may include two detection logic circuits, wherein the first detection logic circuit may be configured to: in response to the coding value of the first n-1-th level coding area being the second value and the coding value of the n-th level coding area being the first value, output a first signal value, otherwise, output a second signal value, and the second detection logic circuit may be configured to: in response to the coding values ​​of the n-th level coding area, the first n-1-th level coding area and the second n-1-th level coding area being the second value, output a first signal value, otherwise, output a second signal value; the remaining levels of detection logic circuits may be configured similarly.

[0058] Further, through the above analysis, it can be known that from the nth level to the first level, the number of coding areas increases gradually, and accordingly, the number of detection logic circuits increases gradually, and the amount of data that the detection circuit needs to process also increases. Therefore, from the nth level to the first level detection circuit, the time when the latter level detection circuit outputs the corresponding shift control signal may be slightly later than the time when the previous level detection circuit outputs the corresponding shift control signal. However, since the shift circuits of each level are cascaded, that is, the shifts of each level are performed sequentially, the step-by-step delay in the output time of the shift control signal will not have a significant impact on the time of overall data normalization. More specifically, while the higher-level sub-shift circuit performs the operation, the lower-level detection circuit can perform the operation of determining the shift control signal of the corresponding level, thereby realizing the maximum parallel operation of the shift control circuit and the shift circuit, so that when the upper-level sub-shift circuit transfers data to the next-level sub-shift circuit, the shift control signal required by the sub-shift circuit can also be transferred to the sub-shift circuit.

[0059] In some embodiments, the detection logic of each detection logic circuit in the at least one detection logic circuit can be further simplified. For example, each detection logic circuit in the detection logic circuits 2211-i1 to 2211-im can be configured to: in response to the coding values ​​of at least one coding area that just covers the range from the first bit of the initial data to the corresponding i-level coding area and does not overlap with each other being the second value, and the coding value of the coding area that covers the adjacent i-level non-coding area after the corresponding i-level coding area and does not cover the adjacent i-level coding area after the corresponding i-level coding area is the first value or does not exist, output a first signal value; otherwise, output a second signal value. Figure 4Taking the coding area shown as an example, for example, the detection logic of the second detection logic circuit in the n-1th level detection circuit can be simplified as follows: in response to the coding values ​​of the n-level coding area and the second n-1-level coding area being the second value, the first signal value is output; otherwise, the second signal value is output. This is because when the coding value of the n-level coding area is the second value, the coding value of the first n-1-level coding area must also be the second value. Similarly, the detection logic of the remaining detection logic circuits can also be simplified. In the above manner, the detection logic of each detection logic circuit can be simplified to the maximum extent, thereby maximizing the simplification of the relevant circuit structure and improving the processing efficiency.

[0060] In some embodiments, the aforementioned detection logic circuit can be implemented by an AND circuit. For example, each of the detection logic circuits 2211-i1 to 2211-im includes an AND circuit, and the input end of the AND circuit can be configured to receive at least one of the following two items: the negation of the coding value of at least one coding area that just covers the range from the first bit of the initial data to the corresponding i-level coding area and does not overlap with each other, and the coding value of one coding area that covers the corresponding i-level coding area and the adjacent i-level non-coding area after the corresponding i-level coding area. The AND circuit can refer to a circuit that implements the AND logic. According to the number of data items that the AND circuit needs to receive, the AND circuit can take different forms. For example, the AND circuit can be a multi-input AND gate, in which the number of input ends can be equal to the number of data items that need to be received, or such a multi-input AND gate can be implemented by a combination of 2-input AND gates; or, when the number of data items that need to be received is 1, the AND circuit may not include a gate circuit, but only a connection. With the help of the AND circuit, a determination can be made conveniently according to the aforementioned detection logic.

[0061] To further facilitate understanding, the following will combine Figures 9 to 11 , a specific example of a circuit for data normalization is described using normalization of 24-bit data.

[0062] For example, Fig. 9 An exemplary block diagram of a circuit for normalizing 24-bit data is schematically shown. For initial data with a bit width of 24 bits, the number of leading zeros can be any value among 0, 1, ... 23, 24, and the number of leading zeros can be represented by a 5-bit binary number. In this example, Fig. 9As shown, the shift control circuit may have 5 levels of encoding circuits, namely, a 5th level encoding circuit, a 4th level encoding circuit, a 3rd level encoding circuit, a 2nd level encoding circuit and a 1st level encoding circuit, and 5 levels of detection circuits, namely, a 5th level detection circuit, a 4th level detection circuit, a 3rd level detection circuit, a 2nd level detection circuit and a 1st level detection circuit; the shift circuit may have 5 levels of sub-shift circuits, namely, a 5th level sub-shift circuit, a 4th level sub-shift circuit, a 3rd level sub-shift circuit, a 2nd level sub-shift circuit and a 1st level sub-shift circuit. In other words, in this example, n in the aforementioned embodiments may be equal to 5. More specifically, the 5-level sub-shift circuits may be cascaded, and the 5th level sub-shift circuit may include 2 4 The 4th-stage sub-shift circuit may include 2 3 The 3rd stage sub-shift circuit may include 2 2 The second-stage sub-shift circuit may include 2 1 The first-stage sub-shift circuit may include 2 0 Shift the component left by 1 bit.

[0063] Each level of coding circuit can encode the shift range involved in the current level shift to assist the detection circuit in quickly determining the shift control signal to be output, so that the shift circuit performs or does not perform the current level shift. In this example, it is assumed that the shift control signal is 1 when the shift is performed, and is 0 when the shift is not performed. Further exemplary, each level of coding circuit can follow the following coding rule (where i represents the i-th level coding circuit): select 2 from the high bit to the low bit direction of the initial data i-1 The i-level coding area can be recorded as Li1; then, continue to the lower direction with an interval of 2 i-1 After that, select 2 i-1 The next i-level coding area is Li2; and so on, as long as the remaining low-order digits are greater than 2 i-1 , then continue to select the i-level coding area, otherwise stop selecting the i-level coding area. More specifically, for 24-bit data, at the 5-level coding circuit, select 2 from the high bit to the low bit of the initial data. 4 The number of digits, that is, the 24th to the 9th digits of the initial data, a total of 16 digits, is recorded as L51; at this time, the remaining 8th to the 1st digit, a total of 8 digits, does not satisfy the greater than 2 4 The condition is that the reading of the 5th level coding area is stopped. At the 4th level coding circuit, 2 bits are selected from the high bit to the low bit of the initial data. 3 The digits are the 24th to 17th digits of the initial data, a total of 8 digits, recorded as L41; at this time, the remaining 16th to 1st digits, a total of 16 digits, satisfying the requirement of greater than 2 3Therefore, the 4th level coding area is read continuously, that is, the interval is 2 3 After that, select 2 3 The remaining number of digits is 0, so the reading of the 4-level coding area is stopped. At the 3rd level coding circuit, 2 bits are selected from the high bit to the low bit of the initial data. 2 The number of digits, that is, the 24th to 21st digits of the input binary, a total of 4 digits, is recorded as L31; at this time, the remaining 19th to 1st digits, a total of 20 digits, satisfy the requirement of greater than 2 2 Therefore, we continue to read the 3rd level coding layer, that is, 2 2 After that, select 2 2 The number of digits, that is, the 16th to 13th digits, is recorded as L32; the remaining 12th to 1st digits, a total of 12 digits, satisfy the requirement of being greater than 2 2 Therefore, we continue to read the 3rd level coding layer, that is, 2 2 After that, select 2 2 The number of digits, that is, the 8th to the 5th digit, is recorded as L33; the remaining 4 digits, from the 4th to the 1st digit, do not satisfy the requirement of being greater than 2 2 The condition is met, so the reading of the 3rd level coding layer is stopped. Similarly, the 2nd level coding circuit can complete the reading of the 2nd level coding area, and the 1st level coding circuit can complete the reading of the 1st level coding area. The coding areas of each level can be Fig.10 shown.

[0064] Each level of coding circuit can determine the coding value of each coding area through an OR circuit. Fig.11 As shown, the 5th level encoding circuit may include 1 16-input OR gate (indicated by the symbol "≥1"), and each input end may be connected to each data bit of the encoding area L51; the 4th level encoding circuit may include 2 8-input OR gates, and each input end of one 8-input OR gate may be connected to each data bit of L41, and each input end of the other may be connected to each data bit of L42; the 3rd level encoding circuit may include 3 4-input OR gates, and the input ends of the 4 4-input OR gates may be respectively connected to each data bit of L31 to L33; the 2nd level encoding circuit may include 6 2-input OR gates, and the input ends of the 6 2-input OR gates may be respectively connected to each data bit of L21 to L26; the 1st level encoding circuit may include 12 connecting lines, and the 12 connecting lines may be respectively connected to L11 to L112.

[0065] Each level of detection circuit can output the corresponding shift control signal according to whether the highest bit 1 in the initial data is in the coding area of ​​that level, that is, Fig. 9In this example, it is assumed that the first signal value of the shift control signal is 1 and the second signal value is 0. As described in the above embodiments, each detection circuit can generate a corresponding shift control signal according to the encoding value of the encoding area determined by each encoding circuit. Fig.10 As shown, for the third level, there are three coding areas L31, L32, and L33. As described in the previous embodiment, when the highest bit 1 of the initial data does not fall into any of the three coding areas, r[3] can be 1. If the highest bit 1 of the initial data does not fall into any of the three coding areas, the highest bit 1 should fall into the third level non-coding area, that is, the highest bit 1 should fall into one of the following areas: the 20th to 17th, the 12th to 9th, and the 4th to 1st. Further, the highest bit 1 falling into the 20th to 17th can be expressed as "falling into L41 but not falling into L31", the highest bit 1 falling into the 12th to 9th can be expressed as "falling into L51 but not falling into L41 but not falling into L32", and the highest bit 1 falling into the 4th to 1st can be expressed as "falling into L42 but not falling into L33 but not falling into L51", so r[3] can be determined by the coding values ​​of the above-mentioned relevant coding areas. like Fig.11 As shown, the third-level detection circuit can include three AND gates (represented by the symbol "AND") and one OR gate, and the input terminals of the three AND gates can be connected to the following combinations: the negation of L41 and L31, the negation of L51, L41 and L31, and the negation of L42, L51 and L33. When the output of any of the three AND gates is 1, r[3] is 1. For the fourth level, there are two coding areas L21 and L22. When the highest bit 1 of the initial data does not fall into any of the two coding areas, r[4] can be 1. If the highest bit 1 of the initial data does not fall into any of the two coding areas, the highest bit 1 should fall into the second-level non-coding area or does not exist, that is, the highest bit 1 should fall into the area from the 16th bit to the 8th bit or does not exist. Furthermore, the highest bit 1 should fall within the range from bit 16 to bit 8, which can be expressed as "falling into L51 but not falling into L41", and the absence of the highest bit 1 can be expressed as "not falling into L51 or L42", so r[4] can be determined by the code values ​​of the above-mentioned related coding areas. Fig.11 As shown, the 4th level detection circuit can include 2 AND gates and 1 OR gate. The inputs of the 2 AND gates can be connected to the following combinations: L51 and the negation of L41, L51 and the negation of L42. When the output of any of the 2 AND gates is 1, r[4] is 1. Based on similar logic, the remaining detection circuits can be designed as Fig.11 The structure shown.

[0066] according to Fig.10 and Fig.11It can be seen that from the 5th level to the 1st level, the number of non-coding regions increases, the number of cases where r[i] is 1 increases, and the number of gate-level circuits used by the detection circuit for outputting r[i] increases. Therefore, the delay of the detection circuit for r[i] increases as i decreases. As mentioned above, in the embodiment of the present disclosure, the detection circuits of each level are executed in parallel and output independently, and in the shift circuit, the highest-level sub-shift circuit is started first, and then started step by step downward. Therefore, the above delay will not significantly affect the overall execution efficiency, so that the scheme of the present disclosure can maximize the parallel execution of the shift control circuit and the shift circuit.

[0067] Each sub-shift circuit can decide whether to left-shift the input data before passing it to the next sub-shift circuit based on the shift control signal r[i] output by the corresponding detection circuit. After the sub-shift circuit of this level performs the corresponding shift operation or directly outputs the input data, the next detection circuit has already output the shift control signal and passed it to the corresponding next sub-shift circuit, which will also decide whether to perform the corresponding shift operation on the input data based on the received shift control signal. This cycle continues until the first sub-shift circuit outputs data, and then the normalized data corresponding to the initial data can be obtained. For example, if the output r[5] of the fifth detection circuit is 1, the fifth sub-shift circuit will shift the initial data left by 2. 4 bits, and pass the left-shifted data to the 4th-level sub-shift circuit; if r[4] output by the 4th-level detection circuit is 0, the 4th-level sub-shift circuit does not shift the input data, and passes the input data to the 3rd-level sub-shift circuit; and so on, until the operation of each level of sub-shift circuit is completed and the normalized data is output, wherein while the i-th-level sub-shift circuit processes the data, the i-1th-level detection circuit is also executed in parallel with it and obtains the value of r[i-1] in advance; the i-1th-level sub-shift circuit will decide whether to left-shift the data input from the i-th-level sub-shift circuit according to r[i-1].

[0068] For further example, assume that the initial data is 000000000000011010110111 (a total of 24 bits). Fig. 9When the circuit shown in the figure is used, each level of the encoding circuit is started in parallel and outputs the encoding value of each level of the encoding area; each level of the detection circuit is started in parallel and outputs the corresponding shift control signal based on the encoding value of the relevant encoding area. As described above, r[5] will be output first, and then r[4], r[3], r[2], and r[1] will be output in sequence. According to the logic described above, r[5] will be 0, r[4] will be 1, r[3] will be 1, r[2] will be 0, and r[1] will be 1. Accordingly, the fifth-level sub-shift circuit does not perform a shift operation on the initial data, and outputs the initial data to the fourth-level sub-shift circuit; the fourth-level sub-shift circuit performs an 8-bit left shift operation on the input data, and outputs the shifted data to the third-level sub-shift circuit; the third-level sub-shift circuit performs a 4-bit left shift operation on the input data, and outputs the shifted data to the second-level sub-shift circuit; the second-level sub-shift circuit does not perform a shift operation on the input data, and outputs the input data to the first-level sub-shift circuit; the first-level sub-shift circuit performs a 1-bit left shift operation on the input data, and outputs the shifted data as normalized data corresponding to the initial data. In addition, as described above, r[5], r[4], r[3], r[2], and r[1] can be spliced ​​into "01101" (if converted to decimal, it is 13) through a splicing circuit, which can represent the number of shifts performed on the initial data, that is, the total number of leading zeros detected.

[0069] It should be understood that the above-mentioned embodiments for 24-bit data are merely exemplary. In fact, the scheme provided in the present application can be used to process data with other bit numbers, such as 32 bits, 53 bits, 64 bits, etc., and the shift ranges involved in each level of shifting may also have different designs. For example, taking the above-mentioned embodiment of 24-bit data as an example, in addition to the shift ranges described in the embodiments described in detail above, the following shift ranges or other shift ranges may also be adopted: the shift range of the 5th level shift may include 1 12-bit shift interval (i.e., 24 to 13 bits), the shift range of the 4th level shift may include 2 6-bit shift intervals (i.e., 24 to 19 bits, 12 to 7 bits), and the shift range of the 3rd level shift may include 4 3-bit shift intervals (i.e., 24 to 22 bits, 1 The shift range of the first level shift can include 16 shift intervals of 1 bit (i.e., the 24th, 22nd, 21st, 19th, 18th, 16th, 15th, 13th, 12th, 10th, 9th, 7th, 6th, 4th, 3rd, and 1st bits).

[0070] In some embodiments, the present disclosure further provides a chip, which may include the circuit for data normalization described in the above various embodiments. Fig.12 FIG. 1 is a schematic block diagram of a chip 1200 according to some embodiments of the present disclosure. As shown in the figure, the chip 1200 may include Figure 2 The circuit 200 for data normalization is shown. In addition, the chip 1200 may also include other circuit structures. Exemplarily, the chip 1200 may be a processor chip, a controller chip, etc., or may be any chip that needs to implement the aforementioned data normalization operation.

[0071] In some embodiments, the present disclosure further provides a computing device, which includes the circuit for data normalization described in the above various embodiments. Fig.13 FIG. 1 is a schematic block diagram of a computing device 1300 according to some embodiments of the present disclosure. As shown in the figure, the computing device 1300 may include Figure 2 The circuit 200 for data normalization shown in FIG. 1 is a circuit for performing data normalization. In addition, the computing device 1300 may also include other circuit structures, such as a memory, etc. Optionally, the computing device 1300 may include a separately arranged circuit 200, or may include a device integrating the circuit 200, such as the aforementioned chip 1200. Exemplarily, the computing device 1300 may be various types of computing devices such as a server, a desktop computer, a tablet computer, a wearable smart device, or may be any device that needs to implement the aforementioned data normalization operation.

[0072] In some embodiments, the present disclosure also provides a method for data normalization. Fig.14 A schematic block diagram of a method 1400 for data normalization according to some embodiments of the present disclosure is shown. Specifically, the method 1400 may include steps 1410 to 1430.

[0073] In step 1410, initial data may be received. The initial data may have a bit width less than or equal to 2. n The data to be normalized is n, where n is an integer greater than 0.

[0074] In step 1420, n levels of detection can be performed in parallel for the initial data, wherein the i-th level detection includes: in response to the first non-zero value of the initial data being not within the shift range of the i-level shift, generating an i-level first signal value, or, in response to the first non-zero value of the initial data being within the shift range of the i-level shift, generating an i-level second signal value, wherein i is an integer greater than 0 and less than or equal to n.

[0075] In step 1430, n-level shift processing can be performed on the initial data, and the processed data can be output as normalized data corresponding to the initial data, wherein the i-th level shift processing in the n-level shift processing can include: receiving i-level input data, wherein when i is equal to n, the i-level input data is the initial data, and when i is greater than 0 and less than n, the i-level input data is the output data of the i+1-th level shift processing; in response to the i-level first signal value, performing i-level shift on the i-level input data toward the first bit direction and outputting the shifted data, or, in response to the i-level second signal value, outputting the i-level input data.

[0076] Similar to what has been mentioned above with respect to circuit 200, the n-level detection in step 1420 and the n-level shift processing in step 1430 may be performed at least partially in parallel, wherein each level of shift processing may be performed based on a signal generated by the corresponding level of detection, and a higher level of shift processing may be performed in parallel with a lower level of detection. In addition, method 1400 may have various embodiments and advantages similar to those described above with respect to circuit 200, which are not described in detail here for the sake of brevity.

[0077] Variations to the disclosed embodiments will be understood and effected by those skilled in the art in practicing the claimed subject matter by studying the drawings, the disclosure and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and "a" or "an" does not exclude a plurality. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.

Claims

1. A circuit for data normalization, comprising: The input terminal is configured to receive initial data, wherein the initial data has a bit width less than or equal to 2. n The data to be normalized, where n is an integer greater than 0; A shift control circuit, comprising n-stage detection circuits, wherein an i-th stage detection circuit in the n-stage detection circuits is configured to: output a first signal value in response to a first non-zero value of the initial data not being within a shift range of the i-stage shift, or output a second signal value in response to a first non-zero value of the initial data being within a shift range of the i-stage shift, wherein i is an integer greater than 0 and less than or equal to n; A shift circuit, comprising n-stage sub-shift circuits, wherein an n-stage sub-shift circuit among the n-stage sub-shift circuits receives the initial data as input data, and other i-stage sub-shift circuits receive output data of an i+1-stage sub-shift circuit as input data, and wherein the i-stage sub-shift circuit among the n-stage sub-shift circuits is configured to: in response to a first signal value from an i-stage detection circuit, perform the i-stage shift on the input data toward a first bit direction and output the shifted data, or, in response to a second signal value from the i-stage detection circuit, output the input data; The output end is configured to: output the output data of the first-stage sub-shift circuit in the shift circuit as normalized data corresponding to the initial data.

2. The circuit according to claim 1, wherein The shift control circuit further includes an n-level encoding circuit, wherein an i-th level encoding circuit in the n-level encoding circuit includes an i-th level partitioning circuit, wherein the i-th level partitioning circuit is configured to: determine at least one i-level encoding region based on the initial data, so that the at least one i-level encoding region just covers the shift range of the i-level shift, and, In which, the i-th level detection circuit is configured to: output a first signal value in response to the first non-zero value of the initial data not being in the at least one i-level coding area, or output a second signal value in response to the first non-zero value of the initial data being in the at least one i-level coding area.

3. The circuit according to claim 2, wherein: Each i-level coding area in the at least one i-level coding area has one of the following items as the first position: the first position of the initial data, the first position of the corresponding i+1-level coding area, and the first position of the corresponding i+1-level non-coding area, and each i-level coding area has an i-level preset bit width, and The shift width of the i-level shift is equal to the i-level preset bit width.

4. The circuit according to claim 3, wherein: The preset bit width of level i is 2 i-1 .

5. The circuit according to claim 4, wherein: The i-th level partitioning circuit is configured as follows: Starting from the first bit of the initial data, read 2 i-1 data bits, as an i-level coding area, and, Iteratively perform the following steps: in response to the remaining bit width in the initial data being greater than 2 i-1 , with a spacing of 2 from the previous i-level coding region i-1 After the data bits are read, 2 i-1 data bits as an i-level coding area, otherwise, stop reading the i-level coding area.

6. The circuit according to claim 4, further comprising: The splicing circuit is configured to splice the signal values ​​output by the detection circuits at each level and output splicing data.

7. The circuit according to claim 2, wherein: The i-th level encoding circuit further includes an i-th level assignment circuit, wherein the i-th level assignment circuit is configured to: for each i-th level encoding region of the at least one i-th level encoding region, in response to the i-th level encoding region containing a non-zero value, determine the encoding value corresponding to the i-th level encoding region as a first value, or, in response to the i-th level encoding region not containing a non-zero value, determine the encoding value corresponding to the i-th level encoding region as a second value; as well as In which, the i-th level detection circuit is configured to: output the first signal value in response to the coding value of at least one coding area among the i-to-n level coding areas indicating that the first non-zero value of the initial data is not in the at least one i-level coding area, or output the second signal value in response to the coding value of at least one coding area among the i-to-n level coding areas indicating that the first non-zero value of the initial data is in the at least one i-level coding area.

8. The circuit according to claim 7, wherein: The i-th level assignment circuit includes at least one OR circuit, each of the at least one OR circuit corresponds to an i-level coding area in the at least one i-level coding area, and is configured to: receive the value of each data bit in the corresponding i-level coding area, and output the coding value corresponding to the corresponding i-level coding area.

9. The circuit according to claim 7, wherein: The i-th level detection circuit comprises: At least one detection logic circuit, each detection logic circuit in the at least one detection logic circuit corresponds to one i-level coding region in the at least one i-level coding region and is configured to: In response to the coding values ​​of the coding areas falling within the range from the first bit of the initial data to the corresponding i-level coding area being the second value, and the coding values ​​of the coding areas covering the adjacent i-level non-coding areas after the corresponding i-level coding area and not covering the adjacent i-level coding areas after the corresponding i-level coding area being the first value or not existing, outputting the first signal value, otherwise, outputting the second signal value; The detection output circuit is configured to: in response to the presence of a first signal value in the output signal of the at least one detection logic circuit, output the first signal value; otherwise, output the second signal value.

10. The circuit according to claim 9, wherein: Each detection logic circuit of the at least one detection logic circuit is configured to: In response to the fact that the coding values ​​of at least one coding area that just covers the range from the first bit of the initial data to the corresponding i-level coding area and does not overlap with each other are all the second value, and the coding value of the coding area that covers the adjacent i-level non-coding area after the corresponding i-level coding area and does not cover the adjacent i-level coding area after the corresponding i-level coding area is the first value or does not exist, the first signal value is output; otherwise, the second signal value is output.

11. The circuit according to claim 10, wherein: Each of the at least one detection logic circuits includes an AND circuit, and an input end of the AND circuit is configured to receive at least one of the following two items: the negation of the coding value of at least one coding area that just covers the range from the first bit of the initial data to the corresponding i-level coding area and does not overlap with each other, and the coding value of a coding area that covers the corresponding i-level coding area and an adjacent i-level non-coding area after the corresponding i-level coding area.

12. The circuit according to any one of claims 1 to 11, wherein: The first non-zero value of the initial data is the first non-zero value starting from the highest bit of the initial data, and performing the i-stage shift on the input data toward the first bit includes: performing the i-stage shift on the input data toward the highest bit.

13. A chip comprising the circuit according to any one of claims 1 to 12.

14. A computing device comprising the circuit of any one of claims 1-12.

15. A method for data normalization, comprising: Receive initial data, the initial data has a bit width less than or equal to 2 n The data to be normalized, where n is an integer greater than 0; For the initial data, performing n-level detection in parallel, wherein the i-th level detection includes: in response to the first non-zero value of the initial data not being within the shift range of the i-level shift, generating an i-level first signal value, or in response to the first non-zero value of the initial data being within the shift range of the i-level shift, generating an i-level second signal value, wherein i is an integer greater than 0 and less than or equal to n; For the initial data, performing n-stage shift processing, and outputting the processed data as normalized data corresponding to the initial data, The i-th level shift processing in the n-level shift processing includes: Receive i-th level input data, wherein when i is equal to n, the i-th level input data is the initial data, and when i is greater than 0 and less than n, the i-th level input data is the output data of the i+1th level shift processing; In response to the i-level first signal value, the i-level shift is performed on the i-level input data toward the first position and the shifted data is output, or, in response to the i-level second signal value, the i-level input data is output.

Citation Information

Patent Citations

  • High-speed floating point normalized arithmetic device

    CN101751239A

  • Apparatus and method for fixed point to floating point conversion and negative power of two detector

    CN107769791A

  • Systems and methods to perform floating-point addition with selected rounding

    CN111767516A

  • Look ahead normaliser

    CN113326065A

  • Floating point arithmetic device, vector processing device, processor, and electronic apparatus

    CN116974512A