CN101207467A - Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence - Google Patents

Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence Download PDF

Info

Publication number
CN101207467A
CN101207467A CNA2006101654183A CN200610165418A CN101207467A CN 101207467 A CN101207467 A CN 101207467A CN A2006101654183 A CNA2006101654183 A CN A2006101654183A CN 200610165418 A CN200610165418 A CN 200610165418A CN 101207467 A CN101207467 A CN 101207467A
Authority
CN
China
Prior art keywords
crc
data
cyclic redundancy
bit
redundancy check
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.)
Granted
Application number
CNA2006101654183A
Other languages
Chinese (zh)
Other versions
CN101207467B (en
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.)
Datang Mobile Communications Equipment Co Ltd
Original Assignee
Datang Mobile Communications Equipment Co Ltd
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 Datang Mobile Communications Equipment Co Ltd filed Critical Datang Mobile Communications Equipment Co Ltd
Priority to CN2006101654183A priority Critical patent/CN101207467B/en
Publication of CN101207467A publication Critical patent/CN101207467A/en
Application granted granted Critical
Publication of CN101207467B publication Critical patent/CN101207467B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a cyclic redundancy check code generating method, which includes the steps that: A. the data sequence is segmented orderly, a cyclic redundancy check code table item the bit of which is uniform with the bit of the segmented data is created; B. the cyclic redundancy check code table item for uniform bit in the first data segment is searched to obtain a r bit search result; C. the search result and the r bit data from the first bit of a second data segment are added up, and the r bit data is replaced by the obtained result; D. the first data segment on the data sequence is discarded; E. step B to step D are repeated; until the data sequence has only the last segment left, the corresponding cyclic redundancy check code table item in the last data segment is searched to obtain a cyclic redundancy check code. By the invention, a data sequence containing more bits can be rapidly processed.

Description

The generation of cyclic redundancy check (CRC) code and data sequence transmission, method of calibration and device
Technical field
The present invention relates to communication and computer data transmission technique field, relate in particular to a kind of generation and data sequence transmission, method of calibration and device of cyclic redundancy check (CRC) code.
Background technology
In data transmission procedure,, make that some unpredictable mistakes take place the transfer of data regular meeting between the communication equipment owing to be subjected to all multifactor influences such as transmission range, field conditions and various interference.For reducing these wrong adverse effects, when transfer of data, adopt the method for data check to find and/or correct usually, for example, in the data to be sent of transmitting terminal, insert specific check code, check code specific in the data that the receiving terminal utilization receives carries out verification to data, and then judges whether described data are wrong in transmission.
At present, cyclic redundancy check (CRC) (CRC, Cyclic Redundancy Check) sign indicating number is to use more general a kind of error control coding in the digital data transmission.The basic principle of described CRC check is: transmitting terminal divided by a certain specific CRC generator polynomial G (x) (as CRC-5, CRC-8, CRC-16, CRC-32 etc.), obtains remainder R (x) with outgoing data sequence N (x), and this remainder R (x) is the CRC check sign indicating number.Transmitting terminal places described outgoing data sequence N (x) afterwards with this CRC check sign indicating number, and together sends with this data sequence N (x).Receiving terminal according to the method identical with transmitting terminal, divided by same generator polynomial G (x), obtains new CRC check sign indicating number with the data sequence N (x) that receives.Should new CRC check sign indicating number and former CRC check sign indicating number compare, if consistent, think that then the data sequence that receives is correct; Otherwise, think that then these data have mistake in transmission, and require transmitting terminal to resend.
Described CRC check operation adopts special hardware circuit to realize usually, but for reducing cost, a lot of systems often utilize single-chip microcomputer, microprocessor programming or programming device to finish.CRC check method commonly used at present has:
Method one: direct method of formation.Described direct method of formation is that the generating principle according to described CRC check sign indicating number directly calculates and generates the CRC check sign indicating number, this method is divided by a certain specific generator polynomial G (x) with permutation outgoing data N (x), up to obtaining final result, the remainder of generation is described CRC check sign indicating number.This method is owing to handle by turn, can only handle 1 Bit data 1 time, so the efficient of deal with data is low, and operand is big, is not suitable for the checking treatment than the long data sequence.
Method two: look-up table.Described look-up table is to find the CRC check sign indicating number corresponding with data sequence in the CRC list item, carries out verification according to this CRC check sign indicating number then.This method at first require to generate one with the CRC list item of pending data sequence length with bit, comprise the data sequence of all these figure places and corresponding with it CRC check sign indicating number in the described list item.Yet this method can take bigger list item resource when data sequence is longer.For example, if the binary data sequence of 20 bits is carried out the CRC-5 verification, the quantity of the list item that then needs is 2 20=1M,, therefore to take 2 again because each list item accounts for 5bit 20The system memory space of * 5Bit=5M Bit, this can't satisfy for general programmable logic device FPGA.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of memory cell that takies few, and can fast processing than generation and data sequence transmission, method of calibration and the device of the cyclic redundancy check (CRC) code of long number data sequence.
For addressing the above problem, the generation method of cyclic redundancy check (CRC) code provided by the invention comprises:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code.
Wherein, described steps A is specially:
When data sequence can be waited timesharing, the data sequence sequential scheduling is divided into the n bit data segment, set up the cyclic redundancy check (CRC) code list item of n bit; Or
When data sequence can not be waited timesharing, be that one section order is divided into plurality of sections with data sequence by the n bit, with the surplus n that goes out 1Bit data is set up n, n as final stage 1The cyclic redundancy check (CRC) code list item of bit.
Wherein, obtain cyclic redundancy check (CRC) code and be specially described in the step e this segment data being carried out searching of corresponding cyclic redundancy check (CRC) code list item:
When data sequence can be waited timesharing, described n Bit data is carried out searching of n bit cyclic redundancy code table item obtain cyclic redundancy check (CRC) code; Or
When data sequence can not be waited timesharing, with described n 1Bit data carries out n 1Searching of bit cyclic redundancy code table item obtains cyclic redundancy check (CRC) code.
Preferably, describedly when the only surplus final stage of described data sequence, be specially: up to described data sequence length during smaller or equal to the n bit.
Preferably, also comprise between described steps A and described step B: the initial value that counter is set is 0.
Wherein, between described step D and step e, also comprise: Counter Value is added 1.
Wherein, describedly when the only surplus final stage of described data sequence, be specially: when the sum that equals the data segment that described data sequence divides when described Counter Value subtracts 1.
Based on such scheme, the generating apparatus of cyclic redundancy check (CRC) code provided by the invention comprises:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit set up with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, obtains cyclic redundancy check (CRC) code.
Wherein, can not be when data sequence by the timesharing such as grade, described lookup unit comprises: first lookup unit, second lookup unit;
Described register is that one section order is divided into plurality of sections with the data sequence that deposits in by the n bit, with the surplus n1 Bit data that goes out as final stage,
N, n in described list item generation unit foundation and the described register 1Bit data segment is with n, the n of bit 1Bit cyclic redundancy code table item, and with described n, n 1Bit cyclic redundancy code table item deposits described first lookup unit, second lookup unit respectively in.
Wherein, described first lookup unit is searched the cyclic redundancy check (CRC) code list item that first data segment in the described register carries out the n bit, and the r position lookup result that obtains is sent to described processing unit;
Described second lookup unit is carried out n to last data segment in the described register 1Searching of the cyclic redundancy check (CRC) code list item of bit obtains cyclic redundancy check (CRC) code.
Based on such scheme, the sending method that contains the data sequence of cyclic redundancy check (CRC) code provided by the invention comprises:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, described cyclic redundancy check (CRC) code is added on after the described data sequence in proper order, together sends with this data sequence.
Based on such scheme, the dispensing device that contains the data sequence of cyclic redundancy check (CRC) code provided by the invention comprises:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit generate with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, and the cyclic redundancy check (CRC) code that obtains is sent to transmitting element;
Described transmitting element is added on described cyclic redundancy check (CRC) code after the described data sequence in proper order, together sends with this data sequence.
Based on such scheme, provided by the invention receiving data sequence is carried out the method for cyclic redundancy check (CRC), comprising:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code are carried out mould two add, this data sequence is carried out verification according to its result.
Wherein, describedly according to its result this data sequence is carried out verification and comprises:
When the gained result is 0, think that then described pending data sequence is errorless;
When the gained result is 1, think that then described pending data sequence is wrong.
Based on such scheme, provided by the invention the data sequence that contains cyclic redundancy check (CRC) code that receives is carried out the device of cyclic redundancy check (CRC), comprising:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit generate with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, and the cyclic redundancy check (CRC) code that obtains is sent to verification unit;
Described verification unit is carried out mould two with the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code and is added, and according to its result this data sequence is carried out verification, and check results is exported.
Be compared with the prior art, the present invention at first divides into groups pending data sequence, is divided into the data segment that contains a small amount of bit number, adds computing by grouped data being tabled look-up, reach simple mould two again, thereby carries out CRC check.Can reduce the operand of system by the present invention, and then improve processing speed, be particularly useful for the more data sequence of figure place; Simultaneously, the present invention only carries out the inquiry of CRC list item to the data segment after the grouping, because the bit number of segment data is little, it is 3~10, so the memory space that described CRC list item takies can be very little, this is for especially adopting programming device to carry out can also saving the storage resources of system for the CRC check.
Description of drawings
Fig. 1 generates the method flow diagram of CRC check sign indicating number for adopting direct method of formation;
Fig. 2 generates the schematic flow sheet of the method embodiment one of CRC check sign indicating number for the present invention;
Fig. 3 generates the schematic flow sheet of the method embodiment two of CRC check sign indicating number for the present invention;
Fig. 4 generates the schematic flow sheet of the method embodiment three of CRC check sign indicating number for the present invention;
Fig. 5 generates the schematic flow sheet of the method embodiment four of CRC check sign indicating number for the present invention;
Fig. 6 is a CRC check sign indicating number generating apparatus structural representation of the present invention;
Fig. 7 contains the dispensing device structural representation of the transmission data sequence of CRC check sign indicating number for the present invention;
Fig. 8 is used for carrying out the apparatus structure schematic diagram of CRC check to receiving data for the present invention.
Embodiment
The generation method of cyclic redundancy check (CRC) code provided by the invention comprises:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code.
Wherein, described cyclic redundancy check (CRC) (hereinafter to be referred as CRC) code table item comprises that length is all data segments and the corresponding CRC check sign indicating number thereof of same bits; Described CRC check sign indicating number can adopt direct method of formation to generate according to specific CRC generator polynomial.See also Fig. 1, generate the method flow diagram of CRC check sign indicating number for adopting direct method of formation, establish pending data sequence g (x) and be the m position, this method comprises:
Step 101: with the value zero setting in the described register.
Step 102: after r individual zero is added in the data sequence g of pending m bit (x) back, deposit in the described register according to the one piece of data of high low level order with this data sequence.Wherein said r value equals to generate the figure place of CRC check sign indicating number, also determines described generator polynomial G (x) according to described r value simultaneously.For example when r=5, then select the CRC-5 generator polynomial.
Step 103: whether the figure place of judging pretreated data sequence g (x) is smaller or equal to r.When greater than r, execution in step 104; Otherwise, execution in step 107.
Step 104: judge that described register first place is 1? if be 1, then execution in step 105; Otherwise, execution in step 106.
Step 105: the pretreated data sequence in the described register and described generator polynomial G (x) are carried out mould two add.
Step 106: the data sequence in the described register is moved to left 1, read in new data behind this data segment and place the position of register-bit 0.Be back to step 103.
Does step 107: the figure place of judging pretreated data sequence g (x) equal r? if equal r, execution in step 108; Otherwise the numerical value in the described register is the CRC check sign indicating number.
Step 108: the pretreated r bit data in the described register and described generator polynomial G (x) are carried out mould two add, the gained result is the CRC check sign indicating number.
Below in conjunction with accompanying drawing the execution mode of the generation method of CRC check sign indicating number of the present invention is done further and to be elaborated.
See also Fig. 2, be the schematic flow sheet of the generation method embodiment one of CRC check sign indicating number of the present invention, the concrete steps of present embodiment one are:
If pending data are m position binary sequence g (x), the CRC check generator polynomial is the G (x) on r rank.
Step 201: m position data sequence g to be verified (x) according to one group of n bit, is begun to be divided into several data segments from the first place, and the span of described bit n is preferably 3~10.
Step 202: utilize direct method of formation to generate the CRC check code table item of n bit.
The CRC check code list item of described n bit comprises all n bit-binary data sequences and the CRC check code corresponding with it, and described check code is to adopt direct method of formation to calculate according to specific CRC generator polynomial.
Be specially, the binary data sequence that " 0 " " 1 " of n bit is formed obtains the binary data sequence of all n bits by permutation and combination, and promptly 2 nThe binary data sequence of individual n bit.Again with 2 nThe binary data sequence of individual n bit by direct method of formation, obtains corresponding with it CRC check sign indicating number respectively.With 2 of described generation nThe individual CRC check sign indicating number data sequence corresponding with it inserted in the described CRC check code table item, obtains the n bit CRC check code table item of a two dimension.For example, when n is 4 bits,, then can generate the CRC-5 check code list item of one 4 bit according to the method described above if adopt the CRC generator polynomial on 5 rank, as shown in table 1 below:
Table 14 bit CRC-5 check code list items
Figure A20061016541800151
Step 203: it is individual zero that r is added at described m Bit data sequence g (x) end, obtains the data sequence of m+r bit.The data sequence of this m+r bit is write in the register of m+r position.
Step 204: judge that g (x) figure place equals n? if be not equal to n, execution in step 205; Otherwise, execution in step 207.
Step 205: first n bit data segment is carried out the inquiry of n bit CRC check code table item.
Get the n Bit data successively from g (x) high position, search the CRC check sign indicating number corresponding with these data in described n bit CRC check code table item, described this CRC check sign indicating number value bit is long to be the r bit.
Step 206: with this lookup result with carry out mould two and add, and the r bit data of the first of second data segment of the described r bit CRC check sign indicating number that will find and described data sequence g (x) carries out XOR, and the gained result is replaced described r bit data; And with this data sequence n position that moves to left.Be back to step 204.
Step 207: according to the inquiry of the n bit data among the described g (x) n bit CRC check code table item.The gained result is the CRC check sign indicating number of described n bit data segment correspondence.
See also Fig. 3, be the schematic flow sheet of the inventive method embodiment two.When the pending binary data sequence g (x) in described m position can not be divided exactly by n, to establish the merchant this moment and be a, the gained remainder is n 1Then can handle according to the method for following embodiment two, the method embodiment two that the present invention carries out CRC check to the data sequence is:
If pending data segment is m position binary sequence g (x), the CRC check generator polynomial is the G (x) on r rank.
Step 301: m position data sequence g to be verified (x) is one group according to the n bit begins to be divided into several data segments from the first place, the span of described bit groupings n is preferably 3~10.Because the remainder of m/n is n 1, last group of then described m position data sequence to be verified is n 1Bit data segment.For example, for the data sequence of 19 bits, divide into groups if be one group according to 4 bits, last group of then described 19 data sequence is n 1=3 bits.
Step 302: utilize direct computing method to generate n, n 1The CRC check code table item of bit.Described n, n 1The CRC check code list item of bit comprises all n, n 1Bit binary data sequence and the CRC check code corresponding with it, described CRC check sign indicating number is to adopt direct method of formation to calculate according to specific CRC generator polynomial.
Step 303: it is individual zero that r is added at described m bit data sequence end, obtains the data sequence of m+r bit.The data sequence of this m+r bit is write in the register of m+r position.
Step 304: judge that g (x) figure place is less than n? if not, execution in step 305; Otherwise, execution in step 307.
Step 305: first n bit data segment is carried out the inquiry of n bit CRC check code table item.
Get the n Bit data successively from g (x) high position, search the CRC check sign indicating number corresponding with these data in described n bit CRC check code table item, described this CRC check sign indicating number value bit is long to be the r bit.
Step 306: with this lookup result with carry out mould two and add, and the r bit data of the first of second data segment of the described r bit CRC check sign indicating number that will find and described data sequence g (x) carries out XOR, and the gained result is replaced described r bit data; And with this data sequence n position that moves to left.Be back to step 304.
Step 307: according to the n among the described g (x) 1Bit data is inquired about described n 1Bit CRC check code table item.Obtain and described n 1The CRC check sign indicating number of bit data section correspondence.
See also Fig. 4,, when the pending binary data sequence g (x) in described m position can be divided exactly by n, establish the merchant this moment and be a for the schematic flow sheet of the embodiment three of CRC check code generating method of the present invention.Then also can handle according to the method for following embodiment three, the method embodiment three that the present invention carries out CRC check to the data sequence is:
If pending data segment is m position binary sequence g (x), the CRC check generator polynomial is the G (x) on r rank.
Step 401: m position data sequence g to be verified (x) is begun to be divided into several data segments according to one group of n bit from the first place, and the span of described bit groupings n is preferably 3~10.
Step 402: utilize direct computing method to generate the CRC check code table item of n bit.
The CRC check code list item of described n bit comprises all n bit binary data sequences and the check code corresponding with it, and described check code is to adopt direct method of formation to calculate according to specific CRC generator polynomial.
Step 403: it is individual zero that r is added at described m bit data sequence end, obtains the data sequence of m+r bit.The data sequence of this m+r bit is write in the register of m+r position.
Step 404: judge that counter equals a-1? if not, execution in step 405; Otherwise, execution in step 407.
Step 405: first n bit data segment is carried out the inquiry of n bit CRC check code table item.
Get the n Bit data successively from g (x) high position, search the CRC check sign indicating number corresponding with these data in described n bit CRC check code table item, described this CRC check sign indicating number value bit is long to be the r bit.
Step 406: with this lookup result with carry out mould two and add, and the r bit data of the first of second data segment of the described r bit CRC check sign indicating number that will find and described data sequence g (x) carries out XOR, and the gained result is replaced described r bit data; And with this data sequence n position that moves to left.Described counter adds 1.Be back to step 404.
Step 407: according to the inquiry of the n bit data among the described g (x) n bit CRC check code table item.The gained result is the CRC check sign indicating number of described n bit data segment correspondence.
See also Fig. 5, be the schematic flow sheet of the generation method embodiment four of CRC check sign indicating number of the present invention.When the pending binary data sequence g (x) in described m position can not be divided exactly by n, to establish the merchant this moment and be a, the gained remainder is n 1Then also can handle according to the method for following embodiment four, the method embodiment four that the present invention carries out CRC check to the data sequence is:
If pending data segment is m position binary sequence g (x), the CRC check generator polynomial is the G (x) on r rank.
Step 501: m position data sequence g to be verified (x) is one group according to the n bit begins to be divided into several data segments from the first place, the span of described bit groupings n is preferably 3~10.Because the remainder of m/n is n 1, last group of then described m position data sequence to be verified is n 1Bit data segment.If be divided into a group.
Step 502: utilize direct computing method to generate n, n 1The CRC check code table item of bit.Described n, n 1The CRC check code list item of bit comprises all n, n 1Bit binary data sequence and the check code corresponding with it, described check code is to adopt direct method of formation to calculate according to specific CRC generator polynomial.
Step 503: it is individual zero that r is added at described m bit data sequence end, obtains the data sequence of m+r bit.The data sequence of this m+r bit is write in the register of m+r position.
Step 504: the initial value that counter is set is 0.
Step 505: judge that described counter equals a? if not, execution in step 506; Otherwise, execution in step 508.
Step 506: first n bit data segment is carried out the inquiry of n bit CRC check code table item.
Get the n Bit data successively from g (x) high position, search the CRC check sign indicating number corresponding with these data in described n bit CRC check code table item, described this CRC check sign indicating number value bit is long to be the r bit.
Step 507: with this lookup result with carry out mould two and add, and the r bit data of the first of second data segment of the described r bit CRC check sign indicating number that will find and described data sequence g (x) carries out XOR, and the gained result is replaced described r bit data; And with this data sequence n position that moves to left.Described Counter Value is added 1.Be back to step 504.
Step 508: according to the n among the described g (x) 1Bit data is inquired about described n 1Bit CRC check code table item.Obtain and described n 1The CRC check sign indicating number of bit data section correspondence.
Fig. 6 is a CRC check sign indicating number generating apparatus structural representation of the present invention, and based on such scheme, the generating apparatus of CRC check sign indicating number provided by the invention comprises register 601, list item generation unit 602, lookup unit 603, processing unit 604, judging unit 605.Wherein,
Register 601 is used for the data sequence sequential segment that will deposit in;
List item generation unit 602 set up with described register 601 in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit 603;
First data segment carries out with the searching of the cyclic redundancy check (CRC) code list item of bit in 603 pairs of described registers 601 of described lookup unit, and will obtain corresponding r position lookup result and be sent to processing unit 604;
Described processing unit 604 carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register 601;
Described register 601 overflows the first data segment of described data sequence;
Data segment sum remaining in 605 pairs of described registers 601 of judging unit is judged, when the data sequence in described register 601 only remains final stage, described lookup unit 603 is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register 601, obtains cyclic redundancy check (CRC) code.
When data sequence can not be waited timesharing, described register 601 is that one section order is divided into plurality of sections with the data sequence that deposits in by the n bit, with the surplus n1 Bit data that goes out as final stage.At this moment, described lookup unit 603 is divided into: first lookup unit, second lookup unit.
N, n in described list item generation unit foundation and the described register 1Bit data segment is with n, the n of bit 1Behind the bit cyclic redundancy code table item, and with described n, n 1Bit cyclic redundancy code table item deposits described first lookup unit, second lookup unit respectively in.
Wherein, when more than one section of data sequence, select described first lookup unit that the CRC check code table item that first data segment in the described register carries out the n bit is searched; When data sequence only remains last data segment, then select second lookup unit that described final stage data are tabled look-up, checking result is final CRC check sign indicating number.
The sending method that contains the data sequence of cyclic redundancy check (CRC) code provided by the invention comprises:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, described cyclic redundancy check (CRC) code is added on after the described data sequence in proper order, together sends with this data sequence.
Based on such scheme, the dispensing device that contains the data sequence of cyclic redundancy check (CRC) code provided by the invention shows as Fig. 6, comprising: register 601, list item generation unit 602, lookup unit 603, processing unit 604, judging unit 605, transmitting element 701.Wherein,
Register 601 is used for the data sequence sequential segment that will deposit in;
List item generation unit 602 set up with described register 601 in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit 603;
First data segment carries out with the searching of the cyclic redundancy check (CRC) code list item of bit in 603 pairs of described registers 601 of described lookup unit, and will obtain corresponding r position lookup result and be sent to processing unit 604;
Described processing unit 604 carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register 601;
Described register 601 overflows the first data segment of described data sequence;
Data segment sum remaining in 605 pairs of described registers 601 of judging unit is judged, when the data sequence in described register 601 only remains final stage, described lookup unit 603 is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register 601, and the cyclic redundancy check (CRC) code that obtains is sent to transmitting element 701;
Described transmitting element 701 is added on described cyclic redundancy check (CRC) code after the described data sequence in proper order, together sends with this data sequence.
Provided by the invention receiving data sequence is carried out the method for cyclic redundancy check (CRC), comprising:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code are carried out mould two add, this data sequence is carried out verification according to its result.
Wherein, describedly according to its result this data sequence is carried out verification and comprises:
When the gained result is 0, think that then described pending data sequence is errorless;
When the gained result is 1, think that then described pending data sequence is wrong.
Based on such scheme, the device that the data sequence that contains the CRC check sign indicating number that receives is carried out CRC check provided by the invention, show as Fig. 8, comprising: register 601, list item generation unit 602, lookup unit 603, processing unit 604, judging unit 605, receiving element 801, verification unit 802.Wherein,
Register 601 is used for and will receives the data sequence sequential segment of coming from accepting unit 801;
List item generation unit 602 set up with described register 601 in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit 603;
First data segment carries out with the searching of the cyclic redundancy check (CRC) code list item of bit in 603 pairs of described registers 601 of described lookup unit, and will obtain corresponding r position lookup result and be sent to processing unit 604;
Described processing unit 604 carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register 601;
Described register 601 overflows the first data segment of described data sequence;
Data segment sum remaining in 605 pairs of described registers 601 of judging unit is judged, when the data sequence in described register 601 only remains final stage, described lookup unit 603 is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register 601, and the cyclic redundancy check (CRC) code that obtains is sent to verification unit 802;
Described verification unit 802 is carried out mould two with the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code and is added, and according to its result this data sequence is carried out verification, and check results is exported.
Above-described embodiment of the present invention does not constitute the qualification to protection range of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within protection scope of the present invention.

Claims (15)

1. the generation method of a cyclic redundancy check (CRC) code is characterized in that, comprising:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code.
2. the generation method of cyclic redundancy check (CRC) code as claimed in claim 1 is characterized in that, described steps A is specially:
When data sequence can be waited timesharing, the data sequence sequential scheduling is divided into the n bit data segment, set up the cyclic redundancy check (CRC) code list item of n bit; Or
When data sequence can not be waited timesharing, be that one section order is divided into plurality of sections with data sequence by the n bit, with the surplus n that goes out 1Bit data is set up n, n as final stage 1The cyclic redundancy check (CRC) code list item of bit.
3. the generation method of cyclic redundancy check (CRC) code as claimed in claim 2 is characterized in that, obtains cyclic redundancy check (CRC) code and is specially described in the step e this segment data being carried out searching of corresponding cyclic redundancy check (CRC) code list item:
When data sequence can be waited timesharing, described n Bit data is carried out searching of n bit cyclic redundancy code table item obtain cyclic redundancy check (CRC) code; Or
When data sequence can not be waited timesharing, with described n 1Bit data carries out n 1Searching of bit cyclic redundancy code table item obtains cyclic redundancy check (CRC) code.
4. the generation method of cyclic redundancy check (CRC) code as claimed in claim 3 is characterized in that, describedly is specially when the only surplus final stage of described data sequence: up to described data sequence length during smaller or equal to the n bit.
5. the generation method of cyclic redundancy check (CRC) code as claimed in claim 2 is characterized in that, also comprises between described steps A and described step B: the initial value that counter is set is 0.
6. the generation method of cyclic redundancy check (CRC) code as claimed in claim 5 is characterized in that, also comprises between described step D and step e: Counter Value is added 1.
7. the generation method of cyclic redundancy check (CRC) code as claimed in claim 6 is characterized in that, describedly is specially when the only surplus final stage of described data sequence: when the sum that equals the data segment that described data sequence divides when described Counter Value subtracts 1.
8. the generating apparatus of a cyclic redundancy check (CRC) code is characterized in that, comprising:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit set up with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, obtains cyclic redundancy check (CRC) code.
9. the generating apparatus of cyclic redundancy check (CRC) code as claimed in claim 8 is characterized in that, can not be when data sequence by the timesharing such as grade, and described lookup unit comprises: first lookup unit, second lookup unit;
Described register is that one section order is divided into plurality of sections with the data sequence that deposits in by the n bit, with the surplus n that goes out 1Bit data is as final stage,
N, n in described list item generation unit foundation and the described register 1Bit data segment is with n, the n of bit 1Bit cyclic redundancy code table item, and with described n, n 1Bit cyclic redundancy code table item deposits described first lookup unit, second lookup unit respectively in.
10. the generating apparatus of cyclic redundancy check (CRC) code as claimed in claim 9, it is characterized in that, described first lookup unit is searched the cyclic redundancy check (CRC) code list item that first data segment in the described register carries out the n bit, and the r position lookup result that obtains is sent to described processing unit;
Described second lookup unit is carried out n to last data segment in the described register 1Searching of the cyclic redundancy check (CRC) code list item of bit obtains cyclic redundancy check (CRC) code.
11. a sending method that contains the data sequence of cyclic redundancy check (CRC) code is characterized in that, comprising:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, described cyclic redundancy check (CRC) code is added on after the described data sequence in proper order, together sends with this data sequence.
12. a dispensing device that contains the data sequence of cyclic redundancy check (CRC) code is characterized in that, comprising:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit generate with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, and the cyclic redundancy check (CRC) code that obtains is sent to transmitting element;
Described transmitting element is added on described cyclic redundancy check (CRC) code after the described data sequence in proper order, together sends with this data sequence.
13. one kind is carried out the method for cyclic redundancy check (CRC) to receiving data sequence, it is characterized in that, comprising:
A, with the data sequence sequential segment, set up and the cyclic redundancy check (CRC) code list item of institute's divided data section with bit;
B, first data segment is carried out obtaining r position lookup result with the searching of the cyclic redundancy check (CRC) code list item of bit;
C, the first r bit data that rises of this lookup result and second data segment is carried out mould two add, and the gained result is replaced described r bit data;
D, the first data segment of described data sequence is abandoned;
E, repeating step B to D; When described data sequence only remains final stage, this segment data is carried out searching of corresponding cyclic redundancy check (CRC) code list item obtain cyclic redundancy check (CRC) code;
F, the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code are carried out mould two add, this data sequence is carried out verification according to its result.
14. the method for cyclic redundancy check (CRC) as claimed in claim 13 is characterized in that, describedly according to its result this data sequence is carried out verification and comprises:
When the gained result is 0, think that then described pending data sequence is errorless;
When the gained result is not 0, think that then described pending data sequence is wrong.
15. one kind is carried out the device of cyclic redundancy check (CRC) to the data sequence that contains cyclic redundancy check (CRC) code that receives, and it is characterized in that, comprising:
Register is used for the data sequence sequential segment that will deposit in;
The list item generation unit generate with described register in data segment with the cyclic redundancy check (CRC) code list item of bit, and deposit this list item in lookup unit;
Described lookup unit is carried out with the searching of the cyclic redundancy check (CRC) code list item of bit first data segment in the described register, and will obtain corresponding r position lookup result and be sent to processing unit;
Described processing unit carries out mould two with the first r bit data that rises of described lookup result and second data segment and adds, and with the gained result by r bit data described in the corresponding position replacement register;
Described register overflows the first data segment of described data sequence;
Judging unit is judged data segment sum remaining in the described register, when the data sequence in described register only remains final stage, described lookup unit is carried out searching of corresponding cyclic redundancy check (CRC) code list item with this segment data in the described register, and the cyclic redundancy check (CRC) code that obtains is sent to verification unit;
Described verification unit is carried out mould two with the described cyclic redundancy check (CRC) code that obtains and former cyclic redundancy check (CRC) code and is added, and according to its result this data sequence is carried out verification, and check results is exported.
CN2006101654183A 2006-12-19 2006-12-19 Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence Active CN101207467B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2006101654183A CN101207467B (en) 2006-12-19 2006-12-19 Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2006101654183A CN101207467B (en) 2006-12-19 2006-12-19 Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence

Publications (2)

Publication Number Publication Date
CN101207467A true CN101207467A (en) 2008-06-25
CN101207467B CN101207467B (en) 2011-05-18

Family

ID=39567379

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2006101654183A Active CN101207467B (en) 2006-12-19 2006-12-19 Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence

Country Status (1)

Country Link
CN (1) CN101207467B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102612173A (en) * 2011-01-21 2012-07-25 芯讯通无线科技(上海)有限公司 Multi-mode mobile phone and method for communication between communication modules of multi-mode mobile phone
CN103516478A (en) * 2012-06-29 2014-01-15 华为技术有限公司 Method and device for information sending
CN109391349A (en) * 2017-08-08 2019-02-26 维沃移动通信有限公司 The method and apparatus of cyclic redundancy check
CN109474379A (en) * 2017-09-08 2019-03-15 华为技术有限公司 Coding method and device
CN113608917A (en) * 2021-06-23 2021-11-05 苏州浪潮智能科技有限公司 Method and device for calculating CRC value of any data
CN115001623A (en) * 2022-05-07 2022-09-02 通号城市轨道交通技术有限公司 Vehicle-mounted electronic map data verification method and device
US11563518B2 (en) 2017-08-08 2023-01-24 Vivo Mobile Communication Co., Ltd. Method and device of cyclic redundancy check
CN115001623B (en) * 2022-05-07 2024-04-19 通号城市轨道交通技术有限公司 Method and device for checking vehicle-mounted electronic map data

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1193294C (en) * 2003-01-27 2005-03-16 西安电子科技大学 Method for parallel computing code of CRC in multiple channels and multiple bits
CN100388629C (en) * 2003-12-22 2008-05-14 普天信息技术研究院 A rapid calculation method for cyclic redundant check

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102612173A (en) * 2011-01-21 2012-07-25 芯讯通无线科技(上海)有限公司 Multi-mode mobile phone and method for communication between communication modules of multi-mode mobile phone
CN102612173B (en) * 2011-01-21 2016-08-10 芯讯通无线科技(上海)有限公司 The means of communication between multi mode terminal and communication module thereof
CN103516478A (en) * 2012-06-29 2014-01-15 华为技术有限公司 Method and device for information sending
CN109391349A (en) * 2017-08-08 2019-02-26 维沃移动通信有限公司 The method and apparatus of cyclic redundancy check
CN109391349B (en) * 2017-08-08 2020-04-07 维沃移动通信有限公司 Method and apparatus for cyclic redundancy check
US11563518B2 (en) 2017-08-08 2023-01-24 Vivo Mobile Communication Co., Ltd. Method and device of cyclic redundancy check
CN109474379A (en) * 2017-09-08 2019-03-15 华为技术有限公司 Coding method and device
CN109474379B (en) * 2017-09-08 2022-05-06 华为技术有限公司 Encoding method and device
CN113608917A (en) * 2021-06-23 2021-11-05 苏州浪潮智能科技有限公司 Method and device for calculating CRC value of any data
CN113608917B (en) * 2021-06-23 2023-07-14 苏州浪潮智能科技有限公司 Method and device for calculating CRC value of arbitrary data
CN115001623A (en) * 2022-05-07 2022-09-02 通号城市轨道交通技术有限公司 Vehicle-mounted electronic map data verification method and device
CN115001623B (en) * 2022-05-07 2024-04-19 通号城市轨道交通技术有限公司 Method and device for checking vehicle-mounted electronic map data

Also Published As

Publication number Publication date
CN101207467B (en) 2011-05-18

Similar Documents

Publication Publication Date Title
CN101207467B (en) Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence
CN102546089B (en) Method and device for implementing cycle redundancy check (CRC) code
CN101527615A (en) Implementation method of cyclic redundancy check (CRC) codes and device
Chen et al. Explicit constructions of MSR codes for clustered distributed storage: The rack-aware storage model
CN102543209B (en) The error correction device of multi-channel flash memory controller, method and multi-channel flash memory controller
CN1242088A (en) Method and apparatus for correcting a multilevel cell memory by using error locating codes
US20070016842A1 (en) Method and apparatus for configuring a cyclic redundancy check (CRC) generation circuit to perform CRC on a data stream
CN100442671C (en) Obtaining cyclic redundancy code
CN101958720A (en) Encoding and decoding methods for shortening Turbo product code
CN104317795A (en) Two-dimensional filter generation method, query method and device
CN102017425A (en) System and method for performing concatenated error correction
US8581751B2 (en) Multi-cell voltage secure data encoding in hybrid vehicles
US8370411B2 (en) Generating unique random numbers for multiple instantiations
CN109669669B (en) Error code generation method and error code generator
JP4260688B2 (en) Data transmission device, data transmission / reception system, data transmission device control method, and data transmission / reception system control method
EP2827516B1 (en) Scrambling code generation method, apparatus and scrambling code processing apparatus
CN102761394A (en) Method and device for processing data
CN101803204B (en) Bit string-error correcting method
CN101001089B (en) Money search method and device in error correction decode
CN103763064A (en) CRC code generating method and circuit applicable to ultra-high-speed communication system
CN101346884B (en) Convolution encoder, communication device, and convolution encoding method
CN100517214C (en) Hardware configuration method implementing binary system polynomial arithmetic and hardware system
CN103138881B (en) Decoding method and equipment
CN101873143B (en) Syndrome computing circuit in RS (Reed-Solomon) error correcting code decoder and computing method thereof
CN103916138A (en) Chien search circuit, and ECC decoding apparatus and method based on the Chien search circuit

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant