US7197526B1 - Method and apparatus for calculating the remainder of a modulo division - Google Patents
Method and apparatus for calculating the remainder of a modulo division Download PDFInfo
- Publication number
- US7197526B1 US7197526B1 US09/321,611 US32161199A US7197526B1 US 7197526 B1 US7197526 B1 US 7197526B1 US 32161199 A US32161199 A US 32161199A US 7197526 B1 US7197526 B1 US 7197526B1
- Authority
- US
- United States
- Prior art keywords
- remainder
- produce
- computer
- divisor
- dividend
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/60—Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
- G06F7/72—Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
- G06F7/727—Modulo N arithmetic, with N being either (2**n)-1,2**n or (2**n)+1, e.g. mod 3, mod 4 or mod 5
Definitions
- the present invention relates to a method and apparatus for calculating the remainder of a modulo division, and more particularly, to a non-iterative technique for calculating the remainder of a modulo division.
- M mod n operations are utilized in a number of computer processes, for example, address generating, communication channel load balancing, computer graphics, telephone switching and telephone transmission, packet switching and transmission, and digital message encoding/decoding. Therefore, a routine that accepts integers m and n and produces m mod n is a useful computer tool.
- N D Q + R D ( 1 )
- step C2: Q 2 1 ?
- the traditional iterative algorithm for determining the remainder of modulo division is a general purpose method, in that any two positive integers may be entered for N and D.
- the present invention is directed to a method and apparatus for calculating the remainder of a modulo division.
- the present invention is directed to a non-iterative technique for calculating the remainder of modulo division.
- the present invention requires significantly fewer operations than the traditional iterative technique for the same calculation.
- the number of calculations requires in the present invention is independent of the number of bits of the divisor in the modulo operation.
- the value of the divisor D should be equal to 2 n ⁇ 1 (where n is the number of bits of the divisor D) and the value of the dividend N should be less than or equal to (D ⁇ 1) 2 , but great than or equal to zero.
- Reed-Solomon coding involves algebraic operations in a Galois field.
- Reed-Solomon coding is a type of forward-error correcting coding that is used extensively in data communications.
- both conditions of the technique of the present invention are met and the algorithm of the present invention greatly improves the Reed-Solomon coding speed.
- the present invention is at least four times faster than the traditional iterative algorithm for a 16-bit fixed-point digital signal processor with special instructions supporting iterative division.
- the algorithm of the present invention is at least twelve times faster than the traditional iterative algorithm.
- FIG. 1 illustrates a flowchart of the traditional iterative method for determining the remainder of a modulo division.
- FIG. 2 illustrates a hardware arrangement of the present invention of one embodiment.
- FIG. 3 illustrates a flowchart of the technique of the present invention for determining the remainder of a modulo division.
- FIG. 2 illustrates an apparatus of the present invention in one embodiment.
- a coder 10 which includes a processing unit 12 , which implements the algorithm of the present invention.
- the processing unit 12 which performs the algorithm of the present invention, may receive a computer program to implement the algorithm of the present invention via an article of manufacture 14 or propagated signal 20 .
- the article of manufacture 14 further includes a medium 16 , in addition to the computer program 18 .
- the processing unit 12 may be any analog or digital processor, and either hardwired or software programmable to carry out the algorithm of the present invention.
- Processing unit 12 could be a general purpose processor, a digital processor (DSP), an algorithmic logic unit (ALU), or any other processing element, either discrete or integrated, which performs the algorithm to be described below.
- the coder 10 could be any type of coder which includes the processing unit 12 , such as, for example, a Reed-Solomon coder.
- the processing unit 12 implements a non-iterative technique for calculating the remainder of modulo division.
- the number of calculations performed by the processing unit 12 is independent of the number of bits of the divisor in the modulo operation.
- Two requirements of the non-iterative algorithm of the present invention are that the value of the divisor D should be equal to 2 n ⁇ 1 (where n is the number of bits of the divisor D) and the value of the dividend N should be less than or equal to (D ⁇ 1) 2 , but greater than or equal to 0. If the two conditions set forth are met, the remainder R of M mod D is determined by summing the upper n 2 and lower n 2 bits of the dividend N to produce the remainder R.
- the two conditions described above enable the processing unit 12 to determine the remainder of a modulo division operation with significantly fewer operations than the traditional iterative technique for the same calculation.
- Equation 8 shows the sum of Q′ and R′ can be equal to R or R+D.
- R a nonnegative integer less than D as shown in Equation 3
- a j the jth bit of N
- N ⁇ (D ⁇ 1) 2 means N is less than or equal to 2 ⁇ n bits.
- FIG. 3 A flow chart of the present invention is illustrated in FIG. 3 .
- Example 2 set forth below, is explained in conjunction with the flowchart illustrated in FIG. 3 .
- the remainder of 25 mod 7 is correctly computed to be 4. Comparing the present invention to the traditional iterative technique, the present invention only requires 5 operations for determining the remainder R, as illustrated in Example 2, whereas the traditional iterative technique, as illustrated in Example 1, requires 21 operations.
- Another example illustrates the additional processing performed in step F′ of the present invention.
- the remainder of 15 mod 7 is correctly computed to be 1.
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Computational Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Detection And Correction Of Errors (AREA)
- Error Detection And Correction (AREA)
Abstract
and lower
bits of the dividend N.
Description
where
-
- N is the dividend,
- D is the divisor,
- Q is the quotient,
- R is the remainder, and
- 0≦R<D.
where Qj is the jth bit of Q,Qj={0,1} for all j
step A1: | R(3) = 25, Q3 = 1, j = 2 | ||
step B1: | j < 0 ? No | ||
step C1: | Q3 = ? Yes | ||
step D1: | R(2) = R(3) − D2J = 25 − (7)(4) = −3 | ||
step E1: | R(2) < 0 ? Yes | ||
step F1: | Qj = Q2 = 0 | ||
step G1: | j = j − 1 = 2 − 1 = 1 | ||
step B2: | j < 0 ? No | ||
step C2: | Q2 = 1 ? No | ||
step H1: | R(1) = R(2) + D2J = −3 + (7)(2) = 11 | ||
step E2: | R(1) < 0 ? No | ||
step I1: | Q1 = 1 | ||
step G2: | j = j − 1 = 1 − 1 = 0 | ||
step B3: | j < 0 ? No | ||
step C3: | Q1 = 1 ? Yes | ||
step D2: | R(0) = R(1) − D2J = 11 − (7)(1) = 4 | ||
step E3: | R(0) < 0 ? No | ||
step I2: | Q0 = 1 | ||
step G3: | j = j − 1 = 0 − 1 = −1 | ||
step B4: | j < 0 ? Yes | ||
step J1: | R = R(−1) = R(0) + (1 − Q0) · D = 4 + (1 − 1)7 = 4 | ||
and lower
bits of the dividend N to produce the remainder R. The two conditions described above enable the
where
0≦R<D
Rearrange the equation above gives:
N=Q·D+R (4)
Equation 4 can be written as
Equation 5 can be reduced to
N=Q′·(D+1)+R′ (6)
where,
Comparing Equation 4 and Equation 6 it can be seen that Q′ and R′ are the quotient and remainder of N(mod (D+1)) and Equation 7 gives the relationship between Q, R and Q′, R′. Adding Q′ and R′ gives:
If the quotient Q′ and remainder R′ of N(mod(D+1)) are available, the remainder of N(mod D) can be obtained using Equation (9).
where aj is the jth bit of N,aj={0,1} for all j then (D+1)=2n. This fact results in a quick method of obtaining Q′ and R′. Assuming N≦(D−1)2 means N is less than or equal to 2·n bits. The binary representation of N is:
where
Comparing Equation 6 and
Equation (12) means that the quotient Q′ and remainder R′ of N(mod (D+1)) are the numbers made up by the high and low n bits of N, respectively.
If N=25 and n=3,
011:001
step A′: | a = high bits of N → a = 011 | ||
step B′: | b = low n bits of N → b = 001 | ||
step C′: | c = a + b = 100 | ||
step D′: | c < D ? Yes | ||
step E′: | N(mod D) = c = 100 = 4 | ||
If N=15 and n=3,
001:111
step A′: | a = high n bits of N → a = 001 | ||
step B′: | b = low n bits of N → b = 111 | ||
step C′: | c = a + b = 1000 | ||
step D′: | 1000 < 0111 ? No | ||
step F′: | c = c − D = 1000 − 0111 = 0001 | ||
step E′: | N (mod D) = c = 0001 = 1 | ||
Claims (46)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US09/321,611 US7197526B1 (en) | 1999-05-28 | 1999-05-28 | Method and apparatus for calculating the remainder of a modulo division |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US09/321,611 US7197526B1 (en) | 1999-05-28 | 1999-05-28 | Method and apparatus for calculating the remainder of a modulo division |
Publications (1)
Publication Number | Publication Date |
---|---|
US7197526B1 true US7197526B1 (en) | 2007-03-27 |
Family
ID=37886183
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US09/321,611 Expired - Fee Related US7197526B1 (en) | 1999-05-28 | 1999-05-28 | Method and apparatus for calculating the remainder of a modulo division |
Country Status (1)
Country | Link |
---|---|
US (1) | US7197526B1 (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040236812A1 (en) * | 2001-11-30 | 2004-11-25 | Yosef Stein | Compound galois field engine and galois field divider and square root engine and method |
US20050149597A1 (en) * | 2002-04-29 | 2005-07-07 | Wieland Fischer | Device and method for converting a term |
US20070261040A1 (en) * | 2005-09-20 | 2007-11-08 | The Mathworks, Inc. | System and method for transforming graphical models |
US7506015B1 (en) * | 2004-11-05 | 2009-03-17 | Xilinx, Inc. | Generation of a remainder from division of a first polynomial by a second polynomial |
US20090193066A1 (en) * | 2008-01-28 | 2009-07-30 | Fujitsu Limited | Communication apparatus, method of checking received data size, multiple determining circuit, and multiple determination method |
US20130051669A1 (en) * | 2011-08-29 | 2013-02-28 | Novatek Microelectronics Corp. | Image adjustment method |
CN102982784A (en) * | 2011-09-06 | 2013-03-20 | 联咏科技股份有限公司 | Image adjusting method |
CN112363687A (en) * | 2020-11-27 | 2021-02-12 | Oppo广东移动通信有限公司 | Integer modular operation method and device and terminal equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4384341A (en) * | 1980-12-24 | 1983-05-17 | Honeywell Information Systems Inc. | Data processor having carry apparatus supporting a decimal divide operation |
US5199070A (en) * | 1990-12-18 | 1993-03-30 | Matsushita Electric Industrial Co., Ltd. | Method for generating a public key |
US5724279A (en) * | 1995-08-25 | 1998-03-03 | Microsoft Corporation | Computer-implemented method and computer for performing modular reduction |
US6125380A (en) * | 1998-04-13 | 2000-09-26 | Winbond Electronics Corporation | Dividing method |
US6175850B1 (en) * | 1997-02-03 | 2001-01-16 | Nippon Telegraph And Telephone Corporation | Scheme for carrying out modular calculations based on redundant binary calculation |
US6275311B1 (en) * | 1997-06-30 | 2001-08-14 | Pirelli Cavi E Sistemi S.P.A. | Optical device for processing an optical digital signal |
-
1999
- 1999-05-28 US US09/321,611 patent/US7197526B1/en not_active Expired - Fee Related
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4384341A (en) * | 1980-12-24 | 1983-05-17 | Honeywell Information Systems Inc. | Data processor having carry apparatus supporting a decimal divide operation |
US5199070A (en) * | 1990-12-18 | 1993-03-30 | Matsushita Electric Industrial Co., Ltd. | Method for generating a public key |
US5724279A (en) * | 1995-08-25 | 1998-03-03 | Microsoft Corporation | Computer-implemented method and computer for performing modular reduction |
US6175850B1 (en) * | 1997-02-03 | 2001-01-16 | Nippon Telegraph And Telephone Corporation | Scheme for carrying out modular calculations based on redundant binary calculation |
US6275311B1 (en) * | 1997-06-30 | 2001-08-14 | Pirelli Cavi E Sistemi S.P.A. | Optical device for processing an optical digital signal |
US6125380A (en) * | 1998-04-13 | 2000-09-26 | Winbond Electronics Corporation | Dividing method |
Non-Patent Citations (6)
Title |
---|
Bini et al. (Improved parallel polynomial division and its extensions; IEEE, pp. 131-136; Oct. 24-27, 1992. * |
Burgess (Efficient RNS to binary conversion using high-radix SRT division; IEEE; pp. 1240-1243 ; 1-4 Nov. 1998). * |
Gala et al. (A high speed VLSI algorithm for A*B modulo N; IEEE, pp. 389-392 vol. 1; Aug. 12-14, 1990). * |
Orton et al. (New fault tolerant techniques for residue number systems; IEEE, pp. 1453-1464; Nov. 1992). * |
Saha, A et al. (Design and FPGA implementation of efficient integer arithmetic algorithms; IEEE, pp. 4 p; Apr. 4-7, 1993). * |
Stout (Basic Electrical Measurements; 2d Ed., 1960; pp. 82-85.) * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040236812A1 (en) * | 2001-11-30 | 2004-11-25 | Yosef Stein | Compound galois field engine and galois field divider and square root engine and method |
US7895253B2 (en) * | 2001-11-30 | 2011-02-22 | Analog Devices, Inc. | Compound Galois field engine and Galois field divider and square root engine and method |
US7493356B2 (en) * | 2002-04-29 | 2009-02-17 | Infineon Technologies Ag | Device and method for cryptoprocessor |
US20050149597A1 (en) * | 2002-04-29 | 2005-07-07 | Wieland Fischer | Device and method for converting a term |
US7506015B1 (en) * | 2004-11-05 | 2009-03-17 | Xilinx, Inc. | Generation of a remainder from division of a first polynomial by a second polynomial |
US8180820B1 (en) | 2004-11-05 | 2012-05-15 | Xilinx, Inc. | Generation of a remainder from division of a first polynomial by a second polynomial |
US20070261040A1 (en) * | 2005-09-20 | 2007-11-08 | The Mathworks, Inc. | System and method for transforming graphical models |
US20090193066A1 (en) * | 2008-01-28 | 2009-07-30 | Fujitsu Limited | Communication apparatus, method of checking received data size, multiple determining circuit, and multiple determination method |
US8489665B2 (en) * | 2008-01-28 | 2013-07-16 | Fujitsu Limited | Communication apparatus, method of checking received data size, multiple determining circuit, and multiple determination method |
US20130051669A1 (en) * | 2011-08-29 | 2013-02-28 | Novatek Microelectronics Corp. | Image adjustment method |
US8634643B2 (en) * | 2011-08-29 | 2014-01-21 | Novatek Microelectronics Corp. | Image adjustment method |
CN102982784A (en) * | 2011-09-06 | 2013-03-20 | 联咏科技股份有限公司 | Image adjusting method |
CN102982784B (en) * | 2011-09-06 | 2015-03-04 | 联咏科技股份有限公司 | Image adjusting method |
CN112363687A (en) * | 2020-11-27 | 2021-02-12 | Oppo广东移动通信有限公司 | Integer modular operation method and device and terminal equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Miller | Short programs for functions on curves | |
TWI383595B (en) | Efficient check node message transform approximation for ldpc decoder | |
EP2283417B1 (en) | Implementation of arbitrary galois field arithmetic on a programmable processor | |
JP3541066B2 (en) | Method and apparatus for performing division and square root calculations in a computer | |
KR950015182B1 (en) | Galois field multiplying circuit | |
JP3891997B2 (en) | Modular binary multiplier for variable width signed and unsigned operands | |
US6976043B2 (en) | Technique for approximating functions based on lagrange polynomials | |
EP0622727A1 (en) | System for optimizing argument reduction | |
EP0621698B1 (en) | Error correction method including erasure correction, and apparatus therefore | |
US6175851B1 (en) | Fast adder/subtractor for signed floating point numbers | |
JP2557193B2 (en) | Floating point calculation execution method and floating point unit | |
EP0596175A1 (en) | Apparatus for executing the argument reduction in exponential computations of IEEE standard floating-point numbers | |
US7197526B1 (en) | Method and apparatus for calculating the remainder of a modulo division | |
US8244790B2 (en) | Multiplier and cipher circuit | |
US5260889A (en) | Computation of sticky-bit in parallel with partial products in a floating point multiplier unit | |
US20050071414A1 (en) | Methods for performing multiplication operations on operands representing complex numbers | |
Bernstein | How to find smooth parts of integers | |
US20010025293A1 (en) | Divider | |
US20090006509A1 (en) | High-radix multiplier-divider | |
US7100103B2 (en) | Efficient method for fast decoding of BCH binary codes | |
US7366745B1 (en) | High-speed function approximation | |
Burgess et al. | Choices of operand truncation in the SRT division algorithm | |
US6697833B2 (en) | Floating-point multiplier for de-normalized inputs | |
US20030126542A1 (en) | Method and apparatus for computing reed-solomon error magnitudes | |
JP3768613B2 (en) | Log approximate value calculation circuit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
AS | Assignment |
Owner name: LUCENT TECHNOLOGIES INC., NEW JERSEY Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:QU, DONGHUI;REEL/FRAME:010267/0404 Effective date: 19990911 |
|
FEPP | Fee payment procedure |
Free format text: PAYOR NUMBER ASSIGNED (ORIGINAL EVENT CODE: ASPN); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY |
|
STCF | Information on status: patent grant |
Free format text: PATENTED CASE |
|
FPAY | Fee payment |
Year of fee payment: 4 |
|
FPAY | Fee payment |
Year of fee payment: 8 |
|
FEPP | Fee payment procedure |
Free format text: MAINTENANCE FEE REMINDER MAILED (ORIGINAL EVENT CODE: REM.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY |
|
LAPS | Lapse for failure to pay maintenance fees |
Free format text: PATENT EXPIRED FOR FAILURE TO PAY MAINTENANCE FEES (ORIGINAL EVENT CODE: EXP.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY |
|
STCH | Information on status: patent discontinuation |
Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362 |
|
FP | Lapsed due to failure to pay maintenance fee |
Effective date: 20190327 |