CN108549589A - A kind of model taking method of low overhead - Google Patents

A kind of model taking method of low overhead Download PDF

Info

Publication number
CN108549589A
CN108549589A CN201810235355.7A CN201810235355A CN108549589A CN 108549589 A CN108549589 A CN 108549589A CN 201810235355 A CN201810235355 A CN 201810235355A CN 108549589 A CN108549589 A CN 108549589A
Authority
CN
China
Prior art keywords
remainder
binary
modulo
rom
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810235355.7A
Other languages
Chinese (zh)
Inventor
王健
李�浩
刘静
陈翔
陆许明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE
Sun Yat Sen University
Original Assignee
SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE
Sun Yat Sen University
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 SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE, Sun Yat Sen University filed Critical SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE
Priority to CN201810235355.7A priority Critical patent/CN108549589A/en
Publication of CN108549589A publication Critical patent/CN108549589A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/18Error detection or correction of the data by redundancy in hardware using passive fault-masking of the redundant circuits
    • G06F11/181Eliminating the failing redundant component
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/18Error detection or correction of the data by redundancy in hardware using passive fault-masking of the redundant circuits
    • G06F11/187Voting techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供一种低开销的取模方法,该方法以模m=3为例,取模运算可以通过统计余数1与余数2的个数,然后根据余数1与余数2的个数查表确定余数,再根据输入数据的正负确定余数的最终结果,这种方法与直接使用%取模方法相比,大大降低了取模运算的开销。

The present invention provides a low-overhead modulo-taking method. The method takes modulo m=3 as an example. The modulo-taking operation can be determined by counting the numbers of the remainder 1 and the remainder 2, and then according to the numbers of the remainder 1 and the remainder 2. The remainder, and then determine the final result of the remainder according to the positive or negative of the input data. Compared with the method of directly using % modulo, this method greatly reduces the overhead of the modulo operation.

Description

一种低开销的取模方法A low-overhead modulo method

技术领域technical field

本发明涉及余数校验领域,更具体地,涉及一种低开销的取模方法。The invention relates to the field of remainder checking, and more specifically, relates to a low-overhead modulo-taking method.

背景技术Background technique

空间辐射环境对空间飞行器的电子产品有着严重的影响,单粒子效应是主要要考虑的影响。在空间应用中,单粒子效应能产生严重后果,包括信息丢失和功能失效。当具有足够转移能量的带电粒子击中芯片时,就可能发生单粒子效应现象,进而引发系统故障。辐射效应引起的瞬时错误已经成为人们的主要关注所在,只有应用容错技术才能保证电路的可靠性。The space radiation environment has a serious impact on the electronic products of the spacecraft, and the single event effect is the main impact to be considered. In space applications, single event effects can have serious consequences, including information loss and functional failure. Single-event effects can occur when charged particles with sufficient transferred energy hit a chip, causing system failure. Transient errors caused by radiation effects have become the main concern of people, and only the application of fault-tolerant technology can ensure the reliability of the circuit.

三模冗余技术在辐射环境下的容错信号处理中得到广泛应用。三模冗余使用三个相同模块对输入数据进行相同滤波操作,选择两路或三路相同的结果进行输出,完全消除了单支路故障对信号处理输出的影响。但在三模冗余技术中,所有的运算及存储资源消耗都增加到原来的三倍,这使得三模冗余技术在很多资源受限的应用中无法使用,如星载平台上的容错信号处理等。Triple-mode redundancy technology is widely used in fault-tolerant signal processing in radiation environments. Three-mode redundancy uses three identical modules to perform the same filtering operation on input data, and selects two or three identical results for output, completely eliminating the influence of single-branch faults on signal processing output. However, in the triple-mode redundancy technology, the consumption of all computing and storage resources is tripled, which makes the triple-mode redundancy technology unusable in many resource-constrained applications, such as fault-tolerant signals on the spaceborne platform processing etc.

为了降低容错开销,研究人员提出了基于余数校验的容错方案。在基于余数校验的容错方案中,校验支路若使用较小的模数,则可以使硬件开销大大低于普通计算支路,因此可以显著降低整体容错系统的开销。In order to reduce the fault-tolerance overhead, the researchers proposed a fault-tolerance scheme based on remainder check. In the fault-tolerant scheme based on remainder check, if the check branch uses a smaller modulus, the hardware overhead can be greatly lower than that of the ordinary calculation branch, so the overhead of the overall fault-tolerant system can be significantly reduced.

如果使用基于余数校验的容错信号处理技术,则对数据取模是必不可少运算。并且若基于余数校验的容错方案较为复杂,使用较多的取模运算,则整个容错方案中的取模运算的资源开销也会占很大比例。Modulo data is an essential operation if error-tolerant signal processing techniques based on remainder checking are used. And if the fault-tolerant scheme based on the remainder check is more complex and uses more modulo operations, the resource overhead of the modulo operations in the entire fault-tolerant scheme will also account for a large proportion.

发明内容Contents of the invention

本发明提供一种低开销的取模方法,以降低基于余数校验的容错方案中取模运算的资源开销。The invention provides a low-overhead modulo-taking method to reduce the resource overhead of modulo-taking operations in a fault-tolerant scheme based on remainder checking.

为了达到上述技术效果,本发明的技术方案如下:In order to achieve the above-mentioned technical effect, the technical scheme of the present invention is as follows:

一种低开销的取模方法,包括以下步骤:A low-overhead modulo method comprising the following steps:

S1:如果二进制有符号数x为负数,则先将x变为二进制正数,然后赋给y;否则如果二进制有符号数x为正数,则直接将x的值赋给y;S1: If the binary signed number x is a negative number, first change x to a binary positive number, and then assign it to y; otherwise, if the binary signed number x is a positive number, directly assign the value of x to y;

S2:统计二进制正数y的第0、2、4、6等偶数位上1的个数,设为m;同样统计二进制正数的第1、3、5、7等奇数位上1的个数,设为n,其中m为余数为1的个数,n为余数为2的个数;S2: Count the number of 1s in the even-numbered bits such as 0, 2, 4, and 6 of the binary positive number y, and set it to m; also count the 1s in the odd-numbered bits of the binary positive number 1, 3, 5, and 7 Number, set to n, where m is the number with a remainder of 1, and n is the number with a remainder of 2;

S3:统计二进制正数m的第0、2、4等偶数位上1的个数,设为a;统计二进制正数m的第1、3、5等奇数位上1的个数,设为b,其中a为余数为1的个数,b为余数为2的个数;S3: Count the number of 1s on the 0th, 2nd, 4th, etc. even-numbered bits of the binary positive number m, and set it to a; count the number of 1s on the 1st, 3rd, 5th, etc. odd-numbered bits of the binary positive number m, and set it to b, where a is the number whose remainder is 1, and b is the number whose remainder is 2;

S4:统计二进制正数n的第0、2、4等偶数位上1的个数,设为c;统计二进制正数m的第1、3、5等奇数位上1的个数,设为d,其中c为余数为2的个数,d为余数为1的个数;S4: Count the number of 1s in the 0th, 2nd, 4th, etc. even-numbered bits of the binary positive number n, and set it to c; count the number of 1s in the 1st, 3rd, 5th, etc. odd-numbered bits of the binary positive number m, and set it to d, where c is the number whose remainder is 2, and d is the number whose remainder is 1;

S5:余数为1的个数为a与d的和,设为e;余数为2的个数为b与c的和,设为f,根据e和f的值可以确定余数,建立一个只读存储器ROM,只读存储器ROM根据e和f的值输出相对应的余数;S5: The number with a remainder of 1 is the sum of a and d, which is set to e; the number with a remainder of 2 is the sum of b and c, which is set to f, the remainder can be determined according to the values of e and f, and a read-only Memory ROM, the read-only memory ROM outputs the corresponding remainder according to the value of e and f;

S6:ROM输出的余数为2位二进制正数,如果输入数据x为正数,则直接将ROM输出的余数作为取模运算最终结果,如果输入数据x为负数,则将ROM输出的余数按位取反后作为取模运算最终结果。S6: The remainder output by the ROM is a 2-digit binary positive number. If the input data x is a positive number, the remainder output by the ROM is directly used as the final result of the modulo operation. If the input data x is a negative number, the remainder output by the ROM is bitwise After negation, it is used as the final result of the modulo operation.

进一步地,所述步骤S1中,如果二进制有符号数x为正数,则直接将x的值赋给y,如果x为负数,则将二进制数x按位取反加1后赋给y。Further, in the step S1, if the binary signed number x is a positive number, the value of x is directly assigned to y, and if x is a negative number, then the binary number x is inverted and 1 is assigned to y.

进一步地,所述步骤S2中,如果二进制正数y的第0、2、4、6等偶数位上为1,则每个相应位置代表数值为4N,其中N为0、1、2、3等整数,4N对模M=3取余为1,所以m为余数为1的个数;Further, in the step S2, if the 0th, 2nd, 4th, 6th and other even-numbered bits of the binary positive number y are 1, then each corresponding position represents a value of 4 N , where N is 0, 1, 2, Integers such as 3, the remainder of 4 N to the modulo M=3 is 1, so m is the number of remainders of 1;

如果二进制正数y的第1、3、5、7等奇数位上为1,则每个相应位置代表数值为2*4N,其中N为0、1、2、3等整数,2*4N对模M=3取余为2,所以n为余数为2的个数。If the 1st, 3rd, 5th, 7th and other odd bits of the binary positive number y are 1, then each corresponding position represents a value of 2*4 N , where N is an integer such as 0, 1, 2, 3, etc., 2*4 The modulo M=3 of N takes a remainder of 2, so n is the number of remainders of 2.

进一步地,步骤S3中,由于m为余数1的个数,所以a为余数为1的个数,b为余数为2的个数。Further, in step S3, since m is the number with remainder 1, a is the number with remainder 1, and b is the number with remainder 2.

进一步地,步骤S4中,由于n为余数2的个数,如果二进制数n的第0、2、4、6等偶数位上为1,则每个相应位置代表数值为2*4N,其中N为0、1、2、3等整数,2*4N对模M=3取余为2,所以c为余数为2的个数;Further, in step S4, since n is the number of the remainder 2, if the 0th, 2nd, 4th, 6th, etc. even-numbered bits of the binary number n are 1, then each corresponding position represents a value of 2*4 N , where N is an integer such as 0, 1, 2, 3, etc., and 2*4 N takes a remainder of modulus M=3 to be 2, so c is the number whose remainder is 2;

由于n为余数2的个数,如果二进制数n的第1、3、5、7等奇数位上为1,则每个相应位置代表数值为4N+1,其中N为0、1、2、3等整数,4N+1对模M=3取余为1,d为余数为1的个数。Since n is the number of remainder 2, if the 1st, 3rd, 5th, 7th and other odd bits of the binary number n are 1, then each corresponding position represents a value of 4N+1, where N is 0, 1, 2, Integers such as 3, the remainder of 4N+1 to the modulo M=3 is 1, and d is the number of remainders of 1.

进一步地,步骤S5中,余数为1的个数为e;余数为2的个数为f;根据e和f的值可以计算出对3取余运算的余数,不同的e和f的值对应不同的余数,这种对应关系相当于建立一个只读存储器ROM的组合逻辑功能的真值表。Further, in step S5, the number with a remainder of 1 is e; the number with a remainder of 2 is f; according to the values of e and f, the remainder of the remainder operation of 3 can be calculated, and the values of different e and f correspond to For different remainders, this corresponding relationship is equivalent to establishing a truth table of the combinatorial logic function of the read-only memory ROM.

进一步地,步骤S6中,ROM输出的余数为2位二进制正数0、1、2,如果输入数据x为正数,则使用位拼接运算符把0和ROM输出的余数拼接起来变为一个最高位为0的有符号数,作为最终的结果输出;如果输入数据x为负数,则其余数一般也为负数,可以先将ROM输出的余数按位取反后再加1变为对应的负数,使用位拼接运算符把1和这个负数拼接起来变为一个最高位为1的有符号数,作为最终的结果,其中如果余数为0,则直接输出,不进行上述操作;Further, in step S6, the remainder output by the ROM is a 2-bit binary positive number 0, 1, and 2. If the input data x is a positive number, the bit splicing operator is used to splice 0 and the remainder output by the ROM into a highest A signed number whose bit is 0 is output as the final result; if the input data x is a negative number, the remainder is generally also a negative number. You can first invert the remainder output by the ROM bit by bit and then add 1 to become the corresponding negative number. Use the bit concatenation operator to concatenate 1 and this negative number into a signed number with the highest bit being 1, as the final result. If the remainder is 0, it will be output directly without performing the above operation;

由于基于余数校验的容错方案中会对三个支路产生的余数进行比较,而如果余数为负数,可将负数加上模数变为正数以方便余数间的比较;模为3,如果输入数据x为负数,则可以将ROM输出的余数按位取反,就可以得到负数加上模数变为正数的结果,其中如果余数为0,则直接输出,不进行上述操作,如果输入数据x为正数,则直接将ROM输出的余数作为结果。Since the remainder generated by the three branches will be compared in the fault-tolerant scheme based on the remainder check, and if the remainder is a negative number, the negative number plus the modulus can be changed into a positive number to facilitate the comparison between the remainder; the modulus is 3, if If the input data x is a negative number, the remainder output by the ROM can be reversed bit by bit, and the result of adding the modulus to the negative number can be obtained to become a positive number. If the remainder is 0, it will be output directly without the above operation. If input If the data x is a positive number, the remainder output by the ROM is directly used as the result.

与现有技术相比,本发明技术方案的有益效果是:Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

本发明方法中以模m=3为例,取模运算可以通过统计余数1与余数2的个数,然后根据余数1与余数2的个数查表确定余数,再根据输入数据的正负确定余数的最终结果,这种方法与直接使用%取模方法相比,大大降低了取模运算的开销。Taking modulo m=3 as an example in the method of the present invention, the modulus operation can be by counting the number of remainder 1 and remainder 2, then according to the number of remainder 1 and remainder 2, look up the table to determine the remainder, and then determine according to the positive or negative of the input data The final result of the remainder, this method greatly reduces the overhead of the modulo operation compared to directly using the % modulo method.

附图说明Description of drawings

图1为本发明方法。Fig. 1 is the method of the present invention.

具体实施方式Detailed ways

附图仅用于示例性说明,不能理解为对本专利的限制;The accompanying drawings are for illustrative purposes only and cannot be construed as limiting the patent;

为了更好说明本实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;In order to better illustrate this embodiment, some parts in the drawings will be omitted, enlarged or reduced, and do not represent the size of the actual product;

对于本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。For those skilled in the art, it is understandable that some well-known structures and descriptions thereof may be omitted in the drawings.

下面结合附图和实施例对本发明的技术方案做进一步的说明。The technical solutions of the present invention will be further described below in conjunction with the accompanying drawings and embodiments.

实施例1Example 1

如图1所示,一种低开销取模方法,包括以下步骤:As shown in Figure 1, a low-overhead modulo taking method includes the following steps:

S1,如果输入二进制数x的最高位为1,将二进制数x按位取反再加1变为正数,把正数的值赋给y,如果二进制数x的最高位为0,则直接将其值赋给y;S1, if the highest bit of the input binary number x is 1, invert the binary number x and add 1 to become a positive number, assign the value of the positive number to y, if the highest bit of the binary number x is 0, directly assign its value to y;

S2,求二进制数y的第0、2、4、6、8、10、12、14位上1的个数,设为m,如果二进制数y上述位置上数为1,则其代表的值对3取模得到的余数为1;S2, find the number of 1s in the 0th, 2nd, 4th, 6th, 8th, 10th, 12th, and 14th bits of the binary number y, set it as m, if the number in the above-mentioned position of the binary number y is 1, then the value it represents The remainder obtained modulo 3 is 1;

求二进制数y的第1、3、5、7、9、11、13位上1的个数,设为n,如果二进制数y上述位置上数为1,则其代表的值对3取模得到的余数为2;Find the number of 1s in the 1st, 3rd, 5th, 7th, 9th, 11th, and 13th bits of the binary number y, and set it to n. If the number in the above-mentioned position of the binary number y is 1, then the value it represents is modulo 3 The resulting remainder is 2;

另外,m的最大值为8,n的最大值为7;In addition, the maximum value of m is 8, and the maximum value of n is 7;

S3,求二进制数m的第0、2位上1的个数,设为a,由于m为S2步骤中余数1的个数,所以a为余数1的个数;S3, seek the number of 1 on the 0th and 2nd positions of the binary number m, set it as a, because m is the number of remainder 1 in the S2 step, so a is the number of remainder 1;

求二进制数m的第1、3位上1的个数,设为b,由于m为S2步骤中余数1的个数,所以b为余数2的个数;Find the number of 1s on the 1st and 3rd bits of the binary number m, set it as b, since m is the number of remainder 1 in the S2 step, so b is the number of remainder 2;

S4,求二进制数n的第0、2位上1的个数,设为c,由于n为S2步骤中余数2的个数,所以c为余数2的个数;S4, seek the number of 1 on the 0th and 2nd positions of binary number n, set it as c, because n is the number of remainder 2 in the S2 step, so c is the number of remainder 2;

求二进制数n的第1位上1的个数,设为d,由于n为S2步骤中余数2的个数,所以d为余数1的个数;Find the number of 1s on the first bit of the binary number n, set it as d, since n is the number of remainder 2 in the S2 step, so d is the number of remainder 1;

S5,分别求S3和S4步骤中余数为1和余数为2总的个数,求得a与d的和,设为e,e为余数为1个数的总和;求得b与c的和,设为f,f为余数为2个数的总和;S5, respectively seek the total number of remainders of 1 and 2 in the steps of S3 and S4, obtain the sum of a and d, set it as e, and e is the sum of the remainder of 1 number; obtain the sum of b and c , set as f, f is the sum of 2 numbers with remainder;

根据e与f的值可以确定余数,例如,e与f均为1时,输出余数为0。这种关系相当于一个逻辑组合的真值表,使用只读存储器ROM将这个真值表的信息存储起来。根据e与f的值输出相应的余数,余数有位宽为2的二进制数0、1、2三种情况;The remainder can be determined according to the values of e and f, for example, when both e and f are 1, the output remainder is 0. This relationship is equivalent to a truth table of logical combination, and the information of this truth table is stored by using the read-only memory ROM. Output the corresponding remainder according to the values of e and f, and the remainder has three cases of binary numbers 0, 1, and 2 with a bit width of 2;

S6,如果S1步骤中的二进制数x最高位为0,则将只读存储器ROM输出的余数作为最终结果;S6, if the highest bit of the binary number x in the S1 step is 0, the remainder output by the read-only memory ROM is used as the final result;

S7,如果S1步骤中的二进制数x最高位为1,则将只读存储器ROM输出除0外的余数按位取反后作为最终结果;如果输出余数为0,不经过取反操作直接作为最终结果。例如,如果输出余数为2,则代表取余运算的结果实际为-2,但是将位宽为2二进制余数2按位取反后就变成了1,这相当于将-2加上一个模数3的结果。S7, if the highest bit of the binary number x in the S1 step is 1, the remainder except 0 output by the read-only memory ROM is bitwise inverted as the final result; if the output remainder is 0, it is directly used as the final result without the inversion operation result. For example, if the output remainder is 2, it means that the result of the remainder operation is actually -2, but after the bitwise inversion of the binary remainder 2 with a bit width of 2, it becomes 1, which is equivalent to adding a modulus to -2 The result of the number 3.

本实施例通过先计算出二进制有符号数x的余数1和余数2的个数,再通过余数1和2的个数查表得到有符号数x的最终余数。比在Verilog程序中直接使用%取模要更节省资源开销。In this embodiment, the number of remainders 1 and 2 of the binary signed number x is calculated first, and then the final remainder of the signed number x is obtained by looking up the number of remainders 1 and 2. Compared with directly using % modulo in the Verilog program, it saves resource overhead.

本申请所述的方法使用Vivado工具进行仿真和设计综合,结果如下:The method described in this application uses the Vivado tool for simulation and design synthesis, and the results are as follows:

对于位宽为49、33、16、6的数据x,使用新提出的取模方法的资源开销比在Verilog程序中直接使用%取模的资源开销分别节省46.2%、41.8%、65.0%、85.7%。由此可见,本申请提出的一种低开销的取模运算方法对降低取模运算的资源开销是非常有效的。For data x with a bit width of 49, 33, 16, and 6, the resource overhead of using the newly proposed modulo method is 46.2%, 41.8%, 65.0%, and 85.7% less than that of directly using % modulo in the Verilog program. %. It can be seen that a low-overhead modulo calculation method proposed in the present application is very effective in reducing the resource overhead of the modulo calculation.

相同或相似的标号对应相同或相似的部件;The same or similar reference numerals correspond to the same or similar components;

附图中描述位置关系的用于仅用于示例性说明,不能理解为对本专利的限制;The positional relationship described in the drawings is only for illustrative purposes and cannot be construed as a limitation to this patent;

显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。Apparently, the above-mentioned embodiments of the present invention are only examples for clearly illustrating the present invention, rather than limiting the implementation of the present invention. For those of ordinary skill in the art, other changes or changes in different forms can be made on the basis of the above description. It is not necessary and impossible to exhaustively list all the implementation manners here. All modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the claims of the present invention.

Claims (7)

1.一种低开销的取模方法,其特征在于,包括以下步骤:1. a low overhead modulo method, characterized in that, may further comprise the steps: S1:如果二进制有符号数x为负数,则先将x变为二进制正数,然后赋给y;否则如果二进制有符号数x为正数,则直接将x的值赋给y;S1: If the binary signed number x is a negative number, first change x to a binary positive number, and then assign it to y; otherwise, if the binary signed number x is a positive number, directly assign the value of x to y; S2:统计二进制正数y的第0、2、4、6等偶数位上1的个数,设为m;同样统计二进制正数的第1、3、5、7等奇数位上1的个数,设为n,其中m为余数为1的个数,n为余数为2的个数;S2: Count the number of 1s in the even-numbered bits such as 0, 2, 4, and 6 of the binary positive number y, and set it to m; also count the 1s in the odd-numbered bits of the binary positive number 1, 3, 5, and 7 Number, set to n, where m is the number with a remainder of 1, and n is the number with a remainder of 2; S3:统计二进制正数m的第0、2、4等偶数位上1的个数,设为a;统计二进制正数m的第1、3、5等奇数位上1的个数,设为b,其中a为余数为1的个数,b为余数为2的个数;S3: Count the number of 1s on the 0th, 2nd, 4th, etc. even-numbered bits of the binary positive number m, and set it to a; count the number of 1s on the 1st, 3rd, 5th, etc. odd-numbered bits of the binary positive number m, and set it to b, where a is the number whose remainder is 1, and b is the number whose remainder is 2; S4:统计二进制正数n的第0、2、4等偶数位上1的个数,设为c;统计二进制正数m的第1、3、5等奇数位上1的个数,设为d,其中c为余数为2的个数,d为余数为1的个数;S4: Count the number of 1s in the 0th, 2nd, 4th, etc. even-numbered bits of the binary positive number n, and set it to c; count the number of 1s in the 1st, 3rd, 5th, etc. odd-numbered bits of the binary positive number m, and set it to d, where c is the number whose remainder is 2, and d is the number whose remainder is 1; S5:余数为1的个数为a与d的和,设为e;余数为2的个数为b与c的和,设为f,根据e和f的值可以确定余数,建立一个只读存储器ROM,只读存储器ROM根据e和f的值输出相对应的余数;S5: The number with a remainder of 1 is the sum of a and d, which is set to e; the number with a remainder of 2 is the sum of b and c, which is set to f, the remainder can be determined according to the values of e and f, and a read-only Memory ROM, the read-only memory ROM outputs the corresponding remainder according to the value of e and f; S6:ROM输出的余数为2位二进制正数,如果输入数据x为正数,则直接将ROM输出的余数作为取模运算最终结果,如果输入数据x为负数,则将ROM输出的余数按位取反后作为取模运算最终结果。S6: The remainder output by the ROM is a 2-digit binary positive number. If the input data x is a positive number, the remainder output by the ROM is directly used as the final result of the modulo operation. If the input data x is a negative number, the remainder output by the ROM is bitwise After negation, it is used as the final result of the modulo operation. 2.根据权利要求1所述的低开销的取模方法,其特征在于,所述步骤S1中,如果二进制有符号数x为正数,则直接将x的值赋给y,如果x为负数,则将二进制数x按位取反加1后赋给y。2. The modulo method of low overhead according to claim 1, characterized in that, in the step S1, if the binary signed number x is a positive number, then directly assign the value of x to y, if x is a negative number , then assign the binary number x to y after bitwise inversion and adding 1. 3.根据权利要求2所述的低开销的取模方法,其特征在于,所述步骤S2中,如果二进制正数y的第0、2、4、6等偶数位上为1,则每个相应位置代表数值为4N,其中N为0、1、2、3等整数,4N对模M=3取余为1,所以m为余数为1的个数;3. The modulo method of low overhead according to claim 2, characterized in that, in the step S2, if the 0th, 2nd, 4th, 6th even-numbered bits of the binary positive number y are 1, then each The corresponding position represents a value of 4 N , wherein N is an integer such as 0, 1, 2, 3, etc., and the remainder of 4 N to the modulus M=3 is 1, so m is the number of remainder 1; 如果二进制正数y的第1、3、5、7等奇数位上为1,则每个相应位置代表数值为2*4N,其中N为0、1、2、3等整数,2*4N对模M=3取余为2,所以n为余数为2的个数。If the 1st, 3rd, 5th, 7th and other odd bits of the binary positive number y are 1, then each corresponding position represents a value of 2*4 N , where N is an integer such as 0, 1, 2, 3, etc., 2*4 The modulo M=3 of N takes a remainder of 2, so n is the number of remainders of 2. 4.根据权利要求3所述的低开销的取模方法,其特征在于,步骤S3中,由于m为余数1的个数,所以a为余数为1的个数,b为余数为2的个数。4. the modulo method of low overhead according to claim 3 is characterized in that, in step S3, since m is the number of remainder 1, so a is the number of remainder 1, and b is the number of remainder 2 number. 5.根据权利要求4所述的低开销的取模方法,其特征在于,步骤S4中,由于n为余数2的个数,如果二进制数n的第0、2、4、6等偶数位上为1,则每个相应位置代表数值为2*4N,其中N为0、1、2、3等整数,2*4N对模M=3取余为2,所以c为余数为2的个数;5. the modulo method of low cost according to claim 4, is characterized in that, in step S4, because n is the number of remainder 2, if on the 0th, 2, 4, 6 etc. even number positions of binary number n is 1, then each corresponding position represents a value of 2*4 N , where N is an integer such as 0, 1, 2, 3, etc., and the remainder of 2*4 N to modulus M=3 is 2, so c is the remainder of 2 number; 由于n为余数2的个数,如果二进制数n的第1、3、5、7等奇数位上为1,则每个相应位置代表数值为4N+1,其中N为0、1、2、3等整数,4N+1对模M=3取余为1,d为余数为1的个数。Since n is the number of remainder 2, if the 1st, 3rd, 5th, 7th and other odd bits of the binary number n are 1, then each corresponding position represents a value of 4N+1, where N is 0, 1, 2, Integers such as 3, the remainder of 4N+1 to the modulo M=3 is 1, and d is the number of remainders of 1. 6.根据权利要求5所述的低开销的取模方法,其特征在于,步骤S5中,余数为1的个数为e;余数为2的个数为f;根据e和f的值可以计算出对3取余运算的余数,不同的e和f的值对应不同的余数,这种对应关系相当于建立一个只读存储器ROM的组合逻辑功能的真值表。6. the modulo method of low overhead according to claim 5, is characterized in that, in step S5, the number that remainder is 1 is e; The number that remainder is 2 is f; Can calculate according to the value of e and f To get the remainder of the 3 remainder operation, different values of e and f correspond to different remainders. This correspondence is equivalent to establishing a truth table of the combinatorial logic function of the read-only memory ROM. 7.根据权利要求6所述的低开销的取模方法,其特征在于,步骤S6中,ROM输出的余数为2位二进制正数0、1、2,如果输入数据x为正数,则使用位拼接运算符把0和ROM输出的余数拼接起来变为一个最高位为0的有符号数,作为最终的结果输出;如果输入数据x为负数,则其余数一般也为负数,可以先将ROM输出的余数按位取反后再加1变为对应的负数,使用位拼接运算符把1和这个负数拼接起来变为一个最高位为1的有符号数,作为最终的结果,其中如果余数为0,则直接输出,不进行上述操作;7. The modulo method of low overhead according to claim 6, characterized in that, in step S6, the remainder output by the ROM is a 2-bit binary positive number 0, 1, 2, if the input data x is a positive number, then use The bit splicing operator splices 0 and the remainder output by ROM into a signed number whose highest bit is 0, and outputs it as the final result; if the input data x is a negative number, the remainder is generally also a negative number, and the ROM can be first The remainder of the output is inverted bit by bit and then added with 1 to become the corresponding negative number. Use the bit splicing operator to splice 1 and the negative number into a signed number with the highest bit being 1 as the final result. If the remainder is 0, then output directly without performing the above operations; 由于基于余数校验的容错方案中会对三个支路产生的余数进行比较,而如果余数为负数,可将负数加上模数变为正数以方便余数间的比较;模为3,如果输入数据x为负数,则可以将ROM输出的余数按位取反,就可以得到负数加上模数变为正数的结果,其中如果余数为0,则直接输出,不进行上述操作,如果输入数据x为正数,则直接将ROM输出的余数作为结果。Since the remainder generated by the three branches will be compared in the fault-tolerant scheme based on the remainder check, and if the remainder is a negative number, the negative number plus the modulus can be changed into a positive number to facilitate the comparison between the remainder; the modulus is 3, if If the input data x is a negative number, the remainder output by the ROM can be reversed bit by bit, and the result of adding the modulus to the negative number can be obtained to become a positive number. If the remainder is 0, it will be output directly without the above operation. If input If the data x is a positive number, the remainder output by the ROM is directly used as the result.
CN201810235355.7A 2018-03-21 2018-03-21 A kind of model taking method of low overhead Pending CN108549589A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810235355.7A CN108549589A (en) 2018-03-21 2018-03-21 A kind of model taking method of low overhead

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810235355.7A CN108549589A (en) 2018-03-21 2018-03-21 A kind of model taking method of low overhead

Publications (1)

Publication Number Publication Date
CN108549589A true CN108549589A (en) 2018-09-18

Family

ID=63516926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810235355.7A Pending CN108549589A (en) 2018-03-21 2018-03-21 A kind of model taking method of low overhead

Country Status (1)

Country Link
CN (1) CN108549589A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567130A (en) * 2012-01-06 2012-07-11 清华大学 Multi-sampling judgment method for fault-tolerant filtering based on remainder check
CN103092729A (en) * 2013-01-29 2013-05-08 清华大学 Fine-adjustment remainder validation fault-tolerant high-pass/band-pass filtering processing method based on input
CN103092731A (en) * 2013-02-01 2013-05-08 清华大学 Fine-adjustment remainder validation fault-tolerant low-pass filtering processing method based on input
CN101464788B (en) * 2008-12-31 2013-07-31 无锡中星微电子有限公司 Device for checking whether binary number is multiple of three, and checking chip thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464788B (en) * 2008-12-31 2013-07-31 无锡中星微电子有限公司 Device for checking whether binary number is multiple of three, and checking chip thereof
CN102567130A (en) * 2012-01-06 2012-07-11 清华大学 Multi-sampling judgment method for fault-tolerant filtering based on remainder check
CN103092729A (en) * 2013-01-29 2013-05-08 清华大学 Fine-adjustment remainder validation fault-tolerant high-pass/band-pass filtering processing method based on input
CN103092731A (en) * 2013-02-01 2013-05-08 清华大学 Fine-adjustment remainder validation fault-tolerant low-pass filtering processing method based on input

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王健等: "同时支持两种有限域的模逆算法及其硬件实现", 《北京大学学报自然科学版》 *

Similar Documents

Publication Publication Date Title
CN106788379B (en) A radiation hardened latch based on heterogeneous dual-mode redundancy
CN104866390B (en) Asynchronous static random access memory triplication redundancy controller
JP6373154B2 (en) Semiconductor device
CN103235710A (en) Reversible-logic-based 16-bit carry look-ahead adder
CN101853198B (en) Detection method, equipment and system of address bus
CN101404557B (en) Cyclic redundancy check code generation apparatus and method
CN108549589A (en) A kind of model taking method of low overhead
CN109741781B (en) Data writing and reading method of multi-substrate memory based on triple modular redundancy
Zhang et al. Transient fault tolerant QDI interconnects using redundant check code
CN104516820A (en) One-hot code detection method and one-hot code detector
CN102204099A (en) reset device
CN105656474A (en) Method for logical inversion optimization of user circuit in FPGA (Field Programmable Gate Array) based on signal probability
CN106383751B (en) Improved random access memory self-checking method
CN113098449B (en) A highly robust three-node flipping self-restoring latch
CN103092731B (en) Fine-adjustment remainder validation fault-tolerant low-pass filtering processing method based on input
Hamdoon et al. Design and implementation of single bit error correction linear block code system based on FPGA
CN103092729B (en) Based on the residue check fault-tolerant high pass/bandpass filtering treatment method of input fine setting
CN102902510A (en) Galois field inversion device
CN108242973B (en) Data error correction method and device
CN105913869A (en) Anti-SET hardened memory circuit
CN1896959A (en) Encoder for correcting static data storage fault
CN101510780B (en) Device for generating CRC code and method for constructing and generating checkout code
Hasan et al. Design and analysis of online testability of reversible sequential circuits
CN107463462A (en) Data recovery method and data prosthetic device
CN111858135B (en) Data storage and verification method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180918

RJ01 Rejection of invention patent application after publication