RU2451987C1 - Apparatus for counting index numbers of high bits in data line - Google Patents

Apparatus for counting index numbers of high bits in data line Download PDF

Info

Publication number
RU2451987C1
RU2451987C1 RU2011115981/08A RU2011115981A RU2451987C1 RU 2451987 C1 RU2451987 C1 RU 2451987C1 RU 2011115981/08 A RU2011115981/08 A RU 2011115981/08A RU 2011115981 A RU2011115981 A RU 2011115981A RU 2451987 C1 RU2451987 C1 RU 2451987C1
Authority
RU
Russia
Prior art keywords
output
input
adder
block
num2
Prior art date
Application number
RU2011115981/08A
Other languages
Russian (ru)
Inventor
Леонид Сергеевич Сотов (RU)
Леонид Сергеевич Сотов
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 RU2011115981/08A priority Critical patent/RU2451987C1/en
Application granted granted Critical
Publication of RU2451987C1 publication Critical patent/RU2451987C1/en

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

FIELD: information technology.
SUBSTANCE: apparatus has n=2k binary inputs of data line bits, where k is a positive integer, n outputs of the values of index numbers high bits in a data line, a POCCNT output of the number of high bits in a data line, n AND elements, each having an output Y, a first input X1 and a second input X2, and generates at output Y the product of X1 and X2, computing units Mij, having adders and forming a hierarchical structure with k processing levels, where the index j varies from 1 to k=log2n and indicates the number of the processing level, and index i varies from 1 to 2j-1 and indicates the number of the unit on the level.
EFFECT: simplification of the apparatus while maintaining high speed of performing operations.
7 cl, 7 dwg

Description

Устройство относится к области обработки информации и может быть использовано в вычислительной технике, системах коммуникации и защиты информации от несанкционированного доступа.The device relates to the field of information processing and can be used in computer technology, communication systems and information protection from unauthorized access.

Известен многовходовый одноразрядный сумматор (пат. №2047216 Россия, G06F 7/50. Многовходовый одноразрядный сумматор). Многовходовый одноразрядный сумматор содержит К элементов сложения по модулю два (К [log2n] n разрядность входного двоичного слова), выход r-го из которых

Figure 00000001
соединен с r-м выходом сумматора, отличающийся тем, что содержит p мажоритарных элементов (p [n/2]), s-й которых
Figure 00000002
имеет порог, равный 2s, i-й вход
Figure 00000003
сумматора соединен с i-м входом первого элемента сложения по модулю два и 1-м входом s-го мажоритарного элемента, t-й вход j-го элемента сложения по модулю два
Figure 00000004
,
Figure 00000005
,
Figure 00000006
соединен с выходом мажоритарного элемента с порогом t∙2j-1, (k+1)-й выход сумматора соединен с выходом мажоритарного элемента с порогом 2k. Known multi-input single-digit adder (US Pat. No. 2047216 Russia, G06F 7/50. Multi-input single-digit adder). A multi-input single-bit adder contains K modulo two addition elements (K [log 2 n] n bit depth of the input binary word), the output of the rth of which
Figure 00000001
connected to the rth output of the adder, characterized in that it contains p majority elements (p [n / 2]), the s-th of which
Figure 00000002
has a threshold equal to 2s, i-th input
Figure 00000003
the adder is connected to the i-th input of the first addition element modulo two and the 1st input of the s-th majority element, the t-th input of the jth addition element modulo two
Figure 00000004
,
Figure 00000005
,
Figure 00000006
connected to the output of the majority element with a threshold t ∙ 2 j-1 , the (k + 1) -th output of the adder is connected to the output of the majority element with a threshold of 2 k .

Данный многовходовый одноразрядный сумматор можно использовать для расчета порядковых номеров битов с высоким логическим уровнем в строке данных длиной n. Но для параллельной обработки необходимо использовать n многовходовых одноразрядных сумматоров, при этом общее число используемых в устройстве сумматоров составляет O(n2).This multi-input single-bit adder can be used to calculate serial numbers of bits with a high logical level in a data string of length n. But for parallel processing, it is necessary to use n multi-input single-digit adders, while the total number of adders used in the device is O (n 2 ).

Недостатком такого решения является существенное усложнение схемы с параллельной обработкой. При использовании последовательной обработки, при которой с использованием одного многовходового одноразрядного сумматора последовательно рассчитывается каждый порядковый номер, существенно возрастает время расчета порядковых номеров битов с высоким логическим уровнем.The disadvantage of this solution is a significant complication of the circuit with parallel processing. When using sequential processing, in which each serial number is sequentially calculated using a single multi-input single-bit adder, the calculation time of the serial numbers of bits with a high logical level increases significantly.

Известен метод и устройство для подсчета количества бит с высоким логическим уровнем (пат. №5541865 США, G06F 7/60, 007/50. Method and apparatus for performing a population count operation). Устройство, предназначенное для вычисления числа бит с высоким логическим уровнем элемента данных, включает: первый набор сумматоров с сохранением переноса, состоящий из первого, второго, третьего и четвертого сумматоров, входы которых соединены с входами устройства так, чтобы получить первую, вторую, третью и четвертую битовые части первого элемента данных соответственно, первый и второй сумматоры с сохранением переноса формируют на своих выходах первый многобитовый блок данных, а третий и четвертый сумматоры с сохранением переноса формируют на своих выходах второй многобитовый блок данных; второй набор сумматоров, состоящий из пятого и шестого сумматоров с сохранением переноса, входы которых соединены так, чтобы получить первый и второй многобитовые блоки данных соответственно, пятый и шестой сумматоры с сохранением переноса формируют на своих выходах третий многобитовый блок данных; седьмой сумматор с сохранением переноса, входы которого соединены так, чтобы получить третий многобитовый блок выходных данных, который формирует на своих выходах четвертый многобитовый блок данных; полный сумматор, входы которого соединены так, чтобы получить четвертый многобитовый блок данных, который формирует на своих выходах количество бит с высоким логическим уровнем. Каждый сумматор с сохранением переноса представляет собой 4-2 сумматор с сохранением переноса. Полный сумматор представляет собой четырехбитовый полный сумматор.A known method and apparatus for counting the number of bits with a high logical level (US Pat. No. 5541865 USA, G06F 7/60, 007/50. Method and apparatus for performing a population count operation). A device for calculating the number of bits with a high logical level of a data element includes: a first set of adders with conservation of transfer, consisting of the first, second, third and fourth adders, the inputs of which are connected to the inputs of the device so as to obtain the first, second, third and the fourth bit parts of the first data element, respectively, the first and second adders with saving transfer form the first multi-bit data block at their outputs, and the third and fourth adders with saving transfer pho second second multi-bit data block is outputted at its outputs; the second set of adders, consisting of the fifth and sixth adders with transfer conservation, the inputs of which are connected so as to obtain the first and second multi-bit data blocks, respectively, the fifth and sixth adders with transfer conservation form at their outputs a third multi-bit data block; a seventh adder with saving transfer, the inputs of which are connected so as to obtain a third multi-bit block of output data, which forms at its outputs a fourth multi-bit block of data; full adder, the inputs of which are connected in such a way as to obtain a fourth multi-bit data block, which generates at its outputs the number of bits with a high logical level. Each adder with conservation transfer is a 4-2 adder with conservation transfer. The full adder is a four-bit full adder.

Данное устройство можно использовать для расчета порядковых номеров битов с высоким логическим уровнем в строке данных длиной n. Но для параллельной обработки необходимо использовать n устройств подсчета количества бит с высоким логическим уровнем, при этом общее число используемых сумматоров составляет O(n2).This device can be used to calculate serial numbers of bits with a high logical level in a data string of length n. But for parallel processing, it is necessary to use n devices for counting the number of bits with a high logical level, while the total number of adders used is O (n 2 ).

Недостатком такого решения является существенное усложнение схемы с параллельной обработкой. При использовании последовательной обработки существенно возрастает время расчета порядковых номеров битов с высоким логическим уровнем.The disadvantage of this solution is a significant complication of the circuit with parallel processing. When using sequential processing, the calculation time of serial numbers of bits with a high logical level is significantly increased.

Известно устройство для расчета количества бит с высоким логическим уровнем (пат. №6754685 США, G06F 5/01, 7/60, 007/00. Dynamic popcount/shift circuit). Устройство выполняет функцию расчета количества бит с высоким логическим уровнем входной строки данных и функцию сдвига данных. Метод, положенный в основу работы устройства, обеспечивает баланс между нагрузкой счетчиков числа бит с высоким логическим уровнем и схем сдвига данных. Это приводит к увеличению скорости выполнения операции. Устройство имеет входы для битов первого вектора, второго вектора, средства для вычисления числа бит с высоким логическим уровнем первого вектора, средства для осуществления операции сдвига множества бит второго вектора на основе результатов расчета числа бит с высоким логическим уровнем первого вектора, средств для формирования третьего вектора, получающегося на основе операции сдвига. Устройство состоит из множества динамических уровней, за которыми следуют статические уровни. На динамических уровнях используются динамические узлы, которые вычисляют величины, зависящие от отдельных бит указателя и разреженного вектора. Устройство расширяется путем повторения базовой схемы, поэтому оно может быть изменено в соответствии с размером указателя и разреженного вектора.A device for calculating the number of bits with a high logical level (US Pat. No. 6754685 USA, G06F 5/01, 7/60, 007/00. Dynamic popcount / shift circuit). The device performs the function of calculating the number of bits with a high logical level of the input data string and the data shift function. The method underlying the operation of the device provides a balance between the load of counters of the number of bits with a high logical level and data shift schemes. This leads to an increase in the speed of the operation. The device has inputs for the bits of the first vector, the second vector, means for calculating the number of bits with a high logical level of the first vector, means for shifting the set of bits of the second vector based on the results of calculating the number of bits with a high logical level of the first vector, means for generating the third vector resulting from a shift operation. The device consists of many dynamic levels, followed by static levels. At dynamic levels, dynamic nodes are used that calculate values depending on the individual bits of the pointer and a sparse vector. The device is expanded by repeating the basic scheme, so it can be changed in accordance with the size of the pointer and the sparse vector.

Данное устройство можно использовать для расчета порядковых номеров битов с высоким логическим уровнем в строке данных длиной n. Но для параллельной обработки необходимо использовать n устройств подсчета количества бит с высоким логическим уровнем, при этом аппаратурная сложность устройства составляет O(n2).This device can be used to calculate serial numbers of bits with a high logical level in a data string of length n. But for parallel processing, it is necessary to use n devices for counting the number of bits with a high logical level, while the hardware complexity of the device is O (n 2 ).

Недостатком такого решения является существенное усложнение схемы с параллельной обработкой. При использовании последовательной обработки существенно возрастает время расчета порядковых номеров битов с высоким логическим уровнем.The disadvantage of this solution is a significant complication of the circuit with parallel processing. When using sequential processing, the calculation time of serial numbers of bits with a high logical level increases significantly.

Известно устройство и метод для расчета количества бит с высоким логическим уровнем (пат. №5717616 США, G06F 7/60, 017/00 Computer hardware instruction and method for computing population counts). Устройство предназначено для вычисления числа бит с высоким логическим уровнем в строках большой длины. При этом вся строка разделяется на более мелкие части и для каждой из частей рассчитывается число бит с высоким логическим уровнем. Для ускорения выполнения операции используются сумматоры с сохранением переноса. Устройство состоит из регистра данных, содержащего строку битов, в которой рассчитывается число битов с высоким логическим уровнем, множества полных сумматоров, каждый из которых имеет выход, и суммирует биты с высоким логическим уровнем из уникального набора битов из регистра данных, множества сумматоров с сохранением переноса, каждый из которых имеет выход, и суммирует биты с высоким логическим уровнем из уникального набора битов из аккумулирующего регистра. Каждый из сумматоров с сохранением переноса формирует уникальный набор выходных данных в регистре назначения, где регистр назначения хранит количество бит с высоким логическим уровнем из подмножества бит регистра данных и группу бит из аккумулирующего регистра в формате суммы с сохранением переноса. Множество полных сумматоров образуют иерархическую структуру так, что первый уровень сумматоров рассчитывает число бит с высоким логическим уровнем, хранящихся в регистре данных. Входы полных сумматоров второго уровня соединены с выходами сумматоров первого уровня так, что каждый из сумматоров второго уровня складывает результаты на выходах двух сумматоров первого уровня, причем каждый из выходов сумматора первого уровня соединен с одним входом сумматора второго уровня. Число полных сумматоров первого уровня составляет половину от числа бит в регистре данных, число полных сумматоров на втором уровне составляет четверть от числа бит в регистре данных. Сумматоры с сохранением переноса суммируют одинаковое количество бит. Роль регистра назначения и аккумулирующего регистра выполняет один и тот же регистр.A device and method are known for calculating the number of bits with a high logical level (US Pat. No. 5717616 USA, G06F 7/60, 017/00 Computer hardware instruction and method for computing population counts). The device is designed to calculate the number of bits with a high logical level in long strings. In this case, the entire line is divided into smaller parts and for each of the parts the number of bits with a high logical level is calculated. To speed up the operation, adders are used with saving transfer. The device consists of a data register containing a string of bits in which the number of bits with a high logical level, a set of full adders, each of which has an output, is calculated, and sums the bits with a high logical level from a unique set of bits from a data register, a set of adders with transfer preservation , each of which has an output, and sums the bits with a high logic level from a unique set of bits from the accumulation register. Each of the adders with transfer preservation forms a unique set of output data in the destination register, where the destination register stores the number of bits with a high logical level from a subset of bits of the data register and a group of bits from the accumulating register in the sum format with transfer preservation. Many complete adders form a hierarchical structure so that the first level of adders calculates the number of bits with a high logical level stored in the data register. The inputs of the full second-level adders are connected to the outputs of the first-level adders so that each of the second-level adders adds the results at the outputs of two first-level adders, and each of the outputs of the first-level adder is connected to one input of the second-level adder. The number of full adders of the first level is half the number of bits in the data register, the number of full adders in the second level is a quarter of the number of bits in the data register. Adders with saving transfer sum the same number of bits. The role of the destination register and the accumulating register is performed by the same register.

Данное устройство можно использовать для расчета порядковых номеров битов с высоким логическим уровнем в строке данных длиной n. Но для параллельной обработки необходимо использовать n устройств подсчета количества бит с высоким логическим уровнем, при этом общее число используемых сумматоров составляет O(n2).This device can be used to calculate serial numbers of bits with a high logical level in a data string of length n. But for parallel processing, it is necessary to use n devices for counting the number of bits with a high logical level, while the total number of adders used is O (n 2 ).

Недостатком такого решения является существенное усложнение схемы с параллельной обработкой. При использовании последовательной обработки существенно возрастает время расчета порядковых номеров битов с высоким логическим уровнем.The disadvantage of this solution is a significant complication of the circuit with parallel processing. When using sequential processing, the calculation time of serial numbers of bits with a high logical level increases significantly.

Задачей настоящего решения является разработка простого устройства с количеством используемых сумматоров не более O(n) для расчета значений порядковых номеров битов и общего числа бит с высоким логическим уровнем в строке данных длиной n бит, обеспечивающего высокое быстродействие за счет параллельной обработки данных.The objective of this solution is to develop a simple device with the number of adders used no more than O (n) for calculating the values of the serial numbers of bits and the total number of bits with a high logical level in a data string of length n bits, providing high performance due to parallel data processing.

Техническим результатом является сокращение числа используемых в устройстве сумматоров до 5/2n-2log2(n)-2 при сохранении высокой скорости выполнения операции.The technical result is to reduce the number of adders used in the device to 5 / 2n-2log 2 (n) -2 while maintaining a high speed of operation.

Поставленная задача достигается тем, что устройство для расчета порядковых номеров битов с высоким логическим уровнем в строке данных, согласно решению содержит n=2k бинарных входов битов строки данных Db1, Db2,.…, Dbn, где k - целое положительное число, n выходов Q1, Q2,.…, Qn значений порядковых номеров битов с высоким логическим уровнем в строке данных, выход POPCNT числа битов с высоким логическим уровнем в строке данных, n элементов логического умножения И1, И2…, Иn, каждый из которых имеет выход Y, первый вход X1 и второй бинарный вход Х2, и формирует на выходе Y результат умножения данных на входах X1 и Х2, вычислительные блоки Mij, образующие структуру с k уровнями обработки, где индекс j меняется от 1 до k=log2n и указывает номер уровня обработки, а индекс i меняется от 1 до 2l-1 и указывает номер блока на уровне j, каждый блок Mij имеет вход I_NUM1 результатов суммирования с нижнего уровня и выход O_NUM2 результатов суммирования, каждый блок Mij, где j=2,.…, k, i=1, 2, …, 2j-1 дополнительно имеет вход I_NUM2 результатов суммирования с нижнего уровня и выход O_NUM результатов суммирования, передаваемых на верхний уровень, каждый блок Mij, где j=2,.…, k, i=2, 3, …, 2j-1 дополнительно имеет вход I_NUM результатов суммирования с верхнего уровня и выход O_NUM1 результатов суммирования, блок Ml,k дополнительно имеет выход O_NUM1 результатов суммирования, блок Mn/2,k дополнительно имеет выход I_NUM2 результатов суммирования, при этом у блока Mij уровня j, где j=1, 2,.…, k-1, i=1, 2,.…, 2j-1, выход O_NUM1 соединен с входом I_NUM блока M2i-1, j+1 выход O_NUM2 соединен с входом I_NUM блока M2ij+1 вход I_NUM1 соединен с выходом O_NUM блока M2ij+1, вход I_NUM2 соединен с выходом O_NUM блока M2ij+1 у блоков Mi,k последнего уровня k, где k=log2n, i=1, 2,.…, 2k-1 выход O_NUM1 соединен с первым входом X1 логического элемента И2i-1 вход I_NUM1 соединен с входом Db2i-1 устройства и вторым бинарным входом Х2 логического элемента И2i-1, выход логического элемента И2i-1, соединен с выходом Q2i-1 устройства, выход O_NUM2 блока Мi,k соединен с первым входом X1 логического элемента И2i, вход I_NUM2 блока Мi,k соединен с входом Db2i устройства и вторым бинарным входом Х2 логического элемента И2i, выход логического элемента И2i соединен с выходом Q2i, устройства, выход O_NUM2 блока Mn/2,k дополнительно соединен с выходом POPCNT устройства. У блока М11 вход I_NUM1 соединен с выходом O_NUM2. Каждый блок промежуточного уровня Mi,j, где j=2,.…, k-1, i=2j-l, включает в себя сумматор с первым I1 и вторым I2 входами, и выходом OU, причем вход блока I_NUM1 соединен с первым входом сумматора I1, вход I_NUM соединен со вторым входом сумматора I2 и с выходом O_NUM1, выход O_NUM2 соединен с выходом OU сумматора. Каждый блок Ml.j, где j=2,.…, k-1 включает в себя сумматор с первым I1 и вторым I2 входами, и выходом OU, причем вход I_NUM1 соединен с первым входом сумматора I1 и с выходом O_NUM2, вход I_NUM2 соединен со вторым входом сумматора I2, выход O_NUM соединен с выходом OU сумматора. Блок М1,k включает в себя сумматор с первым I1 и вторым I2 входами, и выходом OU, причем вход I_NUM1 соединен с первым входом сумматора I1 и с выходом O_NUM1, вход I_NUM2 соединен со вторым входом сумматора I2, выход O_NUM соединен с выходом OU сумматора и с выходом O_NUM2. Каждый блок Мi,k последнего уровня k, где i=2,.…, n/2, состоит из трех сумматоров, каждый из которых имеет первый I1 и второй I2 входы, и выход OU, причем вход I_NUM1 соединен с первыми входами I1 первого и второго сумматоров, вход I_NUM2 соединен со вторым входом I2 первого сумматора, вход I_NUM соединен со вторым входом I2 второго сумматора и с первым входом I1 третьего сумматора, выход OU первого сумматора соединен со вторым входом I2 третьего сумматора и с выходом O_NUM при его наличии, выход O_NUM1 соединен с выходом OU второго сумматора, выход O_NUM2 соединен с выходом OU третьего сумматора. Каждый блок промежуточного уровня Mi,j, где j=2,.…, k-1, i=2, 3,.…, 2j-1-1 состоит из двух сумматоров, имеющих первый I1 и второй I2 входы, и выход OU, причем вход I_NUM1 соединен с первыми входами I1 первого и второго сумматоров, вход I_NUM2 соединен со вторым входом I2 первого сумматора, вход I_NUM соединен с вторым входом I2 второго сумматора и с выходом O_NUM1, выход O_NUM соединен с выходом OU первого сумматора, выход O_NUM2 соединен с выходом OU второго сумматора.The problem is achieved in that the device for calculating the serial numbers of bits with a high logical level in the data string, according to the solution, contains n = 2 k binary inputs of bits of the data string Db 1 , Db 2 , ..., Db n , where k is a positive integer , n outputs Q 1 , Q 2 ,..., Q n values of serial numbers of bits with a high logical level in the data string, output POPCNT of the number of bits with a high logical level in the data string, n logical multiplication elements AND 1 , AND 2 ..., AND n, each of which has a Y output, the first input X1 and a second binary input X2 and forms uet output Y output data of multiplication by the X1 inputs and X2 computing units M ij, forming a structure with k treatment levels, where the index j runs from 1 to k = log 2 n and indicates processing level number, i the index runs from 1 to 2 l-1 and indicates the block number at level j, each block M ij has an input I_NUM1 of summation results from the lower level and output O_NUM2 of summation results, each block M ij , where j = 2, ..., k, i = 1, 2 , ..., 2j -1 additionally has an input I_NUM2 of the summation results from the lower level and an output O_NUM of the summation results transmitted to the upper level, each block M ij , where j = 2, ..., k, i = 2, 3, ..., 2 j-1 additionally has input I_NUM of the summation results from the upper level and output O_NUM1 of the summation results, block M l, k additionally has the output O_NUM1 of the summation results, the block M n / 2, k additionally has the output I_NUM2 of the summation results, while the block M ij has level j, where j = 1, 2, ..., k-1, i = 1, 2 ,. ..., 2 j-1 , output O_NUM1 is connected to input I_NUM of block M 2i-1, j + 1 output O_NUM2 is connected to input I_NUM of block M 2ij + 1 input I_NUM1 is connected to output O_NUM of block M 2ij + 1 , input I_NUM2 is connected to output O_NUM of block M 2ij + 1 for blocks M i, k of the last level k, where e k = log 2 n, i = 1, 2, ..., 2 k-1 output O_NUM1 is connected to the first input X1 of the logic element And 2i-1 input I_NUM1 is connected to the input Db 2i-1 of the device and the second binary input X2 of the logic element And 2i-1 , the output of the logic element And 2i-1, is connected to the output Q 2i-1 of the device, the output O_NUM2 of the block M i, k is connected to the first input X1 of the logic element And 2i , the input I_NUM2 of the block M i, k is connected to the input Db 2i devices and the second binary input X2 of the logic element AND 2i, the output of the logic element And 2i is connected to the output Q 2i , devices, the output O_NUM2 of the block M n / 2, k is additionally connected to the output POPCNT devices. At block M 11, input I_NUM1 is connected to output O_NUM2. Each block of the intermediate level M i, j , where j = 2, ..., k-1, i = 2 jl , includes an adder with the first I1 and second I2 inputs, and the output OU, and the input of the block I_NUM1 is connected to the first input the adder I1, the input I_NUM is connected to the second input of the adder I2 and with the output O_NUM1, the output O_NUM2 is connected to the output OU of the adder. Each block M lj , where j = 2, ..., k-1 includes an adder with the first I1 and second I2 inputs and an OU output, with the input I_NUM1 connected to the first input of the adder I1 and the output O_NUM2, the input I_NUM2 connected to the second input of the adder I2, the output O_NUM is connected to the output OU of the adder. Block M 1, k includes an adder with first I1 and second I2 inputs and an OU output, with input I_NUM1 connected to the first input of adder I1 and output O_NUM1, input I_NUM2 connected to the second input of adder I2, output O_NUM connected to output OU adder and with output O_NUM2. Each block M i, k of the last level k, where i = 2, ..., n / 2, consists of three adders, each of which has the first I1 and second I2 inputs, and the output OU, and the input I_NUM1 is connected to the first inputs I1 of the first and second adders, input I_NUM2 is connected to the second input I2 of the first adder, input I_NUM is connected to the second input I2 of the second adder and the first input I1 of the third adder, the output OU of the first adder is connected to the second input I2 of the third adder and to the output O_NUM, if any , the output O_NUM1 is connected to the OU output of the second adder, the output O_NUM2 is connected to the OU t output a third adder. Each block of the intermediate level M i, j , where j = 2, ..., k-1, i = 2, 3, ..., 2 j-1 -1 consists of two adders having the first I1 and second I2 inputs, and OU output, with input I_NUM1 connected to the first inputs I1 of the first and second adders, input I_NUM2 connected to the second input I2 of the first adder, input I_NUM connected to the second input I2 of the second adder and output O_NUM1, output O_NUM connected to the output OU of the first adder, output O_NUM2 is connected to the OU output of the second adder.

Изобретение поясняется чертежами, где на фиг.1 приведена структурно-функциональная схема устройства для расчета порядковых номеров битов с высоким логическим уровнем в строке данных длиной n=8, на фиг.2 приведена схема блоков Мi,k последнего уровня преобразования k, где k=log2n, i=2, 3,.…, 2k-1, на фиг.3 приведена схема блоков промежуточного уровня Мs,t, где 1<t<k, a 1<s<2t-1, на фиг.4 приведена схема блоков М1,m, где 1<m<k, на фиг.5 приведена схема блоков Mpq, где q=2,.…, k-1, p=2q-1, на фиг.6 приведена схема блока М1,k, на фиг.7 приведена схема блока Mn/2,k, гдеThe invention is illustrated by drawings, where Fig. 1 shows a structural-functional diagram of a device for calculating serial numbers of bits with a high logical level in a data string of length n = 8, Fig. 2 shows a block diagram of M i, k of the last conversion level k, where k = log 2 n, i = 2, 3, ..., 2 k-1 , figure 3 shows the block diagram of the intermediate level M s, t , where 1 <t <k, a 1 <s <2 t-1 , figure 4 shows the block diagram M 1, m , where 1 <m <k, figure 5 shows the block diagram M pq , where q = 2, ..., k-1, p = 2 q-1 , figure .6 shows a block diagram of M 1, k , Fig. 7 shows a block diagram of M n / 2, k , where

М11 - первый блок первого уровня;M 11 - the first block of the first level;

М12, М22 - первый и второй блоки второго уровня;M 12 , M 22 - the first and second blocks of the second level;

M13, М23, M33, M43 - первый, второй, третий и четвертый блоки третьего уровня;M 13 , M 23 , M 33 , M 43 - the first, second, third and fourth blocks of the third level;

И1- И8 - логические элементы И;And 1 - And 8 - logical elements And;

X1 - первый вход логического элемента И;X1 - the first input of the logical element And;

Х2 - второй бинарный вход логического элемента И;X2 - the second binary input of the logical element And;

Y - выход логического элемента И;Y is the output of the AND gate;

O_NUM - выход результатов суммирования, передаваемых на верхний уровень;O_NUM - output of the summation results transferred to the upper level;

O_NUM1, O_NUM2 - первый и второй выходы результатов суммирования, передаваемых на нижний уровень;O_NUM1, O_NUM2 - the first and second outputs of the summation results transmitted to the lower level;

I_NUM - вход результатов суммирования с верхнего уровня;I_NUM - input of summation results from the top level;

I_NUM1, I_NUM2 - первый и второй входы результатов суммирования с нижнего уровня;I_NUM1, I_NUM2 - the first and second inputs of the summation results from the lower level;

Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8 - выходы значений порядковых номеров битов с высоким логическим уровнем;Q 1 , Q 2 , Q 3 , Q 4, Q 5 , Q 6 , Q 7 , Q 8 - outputs of the values of serial numbers of bits with a high logical level;

Db1, Db2, Db3, Db4, Db5, Db6, Db7, Db8 - бинарные входы битов входной строки данных;Db 1 , Db 2 , Db 3 , Db 4 , Db 5 , Db 6 , Db 7 , Db 8 - binary inputs of bits of the input data string;

POPCNT - выход суммы битов с высоким логическим уровнем;POPCNT - output of the sum of bits with a high logical level;

ADD - сумматор;ADD - adder;

I1, I2 - входы сумматора;I1, I2 - inputs of the adder;

OU - выход сумматора.OU - adder output.

В общем случае предлагаемое устройство имеет n бинарных входов для получения битов входной строки данных, n выходов результатов расчета порядковых номеров битов с высоким логическим уровнем, выход результатов расчета количества битов с высоким логическим уровнем. Предлагаемое устройство содержит вычислительные блоки Mi,j, образующие пирамидальную структуру с k=log2n уровнями обработки, причем индекс i меняется от 1 до 2j-1 и указывает номер блока на уровне, а индекс j меняется от 1 до k и указывает номер уровня обработки. Таким образом, на первом уровне (j=1) расположен единственный блок М11, на втором уровне расположено два блока, на третьем - четыре и так далее до последнего уровня (j=k), содержащего n/2 блоков. Устройство также содержит n элементов логического умножения И1, И2…, Иn, каждый из которых имеет выход Y, первый вход X1 и второй бинарный вход Х2, при этом число на выходе Y равно числу на входе Х1, если на входе Х2 высокий логический уровень, если на входе Х2 низкий логический уровень, то число на выходе Y равно нулю.In the General case, the proposed device has n binary inputs for receiving bits of the input data string, n outputs of the results of calculating the serial numbers of bits with a high logical level, the output of the results of calculating the number of bits with a high logical level. The proposed device contains computing blocks M i, j forming a pyramidal structure with k = log 2 n processing levels, with the index i changing from 1 to 2 j-1 and indicating the block number at the level, and the index j changing from 1 to k and indicating processing level number. Thus, at the first level (j = 1) there is a single block M 11 , at the second level there are two blocks, at the third - four and so on to the last level (j = k) containing n / 2 blocks. The device also contains n logical multiplication elements AND 1 , AND 2 ... , AND n , each of which has an output Y, a first input X1 and a second binary input X2, while the number at the output Y is equal to the number at the input X1, if the input X2 is high logic level, if input X2 has a low logic level, then the number at output Y is zero.

Блоки Mi,j разделяются на семь типов.Blocks M i, j are divided into seven types.

1. Блок М11 имеет вход I_NUM1 и выход J_NUM2, которые соединены между собой.1. Block M 11 has an input I_NUM1 and an output J_NUM2, which are interconnected.

Остальные блоки состоят из сумматоров ADD, каждый из которых имеет первый I1 и второй I2 входы для подачи суммируемых чисел и выход OU, на котором формируется сумма чисел, подаваемых на входы I1 и I2.The remaining blocks consist of adders ADD, each of which has the first I1 and second I2 inputs for supplying the summed numbers and the output OU, on which the sum of the numbers supplied to the inputs I1 and I2 is formed.

2. Блоки Mi,k последнего уровня преобразования k, где k=log2n, i=2, 3,.…, 2k-l-1 состоят из трех сумматоров ADD. Схема блоков Mi,k приведена на фиг.2. Блоки Мi,k имеют выход результатов суммирования, передаваемых на верхний уровень O_NUM, первый O_NUM1 и второй O_NUM2 выходы результатов суммирования, передаваемых на нижний уровень, вход I_NUM результатов суммирования с верхнего уровня, первый I_NUM1 и второй I_NUM2 входы результатов суммирования с нижнего уровня. Вход I_NUM1 блока Mi,k соединен с первым входом I1 первого сумматора и со вторым входом I2 второго сумматора. Вход I_NUM2 блока Mi,k соединен со вторым входом I2 первого сумматора. Вход I_NUM блока Mi,k соединен со вторым входом I2 второго сумматора и с первым входом I1 третьего сумматора. Выход O_NUM блока Mi,k соединен с выходом OU первого сумматора и со вторым входом I2 третьего сумматора. Выход O_NUM1 блока Mi,k соединен с выходом OU второго сумматора. Выход O_NUM2 блока Mi,k соединен с выходом OU третьего сумматора. На фиг.1 блоки М23, М33 соответствуют описанию блока Mi,k, схема которого представлена на фиг.2.2. Blocks M i, k of the last level of transformation k, where k = log 2 n, i = 2, 3, ..., 2 kl -1 consist of three adders ADD. The block diagram of M i, k is shown in figure 2. Blocks М i, k have the output of the summation results transmitted to the upper level O_NUM, the first O_NUM1 and the second O_NUM2 outputs the summation results transferred to the lower level, the input I_NUM of the summation results from the upper level, the first I_NUM1 and the second I_NUM2 inputs of the summation results from the lower level. The input I_NUM1 of the block M i, k is connected to the first input I1 of the first adder and to the second input I2 of the second adder. The input I_NUM2 of the block M i, k is connected to the second input I2 of the first adder. The input I_NUM of the block M i, k is connected to the second input I2 of the second adder and to the first input I1 of the third adder. The output O_NUM of the block M i, k is connected to the output OU of the first adder and to the second input I2 of the third adder. The output O_NUM1 of the block M i, k is connected to the output OU of the second adder. The output O_NUM2 of the block M i, k is connected to the output OU of the third adder. In figure 1, the blocks M 23 , M 33 correspond to the description of the block M i, k , a diagram of which is presented in figure 2.

3. Блоки Ms,t промежуточного уровня преобразования t, где 1<t<k, a 1<s<2t-1 состоят из двух сумматоров ADD. Схема блоков Ms,t приведена на фиг.3. Блоки Ms,t имеют выход результатов суммирования, передаваемых на верхний уровень O_NUM, первый O_NUM1 и второй O_NUM2 выходы результатов суммирования, передаваемых на нижний уровень, вход I_NUM результатов суммирования с верхнего уровня, первый I_NUM1 и второй I_NUM2 входы результатов суммирования с нижнего уровня. Вход I_NUM1 блока Ms,t соединен с первым входом I1 первого сумматора и со первым входом I1 второго сумматора. Вход I_NUM2 блока Ms,t соединен со вторым входом I2 первого сумматора. Вход I_NUM блока Ms,t соединен со вторым входом I2 второго сумматора и с выходом O_NUM1 блока M Ms,t. Выход O_NUM блока Ms,t соединен с выходом OU первого сумматора. Выход O_NUM2 блока Ms,t соединен с выходом OU второго сумматора. На фиг.1 не изображены блоки, которые соответствуют описанию блоков Ms,t, схема которых представлена на фиг.3, так как эти блоки появляются при длине входной строки данных n более восьми бит.3. Blocks M s, t of the intermediate level of transformation t, where 1 <t <k, and 1 <s <2 t-1 consist of two adders ADD. The block diagram M s, t is shown in Fig.3. Blocks M s, t have the output of the summation results transferred to the upper level O_NUM, the first O_NUM1 and the second O_NUM2 outputs the summation results transferred to the lower level, the input I_NUM of the summation results from the upper level, the first I_NUM1 and the second I_NUM2 inputs of the summation results from the lower level. The input I_NUM1 of the block M s, t is connected to the first input I1 of the first adder and to the first input I1 of the second adder. The input I_NUM2 of the block M s, t is connected to the second input I2 of the first adder. The input I_NUM of the block M s, t is connected to the second input I2 of the second adder and the output O_NUM1 of the block MM s, t . The output O_NUM of the block M s, t is connected to the output OU of the first adder. The output O_NUM2 of the block M s, t is connected to the output OU of the second adder. Figure 1 does not depict blocks that correspond to the description of blocks M s, t , the scheme of which is presented in figure 3, since these blocks appear when the length of the input data string n is more than eight bits.

4. Блоки М1m промежуточного уровня преобразования m, где 1<m<k состоят из одного сумматора ADD. Схема блоков М1m приведена на фиг.4. Блоки М1,m, имеют выход результатов суммирования, передаваемых на верхний уровень O_NUM, выход O_NUM2 результатов суммирования, передаваемых на нижний уровень, первый I_NUM1 и второй I_NUM2 входы результатов суммирования с нижнего уровня. Вход I_NUM1 блока М1,m соединен с первым входом I1 сумматора и с выходом O_NUM2. Вход I_NUM2 блока М1,m соединен со вторым входом I2 сумматора. Выход O_NUM блока М1,m соединен с выходом OU сумматора. На фиг.1 блок MI2 соответствуют описанию блока М1m, схема которого представлена на фиг.4.4. Blocks M 1m of the intermediate conversion level m, where 1 <m <k consist of one adder ADD. The block diagram of M 1m shown in figure 4. Blocks M 1, m , have the output of the summation results transmitted to the upper level O_NUM, the output O_NUM2 of the summation results transferred to the lower level, the first I_NUM1 and the second I_NUM2 inputs of the summation results from the lower level. The input I_NUM1 of the block M 1, m is connected to the first input I1 of the adder and with the output O_NUM2. The input I_NUM2 of the block M 1, m is connected to the second input I2 of the adder. The output O_NUM of the block M 1, m is connected to the output OU of the adder. In figure 1, the block M I2 correspond to the description of the block M 1m , a diagram of which is presented in figure 4.

5. Блоки Mp,q промежуточного уровня преобразования q, где 1<q<k, p=2q-1 состоят из одного сумматора ADD. Схема блоков Mp,q приведена на фиг.5. Блоки Mp,q имеют первый O_NUM1 и второй O_NUM2 выходы результатов суммирования, передаваемых на нижний уровень, вход результатов суммирования с нижнего уровня I_NUM1, вход I_NUM результатов суммирования с верхнего уровня. Вход I_NUM1 блока Mp.q соединен с первым входом I1 сумматора. Вход I_NUM блока Mp,q соединен со вторым входом I2 сумматора и с выходом O_NUM1 блока Mp,q. Выход O_NUM2 блока Mp.q соединен с выходом OU сумматора. На фиг.1 блок М22 соответствуют описанию блока Mp,q, схема которого представлена на фиг.5.5. Blocks M p, q of the intermediate level of transformation q, where 1 <q <k, p = 2 q-1 consist of one adder ADD. The block diagram M p, q is shown in Fig.5. Blocks M p, q have the first O_NUM1 and second O_NUM2 outputs of the summation results transmitted to the lower level, the input of the summation results from the lower level I_NUM1, the input I_NUM of the summation results from the upper level. The input I_NUM1 of the block M pq is connected to the first input I1 of the adder. The input I_NUM of the block M p, q is connected to the second input I2 of the adder and the output O_NUM1 of the block M p, q . The output O_NUM2 of the block M pq is connected to the output OU of the adder. In figure 1, the block M 22 correspond to the description of the block M p, q , a diagram of which is presented in figure 5.

6. Блок M1,k последнего уровня преобразования k, где k=log2n, состоит из одного сумматора ADD. Схема блока М1,k приведена на фиг.6. Блок M1,k имеет выход результатов суммирования, передаваемых на верхний уровень O_NUM, первый O_NUM1 и второй O_NUM2 выходы результатов суммирования, передаваемых на нижний уровень, первый I_NUM1 и второй I_NUM2 входы результатов суммирования с нижнего уровня. Вход I_NUM1 блока M1,k соединен с первым входом I1 сумматора блока M1,k и с выходом O_NUM1 блока M1,k. Вход I_NUM2 блока M1,k соединен со вторым входом I2 сумматора блока M1,k. Выход O_NUM блока M1,k соединен с выходом OU сумматора блока M1,k и с выходом O_NUM2 блока Mi,k. На фиг.1 блок M13 соответствует описанию блока М1,k, схема которого представлена на фиг.6.6. Block M 1, k of the last conversion level k, where k = log 2 n, consists of one adder ADD. The block diagram of M 1, k is shown in Fig.6. Block M 1, k has the output of the summation results transmitted to the upper level O_NUM, the first O_NUM1 and the second O_NUM2 the outputs of the summation results transmitted to the lower level, the first I_NUM1 and the second I_NUM2 inputs of the summation from the lower level. Input I_NUM1 of block M 1, k is connected to the first input I1 of the adder of block M 1, k and with output O_NUM1 of block M 1, k . The input I_NUM2 of the block M 1, k is connected to the second input I2 of the adder of the block M 1, k . The output O_NUM of block M 1, k is connected to the output OU of the adder of block M 1, k and with the output O_NUM2 of block M i, k . In figure 1, the block M 13 corresponds to the description of the block M 1, k , a diagram of which is presented in Fig.6.

7. Блок Mn/2,k последнего уровня преобразования k, где k=log2n, состоит из трех сумматоров ADD. Схема блока Mn/2,k приведена на фиг.7. Блок Mn/2,k имеет первый O_NUM1 и второй O_NUM2 выходы результатов суммирования, передаваемых на нижний уровень, вход I_NUM результатов суммирования с верхнего уровня, первый I_NUM1 и второй I_NUM2 входы результатов суммирования с нижнего уровня. Вход I_NUM1 блока Mn/2,k соединен с первым входом I1 первого сумматора и с первым входом I1 второго сумматора. Вход I_NUM2 блока Mn/2,k соединен со вторым входом I2 первого сумматора. Вход I_NUM блока Mn/2,k соединен со вторым входом I2 второго сумматора и с первым входом I1 третьего сумматора. Выход OU первого сумматора блока Mn/2,k соединен со вторым входом I2 третьего сумматора. Выход O_NUM1 блока Mn/2,k соединен с выходом OU второго сумматора. Выход O_NUM2 блока Mn/2,k соединен с выходом OU третьего сумматора. На фиг.1 блок М43 соответствует описанию блока Mn/2,k, схема которого представлена на фиг.7.7. Block M n / 2, k of the last level of transformation k, where k = log 2 n, consists of three adders ADD. The block diagram of M n / 2, k is shown in Fig.7. Block M n / 2, k has the first O_NUM1 and second O_NUM2 outputs of the summation results transmitted to the lower level, the input I_NUM of the summation results from the upper level, the first I_NUM1 and the second I_NUM2 inputs of the summation results from the lower level. The input I_NUM1 of the block M n / 2, k is connected to the first input I1 of the first adder and to the first input I1 of the second adder. Input I_NUM2 of the block M n / 2, k is connected to the second input I2 of the first adder. The input I_NUM of the block M n / 2, k is connected to the second input I2 of the second adder and to the first input I1 of the third adder. The output OU of the first adder of the block M n / 2, k is connected to the second input I2 of the third adder. The output O_NUM1 of the block M n / 2, k is connected to the output OU of the second adder. The output O_NUM2 of the block M n / 2, k is connected to the output OU of the third adder. In figure 1, the block M 43 corresponds to the description of the block M n / 2, k , a diagram of which is presented in figure 7.

Соединения между блоками устройства следующие.The connections between the units of the device are as follows.

Если у блока Мр,m уровня m, где m=1, 2,.…, k-1; р=1, 2,.…, 2m-1 существует выход O_NUM1, то он соединен с входом I_NUM блока M2p-1, m+1 уровня m+1. Выход O_NUM2 блока Мр,m уровня m соединен с входом I_NUM блока М2р,m+1 уровня m+1. Вход I_NUM1 блока Мр,m уровня m соединен с выходом O_NUM блока M2p-1, m+1 уровня m+1, если у блока Мр,m уровня m существует вход I_NUM2, то он соединен с выходом O_NUM блока М2р,m+1 уровня m+1. Выход O_NUM1 каждого блока Mi,k последнего уровня k, где k=lоg2n, a i=1, 2,.…, 2k-1 соединен с первым входом X1 логического элемента И2i-1, вход I_NUM1 блока Мi,k соединен с входом Db2i-1 устройства и вторым бинарным входом Х2 логического элемента И2i-1, выход логического элемента И2p-1 соединен с выходом Q2p-1 устройства, выход O_NUM2 блока Мi,k последнего уровня k, где k=log2n, i=1, 2,.…, 2k-l, соединен с первым входом X1 логического элемента И2i, вход I_NUM2 блока Мi,k соединен с входом Db2i устройства и вторым бинарным входом Х2 логического элемента И2i, выход логического элемента И2i соединен с выходом Q2i устройства. Выход O_NUM2 блока Мn/2,k дополнительно соединен с выходом POPCNT суммы битов с высоким логическим уровнем во входной строке данного устройства.If the block М p, m is level m, where m = 1, 2, ..., k-1; p = 1, 2, ..., 2 m-1 there is an output O_NUM1, then it is connected to the input I_NUM of the block M 2p-1, m + 1 of level m + 1. The output O_NUM2 of the block M p, m of level m is connected to the input I_NUM of the block M 2p, m + 1 of level m + 1. The input I_NUM1 of the block M p, m of level m is connected to the output O_NUM of the block M 2p-1, m + 1 of level m + 1, if the block M p, m of level m has an input I_NUM2, then it is connected to the output O_NUM of the block M 2p, m + 1 level m + 1. The output O_NUM1 of each block M i, k of the last level k, where k = log 2 n, ai = 1, 2, ..., 2 k-1 is connected to the first input X1 of the logic element And 2i-1 , input I_NUM1 of the block M i, k is connected to the input Db 2i-1 of the device and the second binary input X2 of the logic element And 2i-1 , the output of the logic element And 2p-1 is connected to the output Q 2p-1 of the device, the output O_NUM2 of the block M i, k of the last level k, where k = log 2 n, i = 1, 2, ..., 2 kl , connected to the first input X1 of the logic element And 2i , the input I_NUM2 of the block M i, k is connected to the input Db 2i of the device and the second binary input X2 of the logical element And 2i , logic element output And 2i connected to the output Q 2i of the device. The output O_NUM2 of the block M n / 2, k is additionally connected to the output POPCNT of the sum of bits with a high logic level in the input line of this device.

Устройство работает следующим образом. На бинарные входы Db1, Db2,.…, Dbn устройства для расчета порядковых номеров битов с высоким логическим уровнем поступают биты входной строки данных. Через время задержки t3 на выходах Q1, Q2,.…, Qn, устройства появляются значения порядковых номеров битов с высоким логическим уровнем во входной строке данных. Скорость выполнения операции зависит от типа используемых сумматоров. Если задержка сумматора не зависит от числа суммируемых разрядов и равна τ, задержка t3 выполнения предлагаемым устройством расчета порядковых номеров битов с высоким логическим уровнем составляет tз=2τ(log2(n)-1). Задержка формирования результата на выходе POPCNT также равна tз.The device operates as follows. The binary inputs Db 1 , Db 2 ,..., Db n of the device for calculating the serial numbers of bits with a high logical level receive the bits of the input data string. After a delay time t 3 at the outputs Q 1 , Q 2 ,..., Q n , the device displays the values of serial numbers of bits with a high logical level in the input data line. The speed of the operation depends on the type of adders used. If the adder delay does not depend on the number of digits to be summed and is equal to τ, the delay t 3 of execution by the proposed device for calculating the serial numbers of bits with a high logical level is t s = 2τ (log 2 (n) -1). The delay in generating the result at the output of POPCNT is also equal to t s .

В блоках Mi,j могут использоваться сумматоры с сохранением переноса, сумматоры со сквозным переносом, сумматоры с ускоренным переносом и другие сумматоры, описанные, например, в книге Жан М. Рабаи, Ананта Чандракасан, Боривож Николич. Цифровые интегральные схемы. Методология проектирования. М.: Вильямс, 2007, 912 с. При расчете порядковых номеров битов с высоким логическим уровнем в n разрядной строке данных используются схемы для суммирования входных данных с числом разрядов от 1 до lоg2n.In the blocks M i, j , adders with conservation of transfer, adders with through transfer, adders with accelerated transfer and other adders described, for example, in the book of Jean M. Rabai, Ananta Chandrakasan, Borivozh Nikolic, can be used. Digital integrated circuits. Design methodology. M .: Williams, 2007, 912 p. When calculating the serial numbers of bits with a high logical level in the n bit row of data, schemes are used to sum the input data with the number of bits from 1 to log 2 n.

В блоках Mi,j могут использоваться сумматоры, суммирующие входные данные по модулю 2. В этом случае устройство определяет четность или нечетность порядкового номера бита с высоким логическим уровнем в строке данных. В общем случае, если в блоках Mi,j используются сумматоры, суммирующие входные данные по модулю d, порядковые номера битов с высоким логическим уровнем в строке данных также будут вычисляться по модулю d.In blocks M i, j adders can be used, summing the input data modulo 2. In this case, the device determines the parity or oddness of the serial number of bits with a high logical level in the data line. In the general case, if adders summing the input data modulo d are used in blocks M i, j , serial numbers of bits with a high logical level in the data line will also be computed modulo d.

Число разрядов суммируемых величин в блоках различно. У блока Мр,m уровня m, где m=1, 3,.…, k; p=1, 2,.…, 2m-1 выход O_NUM1 имеет число двоичных разрядов, равное int(log2(p))+k-m+1, где функция int(log2(p)) вычисляет ближайшее целое число, большее чем log2(p), а выходы O_NUM2 и O_NUM имеют число двоичных разрядов, равное int(log2(p))+k-m+2. Таким образом, последний сумматор последнего уровня, формирующий результат на выходе O_NUM2, имеет k+1 разряд. У блока Мр,m уровня m, где m=1, 3,.…, k; р=1, 2,.…, 2m-1 входы I_NUM1, I_NUM2 имеют число двоичных разрядов, равное k-m+1. В блоках Мр,m можно использовать одинаковые сумматоры с числом разрядов суммируемых чисел, равным k, но при этом часть старших разрядов части сумматоров не будет использоваться.The number of bits of the summed values in blocks is different. The block M p, m is level m, where m = 1, 3, ..., k; p = 1, 2, ..., 2 m-1 output O_NUM1 has the number of binary digits equal to int (log 2 (p)) + k-m + 1, where the function int (log 2 (p)) calculates the nearest integer greater than log 2 (p), and the outputs O_NUM2 and O_NUM have the number of binary bits equal to int (log 2 (p)) + k-m + 2. Thus, the last adder of the last level, which forms the result at the output O_NUM2, has k + 1 bit. The block M p, m is level m, where m = 1, 3, ..., k; p = 1, 2, ..., 2 m-1 inputs I_NUM1, I_NUM2 have the number of binary digits equal to k-m + 1. In blocks M p, m, you can use the same adders with the number of bits of the summed numbers equal to k, but at the same time part of the highest bits of the part of the adders will not be used.

Заметим, что устройство можно использовать при значениях длины входной строки данных n, отличной от степени числа 2. При этом используется только часть блоков, на которые поступают биты строки входных данных. Неиспользуемые блоки и логические элементы Иi можно исключить из устройства.Note that the device can be used with values of the input data string length n different from the power of the number 2. In this case, only part of the blocks to which the bits of the input data string are sent are used. Unused blocks and logic elements And i can be excluded from the device.

Таким образом, устройство выполняет расчет порядковых номеров битов с высоким логическим уровнем входной бинарной строки данных. Одновременно с расчетом порядковых номеров битов устройство осуществляет расчет количества битов с высоким логическим уровнем во входной строке данных. Устройство характеризуется небольшим числом используемых сумматоров. Аппаратурная сложность устройства, определяемая количеством используемых сумматоров, составляет 5/2n-2log2(n)-2, где n - число бит входной строки данных. Это значительно меньше количества сумматоров, необходимого для расчета порядковых номеров битов с высоким логическим уровнем с использованием n устройств расчета количества бит с высоким логическим уровнем. Обработка данных в предлагаемом устройстве выполняется параллельно, что обеспечивает высокую скорость выполнения операции.Thus, the device calculates the serial numbers of bits with a high logical level of the input binary data string. Simultaneously with the calculation of the serial numbers of bits, the device calculates the number of bits with a high logical level in the input data line. The device is characterized by a small number of adders used. The hardware complexity of the device, determined by the number of adders used, is 5 / 2n-2log 2 (n) -2, where n is the number of bits of the input data string. This is significantly less than the number of adders needed to calculate the serial numbers of bits with a high logical level using n devices for calculating the number of bits with a high logical level. Data processing in the proposed device is performed in parallel, which provides a high speed operation.

Claims (7)

1. Устройство для расчета порядковых номеров битов с высоким логическим уровнем в строке данных, характеризующееся тем, что оно содержит n=2k бинарных входов битов строки данных Db1, Db2, …, Dbn, где k - целое положительное число, n выходов Q1, Q2, …, Qn значений порядковых номеров битов с высоким логическим уровнем в строке данных, выход POPCNT числа битов с высоким логическим уровнем в строке данных, n элементов логического умножения И1, И2,…, Иn, каждый из которых имеет выход Y, первый вход X1 и второй бинарный вход Х2, и формирует на выходе Y результат умножения данных на входах X1 и Х2, вычислительные блоки Mq, образующие структуру с k уровнями обработки, где индекс j меняется от 1 до k=log2n и указывает номер уровня обработки, а индекс i меняется от 1 до 2j-1 и указывает номер блока на уровне j, каждый блок Мij имеет вход I-NUM1 результатов суммирования с нижнего уровня и выход 0-NUM2 результатов суммирования, каждый блок Mi,j, где j=2, …, k, i=1, 2, …, 2j-i-1 дополнительно имеет вход I-NUM2 результатов суммирования с нижнего уровня и выход O-NUM результатов суммирования, передаваемых на верхний уровень, каждый блок Mi,j, где j=2, …, k, i=2, 3, …, 2j-1 дополнительно имеет вход I-NUM результатов суммирования с верхнего уровня и выход O-NUM1 результатов суммирования, блок M1,k дополнительно имеет выход O-NUM1 результатов суммирования, блок Mn/2,k дополнительно имеет выход I-NUM2 результатов суммирования, при этом у блока Мij уровня j, где j=1, 2, …, k-1, i=1, 2, …, 2j-1, выход O-NUM1 соединен с входом I-NUM блока М2i+1, j+i, выход O-NUM2 соединен с входом I-NUM блока М2i, j+i, вход I-NUM1 соединен с выходом O-NUM блока M2i-1, j+i, вход I-NUM2 соединен с выходом O-NUM блока М2i,j+1, у блоков Мi,k последнего уровня k, где k=log2n, i=1, 2, …, 2k-1, выход O-NUM1 соединен с первым входом X1 логического элемента И2i-1, вход I-NUM1 соединен с входом Db2i-i устройства и вторым бинарным входом Х2 логического элемента И2i-1, выход логического элемента И2i-1 соединен с выходом Q2i-1 устройства, выход O-NUM2 блока Mi,k соединен с первым входом X1 логического элемента И2i, вход I-NUM2 блока Мi;k соединен с входом Db2i устройства и вторым бинарным входом Х2 логического элемента И2i, выход логического элемента И2i соединен с выходом Q2i устройства, выход O-NUM2 блока Mn/2,k дополнительно соединен с выходом POPCNT устройства.1. Device for calculating the serial numbers of bits with a high logical level in the data string, characterized in that it contains n = 2 k binary inputs of bits of the data string Db 1 , Db 2 , ..., Db n , where k is a positive integer, n outputs Q 1 , Q 2 , ..., Q n values of serial numbers of bits with a high logical level in the data line, output POPCNT of the number of bits with a high logical level in the data line, n logical multiplication elements AND 1 , AND 2 , ..., AND n , each of which has an output Y, the first input X1 and the second binary input X2, and forms the result at the output Y multiplying the data at inputs X1 and X2, computational units M q forming a structure with k processing levels, where the index j varies from 1 to k = log 2 n and indicates the number of the processing level, and the index i varies from 1 to 2 j-1 and indicates the block number at level j, each block M ij has an input I-NUM1 of summation results from the lower level and output 0-NUM2 of summation results, each block M i, j , where j = 2, ..., k, i = 1, 2 , ..., 2 ji -1 additionally has an input I-NUM2 of the summation results from the lower level and an output O-NUM of the summation results transmitted to the upper level, each block M i, j where j = 2, ..., k, i = 2, 3, ..., 2 j-1 additionally has an input I-NUM of the summation results from the upper level and an output O-NUM1 of the summation results, block M 1, k additionally has an output O -NUM1 of the summation results, the block M n / 2, k additionally has an output I-NUM2 of the summation results, while the block M ij has level j, where j = 1, 2, ..., k-1, i = 1, 2, ... , 2 j-1 , the output O-NUM1 is connected to the input I-NUM of the block M 2i + 1 , j + i , the output O-NUM2 is connected to the input I-NUM of the block M 2i , j + i , the input I-NUM1 is connected to the output of the O-NUM block M 2i-1, j + i , the input I-NUM2 is connected to the output O-NUM of the block M 2i, j + 1 , the blocks M i, k of the last level k, where k = log 2 n, i = 1, 2, 2 k-1, O-NUM1 output is connected to the first input X1 AND gate 2i-1, I-NUM1 input coupled to the input Db 2i-i devices and second binary input X2 of the AND gate 2i-1, the NAND gate output of AND 2i-1 is connected to the output Q 2i-1 of the device, the output O-NUM2 of the block M i, k is connected to the first input X1 of the logic element And 2i , the input I-NUM2 of the block M i; k is connected to the input Db 2i of the device and the second binary input X2 of the logic element AND 2i , the output of the logic element AND 2i is connected to the output Q 2i of the device, the output O-NUM2 of the block M n / 2, k is additionally connected to the output POPCNT of the device. 2. Устройство по п.1, характеризующееся тем, что у блока М11 вход I-NUM1 соединен с выходом O-NUM2.2. The device according to claim 1, characterized in that the block M 11 input I-NUM1 is connected to the output O-NUM2. 3. Устройство по п.1, характеризующееся тем, что каждый блок промежуточного уровня Mi,j, где j=2, …, k-1, i=2j-1, включает в себя сумматор с первым I1 и вторым I2 входами и выходом OU, причем вход блока I-NUM1 соединен с первым входом сумматора I1, вход I-NUM соединен со вторым входом сумматора I2 и с выходом O-NUM1, выход O-NUM2 соединен с выходом OU сумматора.3. The device according to claim 1, characterized in that each block of the intermediate level M i, j , where j = 2, ..., k-1, i = 2 j-1 , includes an adder with the first I1 and second I2 inputs and an OU output, wherein the input of I-NUM1 is connected to the first input of the adder I1, the I-NUM input is connected to the second input of the adder I2 and the output O-NUM1, the output O-NUM2 is connected to the output OU of the adder. 4. Устройство по п.1, характеризующееся тем, что каждый блок Мi,j, где j=2, …, k-1 включает в себя сумматор с первым I1 и вторым I2 входами и выходом OU, причем вход I-NUM1 соединен с первым входом сумматора I1 и с выходом O-NUM2, вход I-NUM2 соединен со вторым входом сумматора I2, выход O-NUM соединен с выходом OU сумматора.4. The device according to claim 1, characterized in that each block M i, j , where j = 2, ..., k-1 includes an adder with the first I1 and second I2 inputs and output OU, and the input I-NUM1 is connected with the first input of the adder I1 and with the output O-NUM2, the input I-NUM2 is connected to the second input of the adder I2, the output O-NUM is connected to the output OU of the adder. 5. Устройство по п.1, характеризующееся тем, что блок M1,k включает в себя сумматор с первым I1 и вторым I2 входами и выходом OU, причем вход I-NUM1 соединен с первым входом сумматора I1 и с выходом O-NUM1, вход INUM2 соединен со вторым входом сумматора I2, выход O-NUM соединен с выходом OU сумматора и с выходом O-NUM2.5. The device according to claim 1, characterized in that the block M 1, k includes an adder with a first I1 and second I2 inputs and an OU output, the input I-NUM1 being connected to the first input of the adder I1 and with the output O-NUM1, the INUM2 input is connected to the second input of the adder I2, the O-NUM output is connected to the OU output of the adder and to the O-NUM2 output. 6. Устройство по п.1, характеризующееся тем, что каждый блок Мi,k последнего уровня k, где i=2, …, n/2, состоит из трех сумматоров, каждый из которых имеет первый I1 и второй I2 входы, и выход OU, причем вход I-NUM1 соединен с первыми входами I1 первого и второго сумматоров, вход I-NUM2 соединен со вторым входом I2 первого сумматора, вход I-NUM соединен со вторым входом I2 второго сумматора и с первым входом I1 третьего сумматора, выход OU первого сумматора соединен со вторым входом I2 третьего сумматора и с выходом O-NUM при его наличии, выход O-NUM1 соединен с выходом OU второго сумматора, выход O-NUM2 соединен с выходом OU третьего сумматора.6. The device according to claim 1, characterized in that each block M i, k of the last level k, where i = 2, ..., n / 2, consists of three adders, each of which has first I1 and second I2 inputs, and OU output, with input I-NUM1 connected to the first inputs I1 of the first and second adders, input I-NUM2 connected to the second input I2 of the first adder, input I-NUM connected to the second input I2 of the second adder and the first input I1 of the third adder, output The OU of the first adder is connected to the second input I2 of the third adder and to the output O-NUM, if any, the output O-NUM1 is connected to the output OU of the second of the adder, the O-NUM2 output is connected to the OU output of the third adder. 7. Устройство по п.1, характеризующееся тем, что каждый блок промежуточного уровня Mi,j, где j=2, …, k-1, i=2, 3, …, 2j-1-1, состоит из двух сумматоров, имеющих первый I1 и второй I2 входы и выход OU, причем вход I-NUM1 соединен с первыми входами I1 первого и второго сумматоров, вход I-NUM2 соединен со вторым входом I2 первого сумматора, вход I-NUM соединен со вторым входом I2 второго сумматора и с выходом O-NUM1, выход O-NUM соединен с выходом OU первого сумматора, выход O-NUM2 соединен с выходом OU второго сумматора. 7. The device according to claim 1, characterized in that each block of the intermediate level M i, j , where j = 2, ..., k-1, i = 2, 3, ..., 2 j-1 -1, consists of two adders having first I1 and second I2 inputs and output OU, the input I-NUM1 connected to the first inputs I1 of the first and second adders, the input I-NUM2 connected to the second input I2 of the first adder, the input I-NUM connected to the second input I2 of the second the adder and with the output O-NUM1, the output O-NUM is connected to the output OU of the first adder, the output O-NUM2 is connected to the output OU of the second adder.
RU2011115981/08A 2011-04-25 2011-04-25 Apparatus for counting index numbers of high bits in data line RU2451987C1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
RU2011115981/08A RU2451987C1 (en) 2011-04-25 2011-04-25 Apparatus for counting index numbers of high bits in data line

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
RU2011115981/08A RU2451987C1 (en) 2011-04-25 2011-04-25 Apparatus for counting index numbers of high bits in data line

Publications (1)

Publication Number Publication Date
RU2451987C1 true RU2451987C1 (en) 2012-05-27

Family

ID=46231785

Family Applications (1)

Application Number Title Priority Date Filing Date
RU2011115981/08A RU2451987C1 (en) 2011-04-25 2011-04-25 Apparatus for counting index numbers of high bits in data line

Country Status (1)

Country Link
RU (1) RU2451987C1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2030783C1 (en) * 1991-07-03 1995-03-10 Дагестанский Политехнический Институт Device for determination of number of units in binary eight-digit code
RU2047216C1 (en) * 1992-10-12 1995-10-27 Леонид Болеславович Авгуль Multiple-input single-bit adder
US5541865A (en) * 1993-12-30 1996-07-30 Intel Corporation Method and apparatus for performing a population count operation
US5717616A (en) * 1993-02-19 1998-02-10 Hewlett-Packard Company Computer hardware instruction and method for computing population counts
GB2365636A (en) * 2000-08-04 2002-02-20 Automatic Parallel Designs Ltd Parallel counter and multiplication logic circuit

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2030783C1 (en) * 1991-07-03 1995-03-10 Дагестанский Политехнический Институт Device for determination of number of units in binary eight-digit code
RU2047216C1 (en) * 1992-10-12 1995-10-27 Леонид Болеславович Авгуль Multiple-input single-bit adder
US5717616A (en) * 1993-02-19 1998-02-10 Hewlett-Packard Company Computer hardware instruction and method for computing population counts
US5541865A (en) * 1993-12-30 1996-07-30 Intel Corporation Method and apparatus for performing a population count operation
GB2365636A (en) * 2000-08-04 2002-02-20 Automatic Parallel Designs Ltd Parallel counter and multiplication logic circuit

Similar Documents

Publication Publication Date Title
CN109063825B (en) Convolutional neural network accelerator
CN109146067B (en) Policy convolution neural network accelerator based on FPGA
US20120150933A1 (en) Method and data processing unit for calculating at least one multiply-sum of two carry-less multiplications of two input operands, data processing program and computer program product
JP4290202B2 (en) Booth multiplication apparatus and method
CN102043760B (en) Data processing method and system
US10534576B2 (en) Optimization apparatus and control method thereof
CN102945224A (en) High-speed variable point FFT (Fast Fourier Transform) processor based on FPGA (Field-Programmable Gate Array) and processing method of high-speed variable point FFT processor
Meher et al. Low-Latency, Low-Area, and Scalable Systolic-Like Modular Multipliers for $ GF (2^{m}) $ Based on Irreducible All-One Polynomials
US10628124B2 (en) Stochastic rounding logic
GB2580153A (en) Converting floating point numbers to reduce the precision
RU2439667C1 (en) Processor of higher functioning reliability
CN115238863A (en) Hardware acceleration method, system and application of convolutional neural network convolutional layer
Hiasat Sign detector for the extended four‐moduli set
RU2451987C1 (en) Apparatus for counting index numbers of high bits in data line
CN109379191B (en) Dot multiplication operation circuit and method based on elliptic curve base point
Ago et al. The parallel FDFM processor core approach for neural networks
RU2451988C1 (en) High-speed apparatus for counting index numbers of high bits in data line
Addabbo et al. Efficient implementation of pseudochaotic piecewise linear maps with high digitization accuracies
Abdellatef et al. Characterization of correlation in stochastic computing functions
Kaur et al. Analysis of ternary multiplier using booth encoding technique
RU2786204C1 (en) Digital smoother
Norollah et al. An efficient sorting architecture for area and energy constrained edge computing devices
CN110059814A (en) A kind of lookup tabular form convolution algorithm hardware configuration based on FPGA
US7839164B1 (en) Low depth programmable priority encoders
Abraham et al. An ASIC design of an optimized multiplication using twin precision

Legal Events

Date Code Title Description
MM4A The patent is invalid due to non-payment of fees

Effective date: 20180426