Exponent number calculation circuit for 2
The power-of-2 value calculation circuit uses a de Bruijn sequence-based table lookup and rounding circuit to address the challenge of achieving both compact size and high speed, enabling efficient RTL design by reducing circuit complexity and improving performance.
Patent Information
- Application Number
- JP2023059165
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2043-03-31
AI Technical Summary
Conventional power-of-2 value calculation circuits face challenges in achieving both a small circuit area and high operating speed, particularly in RTL design, as the number of required circuit stages increases with the bit width of the input value.
The power-of-2 value calculation circuit employs a de Bruijn sequence-based table lookup and rounding circuit to determine the maximum power of 2 value, utilizing a multiplication register, multiplication logic operation circuit, and additional processing circuits to generate a solution, enabling efficient calculation at the RTL design stage.
This approach allows for a compact and high-speed power-of-2 value calculation circuit, suitable for RTL design, by leveraging a de Bruijn sequence to efficiently calculate power-of-2 values with reduced circuit complexity and improved performance.
Smart Images

Figure 2024146331000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a power-of-two numerical calculation circuit. [Background technology]
[0002] The development of ASIC includes processes such as RTL (Register Transfer Level) design as a back-end, and is considered extremely important when turning the system being developed into a circuit. It is important that the circuits included in this system are as fast as possible and as small in size as possible.
[0003] For example, consider the case of creating a power-of-two calculation circuit. To find the power-of-two value of the 8-bit binary number "01000110", a bit counter BC is used to count the check bit position of the binary number "01000110". Also, a register R is used to copy the value of the bit counter BC when "1" is set in the check bit position.
[0004] As shown in Figure 1(a), when the lowest bit 0 is inspected, the value of the bit counter BC is "0" and the value of the register R is "0". Next, as shown in Figure 1(b), when the next lowest bit 1 is inspected, the value of the bit counter BC is "1" and because "1" is set in the 1st bit, the value of the register R is equal to the value of the bit counter BC and also becomes "1". Next, as shown in Figure 1(c), when the next bit 2 is inspected, the value of the bit counter BC is "2" and because "1" is set in the 2nd bit, the value of the register R is equal to the value of the bit counter BC and also becomes "2".
[0005] Next, as shown in Fig. 1(d), when the next third bit is inspected, the value of the bit counter BC is "3" and "0" is set to the third bit, so the value of the register R remains "2" unchanged from when the second bit was inspected. When the next fourth and fifth bits are inspected, the set bit values are "0", so the value of the register R remains "2" unchanged from when the second bit was inspected, and is therefore not shown in the figure.
[0006] When the sixth bit is next checked, the value of bit counter BC is "6" as shown in Figure 1(e), and because a "1" is set to the sixth bit, the value of register R is equal to the value of bit counter BC, also being "6". When the seventh bit is next checked, the value of bit counter BC is "7" as shown in Figure 1(f), and because a "0" is set to the seventh bit, the value of register R remains "6" as it was when the sixth bit was checked. As a result, the power of 2 is calculated to be "6".
[0007] In the example in Figure 2, eight selectors S0 to S7 are used. The selection of the selectors S0 to S7 is controlled by the output of the register in which each check bit of the 8-bit numerical value shown on the left side is set. The value of the bit to be checked is provided to the "1" input of the selectors S0 to S7, "0" is provided to the "0" input of the selector S0, and the output of the previous stage selector is provided to the "0" input of the selectors S1 to S7.
[0008] As a result of the above, the outputs of the selectors S0 to S7 are "0", "1", "2", "2", "2", "2", "6", and "6", and the power of 2 is calculated to be "6". In the above example, the result for 8'b01000110 (70 in decimal) is "6". This indicates that 2 to the power of 6 = 64, the largest power of 2 value not exceeding 70. In other words, it represents the position of the leftmost "1".
[0009] If the input value is 8 bits, an 8-stage circuit is required as shown above, and the number of stages of the circuit required increases accordingly as the bit width of the input value increases. Therefore, in an implementation using repetitive control, if the number of bits to be searched increases, it becomes difficult to configure it using a small circuit that can operate at high speed. As a result, designers had to devise an RTL design that made a trade-off between implementation area and high-speed operation, and had to consider the configuration based on the required specifications. As a result, it was impossible to achieve both area and operating speed, and the result was dependent on the designer's experience.
[0010] Patent Document 1 discloses a multiplication device for elements belonging to the Galois field of GF(2^m), comprising a shift register connected with a primitive irreducible polynomial in the Galois field of GF(2^m), a microprocessor, a register area for storing an element of the multiplicand and an element of the multiplier represented by the coefficients of the polynomials in a RAM subordinate to the microprocessor, a further register area for storing the operation result, and a multiplication instruction for the element of the multiplicand and the element of the multiplier written in a ROM area subordinate to the microprocessor, and a ROM area belonging to the microprocessor has m pieces of m-bit coefficient represented polynomials as constants, in which the exponentiation values of the primitive root α are 1, 2^2, 2^3...2^m-1, and an instruction is written in the multiplication device to multiply all of the m-bit coefficient represented polynomial constants corresponding to the digits that take the value of "1" when the exponentiation value is expressed in binary, as a means for finding an element having the exponentiation value to be found. However, the device described in Patent Document 1 includes a microprocessor and the like, and is not at the stage of RTL design.
[0011] Patent Document 2 also describes a method for exponentiating k, A, where k is an n-bit exponent value and A is the exponent value. k Before performing the exponentiation of k, the exponent value processing unit preprocesses the k, and the processed exponent value is input to the calculation unit together with A to obtain A. kThe patent document 2 shows the exponentiation numerical processing unit in an exponentiation device that performs the calculation. However, the patent document 2 also features a calculation method. In other words, by storing a program that executes the calculation method in a recording medium and installing it in a general-purpose computer, the above-mentioned modular exponentiation calculation can be executed by any computer, and is not at the RTL design stage.
[0012] Furthermore, Patent Document 3 discloses a device equipped with a power generation unit, but it is not at the RTL design stage. [Prior art documents] [Patent documents]
[0013] [Patent Document 1] Japanese Patent Application Publication No. 63-221425 [Patent Document 2] JP 2000-330470 A [Patent Document 3] International Publication No. WO2020 / 084692 Summary of the Invention [Problem to be solved by the invention]
[0014] As described above, conventional power-of-two numerical calculation circuits are not designed to balance area and operating speed.
[0015] The present invention has been made in consideration of the problems associated with the conventional power-of-two numerical calculation circuits as described above, and an object of the present invention is to provide a power-of-two numerical calculation circuit that can be used in the RTL design stage and that enables both area and operating speed to be achieved. [Means for solving the problem]
[0016] The power-of-two number calculation circuit according to the present invention, when performing processing on a target binary number which is an m-bit binary number and is the subject of processing to determine what (X) power of 2 number it contains, prepares m binary numbers so that when each of the N bits is set to 1 or 0 to make a binary number, it becomes a Z (integer)-ary number ranging from 0 to (m-1), and when these m binary numbers are right-shifted one bit at a time and arranged, the D-bit binary number value generated is called a De Brown sequence, and a table is created in which the amount of right shift corresponds to the Z-ary number represented by the N-bit binary numbers arranged at that time, and the target binary number is set in an m-bit first-stage register, and the circuit performs logical operation processing including a process of inverting each bit. The present invention is characterized in that it comprises: a rounding circuit which rounds to a one-hot representation number; a multiplication register which sets a binary number resulting from the rounding circuit, the multiplication register having the same D bits as the binary number of the de Brown sequence and which is created by filling vacant boxes of (Dm) bits from the top in the D-bit register with 0; a multiplication logic operation circuit which performs a multiplication by a logical operation corresponding to the multiplication using the value of the multiplication register as the multiplicand, the de Brown sequence which is the D-bit binary number; an operation result register which sets the operation result by the multiplication logic operation circuit; and a solution generating circuit which searches the table based on the Z-ary number represented by the leading N-bit binary number of the operation result register and sets the corresponding shift amount as a solution.
[0017] In the power-of-two numerical calculation circuit according to the present invention, the multiplication logic operation circuit is characterized in that it comprises an addition numerical value generation circuit which shifts the numerical value of the multiplication register according to an ordinal value corresponding to the position of each bit in the de Brown sequence which is the multiplicand, and sets the shifted numerical value in the multiplication register in an addition register corresponding to the number of bits in the de Brown sequence which are set to 1, and a logical OR circuit which creates a logical OR of the values of the addition register and sets the result in the operation result register.
[0018] In the power of 2 numerical calculation circuit of the present invention, the rounding circuit is comprised of a first inversion processing circuit which inverts the high and low digits of the numerical value in the first stage register and sets the result in the second stage register; an inversion and 1 addition circuit which inverts the 0s and 1s of each bit of the numerical value in the second stage register and adds 1 to generate a binary number and sets the result in a third stage register; a logical AND operation circuit which performs a logical AND operation on the numerical value in the second stage register and the numerical value in the third stage register and sets the result in a fourth stage register; and a second inversion processing circuit which inverts the high and low digits of the numerical value in the fourth stage register and sets the result in a fifth stage register, and the numerical value set in the fifth stage register is the processing result. [Brief description of the drawings]
[0019] [Figure 1] FIG. 1 shows an example of a conventional calculation circuit that calculates a power-of-two value based on the bit positions of binary numbers where the bit is 1. [Diagram 2] FIG. 1 is a diagram showing an example of a conventional calculation circuit that uses a selector to calculate a power-of-two value. [Diagram 3] FIG. 2 is a diagram showing the configuration of a main part of a power of 2 numerical calculation circuit according to an embodiment of the present invention. [Figure 4] FIG. 2 is a configuration diagram of a power of 2 numerical calculation circuit according to an embodiment of the present invention, in which the target binary number is 8 bits. [Diagram 5] FIG. 2 is a diagram showing the configuration of a main part of a power of 2 numerical calculation circuit according to an embodiment of the present invention. [Figure 6] FIG. 2 is a diagram showing the configuration of a main part of a power of 2 numerical calculation circuit according to an embodiment of the present invention. [Figure 7] FIG. 2 is a configuration diagram of a power of 2 numerical calculation circuit according to an embodiment of the present invention, in which the target binary number is 8 bits. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0020] Hereinafter, an embodiment of the power of 2 numerical value calculation circuit according to the present invention will be described with reference to the accompanying drawings. In each drawing, the same components are assigned the same reference numerals and duplicated explanations will be omitted. In this embodiment, the table 100 shown in FIG. 3 is provided. In the case of performing the above-mentioned processing on a target binary number that is an m-bit binary value and is the target of processing to determine what (X) power of 2 the value of is included in, when each bit of N bits is set to 1 or 0 to make a binary number, m binary numbers are prepared so that the binary number is a Z (integer) number from 0 to (m-1), and the D-bit binary number generated by shifting these m binary numbers one bit at a time to the right and arranging them is called a de Brown sequence, and the shift amount of the right shift and the Z-ary number represented by the N-bit binary number arranged at that time are associated and tabulated. In this embodiment, the description will be given assuming Z=10, but it goes without saying that Z can be any integer.
[0021] This table 100 is used when performing the above-mentioned processing on a target binary number that is the subject of processing to determine the maximum power of 2 (X) that the m-bit binary number contains. In the embodiment of Fig. 3, this table 100 is used in processing to determine the maximum power of 2 (X) that the 8-bit binary number contains.
[0022] To create table 100, m binary numbers are prepared so that when each bit of N bits is set to 1 or 0 to make a binary number, the resulting number is a decimal number ranging from 0 to (m-1). In this embodiment, (m=8) binary numbers are prepared so that the resulting number is a decimal number ranging from 0 to 7. That is, as shown on the left side of FIG. 3, (0,0,0)=0, (0,0,1)=1, (0,1,1)=3, (1,1,1)=7, (1,1,0)=6, (1,0,1)=5, (0,1,0)=2, and (1,0,0)=4 are prepared. Here, N=3.
[0023] The D-bit binary number generated when these m binary numbers are shifted to the right by one bit each and arranged is called a De Bruijn sequence. In other words, when the above eight binary numbers are shifted to the right by one bit each and arranged, it becomes "10'b0001110100". In other words, a De Bruijn sequence is a sequence in which eight three-bit binary numbers are shifted to the right by one bit each and arranged, and the order of the eight binary numbers is random regardless of the size of the numbers. Therefore, the De Bruijn sequence "10'b0001110100" used in this embodiment is just one example, and there are other sequences that can be used in a power-of-two numerical calculation circuit for 8-bit binary numbers.
[0024] In general, the number of bits D of the de Brown sequence used when performing the above process on a target binary number that is an m-bit binary number and is the target of a process to determine the maximum power (X) of 2 it contains can be calculated as follows: In other words, if the de Brown sequence is a D-bit binary number, and m N-bit binary numbers ranging from 0 to (m-1) are required to express each bit of the m-bit target binary number, then D=N+(m-1) because DN=(m-1).
[0025] Table 100 associates the decimal value represented by the N-bit binary number arranged when creating the de Brown sequence with the shift amount when m binary numbers are arranged by shifting them to the right by one bit at a time. In other words, table 100 is created with the decimal value represented by the N-bit binary number arranged when creating the de Brown sequence as an index, and the shift amount when m binary numbers are arranged by shifting them to the right by one bit at a time as a value.
[0026] Then, the target binary number is rounded to a one-hot representation number and multiplied by the de Brown sequence "10'b0001110100" to obtain the result. The power-of-two value can be obtained by looking up the first N (=3) bits of this result in table 100.
[0027] 4, a rounding circuit 200 is provided which sets the target binary number in an m-bit first stage register and rounds it to a one-hot representation number by logical operation processing including processing to invert each bit. The power of 2 numerical calculation circuit of this embodiment is equipped with a multiplication register 300, a multiplication logical operation circuit 400, an operation result register 500, and an answer generating circuit 600 in addition to the rounding circuit 200.
[0028] The multiplication register 300 is used to set the binary number resulting from the rounding process by the rounding circuit 200. The multiplication register 300 has the same D bits as the binary number of the De Brown sequence, and is created by filling vacant boxes of the first (Dm) bits in the D-bit register with 0. The multiplication logic operation circuit 400 performs a logical operation to perform multiplication using the value in the multiplication register as the multiplicand, which corresponds to the multiplication of the De Brown sequence, which is the D-bit binary value. The operation result register 500 is used to set the operation result of the multiplication logic operation circuit 400. The solution generating circuit 600 searches the table 100 based on the decimal number represented by the N-bit binary number from the beginning of the operation result register 500, and determines the corresponding shift amount as a solution.
[0029] As shown in FIG. 5, the multiplication logic operation circuit 400 includes an addition value generation circuit 410 and a logical OR circuit 420. The adder value generating circuit 410 shifts the value of the multiplication register 300 according to an ordinal value (meaning the ordinal value indicating the ordinal number of the bit set to 1) corresponding to the position of each bit in the de Brown sequence, which is the multiplicand, and sets the value in adder registers 431, 432, 433, 434 corresponding to the number of bits in the de Brown sequence that are set to 1. In the example of Fig. 4, since there are four bits in the de Brown sequence that are set to 1, four adder registers 431, 432, 433, 434 are provided. The above shifting may be performed by using the adder registers 431, 432, 433, 434 as shift registers. The logical sum circuit 420 creates a logical sum of the values of the addition registers 431 , 432 , 433 , and 434 and sets the result in the operation result register 500 .
[0030] As shown in FIG. 6, the rounding circuit 200 includes a first inversion circuit 230, an inversion-1 addition circuit 250, a logical AND operation circuit 260, and a second inversion circuit 290. The first inversion processing circuit 230 inverts the high-order and low-order digits of the value in the first-stage register 210 and sets the value in the second-stage register 220 .
[0031] The inverting and adding one circuit 250 inverts the value of each bit of the second stage register 220 (0, 1) and adds 1 to generate a binary number, which is then set in the third stage register 240. The logical product operation circuit 260 performs a logical product operation on the value of the second stage register 220 and the value of the third stage register 240 , and sets the result in a fourth stage register 270 . The second inversion processing circuit 290 inverts the numerical value of the fourth stage register 270 and sets it in the fifth stage register 280 by inverting the high and low digits. The rounding circuit 200 is configured as described above, and takes the numerical value set in the fifth stage register 280 as the processing result.
[0032] In the power-of-two numerical calculation circuit having the above configuration, assume that 8'b01000110 (70 in decimal) is given as the target binary number and 10'b0001110100 (116 in decimal) is used as the de Brown sequence. In this case, the table 100 shown in Figure 3 is created.
[0033] 4 to 6, the first three bits become 010, which is the decimal value of 2. When table 100 is searched using this 2 as an index, the answer is 6.
[0034] Next, we will explain the case where the target binary number is 64 bits. When the target binary number is 64 bits, it is treated as a De Brownian sequence, as follows: "69'b0000001011000100101 Prepare a code such as "0000110010001111110100111010101011110011011100000" and use the first 6 bits of the value multiplied by the input value.
[0035] The power-of-two calculation circuit for this binary number is shown in Figure 7. If this 69-bit value is also shifted left by one bit, all the numbers from 0 to 63 will appear in the first 6 bits one by one. From this value, a table 100 with 64 entries is prepared.
[0036] 7, the first 6 bits become the index value in decimal. When this index is used to search table 100, the answer is found.
[0037] In the above embodiment, the circuit configuration has been described, but it goes without saying that the power of 2 numerical calculation circuit of this embodiment can be applied to synthesis algorithm synthesis of a logic synthesis tool. Therefore, even if the circuit of this embodiment is synthesized by an RTL description that performs a bit position search using a repetitive syntax, the configuration is within the scope of the present invention as long as it is conceivable from the present invention, and a small and high-speed circuit can be provided by the configuration.
[0038] Although several embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their modifications are included in the scope and spirit of the invention, and are included in the scope of the invention and its equivalents described in the claims. [Explanation of symbols]
[0039] 100 Tables 200 Rounding Circuit 210 First stage register 220 Second stage register 230 First inversion processing circuit 240 3rd stage register 250 Inversion and 1 addition circuit 260 Logical AND Circuit 270 4th stage register 280 5th stage register 290 Second inversion processing circuit 300 Multiplication Registers 400 Multiplication logic circuit 410 Addition Number Generation Circuit 420 OR circuit 431 Addition Register 500 Calculation result register 600 Solution generation circuit
Claims
1. When performing the above process on a target binary number which is an m-bit binary number and is the subject of a process for determining the maximum power (X) of 2 it contains, when a binary number is formed by setting each of the N bits to 1 or 0, m binary numbers are prepared so that the binary number is a Z (integer) number ranging from 0 to (m-1), and the m binary numbers are right-shifted one bit at a time and arranged to generate a D-bit binary number, which is called a de Brown sequence, and a table is created by associating the amount of the right shift with the Z-ary number represented by the N-bit binary number arranged at that time; a rounding circuit that sets the target binary number in an m-bit first stage register and rounds the target binary number to a one-hot representation number by logical operation processing including a process of inverting each bit; a multiplication register for setting a binary number resulting from the rounding process by the rounding circuit, the multiplication register having the same D bits as the binary number of the De Brown sequence, the multiplication register being created by filling vacant boxes of (D-m) bits from the top of the D-bit register with 0; a multiplication logic operation circuit which performs a multiplication corresponding to a multiplication by a logical operation using the value of the multiplication register as a multiplicand, the De Brown sequence being the value of the D-bit binary number; an operation result register for setting an operation result by the multiplication logic operation circuit; a solution generating circuit which searches the table based on a Z-ary number represented by an N-bit binary number from the beginning of the calculation result register, and takes the corresponding shift amount as a solution; A power of 2 numerical calculation circuit comprising:
2. The multiplication logic circuit comprises: an addition value generating circuit which shifts the value of the multiplication register according to an ordinal value corresponding to the position of each bit in the de Brown sequence which is the multiplicand and sets the value in an addition register corresponding to the number of bits in the de Brown sequence which are set to 1; a logical sum circuit which creates a logical sum of the values in the addition register and sets the logical sum in the operation result register; 2. The power of 2 numerical calculation circuit according to claim 1, characterized in that it is configured as follows:
3. The rounding circuit includes: a first inversion processing circuit for inverting the upper and lower order of the numerical value of the first stage register and setting it in a second stage register; an inversion and 1 addition circuit for inverting the 0 or 1 of the value of each bit of the second stage register, adding 1 to generate a binary number and setting the binary number in a third stage register; a logical AND operation circuit for performing a logical AND operation on the value of the second stage register and the value of the third stage register and setting the result in a fourth stage register; a second inversion processing circuit for inverting the upper and lower order of the numerical value of the fourth stage register and setting it in a fifth stage register; 3. The power of 2 numerical value calculation circuit according to claim 1, wherein the numerical value set in said fifth stage register is a processing result.
Citation Information
Patent Citations
Power arithmetic unit for primitive root of galois field GF (2M)
JP1988221425A
Power arithmetic unit, power residue arithmetic unit, elliptic power multiplication point arithmetic unit and method and recording medium therefor
JP2000330470A
Computation processing device and computation processing device control method
WO2020084692A1
Cited By
Heavy duty tire
EP4703149A1
