RU2711051C1 - Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo - Google Patents

Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo Download PDF

Info

Publication number
RU2711051C1
RU2711051C1 RU2019116125A RU2019116125A RU2711051C1 RU 2711051 C1 RU2711051 C1 RU 2711051C1 RU 2019116125 A RU2019116125 A RU 2019116125A RU 2019116125 A RU2019116125 A RU 2019116125A RU 2711051 C1 RU2711051 C1 RU 2711051C1
Authority
RU
Russia
Prior art keywords
input
bit
output
information
control unit
Prior art date
Application number
RU2019116125A
Other languages
Russian (ru)
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 RU2019116125A priority Critical patent/RU2711051C1/en
Application granted granted Critical
Publication of RU2711051C1 publication Critical patent/RU2711051C1/en

Links

Images

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/57Arithmetic logic units [ALU], i.e. arrangements or devices for performing two or more of the operations covered by groups G06F7/483 – G06F7/556 or for performing logical operations
    • 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
    • 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/722Modular multiplication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • G06F9/3001Arithmetic instructions

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Error Detection And Correction (AREA)

Abstract

FIELD: computer equipment.SUBSTANCE: invention relates to computer engineering and can be used in digital computing devices, in digital signal processing devices, as well as in cryptographic applications. Device includes n-bit registers, n-bit accumulating adders by module, n-bit two-input and n-bit three-input multiplexers, n-bit inverters, n-bit adder, n-bit electronic switch, input and output n-bit buses, control unit module.EFFECT: multiplication, addition and subtraction of numbers modulo.1 cl, 2 dwg, 1 tbl

Description

Изобретение относится к вычислительной технике и может быть использовано в цифровых вычислительных устройствах, в устройствах цифровой обработки сигналов, а также в криптографических приложениях.The invention relates to computer technology and can be used in digital computing devices, in digital signal processing devices, as well as in cryptographic applications.

Известно устройство для выполнения операций по заданному модулю (патент РФ №2310223, МПК G06F 7/72, Бюл. №31, 2007 г.), содержащее полные сумматоры, элементы И, элементы ИЛИ, управляющие входы. Недостатком устройства является квадратичная зависимость количества оборудования от разрядности операндов.A device is known for performing operations on a given module (RF patent No. 2310223, IPC G06F 7/72, Bull. No. 31, 2007), containing complete adders, AND elements, OR elements, control inputs. The disadvantage of this device is the quadratic dependence of the amount of equipment on the capacity of the operands.

Наиболее близким по технической сущности к заявляемому изобретению является арифметико-логическое устройство для умножения чисел по модулю (патент РФ №2653263, МПК G06F 7/523, G06F 7/72, Бюл. №13, 2018 г.), содержащее три n-разрядных регистра, два n-разрядных накапливающих сумматора по модулю, n-разрядный двухвходовый мультиплексор, n-разрядный электронный ключ, входную и выходную n-разрядные шины, где n – количество разрядов в двоичном коде операндов, а также модуль управляющего блока. Недостатком устройства является невозможность выполнения операций сложения и вычитания чисел по модулю.The closest in technical essence to the claimed invention is an arithmetic logic device for multiplying modulo numbers (RF patent No. 2653263, IPC G06F 7/523, G06F 7/72, Bull. No. 13, 2018), containing three n-bit register, two n-bit accumulating adders modulo, n-bit two-input multiplexer, n-bit electronic key, input and output n-bit buses, where n is the number of bits in the binary code of the operands, as well as the control unit module. The disadvantage of this device is the inability to perform operations of addition and subtraction of numbers modulo.

Техническим результатом данного изобретения является расширение функциональных возможностей устройства за счет введения операций сложения и вычитания по модулю.The technical result of this invention is to expand the functionality of the device by introducing operations of addition and subtraction modulo.

Для достижения технического результата в арифметико-логическое устройство для сложения, вычитания и умножения чисел по модулю, содержащее три n-разрядных регистра, два n-разрядных накапливающих сумматора по модулю, n-разрядный двухвходовый мультиплексор, n-разрядный электронный ключ, входную и выходную n-разрядные шины, где n – количество разрядов в двоичном коде операндов, а также модуль управляющего блока, причем информационные входы первого и второго n-разрядных регистров соединены со входной n-разрядной шиной, первый информационный вход n-разрядного двухвходового мультиплексора соединен со входной n-разрядной шиной, второй информационный вход соединен с информационным выходом первого n-разрядного накапливающего сумматора по модулю, управляющий вход соединен со вторым выходом модуля управляющего блока, информационный выход соединен с информационным входом третьего n-разрядного регистра, управляющий вход которого соединен с четвертым выходом модуля управляющего блока, а информационный выход соединен со вторым информационным входом первого n-разрядного накапливающего сумматора по модулю, второй управляющий вход которого соединен с пятым выходом модуля управляющего блока, второй управляющий вход второго n-разрядного накапливающего сумматора по модулю соединен с шестым выходом модуля управляющего блока, информационный выход соединен с информационным входом n-разрядного электронного ключа, информационный выход которого соединен с выходной n-разрядной шиной, а управляющий вход соединен с восьмым выходом модуля управляющего блока, первый выход которого соединен с первыми управляющими входами n-разрядных накапливающих сумматоров по модулю и управляющим входом первого n-разрядного регистра, третий выход соединен с первым управляющим входом второго n-разрядного регистра, седьмой выход соединен со вторым управляющим входом второго n-разрядного регистра, на первый вход подается одноразрядный код команды умножения по модулю, введены два n-разрядных инвертора, n-разрядный сумматор, n-разрядный трехвходовый мультиплексор, причем информационный выход первого n-разрядного инвертора соединен с n младшими разрядами первых информационных входов n-разрядных накапливающих сумматоров по модулю, на (n+1)-й разряд которых подается уровень логической «1», выход первого n-разрядного регистра соединен со входом первого n-разрядного инвертора и с первым информационным входом n-разрядного сумматора, на вход переноса которого подается уровень логической «1», информационный выход третьего n-разрядного регистра соединен также с первым информационным входом n-разрядного трехвходового мультиплексора, младший разряд адресного входа которого соединен с девятым выходом модуля управляющего блока, старший разряд соединен с десятым выходом модуля управляющего блока, информационный выход соединен со вторым информационным входом второго n-разрядного накапливающего сумматора по модулю, третий информационный вход соединен с выходом n-разрядного сумматора, второй информационный вход которого соединен с выходом второго n-разрядного инвертора, информационный выход второго n-разрядного регистра соединен со вторым информационным входом n-разрядного трехвходового мультиплексора и входом второго n-разрядного инвертора, младший разряд соединен с пятым входом модуля управляющего блока, на второй вход которого подается одноразрядный код команды сложения по модулю, на третий вход подается одноразрядный код команды вычитания по модулю, на четвертый вход подаются тактовые импульсы, причем модуль управляющего блока содержит два трехвходовых элемента ИЛИ, два двухвходовых элемента И, r-разрядный счетчик, r-входовый дешифратор, где r = ⌈log2 (2n+4)⌉, трехразрядный демультиплексор, блок ПЗУ, два (n-1)-входовых элемента ИЛИ, девятиразрядный электронный ключ, два элемента задержки, инвертор, двухвходовый элемент ИЛИ, три RS-триггера, одноразрядный демультиплексор, причем первый вход первого трехвходового элемента ИЛИ, соединенный с адресным входом трехразрядного демультиплексора, является первым входом модуля управляющего блока, второй вход, соединенный с первым входом второго трехвходового элемента ИЛИ, является вторым входом модуля управляющего блока, третий вход, соединенный со вторым входом второго трехвходового элемента ИЛИ и адресным входом одноразрядного демультиплексора, является третьим входом модуля управляющего блока, выход первого трехвходового элемента ИЛИ соединен со входом инвертора и с первым входом первого двухвходового элемента И, второй вход которого является четвертым входом модуля управляющего блока, выход соединен со входом первого элемента задержки и со счетным входом r-разрядного счетчика, выходы которого соединены с соответствующими информационными входами r-входового дешифратора, первый и второй выходы которого соединены с первым и вторым адресными входами блока ПЗУ соответственно, третий, четвертый и пятый выходы соединены с первым, вторым и третьим разрядами информационного входа трехразрядного демультиплексора соответственно, каждый 2k-й выход соединен с (k-1)-м входом первого (n-1)-входового элемента ИЛИ, каждый (2k+1)-й выход соединен с (k-1)-м входом второго (n-1)-входового элемента ИЛИ, где k = 3, 4, …, n, (2n+2)-й выход соединен с девятым адресным входом блока ПЗУ, (2n+3)-й выход соединен с десятым адресным входом блока ПЗУ, первый, второй и третий разряды первого выхода трехразрядного демультиплексора соединены с третьим, четвертым и пятым адресными входами блока ПЗУ соответственно, первый разряд второго выхода соединен с шестым адресным входом блока ПЗУ, второй разряд второго выхода соединен с первым входом первого (n-1)-входового элемента ИЛИ, третий разряд второго выхода соединен с первым входом второго (n-1)-входового элемента ИЛИ, выход первого (n-1)-входового элемента ИЛИ соединен с седьмым адресным входом блока ПЗУ, выход второго (n-1)-входового элемента ИЛИ соединен с восьмым адресным входом блока ПЗУ, шестой выход которого соединен с первым входом второго двухвходового элемента И, выход которого соединен с шестым разрядом информационного входа девятиразрядного электронного ключа, второй вход соединен с выходом второго трехвходового элемента ИЛИ, третий вход которого является пятым входом модуля управляющего блока, первый, второй, третий, четвертый, пятый, седьмой, восьмой и девятый выходы блока ПЗУ соединены соответственно с первым, вторым, третьим, четвертым, пятым, седьмым, восьмым и девятым разрядами информационного входа девятиразрядного электронного ключа, управляющий вход которого соединен с выходом первого элемента задержки, первый разряд выхода соединен с R-входами второго и третьего RS-триггеров и с первым входом двухвходового элемента ИЛИ, а также является первым выходом модуля управляющего блока, второй разряд выхода соединен с S-входом второго RS-триггера, третий, четвертый, пятый, шестой и седьмой разряды выхода являются третьим, четвертым, пятым, шестым и седьмым выходами модуля управляющего блока соответственно, восьмой разряд выхода соединен с S-входом первого RS-триггера, девятый разряд выхода соединен со входом второго элемента задержки, выход которого соединен с S-входом третьего RS-триггера, выход которого соединен с информационным входом одноразрядного демультиплексора, первый выход которого является девятым выходом модуля управляющего блока, второй выход является десятым выходом модуля управляющего блока, выход инвертора соединен со вторым входом двухвходового элемента ИЛИ, выход которого соединен с R-входом первого RS-триггера, выход которого соединен со входом сброса r-разрядного счетчика, а также является восьмым выходом модуля управляющего блока, выход второго RS-триггера является вторым выходом модуля управляющего блока.To achieve a technical result in an arithmetic logic device for adding, subtracting and multiplying numbers modulo, containing three n-bit registers, two n-bit accumulative adders modulo, an n-bit two-input multiplexer, n-bit electronic key, input and output n-bit buses, where n is the number of bits in the binary code of the operands, as well as the control unit module, the information inputs of the first and second n-bit registers connected to the input n-bit bus, the first information input d n-bit two-input multiplexer is connected to the input n-bit bus, the second information input is connected to the information output of the first n-bit accumulating adder modulo, the control input is connected to the second output of the control unit module, the information output is connected to the information input of the third n-bit register, the control input of which is connected to the fourth output of the control unit module, and the information output is connected to the second information input of the first n-bit accumulatively about an adder modulo, the second control input of which is connected to the fifth output of the control unit module, the second control input of the second n-bit accumulating adder modulo is connected to the sixth output of the control unit module, the information output is connected to the information input of the n-bit electronic key, information output which is connected to the output n-bit bus, and the control input is connected to the eighth output of the control unit module, the first output of which is connected to the first control inputs of the n-bit accumulative adders modulo and the control input of the first n-bit register, the third output is connected to the first control input of the second n-bit register, the seventh output is connected to the second control input of the second n-bit register, the first input is supplied with a single-bit modulation multiply command code , introduced two n-bit inverters, an n-bit adder, an n-bit three-input multiplexer, and the information output of the first n-bit inverter is connected to the n least significant bits of the first information inputs n-bit accumulative adders modulo, at the (n + 1) -th bit of which logic level “1” is supplied, the output of the first n-bit register is connected to the input of the first n-bit inverter and to the first information input of the n-bit adder, the transfer input of which the logical level “1” is supplied, the information output of the third n-bit register is also connected to the first information input of the n-bit three-input multiplexer, the least significant bit of the address input of which is connected to the ninth output of the control unit module, the lowest discharge is connected to the tenth output of the control unit module, the information output is connected to the second information input of the second n-bit accumulating adder modulo, the third information input is connected to the output of the n-bit adder, the second information input of which is connected to the output of the second n-bit inverter, the information output of the second n-bit register is connected to the second information input of the n-bit three-input multiplexer and the input of the second n-bit inverter, the least significant bit is connected inen with the fifth input of the control unit module, to the second input of which a one-bit modulus addition command code is supplied, the one-bit modulus subtraction command code is supplied to the third input, clock pulses are supplied to the fourth input, and the control unit module contains two three-input OR elements, two two-input AND element, r-bit counter, r-input decoder, where r = ⌈log 2 (2n + 4) ⌉, three-bit demultiplexer, ROM unit, two (n-1) -input OR elements, nine-bit electronic key, two delay elements inverter two-input OR element, three RS-flip-flops, one-bit demultiplexer, the first input of the first three-input OR element connected to the address input of the three-bit demultiplexer is the first input of the control unit module, the second input connected to the first input of the second three-input OR element is the second input of the module the control unit, the third input connected to the second input of the second three-input OR element and the address input of the single-bit demultiplexer is the third input of the control module of its block, the output of the first three-input element OR is connected to the input of the inverter and to the first input of the first two-input element AND, the second input of which is the fourth input of the control unit module, the output is connected to the input of the first delay element and to the counting input of the r-bit counter, the outputs of which are connected with the corresponding information inputs of the r-input decoder, the first and second outputs of which are connected to the first and second address inputs of the ROM unit, respectively, the third, fourth and fifth outputs are connected with the first, second, and third bits of the information input of a three-bit demultiplexer, respectively, each 2kth output is connected to the (k-1) -th input of the first (n-1) -input OR element, each (2k + 1) -th output is connected to the (k-1) -th input of the second (n-1) -input OR element, where k = 3, 4, ..., n, (2n + 2) -th output is connected to the ninth address input of the ROM unit, (2n + 3 ) -th output is connected to the tenth address input of the ROM unit, the first, second and third bits of the first output of the three-bit demultiplexer are connected to the third, fourth and fifth address inputs of the ROM unit, respectively Actually, the first bit of the second output is connected to the sixth address input of the ROM unit, the second bit of the second output is connected to the first input of the first (n-1) input element OR, the third bit of the second output is connected to the first input of the second (n-1) input element OR, the output of the first (n-1) -input OR element is connected to the seventh address input of the ROM unit, the output of the second (n-1) -input element OR is connected to the eighth address input of the ROM unit, the sixth output of which is connected to the first input of the second two-input element And, the output of which is connected to In the ninth bit of the information input of the nine-digit electronic key, the second input is connected to the output of the second three-input OR element, the third input of which is the fifth input of the control unit module, the first, second, third, fourth, fifth, seventh, eighth and ninth outputs of the ROM unit are connected respectively to the first , second, third, fourth, fifth, seventh, eighth and ninth bits of the information input of a nine-digit electronic key, the control input of which is connected to the output of the first delay element, the first the first bit of the output is connected to the R-inputs of the second and third RS-flip-flops and to the first input of the two-input OR element, and is also the first output of the control unit module, the second bit of the output is connected to the S-input of the second RS-trigger, third, fourth, fifth, the sixth and seventh bits of the output are the third, fourth, fifth, sixth and seventh outputs of the control unit module, respectively, the eighth bit of the output is connected to the S-input of the first RS-trigger, the ninth bit of the output is connected to the input of the second delay element, the output of which is connected connected to the S-input of the third RS-flip-flop, the output of which is connected to the information input of a single-bit demultiplexer, the first output of which is the ninth output of the control unit module, the second output is the tenth output of the control unit module, the inverter output is connected to the second input of the two-input OR element, the output of which connected to the R-input of the first RS-trigger, the output of which is connected to the reset input of the r-bit counter, and is also the eighth output of the control unit module, the output of the second RS-trigger is second direct output of the control unit module.

Сущность изобретения заключается в реализации операций умножения, сложения и нахождения разности чисел A и B по модулю P. Операндами являются целые числа A и B, которые находятся в диапазоне от 0 до (P-1) включительно.The essence of the invention lies in the implementation of operations of multiplication, addition and finding the difference of numbers A and B modulo P. The operands are integers A and B, which are in the range from 0 to (P-1) inclusive.

Числа A, B и P, имеющие разрядность n, могут быть представлены в двоичном виде:The numbers A, B and P, having the capacity of n, can be represented in binary form:

,, (1)(1) ,, (2)(2) ,, (3)(3)

где ai, bi, pi – коэффициенты в двоичном представлении чисел A, B и P соответственно, i = 0, n 1 ¯

Figure 00000001
.where a i , b i , p i are the coefficients in the binary representation of the numbers A, B and P, respectively, i = 0 n - 1 ¯
Figure 00000001
.

Нахождение суммы чисел A и B по модулю P производится путем последовательного считывания операндов (модуля и слагаемых) со входной шины во входные регистры, подачи значения P на вход модуля накапливающего сумматора по модулю и последовательной подачи слагаемых на информационный вход накапливающего сумматора по модулю.The sum of the numbers A and B modulo P is found by sequentially reading the operands (module and terms) from the input bus to the input registers, supplying the value P to the input of the accumulating adder modulo module and sequentially supplying the summands to the information input of the accumulating adder modulo.

Операция нахождения разности чисел (A-B) по модулю P выполняется как операция нахождения суммы чисел A и (P-B) по модулю P. Модуль, уменьшаемое и вычитаемое последовательно считываются со входной шины во входные регистры, после чего значение P подается на вход модуля накапливающего сумматора по модулю, значение A подается на информационный вход накапливающего сумматора по модулю. Вычисление разности (P-B) производится путем сложения прямого кода модуля P c дополнительным кодом вычитаемого B. Полученное значение (P-B) подается на информационный вход накапливающего сумматора по модулю.The operation of finding the difference of numbers (AB) modulo P is performed as the operation of finding the sum of numbers A and (PB) modulo P. The module being reduced and subtracted is sequentially read from the input bus into the input registers, after which the value P is applied to the input of the accumulating adder module by module, the value A is fed to the information input of the accumulating adder modulo. The difference (P-B) is calculated by adding the direct code of the module P with the additional code of the subtracted B. The obtained value (P-B) is fed to the information input of the accumulating adder modulo.

Вычисление произведения чисел A и B по модулю P производится следующим образом.The calculation of the product of the numbers A and B modulo P is as follows.

Произведение A·B(mod P) можно записать в виде:The product A · B (mod P) can be written as:

,, (4)(4)

где ri – i-й частичный остаток.where r i is the i-th partial remainder.

Таким образом, операция умножения чисел A и B по модулю P может быть выполнена путем последовательного нахождения n частичных остатков вида:Thus, the operation of multiplying the numbers A and B modulo P can be performed by sequentially finding n partial residues of the form:

,, (5)(5)

где i = 0, n 1 ¯

Figure 00000002
, и последующего сложения по модулю P тех из них, для которых коэффициент b i = 1
Figure 00000003
.Where i = 0 n - 1 ¯
Figure 00000002
, and the subsequent addition modulo P of those for which the coefficient b i = 1
Figure 00000003
.

Частичные остатки могут быть вычислены по следующему правилу:Partial balances can be calculated as follows:

(6)(6)

Нулевым частичным остатком является само число A. Для последовательного формирования остальных (n-1) частичных остатков используется n-разрядный накапливающий сумматор по модулю, на вход которого на первом такте поступает число A, а на каждом последующем такте – значение, которое на предыдущем такте было на его выходе. Операция умножения предыдущего частичного остатка

Figure 00000004
на 2 по модулю P в таком случае осуществляется как сложение
Figure 00000004
по модулю P с самим собой.The zero partial remainder is the number A. For the subsequent formation of the remaining (n-1) partial residuals, an n-bit accumulative adder is used modulo the input of which, at the first beat, receives the number A, and at each subsequent beat, the value that at the previous beat was at his exit. The operation of multiplying the previous partial remainder
Figure 00000004
2 modulo P in this case is carried out as addition
Figure 00000004
modulo P with itself.

На фиг. 1 представлена схема арифметико-логического устройства для сложения, вычитания и умножения чисел по модулю.In FIG. 1 is a diagram of an arithmetic logic device for adding, subtracting, and multiplying numbers modulo.

Арифметико-логическое устройство для сложения, вычитания и умножения чисел по модулю содержит три n-разрядных регистра 3, 4, 5, два n-разрядных накапливающих сумматора 8, 11 по модулю, n-разрядный двухвходовый мультиплексор 2, n-разрядный электронный ключ 12, входную n-разрядную шину 1, выходную n-разрядную шину 13, два n-разрядных инвертора 6, 7, n-разрядный сумматор 9, n-разрядный трехвходовый мультиплексор 10, где n – количество разрядов в двоичном коде операндов, а также модуль управляющего блока 14.The arithmetic logic device for adding, subtracting and multiplying numbers modulo contains three n-bit registers 3, 4, 5, two n-bit accumulative adders 8, 11 modulo, an n-bit two-input multiplexer 2, n-bit electronic key 12 , input n-bit bus 1, output n-bit bus 13, two n-bit inverters 6, 7, n-bit adder 9, n-bit three-input multiplexer 10, where n is the number of bits in the binary code of the operands, and also the module control unit 14.

В качестве n-разрядных накапливающих сумматоров 8, 11 по модулю используются устройства, принимающие (n+1)-разрядный двоичный код модуля в инверсной форме (напр. патент РФ №2500017, МПК G06F 7/72, Бюл. № 33, 2013 г.).As n-bit accumulating adders 8, 11 modulo, devices are used that receive an (n + 1) -bit binary code of the module in inverse form (for example, RF patent No. 2500007, IPC G06F 7/72, Bull. No. 33, 2013 .).

Информационные входы первого n-разрядного регистра 3 и второго n-разрядного регистра 4 соединены со входной n-разрядной шиной 1. Первый информационный вход n-разрядного двухвходового мультиплексора 2 соединен со входной n-разрядной шиной 1, второй информационный вход соединен с информационным выходом первого n-разрядного накапливающего сумматора 8 по модулю, управляющий вход соединен со вторым выходом модуля управляющего блока 14, информационный выход соединен с информационным входом третьего n-разрядного регистра 5, управляющий вход которого соединен с четвертым выходом модуля управляющего блока 14, а информационный выход соединен с первым информационным входом n-разрядного трехвходового мультиплексора 10 и со вторым информационным входом первого n-разрядного накапливающего сумматора 8 по модулю, второй управляющий вход которого соединен с пятым выходом модуля управляющего блока 14. Второй управляющий вход второго n-разрядного накапливающего сумматора 11 по модулю соединен с шестым выходом модуля управляющего блока 14, информационный выход соединен с информационным входом n-разрядного электронного ключа 12, информационный выход которого соединен с выходной n-разрядной шиной 13, а управляющий вход соединен с восьмым выходом модуля управляющего блока 14, первый выход которого соединен с первыми управляющими входами n-разрядных накапливающих сумматоров 8, 11 по модулю и управляющим входом первого n-разрядного регистра 3, третий выход соединен с первым управляющим входом второго n-разрядного регистра 4, седьмой выход соединен со вторым управляющим входом второго n-разрядного регистра 4, девятый выход соединен с младшим разрядом адресного входа трехвходового n-разрядного мультиплексора 10, десятый выход соединен со старшим разрядом адресного входа трехвходового n-разрядного мультиплексора 10, на первый вход 15 подается одноразрядный код команды умножения по модулю, на второй вход 16 подается одноразрядный код команды сложения по модулю, на третий вход 17 подается одноразрядный код команды вычитания по модулю, на четвертый вход 18 подаются тактовые импульсы, пятый вход 19 соединен с младшим разрядом второго n-разрядного регистра 4. Информационный выход первого n-разрядного инвертора 6 соединен с n младшими разрядами первых информационных входов n-разрядных накапливающих сумматоров 8, 11 по модулю, на (n+1)-й разряд которых подается уровень логической «1». Выход первого n-разрядного регистра 3 соединен со входом первого n-разрядного инвертора 6 и с первым информационным входом n-разрядного сумматора 9, на вход переноса которого подается уровень логической «1». Информационный выход трехвходового n-разрядного мультиплексора 10 соединен со вторым информационным входом второго n-разрядного накапливающего сумматора 11 по модулю, третий информационный вход соединен с выходом n-разрядного сумматора 9, второй информационный вход которого соединен с выходом второго n-разрядного инвертора 7. Информационный выход второго n-разрядного регистра 4 соединен со вторым информационным входом n-разрядного трехвходового мультиплексора 10 и входом второго n-разрядного инвертора 7.The information inputs of the first n-bit register 3 and the second n-bit register 4 are connected to the input n-bit bus 1. The first information input of the n-bit two-input multiplexer 2 is connected to the input n-bit bus 1, the second information input is connected to the information output of the first n-bit accumulating adder 8 modulo, the control input is connected to the second output of the module of the control unit 14, the information output is connected to the information input of the third n-bit register 5, the control input of which о is connected to the fourth output of the control unit module 14, and the information output is connected to the first information input of the n-bit three-input multiplexer 10 and to the second information input of the first n-bit accumulating adder 8 modulo, the second control input of which is connected to the fifth output of the control unit module 14. The second control input of the second n-bit accumulating adder 11 modulo connected to the sixth output of the module of the control unit 14, the information output is connected to the information input n-p one electronic key 12, the information output of which is connected to the output n-bit bus 13, and the control input is connected to the eighth output of the module of the control unit 14, the first output of which is connected to the first control inputs of the n-bit accumulating adders 8, 11 modulo and the control input the first n-bit register 3, the third output is connected to the first control input of the second n-bit register 4, the seventh output is connected to the second control input of the second n-bit register 4, the ninth output is connected to the lowest a bit of the address input of a three-input n-bit multiplexer 10, the tenth output is connected to the highest bit of the address input of a three-input n-bit multiplexer 10, a single-bit modulo multiply instruction code is supplied to the first input 15, a single-bit modulo-add command code is supplied to the second input 16, by the third input 17 is supplied with a single-bit code of the subtraction instruction modulo, clock pulses are supplied to the fourth input 18, the fifth input 19 is connected to the least significant bit of the second n-bit register 4. The information output of the first n -digit inverter 6 is connected to the n least significant bits of the first information inputs of n-bit accumulating adders 8, 11 modulo, to the (n + 1) -th bit of which the logic level “1” is supplied. The output of the first n-bit register 3 is connected to the input of the first n-bit inverter 6 and to the first information input of the n-bit adder 9, to the transfer input of which the logic level “1” is supplied. The information output of the three-input n-bit multiplexer 10 is connected to the second information input of the second n-bit accumulating adder 11 modulo, the third information input is connected to the output of the n-bit adder 9, the second information input of which is connected to the output of the second n-bit inverter 7. Information the output of the second n-bit register 4 is connected to the second information input of the n-bit three-input multiplexer 10 and the input of the second n-bit inverter 7.

На фиг. 2 представлена схема модуля управляющего блока 14 арифметико-логического устройства для сложения, вычитания и умножения чисел по модулю.In FIG. 2 is a diagram of a module of a control unit 14 of an arithmetic logic device for adding, subtracting, and multiplying numbers modulo.

Модуль управляющего блока 14 содержит два трехвходовых элемента ИЛИ 14.1, 14.9, два двухвходовых элемента И 14.2, 14.10, r-разрядный счетчик 14.3, r-входовый дешифратор 14.4, где r = ⌈log2 (2n+4)⌉, трехразрядный демультиплексор 14.5, блок ПЗУ 14.6, два (n-1)-входовых элемента ИЛИ 14.7, 14.8, девятиразрядный электронный ключ 14.11, два элемента задержки 14.12, 14.17, инвертор 14.13, двухвходовый элемент ИЛИ 14.14, три RS-триггера 14.15, 14.16, 14.18, одноразрядный демультиплексор 14.19.The control unit module 14 contains two three-input elements OR 14.1, 14.9, two two-input elements AND 14.2, 14.10, an r-bit counter 14.3, an r-input decoder 14.4, where r = ⌈log 2 (2n + 4) ⌉, a three-bit demultiplexer 14.5, ROM unit 14.6, two (n-1) input elements OR 14.7, 14.8, nine-bit electronic key 14.11, two delay elements 14.12, 14.17, inverter 14.13, two-input element OR 14.14, three RS-flip-flops 14.15, 14.16, 14.18, single-bit demultiplexer 14.19.

Блок ПЗУ 14.6 хранит десять девятиразрядных битовых строк, имеет десять адресных входов, каждый из которых соответствует строке с соответствующим номером, и девятиразрядный выход. Содержимое блока ПЗУ представлено в таблице 1. При подаче уровня логической «1» на один из адресных входов содержимое соответствующей строки подается на выход блока.The ROM unit 14.6 stores ten nine-bit bit strings, has ten address inputs, each of which corresponds to a string with a corresponding number, and a nine-bit output. The contents of the ROM block are presented in Table 1. When a logical “1” level is applied to one of the address inputs, the contents of the corresponding line are sent to the block output.

Схема, состоящая из первого элемента задержки 14.12, с выхода которого тактовые импульсы поступают на управляющий вход девятиразрядного электронного ключа 14.11, преобразует логические уровни, появляющиеся на выходе блока ПЗУ 14.6, в импульсы, используемые для управления компонентами арифметико-логического устройства. При этом величина задержки, вносимой первым элементом задержки 14.12, определяется временем завершения переходных процессов в схеме, подключенной к информационному входу девятиразрядного электронного ключа 14.11 (элементы 14.2-14.10), после прихода очередного тактового импульса на вход 18.A circuit consisting of the first delay element 14.12, from the output of which clock pulses are supplied to the control input of a nine-bit electronic key 14.11, converts the logic levels that appear at the output of the ROM unit 14.6 into pulses used to control the components of the arithmetic-logic device. At the same time, the amount of delay introduced by the first delay element 14.12 is determined by the completion time of transients in a circuit connected to the information input of a nine-digit electronic key 14.11 (elements 14.2-14.10), after the arrival of the next clock pulse at input 18.

Таблица 1 – Содержимое блока ПЗУTable 1 - the contents of the block ROM

Номер строкиLine number Номер бита в строке Bit number in string 11 22 33 44 55 66 77 88 99 11 11 00 00 00 00 00 00 00 00 22 00 00 00 11 00 00 00 00 00 33 00 00 11 00 00 11 00 00 11 44 00 00 00 00 00 11 00 00 00 55 00 00 00 00 00 00 00 11 00 66 00 11 11 00 11 00 00 00 00 77 00 00 00 00 11 11 00 00 00 88 00 00 00 11 00 00 11 00 00 99 00 00 00 00 00 11 00 00 00 1010 00 00 00 00 00 00 00 11 00

Величина задержки, вносимой вторым элементом задержки 14.17, определяется временем выполнения операции сложения по модулю вторым n-разрядным накапливающим сумматором 11 по модулю.The amount of delay introduced by the second delay element 14.17 is determined by the execution time of the addition operation modulo the second n-bit accumulating adder 11 modulo.

Первый вход первого трехвходового элемента ИЛИ 14.1, соединенный с адресным входом трехразрядного демультиплексора 14.5, является первым входом 15 модуля управляющего блока 14, второй вход, соединенный с первым входом второго трехвходового элемента ИЛИ 14.9, является вторым входом 16 модуля управляющего блока 14, третий вход, соединенный со вторым входом второго трехвходового элемента ИЛИ 14.9 и адресным входом одноразрядного демультиплексора 14.19, является третьим входом 17 модуля управляющего блока 14.The first input of the first three-input OR element 14.1 connected to the address input of the three-digit demultiplexer 14.5 is the first input 15 of the control unit module 14, the second input connected to the first input of the second three-input OR element 14.9 is the second input 16 of the control unit 14 module, third input, connected to the second input of the second three-input element OR 14.9 and the address input of the single-bit demultiplexer 14.19, is the third input 17 of the module of the control unit 14.

Выход первого трехвходового элемента ИЛИ 14.1 соединен со входом инвертора 14.13 и с первым входом первого двухвходового элемента И 14.2, второй вход которого является четвертым входом 18 модуля управляющего блока 14, выход соединен со входом первого элемента задержки 14.12 и со счетным входом r-разрядного счетчика 14.3, выходы которого соединены с соответствующими информационными входами r-входового дешифратора 14.4.The output of the first three-input element OR 14.1 is connected to the input of the inverter 14.13 and the first input of the first two-input element AND 14.2, the second input of which is the fourth input 18 of the module of the control unit 14, the output is connected to the input of the first delay element 14.12 and to the counting input of the r-bit counter 14.3 the outputs of which are connected to the corresponding information inputs of the r-input decoder 14.4.

Первый и второй выходы r-входового дешифратора 14.4 соединены с первым и вторым адресными входами блока ПЗУ 14.6 соответственно, третий, четвертый и пятый выходы соединены с первым, вторым и третьим разрядами информационного входа трехразрядного демультиплексора 14.5 соответственно, каждый 2k-й выход соединен с (k-1)-м входом первого (n-1)-входового элемента ИЛИ 14.7, каждый (2k+1)-й выход соединен с (k-1)-м входом второго (n-1)-входового элемента ИЛИ 14.8, где k = 3, 4, …, n, (2n+2)-й выход соединен с девятым адресным входом блока ПЗУ 14.6, (2n+3)-й выход соединен с десятым адресным входом блока ПЗУ 14.6.The first and second outputs of the r-input decoder 14.4 are connected to the first and second address inputs of the ROM unit 14.6, respectively, the third, fourth and fifth outputs are connected to the first, second and third bits of the information input of the three-bit demultiplexer 14.5, respectively, each 2k-th output is connected to ( k-1) -th input of the first (n-1) -input element OR 14.7, each (2k + 1) -th output is connected to the (k-1) -th input of the second (n-1) -input element OR 14.8, where k = 3,4, ..., n, (2n + 2) -th output is connected to the ninth address input of the ROM unit 14.6, (2n + 3) -th output is connected to the tenth address 14.6 ROM waist input unit.

Первый, второй и третий разряды первого выхода трехразрядного демультиплексора 14.5 соединены с третьим, четвертым и пятым адресными входами блока ПЗУ 14.6 соответственно, первый разряд второго выхода соединен с шестым адресным входом блока ПЗУ 14.6, второй разряд второго выхода соединен с первым входом первого (n-1)-входового элемента ИЛИ 14.7, третий разряд второго выхода соединен с первым входом второго (n-1)-входового элемента ИЛИ 14.8.The first, second and third bits of the first output of the three-bit demultiplexer 14.5 are connected to the third, fourth and fifth address inputs of the ROM block 14.6, respectively, the first bit of the second output is connected to the sixth address input of the ROM block 14.6, the second bit of the second output is connected to the first input of the first (n- 1) input element OR 14.7, the third bit of the second output is connected to the first input of the second (n-1) input element OR 14.8.

Выход первого (n-1)-входового элемента ИЛИ 14.7 соединен с седьмым адресным входом блока ПЗУ 14.6, выход второго (n-1)-входового элемента ИЛИ 14.8 соединен с восьмым адресным входом блока ПЗУ 14.6.The output of the first (n-1) input element OR 14.7 is connected to the seventh address input of the ROM unit 14.6, the output of the second (n-1) input element OR 14.8 is connected to the eighth address input of the ROM unit 14.6.

Шестой выход блока ПЗУ 14.6 соединен с первым входом второго двухвходового элемента И 14.10, выход которого соединен с шестым разрядом информационного входа девятиразрядного электронного ключа 14.11, второй вход соединен с выходом второго трехвходового элемента ИЛИ 14.9, третий вход которого является пятым входом 19 модуля управляющего блока 14.The sixth output of the ROM unit 14.6 is connected to the first input of the second two-input element And 14.10, the output of which is connected to the sixth bit of the information input of the nine-digit electronic key 14.11, the second input is connected to the output of the second three-input element OR 14.9, the third input of which is the fifth input 19 of the control unit module 14 .

Первый, второй, третий, четвертый, пятый, седьмой, восьмой и девятый выходы блока ПЗУ 14.6 соединены соответственно с первым, вторым, третьим, четвертым, пятым, седьмым, восьмым и девятым разрядами информационного входа девятиразрядного электронного ключа 14.11, управляющий вход которого соединен с выходом первого элемента задержки 14.12, первый разряд выхода соединен с R-входами второго и третьего RS-триггеров 14.16, 14.18 и с первым входом двухвходового элемента ИЛИ 14.14, а также является первым выходом модуля управляющего блока 14, второй разряд выхода соединен с S-входом второго RS-триггера 14.16, третий, четвертый, пятый, шестой и седьмой разряды выхода являются третьим, четвертым, пятым, шестым и седьмым выходами модуля управляющего блока 14 соответственно, восьмой разряд выхода соединен с S-входом первого RS-триггера 14.15, девятый разряд выхода соединен со входом второго элемента задержки 14.17, выход которого соединен с S-входом третьего RS-триггера 14.18, выход которого соединен с информационным входом одноразрядного демультиплексора 14.19, первый выход которого является девятым выходом модуля управляющего блока 14, второй выход является десятым выходом модуля управляющего блока 14.The first, second, third, fourth, fifth, seventh, eighth and ninth outputs of the ROM unit 14.6 are connected respectively to the first, second, third, fourth, fifth, seventh, eighth and ninth bits of the information input of the nine-digit electronic key 14.11, the control input of which is connected to the output of the first delay element 14.12, the first discharge bit is connected to the R-inputs of the second and third RS-flip-flops 14.16, 14.18 and the first input of the two-input OR element 14.14, and also is the first output of the control unit module 14, the second discharge connected to the S-input of the second RS-trigger 14.16, the third, fourth, fifth, sixth and seventh bits of the output are the third, fourth, fifth, sixth and seventh outputs of the module of the control unit 14, respectively, the eighth bit of the output is connected to the S-input of the first RS- of the trigger 14.15, the ninth bit of the output is connected to the input of the second delay element 14.17, the output of which is connected to the S-input of the third RS-trigger 14.18, the output of which is connected to the information input of the single-bit demultiplexer 14.19, the first output of which is the ninth output of the control module vlyayuschego unit 14, the second output is the tenth module output control unit 14.

Выход инвертора 14.13 соединен со вторым входом двухвходового элемента ИЛИ 14.14, выход которого соединен с R-входом первого RS-триггера 14.15, выход которого соединен со входом сброса r-разрядного счетчика 14.3, а также является восьмым выходом модуля управляющего блока 14. Выход второго RS-триггера 14.16 является вторым выходом модуля управляющего блока 14.The output of the inverter 14.13 is connected to the second input of the two-input element OR 14.14, the output of which is connected to the R-input of the first RS-trigger 14.15, the output of which is connected to the reset input of the r-bit counter 14.3, and is also the eighth output of the control unit 14. The output of the second RS -trigger 14.16 is the second output of the module of the control unit 14.

Арифметико-логическое устройства для сложения, вычитания и умножения чисел по модулю работает следующим образом.Arithmetic-logical device for addition, subtraction and multiplication of numbers modulo works as follows.

В исходном состоянии r-разрядный счетчик 14.3 обнулен, на входы 15, 16, 17 подается логический «0». Для начала работы устройства и на протяжении всего цикла выполнения операции на один из входов 15, 16, 17 подается уровень логической «1»: на вход 15 – при выполнении умножения чисел по модулю, на вход 16 – при выполнении сложения чисел по модулю, на вход 17 – при выполнении вычитания чисел по модулю. При этом тактовые импульсы, поступающие на вход 18, начинают подсчитываться r-разрядным счетчиком 14.3. Результат подсчета подается на вход r-входового дешифратора 14.4, и на его выходах с номерами 1, 2, …, (2n+3) последовательно появляются уровни логической «1».In the initial state, the r-bit counter 14.3 is reset to zero, a logical "0" is supplied to the inputs 15, 16, 17. To start the operation of the device and throughout the entire operation cycle, one of the inputs 15, 16, 17 receives a logical “1” level: input 15 - when performing multiplication of numbers modulo, input 16 - when performing addition of numbers modulo, input 17 - when performing subtraction of numbers modulo. In this case, the clock pulses arriving at input 18 begin to be counted by an r-bit counter 14.3. The counting result is fed to the input of the r-input decoder 14.4, and at its outputs with numbers 1, 2, ..., (2n + 3) logical “1” levels appear sequentially.

При работе устройства в режиме сложения или вычитания на адресный вход трехразрядного демультиплексора 14.5 подается уровень логического «0», что соответствует подключению третьего, четвертого и пятого выходов r-входового дешифратора 14.4 к третьему, четвертому и пятому входам блока ПЗУ 14.6.When the device is in the addition or subtraction mode, the logical input level “0” is applied to the address input of the three-bit demultiplexer 14.5, which corresponds to the connection of the third, fourth and fifth outputs of the r-input decoder 14.4 to the third, fourth and fifth inputs of the ROM block 14.6.

Операция сложения n-разрядных чисел по модулю выполняется за пять тактов.The operation of adding n-bit numbers modulo is performed in five cycles.

С приходом первого тактового импульса на вход 18 уровень логической «1» появляется на первом выходе блока ПЗУ 14.6, что приводит к появлению на первом выходе модуля управляющего блока 14 управляющего сигнала, поступающего на первые управляющие входы (входы сброса) n-разрядных накапливающих сумматоров 8, 11 по модулю и на управляющий вход первого n-разрядного регистра 3, в результате чего происходит сброс первого и второго n-разрядных накапливающих сумматоров 8, 11 по модулю, а также считывание кода модуля P со входной n-разрядной шины 1 в первый n-разрядный регистр 3. Также происходит подача уровня логической «1» на R-входы первого (посредством двухвходового элемента ИЛИ 14.14), второго и третьего RS-триггеров 14.15, 14.6 и 14.18, что приводит к переводу данных триггеров в нулевое состояние. В результате установки в состояние «0» первого RS-триггера 14.15 происходит закрытие n-разрядного электронного ключа 12, т.е. отключение информационного выхода второго n-разрядного накапливающего сумматора 11 по модулю от выходной n-разрядной шины 13. В результате установки в состояние «0» второго RS-триггера 14.16 на адресный вход n-разрядного двухвходового мультиплексора 2 поступает уровень логического «0», вследствие чего происходит подключение информационного входа третьего n-разрядного регистра 5 к входной n-разрядной шине 1. В результате установки в состояние «0» третьего RS-триггера 14.18 на младший и старший разряды адресного входа n-разрядного трехвходового мультиплексора 10 подаются уровни логического «0», вследствие чего происходит подключение информационного выхода третьего n-разрядного регистра 5 ко второму информационному входу второго n-разрядного накапливающего сумматора 11 по модулю.With the arrival of the first clock pulse at input 18, the logic level “1” appears at the first output of ROM unit 14.6, which leads to the appearance on the first output of the control unit module 14 of a control signal supplied to the first control inputs (reset inputs) of n-bit accumulating adders 8 11 modulo and to the control input of the first n-bit register 3, resulting in a reset of the first and second n-bit accumulative adders 8, 11 modulo, as well as reading the code of module P from the input n-bit bus 1 to the first n -size projectile loader register 3. Also occurs feed level logical "1" on the R-inputs of the first (via two-input OR gate 14.14), second and third RS-triggers 14.15, 14.6 and 14.18, which leads to a transfer of data flip-flops to zero. As a result of setting the first RS-trigger 14.15 to state “0”, the n-bit electronic key 12 is closed, i.e. disconnecting the information output of the second n-bit accumulating adder 11 modulo from the output of the n-bit bus 13. As a result of setting the second RS-flip-flop 14.16 to state “0”, the logic input level “0” is received at the address input of the n-bit two-input multiplexer 2, due to why the information input of the third n-bit register 5 is connected to the input n-bit bus 1. As a result of setting the third RS-trigger 14.18 to the lower and upper bits of the address input of the n-bit three-input mult to state “0” plexor 10 are supplied logic levels "0", thereby going data output connection of the third n-bit register 5 to the second data input of the second n-bit accumulator 11 to the module.

С приходом второго тактового импульса на вход 18 уровень логической «1» появляется на четвертом выходе блока ПЗУ 14.6, что приводит к подаче на четвертый выход модуля управляющего блока 14 управляющего сигнала, который поступает на управляющий вход третьего n-разрядного регистра 5, в результате чего происходит считывание со входной n-разрядной шины 1 в данный регистр кода операнда A.With the arrival of the second clock pulse at input 18, the logic level “1” appears on the fourth output of the ROM unit 14.6, which leads to the supply to the fourth output of the module of the control unit 14 of the control signal, which is fed to the control input of the third n-bit register 5, as a result of which reads from the input n-bit bus 1 into the given register of the operand A.

С приходом третьего тактового импульса на вход 18 уровни логической «1» появляются на третьем, шестом и девятом выходах блока ПЗУ 14.6. В результате появления уровня логической «1» на третьем выходе блока ПЗУ 14.6 управляющий сигнал появляется на третьем выходе модуля управляющего блока 14, откуда поступает на первый управляющий вход второго n-разрядного регистра 4, что приводит к считыванию в данный регистр кода операнда B со входной n-разрядной шины 1. В результате появления уровня логической «1» на шестом выходе блока ПЗУ 14.6 управляющий сигнал появляется на шестом выходе модуля управляющего блока 14, вследствие чего значение операнда A, хранящееся в третьем n-разрядном регистре 5, складывается по модулю с текущим значением, хранимым во втором n-разрядном накапливающем сумматоре 11 по модулю. Поскольку на первом такте был произведен сброс данного накапливающего сумматора по модулю, значение, хранящееся в нем, будет равно A. В результате появления уровня логической «1» на девятом выходе блока ПЗУ 14.6 на S-вход третьего RS-триггера 14.18 поступает задержанный по времени управляющий сигнал, который приводит к появлению на девятом выходе модуля управляющего блока 14 уровня логической «1», который подается на младший разряд адресного входа трехвходового n-разрядного мультиплексора 10, вследствие чего ко второму информационному входу второго n-разрядного накапливающего сумматора 11 по модулю подключается выход второго n-разрядного регистра 4, хранящего значение операнда B.With the arrival of the third clock pulse at input 18, the logical 1 levels appear on the third, sixth, and ninth outputs of the ROM block 14.6. As a result of the appearance of the logical level “1” at the third output of the ROM unit 14.6, the control signal appears at the third output of the module of the control unit 14, from where it enters the first control input of the second n-bit register 4, which leads to the reading of the operand B code into the given register from the input n-bit bus 1. As a result of the appearance of the logic level “1” at the sixth output of the ROM unit 14.6, a control signal appears at the sixth output of the module of the control unit 14, as a result of which the value of the operand A stored in the third n-bit register 5 e, modulo sum with the current value stored in the second n-bit accumulator 11 to the module. Since the first accumulator was reset modulo this accumulating adder, the value stored in it will be equal to A. As a result of the appearance of the logic level “1” at the ninth output of the ROM block 14.6, the time delayed signal arrives at the S-input of the third RS-trigger 14.18 the control signal, which leads to the appearance on the ninth output of the module of the control unit 14 of the logic level “1”, which is fed to the low-order bit of the address input of a three-input n-bit multiplexer 10, as a result of which the second information input th n-bit accumulator modulo 11 connects the output of the second n-bit register 4, which stores the value of the operand B.

С приходом четвертого тактового импульса на вход 18 уровень логической «1» появляется на шестом выходе блока ПЗУ 14.6, в результате чего управляющий сигнал появляется на шестом выходе модуля управляющего блока 14, с которого подается на второй управляющий вход второго n-разрядного накапливающего сумматора 11 по модулю. Значение операнда B, хранящееся во втором n-разрядном регистре 4, складывается по модулю P со значением A, хранимым во втором n-разрядном накапливающем сумматоре 11 по модулю.With the arrival of the fourth clock pulse at input 18, the logic level “1” appears at the sixth output of the ROM unit 14.6, as a result of which the control signal appears at the sixth output of the module of the control unit 14, from which it is supplied to the second control input of the second n-bit accumulating adder 11 to the module. The value of operand B stored in the second n-bit register 4 is added modulo P with the value A stored in the second n-bit accumulative adder 11 modulo.

С приходом пятого тактового импульса на вход 18 уровень логической «1» появляется на восьмом выходе блока ПЗУ 14.6, в результате чего управляющий сигнал подается на S-вход первого RS-триггера 14.15. Уровень логической «1» с выхода первого RS-триггера 14.15 подается на вход сброса r-разрядного счетчика 14.3, устанавливая счетчик в нулевое состояние, а также на восьмой выход модуля управляющего блока 14, откуда поступает на управляющий вход n-разрядного электронного ключа 12, вследствие чего результат выполнения операции, хранящийся во втором n-разрядном накапливающем сумматоре 11 по модулю, подается на выходную n-разрядную шину 13. Сброс r-разрядного счетчика 14.3 происходит по фронту управляющего импульса, поступающего на вход сброса.With the arrival of the fifth clock pulse at input 18, the logic level “1” appears on the eighth output of the ROM block 14.6, as a result of which the control signal is supplied to the S-input of the first RS-trigger 14.15. Logical level “1” from the output of the first RS-trigger 14.15 is fed to the reset input of the r-bit counter 14.3, setting the counter to zero, as well as to the eighth output of the control unit module 14, from where it enters the control input of the n-bit electronic key 12, as a result, the result of the operation, stored in the second n-bit accumulating adder 11 modulo, is fed to the output n-bit bus 13. The reset of the r-bit counter 14.3 occurs along the edge of the control pulse supplied to the reset input.

Закрытие n-разрядного электронного ключа 12 происходит при поступлении тактового импульса на вход 18 при начале нового цикла выполнения операции умножения, сложения или вычитания по модулю, либо при установке на всех входах 15, 16, 17 уровня логического «0».The closure of the n-bit electronic key 12 occurs upon receipt of a clock pulse at input 18 at the start of a new cycle of the operation of multiplication, addition or subtraction modulo, or when the logic level “0” is set at all inputs 15, 16, 17.

Операция нахождения разности n-разрядных чисел по модулю также выполняется за пять тактов. Отличие работы устройства в режиме вычитания от работы в режиме сложения заключается в том, что в результате подачи уровня логической единицы на вход 17 одноразрядный демультиплексор 14.19 подает сигнал с выхода третьего RS-триггера 14.18 на десятый, а не девятый выход модуля управляющего блока 14. Таким образом, на третьем такте работы устройства уровень логической «1» подается не на младший, а на старший разряд адресного входа n-разрядного трехвходового мультиплексора 10, в результате чего ко второму информационному входу второго n-разрядного накапливающего сумматора 11 по модулю подключается выход n-разрядного сумматора 9, на первый информационный вход которого подается код модуля P, на второй информационный вход подается инверсный код операнда B, а на вход переноса – уровень логической «1», что соответствует вычислению разности (P-B). Полученное значение на четвертом такте складывается со значением A, хранимым во втором n-разрядном накапливающем сумматоре 11 по модулю.The operation of finding the difference of n-bit numbers modulo is also performed in five clock cycles. The difference between the operation of the device in the subtraction mode and the operation in the addition mode is that as a result of supplying the level of the logical unit to input 17, the single-bit demultiplexer 14.19 delivers a signal from the output of the third RS-trigger 14.18 to the tenth, and not the ninth, output of the control unit 14. Thus Thus, on the third clock of the device’s operation, the logic level “1” is applied not to the lowest, but to the highest bit of the address input of the n-bit three-input multiplexer 10, as a result of which to the second information input of the second n-bit The heating adder 11 modulo connects the output of the n-bit adder 9, the module P code is supplied to the first information input, the operand B is inverted to the second information input, and the logic level is 1 to the transfer input, which corresponds to the difference calculation (PB ) The obtained value on the fourth clock is added to the value A stored in the second n-bit accumulating adder 11 modulo.

Операция умножения n-разрядных чисел по модулю выполняется за (2n+3) тактов. При работе устройства в режиме умножения на адресный вход трехразрядного демультиплексора 14.5 подается уровень логической «1», что соответствует подключению третьего, четвертого и пятого выходов r-входового дешифратора 14.4 к шестому, седьмому (посредством первого (n-1)-входового элемента ИЛИ 14.7) и восьмому (посредством второго (n-1)-входового элемента ИЛИ 14.8) входам блока ПЗУ 14.6 соответственно.The operation of multiplying n-bit numbers modulo is performed in (2n + 3) clock cycles. When the device is operating in multiplication mode, the logic input level “1” is supplied to the address input of the three-digit demultiplexer 14.5, which corresponds to connecting the third, fourth and fifth outputs of the r-input decoder 14.4 to the sixth, seventh (through the first (n-1) -input element OR 14.7 ) and the eighth (through the second (n-1) -input element OR 14.8) inputs of the ROM block 14.6, respectively.

Работа устройства на первых двух тактах выполнения операции умножения по модулю идентична работе устройства на первых двух тактах выполнения операции сложения по модулю. The operation of the device in the first two clock cycles of the operation of modulation is identical to the operation of the device in the first two clocks of the operation of addition modulo.

С приходом третьего тактового импульса на вход 18 уровень логической «1» появляется на втором, третьем и пятом выходах блока ПЗУ 14.6. В результате появления уровня логической «1» на втором выходе блока ПЗУ 14.6 происходит подача управляющего сигнала на S-вход второго RS-триггера 14.16, что приводит к установке на втором выходе модуля управляющего блока 14 уровня логической «1», поступающего на адресный вход n-разрядного двухвходового мультиплексора 2, вследствие чего данный мультиплексор подключает информационный выход первого n-разрядного накапливающего сумматора 8 по модулю к информационному входу третьего n-разрядного регистра 5. В результате появления уровня логической «1» на третьем выходе блока ПЗУ 14.6 управляющий сигнал появляется на третьем выходе модуля управляющего блока 14, откуда поступает на первый управляющий вход второго n-разрядного регистра 4, что приводит к считыванию в данный регистр кода операнда B со входной n-разрядной шины 1. В результате появления уровня логической «1» на пятом выходе блока ПЗУ 14.6 управляющий сигнал появляется на пятом выходе модуля управляющего блока 14, откуда поступает на второй управляющий вход (вход тактовых импульсов) первого n-разрядного накапливающего сумматора 8 по модулю, вследствие чего в данный накапливающий сумматор записывается значение операнда A, поступающее с информационного выхода третьего n-разрядного регистра 5.With the arrival of the third clock pulse at input 18, the logic level “1” appears on the second, third, and fifth outputs of the ROM block 14.6. As a result of the appearance of the logic level “1” at the second output of the ROM unit 14.6, a control signal is supplied to the S-input of the second RS-flip-flop 14.16, which leads to the installation at the second output of the module of the control unit 14 of the level of the logical “1” received at the address input n -digit two-input multiplexer 2, as a result of which this multiplexer connects the information output of the first n-bit accumulating adder 8 modulo to the information input of the third n-bit register 5. As a result of the appearance of the logic level “1 at the third output of ROM block 14.6, a control signal appears at the third output of the module of control block 14, from where it enters the first control input of the second n-bit register 4, which leads to the reading of the operand B code into the given register from the input n-bit bus 1. As a result the appearance of the logic level “1” at the fifth output of the ROM unit 14.6, a control signal appears at the fifth output of the module of the control unit 14, from where it enters the second control input (clock pulse input) of the first n-bit accumulating adder 8 in m absolute value, whereby at the recorded accumulator operand A, supplied from the data output of the third n-bit register 5.

С приходом на вход 18 каждого 2k-го тактового импульса, где k = 2, 3, …, n, уровень логической «1» появляется на пятом и шестом выходах блока ПЗУ 14.6. В результате появления уровня логической «1» на пятом выходе блока ПЗУ 14.6 управляющий сигнал появляется на пятом выходе модуля управляющего блока 14, откуда поступает на второй управляющий вход (вход тактовых импульсов) первого n-разрядного накапливающего сумматора 8 по модулю, вследствие чего хранимое в нем значение складывается по модулю Р с текущим частичным остатком, находящимся в третьем n-разрядном регистре 5, т.е. происходит формирование следующего частичного остатка. Уровень логической «1», появившийся на шестом выходе блока ПЗУ 14.6, поступает на первый вход второго двухвходового элемента И 14.10. Если при этом значение младшего разряда числа, хранимого во втором n-разрядном регистре 4, равно 1, то на вход 19 модуля управляющего блока 14, являющийся третьим входом второго трехвходового элемента ИЛИ 14.9, подается уровень логической «1», который поступает с выхода данного элемента ИЛИ на второй вход второго двухвходового элемента И 14.10, вследствие чего на шестом выходе модуля управляющего блока 14 появляется управляющий сигнал, поступающий на второй управляющий вход второго n-разрядного накапливающего сумматора 11 по модулю, что приводит к сложению по модулю P хранимого в нем значения с текущим частичным остатком. Если значение младшего разряда числа, хранимого во втором n-разрядном регистре 4, равно 0, управляющий сигнал на шестом выходе модуля управляющего блока 14 не появляется и прибавление текущего частичного остатка к содержимому второго n-разрядного накапливающего сумматора 11 не производится.With the arrival of 18 every 2k-th clock pulse at the input, where k = 2, 3, ..., n, the logic level “1” appears on the fifth and sixth outputs of the ROM block 14.6. As a result of the appearance of the logic level “1” at the fifth output of the ROM unit 14.6, the control signal appears at the fifth output of the module of the control unit 14, from where it enters the second control input (clock pulse input) of the first n-bit accumulating adder 8 modulo, as a result of which the value is added modulo P with the current partial remainder located in the third n-bit register 5, i.e. the formation of the next partial residue occurs. The logical level "1", which appeared on the sixth output of the ROM unit 14.6, is fed to the first input of the second two-input element And 14.10. If the value of the least significant digit of the number stored in the second n-bit register 4 is 1, then the input level 19 of the control unit module 14, which is the third input of the second three-input element OR 14.9, is supplied with the logic level “1”, which comes from the output of this OR element to the second input of the second two-input element And 14.10, whereby a control signal appears at the sixth output of the module of the control unit 14, which is supplied to the second control input of the second n-bit accumulating adder 11 modulo, which leads to position modulo P of the value stored in it with the current partial remainder. If the value of the least significant digit of the number stored in the second n-bit register 4 is 0, the control signal does not appear at the sixth output of the control unit module 14 and the current partial remainder is not added to the contents of the second n-bit accumulating adder 11.

С приходом на вход 18 каждого (2k+1)-го тактового импульса, где k = 2, 3, …, n, уровень логической «1» появляется на четвертом и седьмом выходах блока ПЗУ 14.6. В результате появления уровня логической «1» на четвертом выходе блока ПЗУ 14.6 управляющий сигнал подается на четвертый выход модуля управляющего блока 14, с которого поступает на управляющий вход третьего n-разрядного регистра 5, что приводит к записи в данный регистр частичного остатка, поступающего с информационного выхода первого n-разрядного накапливающего сумматора 8 по модулю. Данный частичный остаток будет использован на следующем такте выполнения операции. В результате появления уровня логической «1» на седьмом выходе блока ПЗУ 14.6 управляющий сигнал подается на седьмой выход модуля управляющего блока 14, с которого поступает на второй управляющий вход второго n-разрядного регистра 4, в результате чего происходит сдвиг значения, хранимого в данном регистре, на один разряд вправо.With the arrival of 18 of each (2k + 1) th clock pulse, where k = 2, 3, ..., n, the logic level “1” appears on the fourth and seventh outputs of the ROM block 14.6. As a result of the appearance of the logical level “1” at the fourth output of the ROM unit 14.6, the control signal is supplied to the fourth output of the module of the control unit 14, from which it is supplied to the control input of the third n-bit register 5, which leads to writing to this register a partial remainder coming from information output of the first n-bit accumulating adder 8 modulo. This partial remainder will be used on the next step of the operation. As a result of the appearance of the logic level “1” at the seventh output of the ROM unit 14.6, the control signal is supplied to the seventh output of the module of the control unit 14, from which it is supplied to the second control input of the second n-bit register 4, as a result of which the value stored in this register is shifted , one digit to the right.

С приходом на вход 18 (2n+2)-го тактового импульса уровень логической «1» появляется на шестом выходе блока ПЗУ 14.6. Если при этом младший разряд числа, находящегося во втором n-разрядном регистре 4, равен 1, на шестой выход модуля управляющего блока 14 поступает управляющий сигнал, в результате чего производится сложение по модулю P последнего частичного остатка со значением, хранимым во втором n-разрядном накапливающем сумматоре 11 по модулю.With the arrival of the 18 (2n + 2) -th clock pulse, the logic level “1” appears on the sixth output of the ROM block 14.6. If in this case the least significant bit of the number in the second n-bit register 4 is 1, the control signal arrives at the sixth output of the control unit module 14, resulting in the addition of the last partial remainder modulo P with the value stored in the second n-bit the accumulating adder 11 modulo.

С приходом на вход 18 (2n+3)-го тактового импульса уровень логической «1» появляется на восьмом выходе блока ПЗУ 14.6, в результате чего управляющий сигнал подается на S-вход первого RS-триггера 14.15. Уровень логической «1» с выхода первого RS-триггера 14.15 подается на вход сброса r-разрядного счетчика 14.3, устанавливая счетчик в нулевое состояние, а также на восьмой выход модуля управляющего блока 14, откуда поступает на управляющий вход n-разрядного электронного ключа 12, вследствие чего результат выполнения операции умножения чисел по модулю, хранящийся во втором n-разрядном накапливающем сумматоре 11 по модулю, подается на n-разрядную выходную шину 13.With the arrival of the 18 (2n + 3) clock pulse, the logic level “1” appears on the eighth output of the ROM block 14.6, as a result of which the control signal is fed to the S-input of the first RS-trigger 14.15. Logical level “1” from the output of the first RS-trigger 14.15 is fed to the reset input of the r-bit counter 14.3, setting the counter to zero, as well as to the eighth output of the control unit module 14, from where it enters the control input of the n-bit electronic key 12, as a result, the result of the operation of multiplying the numbers modulo stored in the second n-bit accumulating adder 11 modulo is fed to the n-bit output bus 13.

Рассмотрим работу арифметико-логического устройства для сложения, вычитания и умножения чисел по модулю на конкретном примере. Consider the work of an arithmetic-logical device for adding, subtracting and multiplying numbers modulo a specific example.

Пусть n=4, A=7, B=9, P=13. Операция умножения по модулю выполняется за (2n+3)=11 тактов. Let n = 4, A = 7, B = 9, P = 13. The modulation operation is performed in (2n + 3) = 11 clock cycles.

На первом такте производится считывание со входной шины 1 кода модуля P=1310=11012 в первый регистр 3.At the first cycle, the module code P = 13 10 = 1101 2 is read from the input bus 1 into the first register 3.

На втором такте со входной шины 1 считывается код множителя A=710=01112 в третий регистр 5. At the second clock, the multiplier code A = 7 10 = 0111 2 is read from the input bus 1 into the third register 5.

На третьем такте со входной шины считывается код множителя B=910=10012 во второй регистр 4, а код множителя A=710=01112 записывается в первый накапливающий сумматор 8 по модулю. At the third cycle, the factor code B = 9 10 = 1001 2 is read into the second register 4 from the input bus, and the factor code A = 7 10 = 0111 2 is written to the first accumulating adder 8 modulo.

На четвертом такте происходит вычисление первого частичного остатка путем сложения по модулю P=13 значения, находящегося в третьем регистре 5, со значением, хранимым в первом накапливающем сумматоре 8 по модулю: 7+7≡1 (mod 13). Поскольку младший разряд B=10012 равен 1, к содержимому второго накапливающего сумматора 11 по модулю прибавляется значение нулевого частичного остатка: 0+7≡7 (mod 13).At the fourth step, the first partial remainder is calculated by adding modulo P = 13 the value in the third register 5 with the value stored in the first accumulating adder 8 modulo: 7 + 7≡1 (mod 13). Since the least significant bit B = 1001 2 is equal to 1, the value of the zero partial remainder is added modulo the contents of the second accumulating adder 11: 0 + 7≡7 (mod 13).

На пятом такте сдвигается на один разряд вправо содержимое второго регистра 4, в котором хранится значение множителя B=10012, т.е. B/=01002, а также происходит запись первого частичного остатка, равного 1, в третий регистр 5.On the fifth step, the contents of the second register 4, which stores the value of the factor B = 1001 2 , is shifted by one bit to the right, i.e. B / = 0100 2 , and the first partial remainder equal to 1 is also written to the third register 5.

На шестом такте происходит вычисление второго частичного остатка: 1+1≡2 (mod 13). Младший разряд B/=01002 равен 0, поэтому первый частичный остаток, хранящийся в третьем регистре 5, не прибавляется к содержимому второго накапливающего сумматора 11 по модулю.At the sixth step, the second partial remainder is calculated: 1 + 1≡2 (mod 13). The least significant bit B / = 0100 2 is 0, therefore the first partial remainder stored in the third register 5 is not added to the contents of the second accumulating adder 11 modulo.

На седьмом такте сдвигается на один разряд вправо содержимое второго регистра 4, в котором хранится значение B/=01002, т.е. B//=00102, а также происходит запись второго частичного остатка, равного 2, в третий регистр 5.At the seventh step, the contents of the second register 4, which stores the value B / = 0100 2 , is shifted by one bit to the right, i.e. B // = 0010 2 , and the second partial remainder equal to 2 is also recorded in the third register 5.

На восьмом такте происходит вычисление третьего частичного остатка: 2+2≡4 (mod 13). Младший разряд B//=00102 равен 0, поэтому второй частичный остаток, хранящийся в третьем регистре 5, не прибавляется к содержимому второго накапливающего сумматора 11 по модулю.On the eighth step, the third partial remainder is calculated: 2 + 2≡4 (mod 13). The least significant bit B // = 0010 2 is 0, so the second partial remainder stored in the third register 5 is not added to the contents of the second accumulating adder 11 modulo.

На девятом такте сдвигается на один разряд вправо содержимое второго регистра 4, в котором хранится значение B//=00102, т.е. B///=00012, а также происходит запись третьего частичного остатка, равного 4, в третий регистр 5.At the ninth step, the contents of the second register 4, which stores the value B // = 0010 2 , is shifted by one bit to the right, i.e. B /// = 0001 2 , and the third partial remainder equal to 4 is also written to the third register 5.

Поскольку младший разряд B///=00012 равен 1, на десятом такте к содержимому накапливающего сумматора 11 по модулю прибавляется значение третьего частичного остатка, хранящегося в третьем регистре 5: 7+4≡11 (mod 13).Since the least significant bit B /// = 0001 2 is 1, on the tenth step, the value of the third partial remainder stored in the third register 5: 7 + 4≡11 (mod 13) is added to the contents of accumulating adder 11 modulo.

На одиннадцатом такте содержимое второго накапливающего сумматора 11 по модулю подается на выходную шину 13. Таким образом, результат операции умножения по модулю равен 11. Умножение выполнено корректно, поскольку 7∙9≡11 (mod 13)At the eleventh clock, the contents of the second accumulating adder 11 are modulo fed to the output bus 13. Thus, the result of the multiply modulo operation is 11. The multiplication is performed correctly, since 7 ∙ 9≡11 (mod 13)

Рассмотрим процесс выполнения устройством операции сложения чисел по модулю для заданных ранее значений n, A, B, P.Consider the process of the device performing the operation of adding numbers modulo for the previously set values of n, A, B, P.

На первом такте производится считывание со входной шины 1 кода модуля P=1310=11012 в первый регистр 3.At the first cycle, the module code P = 13 10 = 1101 2 is read from the input bus 1 into the first register 3.

На втором такте со входной шины 1 считывается код слагаемого A=710=01112 в третий регистр 5. On the second clock, the term code A = 7 10 = 0111 2 is read into the third register 5 from the input bus 1.

На третьем такте со входной шины 1 считывается код слагаемого B=910=10012 во второй регистр 4. Значение операнда A, хранящееся в третьем регистре 5, записывается во второй накапливающий сумматор 11 по модулю. Ко второму информационному входу второго накапливающего сумматора 11 по модулю подключается выход второго регистра 4, хранящего значение операнда B.On the third clock from the input bus 1, the term code B = 9 10 = 1001 2 is read into the second register 4. The value of the operand A stored in the third register 5 is written to the second accumulating adder 11 modulo. To the second information input of the second accumulating adder 11 modulo connects the output of the second register 4, which stores the value of the operand B.

На четвертом такте значение A, хранящееся во втором накапливающем сумматоре 11 по модулю, складывается по модулю 13 со значением B, поступающим с выхода второго регистра 4: 7+9≡3 (mod 13).At the fourth clock cycle, the value A stored in the second accumulating adder 11 modulo is added modulo 13 with the value B coming from the output of the second register 4: 7 + 9≡3 (mod 13).

На пятом такте содержимое второго накапливающего сумматора 11 по модулю подается на выходную шину 13. Таким образом, результат операции сложения по модулю равен 3.On the fifth step, the contents of the second accumulating adder 11 are modulo supplied to the output bus 13. Thus, the result of the modulo addition operation is 3.

Рассмотрим процесс выполнения устройством операции нахождения разности чисел по модулю.Consider the process of the device performing the operation of finding the difference of numbers modulo.

На первом такте производится считывание со входной шины 1 кода модуля P=1310=11012 в первый регистр 3.At the first cycle, the module code P = 13 10 = 1101 2 is read from the input bus 1 into the first register 3.

На втором такте со входной шины 1 считывается код уменьшаемого A=710=01112 в третий регистр 5. On the second clock, the code of the decremented A = 7 10 = 0111 2 is read into the third register 5 from the input bus 1.

На третьем такте со входной шины 1 считывается код вычитаемого B=910=10012 во второй регистр 4. Значение операнда A, хранящееся в третьем регистре 5, записывается во второй накапливающий сумматор 11 по модулю. Ко второму информационному входу второго накапливающего сумматора 11 по модулю подключается выход сумматора 9, на первый информационный вход которого подается код модуля P=11012, на второй информационный вход подается инверсный код вычитаемого Bинв=01102, а на вход переноса – уровень логической «1». Результат работы сумматора 9 равен 11012+01102+1=101002. Поскольку сумматор имеет разрядность n=4, на его выход поступает значение 01002=410.On the third clock from the input bus 1, the subtracted code B = 9 10 = 1001 2 is read into the second register 4. The value of the operand A, stored in the third register 5, is written into the second accumulating adder 11 modulo. The output of the adder 9 is connected modulo to the second information input of the second accumulating adder 11, the module code P = 1101 2 is supplied to the first information input, the inverse code of the subtracted B inv = 0110 2 is fed to the second information input, and the logical level “ 1". The result of the adder 9 is 1101 2 +0110 2 + 1 = 10100 2 . Since the adder has a bit width of n = 4, its output receives the value 0100 2 = 4 10 .

На четвертом такте значение A, хранящееся во втором накапливающем сумматоре 11 по модулю, складывается по модулю P=13 со значением, поступающим с выхода сумматора 9: 7+4≡11 (mod 13).On the fourth clock cycle, the value A stored in the second accumulating adder 11 modulo is added modulo P = 13 with the value coming from the output of the adder 9: 7 + 4≡11 (mod 13).

На пятом такте содержимое второго накапливающего сумматора 11 по модулю подается на выходную шину 13. Таким образом, результат операции вычитания по модулю равен 11. Операция выполнена верно, поскольку 7-9≡11 (mod 13).On the fifth step, the contents of the second accumulating adder 11 are modulo supplied to the output bus 13. Thus, the result of the subtraction operation modulo is 11. The operation is performed correctly, since 7-9≡11 (mod 13).

Claims (1)

Арифметико-логическое устройство для сложения, вычитания и умножения чисел по модулю, содержащее три n-разрядных регистра, два n-разрядных накапливающих сумматора по модулю, n-разрядный двухвходовый мультиплексор, n-разрядный электронный ключ, входную и выходную n-разрядные шины, где n – количество разрядов в двоичном коде операндов, а также модуль управляющего блока, причем информационные входы первого и второго n-разрядных регистров соединены с входной n-разрядной шиной, первый информационный вход n-разрядного двухвходового мультиплексора соединен с входной n-разрядной шиной, второй информационный вход соединен с информационным выходом первого n-разрядного накапливающего сумматора по модулю, управляющий вход соединен со вторым выходом модуля управляющего блока, информационный выход соединен с информационным входом третьего n-разрядного регистра, управляющий вход которого соединен с четвертым выходом модуля управляющего блока, а информационный выход соединен со вторым информационным входом первого n-разрядного накапливающего сумматора по модулю, второй управляющий вход которого соединен с пятым выходом модуля управляющего блока, второй управляющий вход второго n-разрядного накапливающего сумматора по модулю соединен с шестым выходом модуля управляющего блока, информационный выход соединен с информационным входом n-разрядного электронного ключа, информационный выход которого соединен с выходной n-разрядной шиной, а управляющий вход соединен с восьмым выходом модуля управляющего блока, первый выход которого соединен с первыми управляющими входами n-разрядных накапливающих сумматоров по модулю и управляющим входом первого n-разрядного регистра, третий выход соединен с первым управляющим входом второго n-разрядного регистра, седьмой выход соединен со вторым управляющим входом второго n-разрядного регистра, на первый вход подается одноразрядный код команды умножения по модулю, отличающееся тем, что в него введены два n-разрядных инвертора, n-разрядный сумматор, n-разрядный трехвходовый мультиплексор, причем информационный выход первого n-разрядного инвертора соединен с n младшими разрядами первых информационных входов n-разрядных накапливающих сумматоров по модулю, на (n+1)-й разряд которых подается уровень логической «1», выход первого n-разрядного регистра соединен с входом первого n-разрядного инвертора и с первым информационным входом n-разрядного сумматора, на вход переноса которого подается уровень логической «1», информационный выход третьего n-разрядного регистра соединен также с первым информационным входом n-разрядного трехвходового мультиплексора, младший разряд адресного входа которого соединен с девятым выходом модуля управляющего блока, старший разряд соединен с десятым выходом модуля управляющего блока, информационный выход соединен со вторым информационным входом второго n-разрядного накапливающего сумматора по модулю, третий информационный вход соединен с выходом n-разрядного сумматора, второй информационный вход которого соединен с выходом второго n-разрядного инвертора, информационный выход второго n-разрядного регистра соединен со вторым информационным входом n-разрядного трехвходового мультиплексора и входом второго n-разрядного инвертора, младший разряд соединен с пятым входом модуля управляющего блока, на второй вход которого подается одноразрядный код команды сложения по модулю, на третий вход подается одноразрядный код команды вычитания по модулю, на четвертый вход подаются тактовые импульсы, причем модуль управляющего блока содержит два трехвходовых элемента ИЛИ, два двухвходовых элемента И, r-разрядный счетчик, r-входовый дешифратор, где r = ⌈log2 (2n+4)⌉, трехразрядный демультиплексор, блок ПЗУ, два (n-1)-входовых элемента ИЛИ, девятиразрядный электронный ключ, два элемента задержки, инвертор, двухвходовый элемент ИЛИ, три RS-триггера, одноразрядный демультиплексор, причем первый вход первого трехвходового элемента ИЛИ, соединенный с адресным входом трехразрядного демультиплексора, является первым входом модуля управляющего блока, второй вход, соединенный с первым входом второго трехвходового элемента ИЛИ, является вторым входом модуля управляющего блока, третий вход, соединенный со вторым входом второго трехвходового элемента ИЛИ и адресным входом одноразрядного демультиплексора, является третьим входом модуля управляющего блока, выход первого трехвходового элемента ИЛИ соединен с входом инвертора и с первым входом первого двухвходового элемента И, второй вход которого является четвертым входом модуля управляющего блока, выход соединен с входом первого элемента задержки и со счетным входом r-разрядного счетчика, выходы которого соединены с соответствующими информационными входами r-входового дешифратора, первый и второй выходы которого соединены с первым и вторым адресными входами блока ПЗУ соответственно, третий, четвертый и пятый выходы соединены с первым, вторым и третьим разрядами информационного входа трехразрядного демультиплексора соответственно, каждый 2k-й выход соединен с (k-1)-м входом первого (n-1)-входового элемента ИЛИ, каждый (2k+1)-й выход соединен с (k-1)-м входом второго (n-1)-входового элемента ИЛИ, где k = 3, 4, …, n, (2n+2)-й выход соединен с девятым адресным входом блока ПЗУ, (2n+3)-й выход соединен с десятым адресным входом блока ПЗУ, первый, второй и третий разряды первого выхода трехразрядного демультиплексора соединены с третьим, четвертым и пятым адресными входами блока ПЗУ соответственно, первый разряд второго выхода соединен с шестым адресным входом блока ПЗУ, второй разряд второго выхода соединен с первым входом первого (n-1)-входового элемента ИЛИ, третий разряд второго выхода соединен с первым входом второго (n-1)-входового элемента ИЛИ, выход первого (n-1)-входового элемента ИЛИ соединен с седьмым адресным входом блока ПЗУ, выход второго (n-1)-входового элемента ИЛИ соединен с восьмым адресным входом блока ПЗУ, шестой выход которого соединен с первым входом второго двухвходового элемента И, выход которого соединен с шестым разрядом информационного входа девятиразрядного электронного ключа, второй вход соединен с выходом второго трехвходового элемента ИЛИ, третий вход которого является пятым входом модуля управляющего блока, первый, второй, третий, четвертый, пятый, седьмой, восьмой и девятый выходы блока ПЗУ соединены соответственно с первым, вторым, третьим, четвертым, пятым, седьмым, восьмым и девятым разрядами информационного входа девятиразрядного электронного ключа, управляющий вход которого соединен с выходом первого элемента задержки, первый разряд выхода соединен с R-входами второго и третьего RS-триггеров и с первым входом двухвходового элемента ИЛИ, а также является первым выходом модуля управляющего блока, второй разряд выхода соединен с S-входом второго RS-триггера, третий, четвертый, пятый, шестой и седьмой разряды выхода являются третьим, четвертым, пятым, шестым и седьмым выходами модуля управляющего блока соответственно, восьмой разряд выхода соединен с S-входом первого RS-триггера, девятый разряд выхода соединен с входом второго элемента задержки, выход которого соединен с S-входом третьего RS-триггера, выход которого соединен с информационным входом одноразрядного демультиплексора, первый выход которого является девятым выходом модуля управляющего блока, второй выход является десятым выходом модуля управляющего блока, выход инвертора соединен со вторым входом двухвходового элемента ИЛИ, выход которого соединен с R-входом первого RS-триггера, выход которого соединен с входом сброса r-разрядного счетчика, а также является восьмым выходом модуля управляющего блока, выход второго RS-триггера является вторым выходом модуля управляющего блока. An arithmetic logic device for adding, subtracting and multiplying numbers modulo, containing three n-bit registers, two n-bit accumulative adders modulo, an n-bit two-input multiplexer, an n-bit electronic key, input and output n-bit buses, where n is the number of bits in the binary code of the operands, as well as the control unit module, the information inputs of the first and second n-bit registers connected to the input n-bit bus, the first information input of the n-bit two-input multiplexer and connected to the input n-bit bus, the second information input is connected to the information output of the first n-bit accumulating adder modulo, the control input is connected to the second output of the control unit module, the information output is connected to the information input of the third n-bit register, the control input of which connected to the fourth output of the control unit module, and the information output is connected to the second information input of the first n-bit accumulating adder modulo, the second One of which is connected to the fifth output of the control unit module, the second control input of the second n-bit accumulating adder is connected modulo to the sixth output of the control unit module, the information output is connected to the information input of the n-bit electronic key, the information output of which is connected to the n-bit output bus, and the control input is connected to the eighth output of the control unit module, the first output of which is connected to the first control inputs of n-bit accumulating adders modulo and the first input of the first n-bit register, the third output is connected to the first control input of the second n-bit register, the seventh output is connected to the second control input of the second n-bit register, the first input is supplied with a one-bit modulo multiply instruction code, characterized in that two n-bit inverters, an n-bit adder, an n-bit three-input multiplexer are introduced to it, and the information output of the first n-bit inverter is connected to the n least significant bits of the first information inputs of n-bit modulators, on the (n + 1) th digit of which logic level “1” is supplied, the output of the first n-bit register is connected to the input of the first n-bit inverter and to the first information input of the n-bit adder, to the transfer input of which the logic level is “1”, the information output of the third n-bit register is also connected to the first information input of the n-bit three-input multiplexer, the least significant bit of the address input of which is connected to the ninth output of the control unit module, the highest bit with is single with the tenth output of the control unit module, the information output is connected to the second information input of the second n-bit accumulating adder modulo, the third information input is connected to the output of the n-bit adder, the second information input of which is connected to the output of the second n-bit inverter, the information output the second n-bit register is connected to the second information input of the n-bit three-input multiplexer and the input of the second n-bit inverter, the least significant bit is connected to the fifth input ohm of the control unit module, to the second input of which a one-bit modular addition command code is supplied, the single-digit module subtraction command code is supplied to the third input, clock pulses are supplied to the fourth input, and the control unit module contains two three-input OR elements, two two-input AND elements, r-bit counter, r-input decoder, where r = ⌈log 2 (2n + 4) ⌉, three-digit demultiplexer, ROM unit, two (n-1) input OR elements, nine-bit electronic key, two delay elements, inverter, two-input electric OR, three RS-flip-flops, one-bit demultiplexer, the first input of the first three-input OR element connected to the address input of the three-bit demultiplexer is the first input of the control unit module, the second input connected to the first input of the second three-input OR element is the second input of the control module unit, the third input connected to the second input of the second three-input OR element and the address input of the single-bit demultiplexer is the third input of the control unit module, the output of the first three-input element OR is connected to the input of the inverter and to the first input of the first two-input element AND, the second input of which is the fourth input of the control unit module, the output is connected to the input of the first delay element and to the counting input of the r-bit counter, the outputs of which are connected to the corresponding information inputs r-input decoder, the first and second outputs of which are connected to the first and second address inputs of the ROM unit, respectively, the third, fourth and fifth outputs are connected to the first, second and the third bits of the information input of a three-digit demultiplexer, respectively, each 2k-th output is connected to the (k-1) -th input of the first (n-1) -input element OR, each (2k + 1) -th output is connected to (k-1) -th input of the second (n-1) -input element OR, where k = 3, 4, ..., n, (2n + 2) -th output is connected to the ninth address input of the ROM unit, (2n + 3) -th output is connected with the tenth address input of the ROM block, the first, second and third bits of the first output of the three-bit demultiplexer are connected to the third, fourth and fifth address inputs of the ROM block, respectively, the first a row of the second output is connected to the sixth address input of the ROM unit, a second bit of the second output is connected to the first input of the first (n-1) -input OR element, a third discharge of the second output is connected to the first input of the second (n-1) -input OR element, output the first (n-1) -input OR element is connected to the seventh address input of the ROM unit, the output of the second (n-1) -input OR element is connected to the eighth address input of the ROM unit, the sixth output of which is connected to the first input of the second two-input element And, the output which is connected to the sixth digit inf the input input of a nine-digit electronic key, the second input is connected to the output of the second three-input OR element, the third input of which is the fifth input of the control unit module, the first, second, third, fourth, fifth, seventh, eighth and ninth outputs of the ROM unit are connected respectively to the first, second , third, fourth, fifth, seventh, eighth and ninth bits of the information input of a nine-digit electronic key, the control input of which is connected to the output of the first delay element, the first discharge of the soy Din with the R-inputs of the second and third RS-flip-flops and with the first input of the two-input OR element, and also is the first output of the control unit module, the second discharge bit is connected to the S-input of the second RS-trigger, the third, fourth, fifth, sixth and seventh the output bits are the third, fourth, fifth, sixth and seventh outputs of the control unit module, respectively, the eighth bit of the output is connected to the S-input of the first RS trigger, the ninth bit of the output is connected to the input of the second delay element, the output of which is connected to the third S-input o RS-flip-flop, the output of which is connected to the information input of a single-bit demultiplexer, the first output of which is the ninth output of the control unit module, the second output is the tenth output of the control unit module, the inverter output is connected to the second input of the two-input OR element, the output of which is connected to the R-input the first RS-trigger, the output of which is connected to the reset input of the r-bit counter, and is also the eighth output of the control unit module, the output of the second RS-trigger is the second output of the control unit blocking unit.
RU2019116125A 2019-05-24 2019-05-24 Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo RU2711051C1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
RU2019116125A RU2711051C1 (en) 2019-05-24 2019-05-24 Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
RU2019116125A RU2711051C1 (en) 2019-05-24 2019-05-24 Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo

Publications (1)

Publication Number Publication Date
RU2711051C1 true RU2711051C1 (en) 2020-01-14

Family

ID=69171423

Family Applications (1)

Application Number Title Priority Date Filing Date
RU2019116125A RU2711051C1 (en) 2019-05-24 2019-05-24 Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo

Country Status (1)

Country Link
RU (1) RU2711051C1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2748744C1 (en) * 2020-08-07 2021-05-31 Федеральное государственное казенное военное образовательное учреждение высшего образования "Военный учебно-научный центр Военно-воздушных сил "Военно-воздушная академия имени профессора Н.Е. Жуковского и Ю.А. Гагарина" (г. Воронеж) Министерства обороны Российской Федерации Device for multiplying numbers modulo m

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5345410A (en) * 1991-05-30 1994-09-06 Hitachi, Ltd. Arithmetic-logic unit with modulo addition/substraction function and microprocessor using the same
US20030212729A1 (en) * 2002-05-01 2003-11-13 Sun Microsystems, Inc. Modular multiplier
RU2310223C2 (en) * 2005-10-03 2007-11-10 Пензенский государственный университет (ПГУ) Homogeneous computing structure for performing operations with given modulus
RU2639645C1 (en) * 2017-02-21 2017-12-21 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Arithmetic-logical device for summing numbers by module
RU2653263C1 (en) * 2017-07-24 2018-05-07 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Arithmetic-logic device for number module multiplication

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5345410A (en) * 1991-05-30 1994-09-06 Hitachi, Ltd. Arithmetic-logic unit with modulo addition/substraction function and microprocessor using the same
US20030212729A1 (en) * 2002-05-01 2003-11-13 Sun Microsystems, Inc. Modular multiplier
RU2310223C2 (en) * 2005-10-03 2007-11-10 Пензенский государственный университет (ПГУ) Homogeneous computing structure for performing operations with given modulus
RU2639645C1 (en) * 2017-02-21 2017-12-21 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Arithmetic-logical device for summing numbers by module
RU2653263C1 (en) * 2017-07-24 2018-05-07 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Arithmetic-logic device for number module multiplication

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2748744C1 (en) * 2020-08-07 2021-05-31 Федеральное государственное казенное военное образовательное учреждение высшего образования "Военный учебно-научный центр Военно-воздушных сил "Военно-воздушная академия имени профессора Н.Е. Жуковского и Ю.А. Гагарина" (г. Воронеж) Министерства обороны Российской Федерации Device for multiplying numbers modulo m

Similar Documents

Publication Publication Date Title
JP3689183B2 (en) Accurate and effective sticky bit calculation for accurate floating-point division / square root operations
USRE39578E1 (en) Pipelined carry-lookahead generation for a fast incrementer
US4041292A (en) High speed binary multiplication system employing a plurality of multiple generator circuits
JPH0414366B2 (en)
EP0040279B1 (en) Binary divider
Marzouqi et al. An FPGA implementation of NIST 256 prime field ECC processor
US4110832A (en) Carry save adder
US6009450A (en) Finite field inverse circuit
US3730425A (en) Binary two{40 s complement multiplier processing two multiplier bits per cycle
RU2711051C1 (en) Arithmetic logic unit for addition, subtraction and multiplication of numbers modulo
GB2196453A (en) Treatment of floating point numbers
US4065666A (en) Multiply-divide unit
RU2639645C1 (en) Arithmetic-logical device for summing numbers by module
RU2653263C1 (en) Arithmetic-logic device for number module multiplication
CN112650469A (en) Circuit and method for binary flag determination
US5012439A (en) Method and apparatus for performing division
US3287546A (en) Parity prediction apparatus for use with a binary adder
Nikhila et al. FPGA based implementation of a floating point multiplier and its hardware trojan models
US7590235B2 (en) Reduction calculations in elliptic curve cryptography
EP1504338B1 (en) "emod" a fast modulus calculation for computer systems
Cilardo Variable-latency signed addition on fpgas
US6109777A (en) Division with limited carry-propagation in quotient accumulation
RU2628175C1 (en) Arithmetic-logical device for summing numbers to module
RU2799035C1 (en) Conveyor totalizer by modulo
RU2804380C1 (en) Pipeline calculator