KR20050041567A - Binary integral numbers modulo calculation method - Google Patents

Binary integral numbers modulo calculation method Download PDF

Info

Publication number
KR20050041567A
KR20050041567A KR1020030076776A KR20030076776A KR20050041567A KR 20050041567 A KR20050041567 A KR 20050041567A KR 1020030076776 A KR1020030076776 A KR 1020030076776A KR 20030076776 A KR20030076776 A KR 20030076776A KR 20050041567 A KR20050041567 A KR 20050041567A
Authority
KR
South Korea
Prior art keywords
bit
value
integer
binary
mod
Prior art date
Application number
KR1020030076776A
Other languages
Korean (ko)
Inventor
문상국
Original Assignee
매그나칩 반도체 유한회사
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 매그나칩 반도체 유한회사 filed Critical 매그나칩 반도체 유한회사
Priority to KR1020030076776A priority Critical patent/KR20050041567A/en
Publication of KR20050041567A publication Critical patent/KR20050041567A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/499Denomination or exception handling, e.g. rounding or overflow
    • G06F7/49905Exception handling
    • G06F7/4991Overflow or underflow
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods 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/72Methods 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/727Modulo N arithmetic, with N being either (2**n)-1,2**n or (2**n)+1, e.g. mod 3, mod 4 or mod 5

Abstract

본 발명은 논리 회로의 추가 없이 임의의 k 비트 이진 정수 N에 대한 모듈로 연산을 수행할 수 있는 이진 정수 모듈로 연산 방법에 관한 것으로, 임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법에 있어서, k 비트 이진 정수 x에 최상위 비트를 추가로 할당하여 (k+1) 비트 정수 [0, x]를 만드는 제 1 단계와, (k+1) 비트 정수 [0, x]에 N을 더해서 2k가 되는 정수 (2k-N)의 값을 더하는 제 2 단계와, 제 2 단계에서의 결과 값의 (k+1) 번째 비트로 오버플로우(overflow)가 발생하면 결과 값(x mod N)으로 제 2 단계에서의 결과 값의 k 비트만의 값을 출력하고, (k+1) 번째 비트 값으로 오버플로우가 발생하지 않으면 결과 값(x mod N)으로 x의 값을 출력하는 제 3 단계를 포함한다.The invention as in any of the k-bit binary integer module capable of performing a modulo operation on a binary integer N on the calculation method, a random binary integer N (2 k-1 <k N≤2 without the addition of logic circuits In a modulo operation method of an arbitrary integer x (0 ≦ x ≦ 2 k −1) with respect to −1), the most significant bit is additionally assigned to a k-bit binary integer x such that (k + 1) bit integer [0, x], the second step of adding the value of the integer (2 k -N) to be 2 k by adding N to the (k + 1) bit integer [0, x], and the second step If an overflow occurs with the (k + 1) th bit of the result value, only the k bits of the result value in the second step are output as the result value (x mod N), and the (k + 1) th bit. If no overflow occurs with a value, a third step of outputting a value of x as a result value (x mod N) is included.

Description

이진 정수 모듈로 연산 방법{Binary integral numbers modulo calculation method}Binary integral numbers modulo calculation method

본 발명은 모듈로(modulo) 연산 방법에 관한 것으로, 보다 상세하게는 논리 회로의 추가 없이 임의의 k 비트 이진 정수 N에 대한 모듈로 연산을 수행할 수 있는 이진 정수 모듈로 연산 방법에 관한 것이다.The present invention relates to a modulo operation method, and more particularly to a binary integer modulo operation method capable of performing a modulo operation for any k-bit binary integer N without the addition of a logic circuit.

일반적으로 모듈로 연산 방법은 블루투스 베이스 밴드(bluetooth based band) 내의 호핑 주파수(hoping frequency)를 계산하는데 필수적일 뿐만 아니라 코딩이나 암호학적인 응용분야에서 필수적으로 사용된다.In general, the modulo operation is not only necessary for calculating the hopping frequency within the Bluetooth base band, but also for coding or cryptographic applications.

종래 기술에 따른 모듈로 연산 방법에서 k 비트 이진 정수 x(0≤x≤2k)를 모듈러스(mod) N(2k-1<N<2k)으로 나타내기 위해서는 다음과 같은 연산이 필요하다.It is to indicate the k-bit binary integer x (0≤x≤2 k) The modulo (mod) N (2 k- 1 <N <2 k) in a computing method as a module according to the prior art requires the following operations: .

만약 x가 '0'이상이고 N보다 작은 조건(0≤x<N)을 만족하면, x의 모듈러스 N(x mod N)은 x와 같아진다.If x is greater than '0' and satisfies a condition less than N (0 ≦ x <N), then modulus N (x mod N) of x is equal to x.

또한 x가 N이상이고 2k이하의 조건(N≤x≤2k)이 된다면, x의 모듈러스 N(x mod N)은 x-N이 된다.Further, if x is greater than or equal to N and 2 k or less (N ≦ x ≦ 2 k ), then modulus N (x mod N) of x becomes xN.

다시 말해서 x의 범위가 N보다 작을 때는 상관이 없지만, k 비트 내에서 N보다 큰 경우에는 N을 빼야한다는 것을 의미한다.In other words, it does not matter when the range of x is smaller than N, but it means that N must be subtracted if it is larger than N within k bits.

이를 구현하기 위해서는 x와 N의 크기를 비교하는 k 비트 비교기가 필요하다.To implement this, we need a k-bit comparator that compares the sizes of x and N.

따라서 정해진 N 값에 대한 비교기의 구현은 최대 k 비트 이하의 비교 논리 회로를 별도로 구성해야 하는 문제점이 있다.Therefore, the implementation of a comparator for a given N value has a problem in that a comparison logic circuit having a maximum of k bits or less must be separately configured.

상기 문제점을 해결하기 위한 본 발명의 목적은 논리 회로의 추가 없이 이진 정수 모듈로 연산을 수행하는 것이다.An object of the present invention to solve the above problem is to perform operations with binary integer modules without the addition of logic circuitry.

상기 목적을 달성하기 위한 본 발명의 이진 정수 모듈로 연산 방법은, 임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법에 있어서, k 비트 이진 정수 x에 최상위 비트를 추가로 할당하여 (k+1) 비트 정수 [0, x]를 만드는 제 1 단계; 상기 (k+1) 비트 정수 [0, x]에 N을 더해서 2k가 되는 정수 (2k-N)의 값을 더하는 제 2 단계; 및 상기 제 2 단계에서의 결과 값의 (k+1) 번째 비트로 오버플로우(overflow)가 발생하면 결과 값(x mod N)으로 상기 제 2 단계에서의 결과 값의 k 비트만의 값을 출력하고, 상기 (k+1) 번째 비트 값으로 오버플로우가 발생하지 않으면 상기 결과 값(x mod N)으로 상기 x의 값을 출력하는 제 3 단계를 포함하는 것을 특징으로 한다.Computing method as a binary integer module of the present invention for achieving the abovementioned objects is an arbitrary integer x (0≤x≤2 k -1 for an arbitrary binary integers N (2 k-1 <N≤2 k -1) A modulo operation method of claim 1, comprising: a first step of further assigning a most significant bit to a k-bit binary integer x to produce a (k + 1) bit integer [0, x]; Said (k + 1) bit integers [0, x] a second step adding the N adds the value of k 2 is an integer (2 k -N) is in; And when an overflow occurs in the (k + 1) th bit of the result value in the second step, outputs a value of only k bits of the result value in the second step as a result value (x mod N). And outputting the value of x as the result value (x mod N) if the overflow does not occur with the (k + 1) th bit value.

상술한 목적 및 기타의 목적과 본 발명의 특징 및 이점은 첨부도면과 관련한 다음의 상세한 설명을 통해 보다 분명해 질 것이다.The above and other objects and features and advantages of the present invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings.

이하, 첨부 도면을 참조하여 본 발명의 실시예를 상세히 설명하면 다음과 같다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

본 발명의 원리는 N이 2k일 때 모듈로 덧셈 연산의 구현이 간단하다는 점을 이용하는 것이다.The principle of the present invention is to take advantage of the simplicity of implementation of the modulo add operation when N is 2 k .

N이 2k일 때 모듈로 연산을 구현하는 방법은 단순히 연산 결과 비트 수를 k 비트로 제한하는 것이다.The way to implement a modulo operation when N is 2 k is to simply limit the result bit to k bits.

즉, x와 y가 '0'이상이고 2k-1이하의 정수이면(0≤x≤2k-1, 0≤y≤2k-1), x와 y를 더한 값은 0이상과 2×2k-2이하의 범위에 속한다(0≤x+y≤2×2k-2). 여기서 결과 비트 수를 k 비트로 제한하면, x와 y를 더한 값은 0이상과 2k-1이하의 범위에 속한다(0≤x+y≤2k-1).That is, if x and y are greater than or equal to '0' and less than or equal to 2 k -1 (0≤x≤2 k -1, 0≤y≤2 k -1), the sum of x and y is greater than or equal to 2 × 2 k -2 is within the scope of the following (0≤x + y≤2 × 2 k -2 ). Here, if the number of result bits is limited to k bits, the sum of x and y is in the range of 0 or more and 2 k −1 or less (0 ≦ x + y ≦ 2 k −1).

이와 같은 원리에 의해 N이 2k인 경우에는 비트 수의 제한만으로 모듈로 연산이 가능하다.According to this principle, when N is 2k , modulo operation can be performed only by limiting the number of bits.

본 발명에서는 이러한 원리를 이용하기 위해 비트 수를 하나 늘리고 2k-N이란 값을 오퍼랜드(operand)에 더하여 최상위 비트에 오버플로우(overflow)가 발생하는지 여부를 확인하여 올바른 결과 값을 선택하는 방법을 사용한다.In the present invention, in order to use this principle, a method of selecting a correct result value by increasing the number of bits and adding a value of 2 k -N to an operand to determine whether an overflow occurs in the most significant bit is performed. use.

본 발명에 따른 임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법은 먼저, k 비트 이진 정수 x에 '0'의 값을 갖는 상위 비트를 하나 더 할당하여 (k+1) 비트 정수 [0, x]를 만든다.Modulo operation of the random integer x (0≤x≤2 k -1) for the random binary integer N (2 k-1 <N≤2 k -1) The process according to the invention, first, k-bit binary integer; We assign (k + 1) bit integer [0, x] to x by assigning another higher bit with a value of '0'.

이 정수에 N을 더해서 2k가 되는 정수, 즉 (2k-N)의 값을 더한다(t=[0, x]+2k-N).N is added to this constant, and an integer equal to 2 k , that is, a value of (2 k -N) is added (t = [0, x] + 2 k -N).

이때 만일 x의 값이 N보다 크고 (2k-1) 이하의 값이라면(N<x≤(2k-1)) 최상위 비트 자리에 추가되었던 (k+1)번째 비트로 오버플로우(overflow)가 발생한다.If the value of x is greater than N and less than (2 k -1) (N <x≤ (2 k -1)), overflow occurs to the (k + 1) th bit added to the most significant bit position. Occurs.

(k+1)번째 비트의 값이 '1'이면 결과 값(x mod N)으로 정의된 t 값의 k 비트만을 취하고, (k+1)번째 비트 값이 '0'이면 그대로 x의 값을 결과 값(x mod N)으로 취한다.If the value of the (k + 1) th bit is '1', only the k bits of the t value defined as the result value (x mod N) are taken. If the (k + 1) th bit value is '0', the value of x is taken as it is. Take the result (x mod N).

도 1은 본 발명에 따른 임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법을 구현하기 위한 블록도이다.1 is for implementing a method for calculating a module of the random integer x (0≤x≤2 k -1) for the random binary integer N (2 k-1 <N≤2 k -1) according to the invention It is a block diagram.

(k+1)비트 가산기(1)는 k 비트 이진 정수 x에 '0'의 값을 갖는 상위 비트를 하나 더 할당한 (k+1)비트 정수 [0, x]에 N을 더해서 2k가 되는 k 비트 정수 (2k-N)의 값을 더한다.The (k + 1) bit adder (1) adds N to the (k + 1) bit integer [0, x], which allocates one more significant bit with a value of '0' to the k bit binary integer x, thereby adding 2 k . The value of the k-bit integer (2 k -N) is added.

멀티플렉서(2)는 오버플로우된 (k+1)번째 MSB 값에 따라 정수 x 값 또는 가산기(1)로부터 출력된 (k+1) 비트의 결과 값 t 중에서 k 비트의 값을 x의 모듈러스 N 값(x mod N)으로 출력한다.The multiplexer 2 selects the k-bit value from the integer x value or the result value t of the (k + 1) bit output from the adder 1 according to the overflowed (k + 1) th MSB value and modulus N value of x. output as (x mod N)

즉, (k+1)번째 MSB의 값이 '1'이면 정의된 t 값의 k 비트만을 결과 값(mod N)으로 취하고, (k+1)번째 MSB의 값이 '0'이면 그대로 x의 값을 결과 값(x mod N)으로 취한다.That is, if the value of the (k + 1) th MSB is '1', only k bits of the defined t value are taken as the result value (mod N) .If the value of the (k + 1) th MSB is '0', the value of x Take the value as the result (x mod N).

이상에서 살펴본 바와 같이, 본 발명에 따른 이진 정수 모듈로 연산 방법은 논리 회로를 추가할 필요 없이 효율적으로 임의의 k 비트 이진 정수 N에 대한 모듈로 연산을 수행하여 어떠한 정수 x의 N에 대한 모듈러스를 구하고, 이를 이용하여 두 개 이상의 정수의 모듈로 덧셈에도 응용할 수 있는 효과가 있다.As described above, the binary integer modulo operation method according to the present invention performs modulo operation on any k-bit binary integer N efficiently without adding a logic circuit, thereby modulating the modulus of N of any integer x. It can be applied to the addition of modules of two or more integers.

아울러 본 발명의 바람직한 실시예는 예시의 목적을 위한 것으로, 당업자라면 첨부된 특허청구범위의 기술적 사상과 범위를 통해 다양한 수정, 변경, 대체 및 부가가 가능할 것이며, 이러한 수정 변경 등은 이하의 특허청구범위에 속하는 것으로 보아야 할 것이다.In addition, a preferred embodiment of the present invention is for the purpose of illustration, those skilled in the art will be able to various modifications, changes, substitutions and additions through the spirit and scope of the appended claims, such modifications and changes are the following claims It should be seen as belonging to a range.

도 1은 본 발명에 따른 임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법을 구현하기 위한 블록도.1 is for implementing a method for calculating a module of the random integer x (0≤x≤2 k -1) for the random binary integer N (2 k-1 <N≤2 k -1) according to the invention Block diagram.

Claims (2)

임의의 이진 정수 N(2k-1<N≤2k-1)에 대한 임의의 정수 x(0≤x≤2k-1)의 모듈로 연산 방법에 있어서,In the method for calculating a module of the random integer x (0≤x≤2 k -1) for the random binary integer N (2 k-1 <N≤2 k -1), k 비트 이진 정수 x에 최상위 비트를 추가로 할당하여 (k+1) 비트 정수 [0, x]를 만드는 제 1 단계;a first step of further assigning the most significant bit to the k bit binary integer x to produce a (k + 1) bit integer [0, x]; 상기 (k+1) 비트 정수 [0, x]에 N을 더해서 2k가 되는 정수 (2k-N)의 값을 더하는 제 2 단계; 및Said (k + 1) bit integers [0, x] a second step adding the N adds the value of k 2 is an integer (2 k -N) is in; And 상기 제 2 단계에서의 결과 값의 (k+1) 번째 비트로 오버플로우(overflow)가 발생하면 결과 값(x mod N)으로 상기 제 2 단계에서의 결과 값의 k 비트만의 값을 출력하고, 상기 (k+1) 번째 비트 값으로 오버플로우가 발생하지 않으면 상기 결과 값(x mod N)으로 상기 x의 값을 출력하는 제 3 단계를 포함하는 것을 특징으로 하는 이진 정수 모듈로 연산 방법.If overflow occurs in the (k + 1) th bit of the result value in the second step, output only a value of k bits of the result value in the second step as a result value (x mod N), And a third step of outputting the value of x as the result value (x mod N) if the overflow does not occur with the (k + 1) th bit value. 제 1 항에 있어서, 상기 제 2 단계에서The method of claim 1, wherein in the second step 상기 (k+1) 비트 정수 [0, x]의 값이 N보다 크고 (2k-1) 이하의 값이라면 최상위 비트 자리에 추가되었던 (k+1)번째 비트로 오버플로우가 발생하는 것을 특징으로 하는 이진 정수 모듈로 연산 방법.If the value of the (k + 1) bit integer [0, x] is greater than N and less than (2 k -1), overflow occurs to the (k + 1) th bit added to the most significant bit position. Binary integer modulo operation method.
KR1020030076776A 2003-10-31 2003-10-31 Binary integral numbers modulo calculation method KR20050041567A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020030076776A KR20050041567A (en) 2003-10-31 2003-10-31 Binary integral numbers modulo calculation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020030076776A KR20050041567A (en) 2003-10-31 2003-10-31 Binary integral numbers modulo calculation method

Publications (1)

Publication Number Publication Date
KR20050041567A true KR20050041567A (en) 2005-05-04

Family

ID=37243030

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020030076776A KR20050041567A (en) 2003-10-31 2003-10-31 Binary integral numbers modulo calculation method

Country Status (1)

Country Link
KR (1) KR20050041567A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417757B2 (en) 2006-12-07 2013-04-09 Electronics And Telecommunications Research Institute Method and apparatus for modulo N calculation wherein calculation result is applied to match speeds in wireless communication system
KR101318992B1 (en) * 2009-12-16 2013-10-16 한국전자통신연구원 Modulo n calculation method and apparatus thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417757B2 (en) 2006-12-07 2013-04-09 Electronics And Telecommunications Research Institute Method and apparatus for modulo N calculation wherein calculation result is applied to match speeds in wireless communication system
KR101318992B1 (en) * 2009-12-16 2013-10-16 한국전자통신연구원 Modulo n calculation method and apparatus thereof

Similar Documents

Publication Publication Date Title
KR100236536B1 (en) Modulo address generator
US7205800B2 (en) Clock frequency divider circuit
JPH04250490A (en) Encrypting system based on chaos theory
US8495116B2 (en) Circuit and method converting boolean and arithmetic masks
US20050097153A1 (en) Pseudorandom number generator
US7024560B2 (en) Power-residue calculating unit using Montgomery algorithm
JP2006227939A (en) Arithmetic unit
US7480691B2 (en) Arithmetic device for multiple precision arithmetic for Montgomery multiplication residue arithmetic
US6581078B1 (en) Random number generating circuit and process
KR20050041567A (en) Binary integral numbers modulo calculation method
CN113810169A (en) Homomorphic encryption device and ciphertext arithmetic method thereof
JP4567753B2 (en) Parity generation circuit, counting circuit, and counting method
US8933731B2 (en) Binary adder and multiplier circuit
US10608675B1 (en) Method for performing polar decoding with aid of notation transformation and associated polar decoder
CN111431541A (en) Method and device for obtaining CRC (Cyclic redundancy check) code
KR100307705B1 (en) Layered orthogonal code generation apparatus and method
JP2010122246A (en) Inverse computing device and inverse computing program
KR101311617B1 (en) Method and apparatus of address bus coding/decoding for low-power very large scale integration system
KR100456035B1 (en) Divider
US20220308840A1 (en) Reciprocal calculating method and reciprocal calculating apparatus
CN102214082B (en) Zoom device for residue number system
KR19980052741A (en) Modulo address generator and its method
KR100275527B1 (en) Apparatus and method for generating word random number
Vimalkumar et al. FPGA Implementation of Modified Lightweight 128-Bit AES Algorithm for IoT Applications
JP2013167740A (en) Encryption device, encryption method, and encryption program

Legal Events

Date Code Title Description
N231 Notification of change of applicant
WITB Written withdrawal of application