WO2015100624A1 - 一种crc计算方法及装置 - Google Patents

一种crc计算方法及装置 Download PDF

Info

Publication number
WO2015100624A1
WO2015100624A1 PCT/CN2013/091138 CN2013091138W WO2015100624A1 WO 2015100624 A1 WO2015100624 A1 WO 2015100624A1 CN 2013091138 W CN2013091138 W CN 2013091138W WO 2015100624 A1 WO2015100624 A1 WO 2015100624A1
Authority
WO
WIPO (PCT)
Prior art keywords
binary sequence
crc
calculation circuit
bit
bits
Prior art date
Application number
PCT/CN2013/091138
Other languages
English (en)
French (fr)
Inventor
梅峰银
杨文斌
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201380003207.8A priority Critical patent/CN105264778B/zh
Priority to PCT/CN2013/091138 priority patent/WO2015100624A1/zh
Priority to EP13900606.8A priority patent/EP3076555A4/en
Publication of WO2015100624A1 publication Critical patent/WO2015100624A1/zh
Priority to US15/199,222 priority patent/US10211852B2/en

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/03Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words
    • H03M13/05Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words using block codes, i.e. a predetermined number of check bits joined to a predetermined number of information bits
    • H03M13/09Error detection only, e.g. using cyclic redundancy check [CRC] codes or single parity bit
    • 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/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/03Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words
    • H03M13/05Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words using block codes, i.e. a predetermined number of check bits joined to a predetermined number of information bits
    • H03M13/09Error detection only, e.g. using cyclic redundancy check [CRC] codes or single parity bit
    • H03M13/091Parallel or block-wise CRC computation
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/61Aspects and characteristics of methods and arrangements for error correction or error detection, not provided for otherwise
    • H03M13/615Use of computational or mathematical techniques
    • H03M13/616Matrix operations, especially for generator matrices or check matrices, e.g. column or row permutations
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/65Purpose and implementation aspects
    • H03M13/6508Flexibility, adaptability, parametrability and configurability of the implementation
    • H03M13/6516Support of multiple code parameters, e.g. generalized Reed-Solomon decoder for a variety of generator polynomials or Galois fields

Definitions

  • the present invention relates to the field of communications, and in particular, to a cyclic redundancy code (English: cyclic redundancy code, CRC) calculation method and apparatus.
  • a cyclic redundancy code (English: cyclic redundancy code, CRC) calculation method and apparatus.
  • Cyclic redundancy check (English: cyclic redundancy check) is a verification method. Cyclic redundancy check is a commonly used error check method in communication systems. Specifically, the source can calculate the CRC of the original data based on the generator polynomial. The CRC can also be called a cyclic redundancy check code. The source adds a CRC after the original data and sends the original data with the added CRC to the sink. After receiving the original data with the added CRC, the sink can check whether the original data has an error during the transmission according to the CRC and the generator polynomial.
  • a CRC calculation circuit corresponding to a message of a specific length is disposed in the receiver. After receiving the packet of a certain length, the receiver can check whether the packet of a certain length has an error according to the CRC calculation circuit.
  • the above technical solutions are not well suited for flexible Ethernet (English: flexible ethernet). Summary of the invention
  • the embodiment of the invention provides a CRC calculation method and device, which can be well adapted to flexible Ethernet.
  • a method for calculating a cyclic redundancy check code CRC comprising: receiving a binary sequence of a first pulse, the binary sequence of the first pulse comprising a first message and a second message, The number of bits of the first message is M, and the number of bits of the second message is
  • N, M and N are positive integers, and M is not equal to N;
  • the binary sequence of the first pulse further includes a third packet, where the number of bits of the third packet is X, the method further includes:
  • Generating, according to the third packet, a first binary sequence, where the number of bits of the first binary sequence is Y, and a value of a high X bit of the first binary sequence is equal to the third report a value of a bit of the text, a value of a low C bit of the first binary sequence is equal to 0, Y X+C, Y, X, and C are positive integers; distributing the first binary sequence to the first And a third CRC calculation circuit, wherein the third CRC calculation circuit calculates a CRC of the first binary sequence.
  • the binary sequence of the first pulse further includes a high A bit of the fourth packet, where the fourth The number of bits of the message is A+B, and the method further includes:
  • the number of bits of the second binary sequence is G
  • the value of the high A bit of the second binary sequence is equal to
  • the fourth CRC calculation circuit Distributing the second binary sequence to a fourth CRC calculation circuit, the fourth CRC calculation circuit calculating a CRC of the second binary sequence to perform a value of a CRC register of the fourth CRC calculation circuit
  • the fourth CRC calculation circuit calculates a low B bit CRC of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fourth CRC calculation circuit.
  • the binary sequence of the first pulse further includes a high A bit of the fourth packet, where the fourth The number of bits of the message is A+B
  • the fifth CRC calculation circuit Dissipating a low B bit of the fourth message to a fifth CRC calculation circuit, the fifth CRC calculation circuit using the CRC of the second binary sequence as an initial of a CRC register of the fifth CRC calculation circuit The value calculates the CRC of the low B bits of the fourth message.
  • the first CRC calculation circuit includes a first a data exclusive OR calculation circuit, wherein the first data exclusive OR calculation circuit is expressed as:
  • the second CRC calculation circuit includes a second data exclusive OR calculation circuit, and the second data exclusive OR calculation circuit is expressed as: n-l
  • a cyclic redundancy check code CRC calculation apparatus comprising: a receiving unit, configured to receive a binary sequence of a first pulse, and a binary sequence of the first pulse
  • the column includes a first packet and a second packet, the number of bits of the first packet is M, the number of bits of the second packet is N, M and N are positive integers, and M is not equal to N;
  • a scheduling unit configured to distribute the first packet received by the receiving unit to a first CRC calculation circuit, and distribute the second packet received by the receiving unit to a second CRC calculation circuit;
  • a CRC calculation circuit configured to calculate a CRC of the first packet distributed by the scheduling unit;
  • the second CRC calculation circuit is configured to calculate a CRC of the second packet that is distributed by the scheduling unit.
  • the device further includes a third CRC calculation circuit, where the binary sequence of the first pulse further includes a third packet, where the third packet is The quantity is X;
  • the scheduling unit is further configured to:
  • the third CRC calculation circuit is configured to calculate a CRC of the first binary sequence distributed by the scheduling unit.
  • the apparatus further includes a fourth CRC calculation circuit, where the binary sequence of the first pulse further includes a fourth The high A bit of the message, the number of bits of the fourth message is A+B;
  • the scheduling unit is further configured to:
  • the fourth CRC calculation circuit is configured to calculate a CRC of the second binary sequence to initialize a value of a CRC register of the fourth CRC calculation circuit;
  • the receiving unit is further configured to receive a binary sequence of the second pulse, the second pulse is a next pulse of the first pulse, and the binary sequence of the second pulse includes a low of the fourth B bit;
  • the scheduling unit is further configured to distribute the low B bits of the fourth packet to the fourth CRC calculation circuit;
  • the fourth CRC calculation circuit is further configured to calculate a CRC of a low B bit of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fourth CRC calculation circuit.
  • the apparatus further includes a fourth CRC calculation circuit and a fifth CRC calculation circuit, where the first pulse is The binary sequence further includes a high A bit of the fourth file, and the number of bits of the fourth message is A+B;
  • the scheduling unit is further configured to:
  • the fourth CRC calculation circuit is configured to calculate a CRC of the second binary sequence according to the second binary sequence distributed by the scheduling unit;
  • the receiving unit is further configured to receive a binary sequence of the second pulse, the second pulse is a next pulse of the first pulse, and the binary sequence of the second pulse includes a low of the fourth B bit;
  • the scheduling unit is further configured to distribute the low B bits of the fourth packet to the fifth CRC calculation circuit;
  • the fifth CRC calculation circuit is configured to calculate a CRC of a low B bit of the fourth packet by using a CRC of the second binary sequence as an initial value of a CRC register of the fifth CRC calculation circuit.
  • the first CRC calculation circuit includes a first a data exclusive OR calculation circuit, wherein the first data exclusive OR calculation circuit is expressed as:
  • the coefficient of the CRC polynomial of the CRC calculation circuit, m is the order of the generator polynomial
  • a system chip 500 is provided.
  • the system chip 500 can be used to perform any of the possible implementations of the first aspect or the first to fourth possible implementations of the first aspect or the first aspect.
  • the system chip 500 includes a PHY 510 and a MAC 520.
  • the MAC 520 includes an RS 521, a distributor 522, and a CRC calculation circuit 523 to a CRC calculation circuit 527.
  • the PHY 510 is connected to the MAC 520 via ⁇ .
  • RS521 is coupled to distributor 522.
  • the distributor 522 is coupled to the CRC calculation circuit 523 to the CRC calculation circuit 527.
  • the MAC520 can operate under the drive of a clock device. Specifically, RS521, distributor 522 and CRC calculation circuit 523 to CRC calculation circuit 527 operate under the driving of the clock device.
  • the RS 521 under the driving of the clock device, transmits a binary sequence of the first clock cycle to the distributor 522 in a first clock cycle.
  • the binary sequence of the first clock cycle includes the first The message and the second message.
  • the number of bits of the first packet is ⁇ 1.
  • the number of bits of the second message is N.
  • M and N are positive integers. M is not equal to N.
  • the first message is an Ethernet frame.
  • the second message is an Ethernet frame.
  • the distributor 522 receives the binary sequence of the first clock cycle under the driving of the clock device.
  • the distributor 522 distributes the first message to a first CRC calculation circuit, and the first CRC calculation circuit calculates a CRC of the first message.
  • the CRC calculation circuit 523 is the first CRC calculation circuit.
  • the distributor 522 distributes the second message to a second CRC calculation circuit, and the second CRC calculation circuit calculates a CRC of the second message.
  • the CRC calculation circuit 524 is the second CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a third packet, where the number of bits of the third packet is X.
  • the distributor 522 distributes the first binary sequence to a third CRC calculation circuit, and the third CRC calculation circuit calculates a CRC of the first binary sequence.
  • the CRC calculation circuit 525 is the third CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a high A bit of the fourth packet, where the The number of bits of the four messages is A+B.
  • the fourth message is an Ethernet frame.
  • the distributor 522 generates a second binary sequence according to the high A bit of the fourth packet, the number of bits of the second binary sequence is G, and the high A bit of the second binary sequence
  • the value is equal to the value of the high A bit of the fourth message
  • the value of the low H bit of the second binary sequence is equal to 0,
  • G A + H
  • A, B, and G are positive integers.
  • H is an integer greater than or equal to zero.
  • B is less than or equal to G.
  • the distributor 522 distributes the second binary sequence to a fourth CRC calculation circuit, the fourth CRC calculation circuit calculates a CRC of the second binary sequence for the fourth CRC calculation circuit
  • the value of the CRC register is initialized.
  • the distributor 522 receives the binary sequence transmitted by the RS 521 in the second clock cycle driven by the clock device.
  • the second clock cycle is the next clock cycle of the first clock cycle.
  • the binary sequence of the second clock cycle includes the lower B bits of the fourth message.
  • the distributor 522 distributes the low B bits of the fourth message to the fourth CRC calculation circuit.
  • the CRC calculation circuit 526 is the fourth CRC calculation circuit.
  • the fourth CRC calculation circuit calculates a low B bit CRC of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fourth CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a high A bit of the fourth packet, where the The number of bits of the four messages is A+B.
  • the distributor 522 distributes the second binary sequence to a fourth CRC calculation circuit, and the fourth CRC calculation circuit calculates a CRC of the second binary sequence.
  • the CRC calculation circuit 526 is the fourth CRC calculation circuit.
  • the distributor 522 receives the binary sequence transmitted by the RS 521 in the second clock cycle driven by the clock device.
  • the second clock cycle is the next clock cycle of the first clock cycle.
  • the binary sequence of the second clock cycle includes the lower B bits of the fourth message.
  • the distributor 522 distributes the low B bits of the fourth message to the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit calculates a CRC of a low B bit of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fifth CRC calculation circuit.
  • the CRC calculation circuit 527 is the fifth CRC calculation circuit.
  • the first CRC calculation circuit A first data exclusive OR calculation circuit is included.
  • the first data exclusive OR calculation circuit is expressed as: ⁇ nl
  • the second CRC calculation circuit includes a second data exclusive OR calculation circuit, where the data exclusive OR calculation circuit is expressed as: descn-l
  • CRC D IPH*P ⁇ H n_1 *P l*l In the d.
  • n4 are the lowest bits of the binary sequence of the M bits, respectively
  • the CRC calculation scheme provided by the embodiment of the present invention is relatively easy to apply to a flexible bandwidth Ethernet scenario.
  • the following application scenarios may exist on the flexible Ethernet:
  • a receiver needs to receive packets sent by multiple transmitters through multiple Ethernet interfaces through the Ethernet interface of the receiver.
  • Each transmitter includes an Ethernet interface.
  • the plurality of transmitters correspond to the plurality of Ethernet interfaces.
  • the lengths of the messages sent by different transmitters may be different.
  • the binary sequence of the first pulse includes the first packet and the second packet.
  • the number of bits in the first packet is not equal to the number of bits in the second packet.
  • the CRC of the first packet is calculated by the first CRC calculation circuit.
  • FIG. 1 is a schematic diagram of a CRC calculation scheme according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of application of a CRC calculation structure in 400GE Ethernet according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a CRC calculation method according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a CRC computing apparatus according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a MAC according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present invention. detailed description
  • the PHY can pass the current Field programmable gate array (English: field programmable gate array, cartridge: FPGA) or application specific integrated circuit (English: application specific integrated circuit, cartridge: ASIC) implementation.
  • the PHY may be a component in a network interface card (English: network interface card, NIC), and the NIC may be a line card (English: line card, cartridge: LC) or a physical interface card (English: physical Interface card, cartridge: PIC).
  • the PHY can be connected to a media access controller (English: media access controller, MAC: MAC) through a media independent interface (English: Media Independent Interface, nickname: ⁇ ).
  • the PHY chip may include one PHY or multiple PHYs.
  • the PHY chip can be implemented by an FPGA or an ASIC.
  • the MAC can be implemented by an FPGA or an ASIC.
  • the MAC may include a coordination sublayer circuit (English: reconciliation sublayer, RS: RS), a distributor (English: dispatcher), and at least one CRC calculation circuit.
  • the RS is coupled to the distributor.
  • the distributor is coupled to the at least one CRC calculation circuit.
  • the distributor may be configured to receive a binary sequence of the RS output, the binary sequence including at least one Ethernet frame (English: ethernet frame).
  • the distributor can be configured to distribute the at least one Ethernet frame to the at least one CRC calculation circuit.
  • the MAC can operate under the drive of a clock device.
  • the components in the MAC e.g., RS, distributor, and at least one CRC calculation circuit
  • the MAC chip may include one MAC or multiple MACs.
  • the MAC chip can be implemented by an FPGA or an ASIC.
  • the system chip can include 1 MAC and 1 PHY.
  • the system chip may also include multiple MACs and multiple PHYs.
  • the PHY in the system chip can be coupled to a MAC in the system chip.
  • the system chip can be implemented by an FPGA or an ASIC.
  • CRC calculation circuit (English: cyclic redundancy code calculating circuit): A circuit for calculating the CRC of data. Specifically, the CRC calculation circuit may calculate a CRC of the data according to a generator polynomial.
  • the data can be a binary sequence (English: binary sequence).
  • the binary sequence can be a message.
  • the CRC calculation The circuit can include a CRC register.
  • the CRC calculation circuit when the CRC calculation circuit calculates the CRC of the data, the CRC calculation circuit may serially calculate the CRC of the data, or may calculate the CRC of the data in parallel.
  • each CRC calculation circuit may correspond to the same generator polynomial.
  • the receiver can include an Ethernet interface.
  • the Ethernet interface may include a serializer/deserializer (English: serializer/deserializer, cartridge: serdes), PHY, and MAC.
  • the serdes are coupled to the PHY.
  • the PHY is coupled to the MAC.
  • the multi-port Ethernet device can be an Ethernet hub, an Ethernet router, or an Ethernet switch.
  • the multi-port Ethernet device includes a plurality of ports, each of which may include a receiver.
  • a system chip may be included in the receiver.
  • the system chip can include a MAC and a PHY.
  • the value of the bit of the binary sequence the value of the binary number corresponding to the binary sequence (English: binary number ).
  • the value of the binary number can be represented by a decimal number.
  • the binary number corresponding to the binary sequence 1010 is 1010.
  • the value of binary 1010 is equal to 10 (decimal).
  • the binary number corresponding to the upper 2 bits of the binary sequence 1010 is 10.
  • the value of the upper 2 bits of the binary sequence 1010 is equal to 2 (decimal).
  • the binary number corresponding to the lower 2 bits of the binary sequence 1010 is also 10.
  • the lower 2 bits of the binary sequence 1010 have a value equal to 2 (decimal).
  • the CRC calculation scheme provided by the embodiment of the present invention is relatively easy to apply to a flexible bandwidth Ethernet scenario. Specifically, in a flexible Ethernet scenario, the lengths of different packets may be different. For the application scenario of the variable length message, the embodiment of the present invention provides a CRC calculation method.
  • FIG. 3 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present invention.
  • the execution body of the method can be a MAC, a MAC chip, a system chip, a receiver, or a multi-port Ethernet device. Referring to Figure 3, the method includes:
  • S101 Receive a binary sequence of the first pulse, where the binary sequence of the first pulse includes a first packet and a second packet, where the number of bits of the first packet is M, and the bits of the second packet The number is N, M and N are positive integers, and M is not equal to N.
  • the execution body of S101 may be a distributor in the MAC.
  • the first pulse of the second The hexadecimal sequence can be the RS output in the MAC.
  • the first message is an Ethernet frame.
  • the second message is an Ethernet frame.
  • the first pulse corresponds to one clock cycle of the clock device.
  • the clock means is for driving the execution body of the method shown in Figure 3 to receive the binary sequence of the first pulse.
  • the first packet may be a packet sent by the first sender.
  • the second packet may be a packet sent by the second sender.
  • the first transmitter sends the first packet by using a first Ethernet interface.
  • the second transmitter sends the second message through a second Ethernet interface.
  • the type of the first Ethernet interface may be different from the type of the second Ethernet interface.
  • the first Ethernet interface may be a 40 Gigabit Ethernet (English: 40 gigabit ethernet, cartridge: 40GE) interface.
  • the second Ethernet interface may be a 100 Gigabit Ethernet (English: 100 gigabit ethernet, cartridge: 100GE) interface.
  • the first transmitter may be a transmitter in the first network device.
  • the second transmitter may be a transmitter in the second network device.
  • the first network device and the second network device may be different network devices.
  • the "first pulse” here can be any pulse.
  • the number of bits of the binary sequence received by the receiver at each pulse can be the same. For example, the number of bits of a binary sequence received per pulse is 1280.
  • the length of different packets can be unequal, that is, the number of binary bits of different packets can be different.
  • the communication system can specify the minimum length of the message. For example, the communication system can specify that a message contains a minimum of 512 bits.
  • a binary sequence of pulses may include one or more ⁇ , and the number of binary bits of each ⁇ may be the same or different.
  • the binary sequence of the first pulse includes a first message and a second message, and the number of bits of the binary sequence of the first message and the second message is different.
  • S102 Distribute the first packet to a first CRC calculation circuit, where the first CRC calculation circuit calculates a CRC of the first packet, and distribute the second packet to a second CRC calculation circuit.
  • the second CRC calculation circuit calculates a CRC of the second message.
  • the execution body of S102 can be the distributor. According to the number of bits of the binary sequence received by one pulse, and the minimum length of the message specified by the communication system (ie, the minimum number of bits of the binary sequence of the message), it is possible to determine the maximum number of receivables of a pulse. The number of texts. The number of CRC calculation circuits can be determined based on the maximum number of messages that can be received by one pulse. For example, the maximum number of messages received by a pulse is:
  • P kn is the number of bits of the binary sequence received by one pulse, and 1 is the minimum number of bits of the binary sequence of a message; "" means rounding up, that is, taking the smallest integer greater than or equal to.
  • the number of CRC calculation circuits may be N calculated by the above expression.
  • Each CRC calculation circuit is configured to calculate a CRC of a binary sequence of a certain number of bits in parallel.
  • each CRC calculation circuit can be configured to calculate the CRC of a binary sequence of N bits in parallel, wherein the value of N can be the same as the number of bits of the binary sequence received by one pulse.
  • the first CRC calculation circuit is configured to calculate the CRC of the binary sequences of M bits in parallel
  • the second CRC calculation circuit is configured to calculate the CRC of the binary sequence of N bits in parallel.
  • a receiver needs to receive packets sent by multiple transmitters through multiple Ethernet interfaces through the Ethernet interface of the receiver.
  • Each transmitter includes an Ethernet interface.
  • the plurality of transmitters correspond to the plurality of Ethernet interfaces.
  • the lengths of the messages sent by different transmitters may be different.
  • the binary sequence of the first pulse includes the first packet and the second packet.
  • the number of bits in the first packet is not equal to the number of bits in the second packet.
  • the CRC of the first packet is calculated by the first CRC calculation circuit.
  • Pass The CRC of the second message is obtained by the second CRC calculation circuit.
  • the binary sequence of the first pulse may further include a third packet, where the number of bits of the third packet is X.
  • the third CRC calculation circuit may also be involved in the technical solution shown in FIG. 3.
  • the third CRC calculation circuit is configured to calculate the CRC of the binary sequence of Y ( ⁇ > ⁇ ) bits in parallel.
  • the following processing can be performed on the third file:
  • the first binary sequence may be obtained by performing a shift operation on the third message.
  • the first binary sequence is distributed to the third CRC calculation circuit, and the third CRC calculation circuit calculates a CRC of the first binary sequence.
  • Y may not equal M.
  • Y may not equal N.
  • the binary sequence of the first pulse further includes a high A bit of the fourth packet, and the number of bits of the fourth packet is A+B.
  • the sum of A and B is not equal to M.
  • the sum of A and B is not equal to N.
  • the fourth CRC calculation circuit may also be involved in the technical solution shown in FIG. 3.
  • the fourth CRC calculation circuit is configured to calculate a CRC of a binary sequence of G bits.
  • the fourth method can be processed in the following two ways:
  • the number of bits of the second binary sequence is G
  • the value of the high A bit of the second binary sequence is equal to
  • the second binary sequence may be obtained by performing a shift operation on the high A bit of the fourth packet.
  • H the second binary sequence is equal to the high A bit of the fourth hexadecimal.
  • the fourth CRC calculation circuit Distributing the second binary sequence to the fourth CRC calculation circuit, the fourth CRC calculation circuit calculating a CRC of the second binary sequence to a CRC register of the fourth CRC calculation circuit The value is initialized.
  • a binary sequence of second pulses is received (the second pulse being the next pulse of the first pulse, the binary sequence of the second pulse comprising the lower B bits of the fourth message).
  • the lower B bits of the fourth message are distributed to the fourth CRC calculation circuit.
  • the fourth CRC calculation circuit calculates a CRC of a low B bit of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fourth CRC calculation circuit.
  • the number of bits of the second binary sequence is G
  • the value of the high A bit of the second binary sequence is equal to The value of the high A bit of the fourth message
  • the value of the low H bit of the second binary sequence is equal to 0
  • G A+H
  • A, B, and G are positive integers
  • H is greater than or equal to 0. The integer.
  • the second binary sequence may be obtained by performing a shift operation on the high A bit of the fourth packet.
  • H the second binary sequence is equal to the high A bit of the fourth hexadecimal.
  • the second binary sequence is distributed to a fourth CRC calculation circuit, and the fourth CRC calculation circuit calculates a CRC of the second binary sequence.
  • a binary sequence of second pulses is received, the second pulse being the next pulse of the first pulse, and the binary sequence of the second pulse comprising the lower B bits of the fourth message.
  • the lower B bits of the fourth message are distributed to the fifth CRC calculation circuit.
  • the CRC register in the fourth CRC calculation circuit transfers information to the CRC register in the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit calculates a CRC of a low B bit of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit and the fourth CRC calculation circuit are different CRC calculation circuits.
  • the fifth CRC calculation circuit is configured to calculate a CRC of a binary sequence of J bits.
  • J is a positive integer.
  • J is greater than or equal to B.
  • the fifth CRC calculation circuit and the first CRC calculation circuit may be the same CRC calculation circuit.
  • the CRC calculation circuit in the above embodiment includes a first data exclusive OR calculation circuit.
  • the first data exclusive OR calculation circuit is expressed as: ⁇ n-l
  • the second CRC calculation circuit includes a second data exclusive OR calculation circuit, where the second data exclusive OR calculation circuit is expressed as:
  • P is a matrix of generator polynomial entries, p m4 to p. Is said;
  • the above embodiment describes the present invention by taking only a few typical application scenarios as an example.
  • the CRC calculation method provided by the foregoing embodiment can also be applied to other application scenarios.
  • FIG. 1 is a schematic diagram of a CRC calculation scheme applicable to a flexible Ethernet according to an embodiment of the present invention.
  • the minimum length of the Ethernet message is 1 (ie, the minimum length of the message is 1 bit), and the number of bits of the binary sequence received by each pulse receiver is recorded.
  • P kn the maximum number of messages that can be included in the binary sequence of each pulse is:
  • each CRC calculation circuit is configured to calculate a CRC of a binary sequence of a certain number of bits in parallel.
  • the scheduling unit is configured to distribute the messages contained in the binary sequence of one pulse to the corresponding CRC calculation circuit.
  • a binary sequence of messages is distributed to a CRC calculation circuit.
  • the scheduling unit can be implemented by logic circuits.
  • each CRC calculation circuit is configured to calculate the CRC of a binary number of binary sequences in parallel.
  • the scheduling unit can distribute the messages according to the order of " Calc - CRC - 1 , Calc_CRC_2, Calc - CRC - ⁇ ", that is, always starting from the CRC calculation circuit with the lowest number, and increasing by number. The order is distributed.
  • the number of bits of the binary sequence that the CRC calculation circuit can process can be decremented in the order of the CRC calculation circuit number from small to large.
  • the minimum packet length is 512 bits.
  • the alignment block size is 64 bits. That is, the minimum granularity of data processing is 64 bits, that is, data processing is performed in units of at least 64 bits;), taking the number of bits of the binary sequence of each pulse as 1280, then the binary sequence of one pulse can be at most It contains 4 messages, that is, the CRC of 4 messages needs to be calculated at most. Therefore, up to 4 CRC calculation circuits can be set in the CRC calculation architecture.
  • the messages contained in the binary sequence of each pulse are ordered in order. For example, a binary sequence of pulses contains a complete packet (denoted as message a) and a message (denoted as message b). The bit portion, then the first message in the binary sequence of the next pulse is the remaining bits of message b.
  • the minimum number of bits in the second message is 512
  • the fourth message only the number of bits is included.
  • each CRC calculation circuit is as follows:
  • Calc_CRC_1 is configured to calculate a CRC of a binary sequence of 1280 bits in parallel;
  • Calc_CRC_2 is configured to calculate a CRC of a binary sequence of 1216 bits in parallel;
  • Calc_CRC_3 is configured to calculate a CRC of a binary sequence of 704 bits in parallel;
  • Calc_CRC_4 is configured to calculate the CRC of a binary sequence of 192 bits in parallel.
  • the CRC calculation structure of the above-mentioned 400G traffic MAC frame can be as shown in FIG. 2.
  • the configuration principle of the CRC calculation circuit can be:
  • the number of bits processed by the Xth CRC calculation circuit is less than M bits (M is the size of the alignment block);
  • the configuration of the CRC calculation circuit according to the above principle is only a preferred implementation, and the configuration of the CRC calculation circuit in the embodiment of the invention, that is, the number of bits that can be processed by one CRC calculation circuit does not constitute a limitation of the present invention. .
  • An embodiment of the present invention also provides an apparatus capable of implementing the method shown in FIG.
  • FIG. 4 is a schematic structural diagram of a CRC computing apparatus according to an embodiment of the present invention.
  • the apparatus can be used to perform the method illustrated in Figure 3.
  • the device can be a MAC, a MAC chip, a system chip, a receiver, or a multi-port Ethernet device.
  • the apparatus 400 includes:
  • the receiving unit 401 is configured to receive a binary sequence of the first pulse, where the binary sequence of the first pulse includes a first packet and a second packet, where the number of bits of the first packet is M, and the second The number of bits of the message is N, M and N are positive integers, and M is not equal to N.
  • the receiving unit 401 can be a distributor in the MAC.
  • the binary sequence may be an RS output in the MAC.
  • the first message is an Ethernet frame.
  • the second message is an Ethernet frame.
  • the first pulse corresponds to one clock cycle of the clock device.
  • the clock device is configured to drive the receiving unit 401 to receive a binary sequence of the first pulse.
  • the first packet may be a packet sent by the first sender.
  • the second packet may be a packet sent by the second sender.
  • the first transmitter sends the first packet by using a first Ethernet interface.
  • the second transmitter sends the second message through a second Ethernet interface.
  • the type of the first Ethernet interface may be different from the type of the second Ethernet interface.
  • the first Ethernet interface can be a 40GE interface.
  • the second Ethernet interface can be a 100GE interface.
  • the first transmitter may be a transmitter in the first network device.
  • the second transmitter can be a transmitter in the second network device.
  • the first network device and the second network device may be different network devices.
  • the scheduling unit 402 is configured to distribute the first packet received by the receiving unit 401 to the first CRC calculation circuit 403, and distribute the second packet received by the receiving unit 401 to the second CRC calculation circuit. 404.
  • scheduling unit 402 can be the distributor.
  • the first CRC calculation circuit 403 is configured to calculate a CRC of the first packet that is sent by the scheduling unit 402.
  • the first CRC calculation circuit 403 is configured to calculate a CRC of a binary sequence of M bits.
  • the second CRC calculation circuit 404 is configured to calculate a CRC of the second packet that is sent by the scheduling unit 402.
  • the second CRC calculation circuit 404 is configured to calculate a CRC of a binary sequence of N bits.
  • the apparatus 400 further includes a third CRC calculation circuit (not shown in FIG. 4).
  • the binary sequence of the first pulse further includes a third packet, and the ratio of the third packet
  • the special quantity is X.
  • the scheduling unit 402 is further configured to:
  • the first binary sequence is distributed to the third CRC calculation circuit.
  • the scheduling unit 402 can include a shift register.
  • the shift register may perform a shift operation on the third message to generate the first binary sequence.
  • the third CRC calculation circuit is configured to calculate a CRC of the first binary sequence distributed by the scheduling unit 402.
  • the apparatus 400 further includes a fourth CRC calculation circuit (not shown in FIG. 4), and the binary sequence of the first pulse further includes a high A bit of the fourth packet.
  • the number of bits of the fourth packet is A+B.
  • the fourth CRC calculation circuit is configured to calculate a CRC of a binary sequence of G bits.
  • the scheduling unit 402 is further configured to:
  • the value of the high A bit is equal to the value of the high A bit of the fourth message
  • the value of the low H bit of the second binary sequence is equal to 0,
  • G A + H, A, B and G are positive integers
  • H is an integer greater than or equal to 0, and B is less than or equal to G.
  • the second binary sequence can be obtained by performing a shift operation on the high A bit of the fourth message.
  • H the second binary sequence is equal to the high A bit of the fourth message.
  • the second binary sequence is distributed to a fourth CRC calculation circuit.
  • the fourth CRC calculation circuit is configured to calculate a CRC of the second binary sequence to The value of the CRC register of the fourth CRC calculation circuit is initialized.
  • the receiving unit 401 is further configured to receive a binary sequence of the second pulse, the second pulse is a next pulse of the first pulse, and the binary sequence of the second pulse includes the fourth Low B bits.
  • the lower B bits of the fourth message are distributed to the fourth CRC calculation circuit.
  • the fourth CRC calculation circuit is further configured to calculate, by using a CRC of the second binary sequence distributed by the scheduling unit 402, an initial value of a CRC register of the fourth CRC calculation circuit to calculate the fourth packet. Low B bit CRC.
  • the apparatus 400 further includes a fourth CRC calculation circuit (not shown in Fig. 4) and a fifth CRC calculation circuit (not shown in Fig. 4).
  • the binary sequence of the first pulse further includes a high A bit of the fourth message, and the number of bits of the fourth message is A+B.
  • the fourth CRC calculation circuit is configured to calculate a CRC of a binary sequence of G bits.
  • the scheduling unit 402 is further configured to:
  • the number of bits of the second binary sequence is zero.
  • the value of the high A bit of the second binary sequence is equal to the value of the high A bit of the fourth message.
  • the value of the low H bit of the second binary sequence is equal to zero.
  • G A+H.
  • A, B, and G are positive integers.
  • H is an integer greater than or equal to zero.
  • the second binary sequence can be obtained by performing a shift operation on the high A bit of the fourth message.
  • H the second binary sequence is equal to the high A bit of the fourth message.
  • the second binary sequence is distributed to the fourth CRC calculation circuit.
  • the fourth CRC calculation circuit is configured to calculate a CRC of the second binary sequence according to the second binary sequence distributed by the scheduling unit 402.
  • the receiving unit 401 is further configured to receive a binary sequence of the second pulse.
  • the second pulse is the next pulse of the first pulse.
  • the binary sequence of the second pulse includes the lower B bits of the fourth hexadecimal. Dissipating the low B bits of the fourth message to the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit is configured to calculate, by using a CRC of the second binary sequence distributed by the scheduling unit 402, an initial value of a CRC register of the fifth CRC calculation circuit Low B bit CRC.
  • the fifth CRC calculation circuit is configured to calculate a CRC of a binary sequence of J bits.
  • J is a positive integer.
  • J is greater than or equal to B.
  • the fifth CRC calculation circuit and the first CRC calculation circuit may be the same CRC calculation circuit.
  • the first CRC calculation circuit 403 includes a first data exclusive OR calculation circuit.
  • the first data exclusive OR calculation circuit is expressed as: ⁇ n-l
  • n is the value of M c is the generator polynomial matrix.
  • the second CRC calculation circuit includes a J: two data exclusive OR calculation circuit.
  • the second data exclusive OR calculation circuit is expressed as: nl
  • n N; to generate a matrix of polynomial entries, p m4 to p. Is said;
  • FIG. 5 is a schematic structural diagram of a system chip according to an embodiment of the present invention.
  • System chip 500 can be used to perform the method illustrated in FIG.
  • the system chip 500 includes a PHY 510 (shown as physical layer circuit 510) and a MAC 520.
  • the MAC 520 includes an RS 521 (shown as a coordination sublayer circuit 521 in the figure), a distributor 522, and a CRC calculation circuit 523 to a CRC calculation circuit 527.
  • the PHY 510 is connected to the MAC 520 via ⁇ .
  • RS 521 is coupled to distributor 522.
  • the distributor 522 is coupled to the CRC calculation circuit 523 to the CRC calculation circuit 527.
  • the MAC520 can operate under the drive of a clock device. Specifically, the RS 521, the distributor 522, and the CRC calculation circuit 523 to the CRC calculation circuit 527 are at the clock. Work under the drive of the device.
  • the RS 521 under the driving of the clock device, transmits a binary sequence of the first clock cycle to the distributor 522 in a first clock cycle.
  • the binary sequence of the first clock cycle includes a first message and a second message.
  • the number of bits of the first packet is ⁇ 1.
  • the number of bits of the second message is N.
  • M and N are positive integers.
  • M is not equal to N.
  • the first text is an Ethernet frame.
  • the second message is an Ethernet frame.
  • the distributor 522 receives the binary sequence of the first clock cycle under the driving of the clock device.
  • the distributor 522 distributes the first message to a first CRC calculation circuit, and the first CRC calculation circuit calculates a CRC of the first message.
  • the CRC calculation circuit 523 is the first CRC calculation circuit.
  • the distributor 522 distributes the second message to a second CRC calculation circuit, and the second CRC calculation circuit calculates a CRC of the second message.
  • the CRC calculation circuit 524 is the second CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a third packet, where the number of bits of the third packet is X.
  • the third message is an Ethernet frame.
  • a shift register is included in the distributor 522. The shift register performs a shift operation on the third message to obtain the first binary sequence.
  • the distributor 522 distributes the first binary sequence to a third CRC calculation circuit, and the third CRC calculation circuit calculates a CRC of the first binary sequence.
  • the CRC calculation circuit 525 is the third CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a high A bit of the fourth packet, and the number of bits of the fourth packet is A+B.
  • the fourth message is an Ethernet frame.
  • the fourth CRC calculation circuit is configured to calculate a binary sequence of G bits CRC.
  • the distributor 522 generates a second binary sequence according to the high A bit of the fourth packet, the number of bits of the second binary sequence is G, and the high A bit of the second binary sequence
  • the value is equal to the value of the high A bit of the fourth message
  • the value of the low H bit of the second binary sequence is equal to 0,
  • G A + H
  • A, B, and G are positive integers.
  • H is an integer greater than or equal to zero.
  • B is less than or equal to G.
  • the second binary sequence can be obtained by performing a shift operation on the high A bit of the fourth message.
  • H the second binary sequence is equal to the high A bit of the fourth message.
  • the distributor 522 distributes the second binary sequence to a fourth CRC calculation circuit, the fourth CRC calculation circuit calculates a CRC of the second binary sequence to a CRC register of the fourth CRC calculation circuit The value is initialized.
  • the distributor 522 receives the binary sequence transmitted by the RS 521 in the second clock cycle driven by the clock device.
  • the second clock cycle is the next clock cycle of the first clock cycle.
  • the binary sequence of the second clock cycle includes the lower B bits of the fourth message.
  • the distributor 522 distributes the low B bits of the fourth message to the fourth CRC calculation circuit.
  • the CRC calculation circuit 526 is the fourth CRC calculation circuit.
  • the fourth CRC calculation circuit calculates a low B bit CRC of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fourth CRC calculation circuit.
  • the binary sequence of the first clock cycle further includes a high A bit of the fourth message, and the number of bits of the fourth message is A+B.
  • the fourth CRC calculation circuit is configured to calculate a CRC of a binary sequence of G bits.
  • shifting can be performed on the high A bit of the fourth message.
  • the second binary sequence is equal to the high A bit of the fourth message.
  • the distributor 522 distributes the second binary sequence to a fourth CRC calculation circuit, and the fourth CRC calculation circuit calculates a CRC of the second binary sequence.
  • the CRC calculation circuit 526 is the fourth CRC calculation circuit.
  • the distributor 522 receives the binary sequence transmitted by the RS 521 in the second clock cycle driven by the clock device.
  • the second clock cycle is the next clock cycle of the first clock cycle.
  • the binary sequence of the second clock cycle includes the lower B bits of the fourth message.
  • the distributor 522 distributes the low B bits of the fourth message to the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit calculates a CRC of a low B bit of the fourth message by using a CRC of the second binary sequence as an initial value of a CRC register of the fifth CRC calculation circuit.
  • the CRC calculation circuit 527 is the fifth CRC calculation circuit.
  • the fifth CRC calculation circuit is configured to calculate a CRC of a binary sequence of J bits.
  • J is a positive integer.
  • J is greater than or equal to B.
  • the fifth CRC calculation circuit and the first CRC calculation circuit may be the same CRC calculation circuit.
  • the first CRC calculation circuit includes a first data exclusive OR calculation circuit.
  • the first data exclusive OR calculation circuit is expressed as:
  • the second CRC ⁇ : circuit includes a second data exclusive OR calculation circuit, and the second data exclusive OR calculation circuit is represented as:
  • n takes the value N; to generate a matrix of polynomial entries, p m4 to . Is the first
  • the coefficient of the CRC polynomial of a CRC calculation circuit, m is the order of the generator polynomial
  • FIG. 6 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present invention.
  • the executor of the method can be a MAC, a MAC chip, a system chip, a receiver, or a multi-port Ethernet device. Referring to Figure 6, the method includes:
  • the binary sequence of the first pulse includes a first message.
  • the number of bits of the first message is X.
  • the executor of S601 can be a distributor in the MAC.
  • the binary sequence can be an RS output in the MAC.
  • the first message is an Ethernet frame.
  • the first pulse corresponds to one clock cycle of the clock device.
  • the clock means is operative to drive an execution body of the method illustrated in Figure 6 to receive a binary sequence of the first pulses.
  • the execution body of S601 may be the distributor.
  • the distributor can include a shift register.
  • the shift register may perform a shift operation on the first message to obtain the first binary sequence.
  • the number of bits of the first binary sequence is Y
  • the value of the high X bit of the first binary sequence is equal to the value of the bit of the first packet
  • the first CRC calculation circuit is configured to calculate the binary order of Y bits in parallel The CRC of the column.
  • the first CRC calculation circuit calculates a CRC of the first binary sequence.
  • the first CRC calculation circuit corresponds to a scrambling polynomial.
  • the first CRC calculation circuit calculates a CRC of the first binary sequence based on the scrambling polynomial.
  • the number of bits of the packet received by the Ethernet interface may be smaller than the number of bits of the binary sequence.
  • the binary sequence refers to a binary sequence corresponding to the CRC when the CRC calculation circuit calculates the CRC.
  • FIG. 7 is a schematic flowchart diagram of a CRC calculation method according to an embodiment of the present invention.
  • the method of execution of the method may be a MAC, a MAC chip, a system chip, a receiver, or a multi-port Ethernet device.
  • CRC calculation circuit Referring to Figure 7, the method includes:
  • the binary sequence of the first pulse includes a low X bit of the first packet, and the most significant bit of the low X bit of the first packet (English: most significant bit, cartridge: MSB) is The MSB of the binary sequence of the first pulse.
  • the low X bits are located at the head of the binary sequence of the first pulse.
  • the execution body of S701 may be a distributor in the MAC.
  • the binary sequence of the first pulse may be the RS output in the MAC.
  • the first message is an Ethernet frame.
  • the second message is an Ethernet frame.
  • the first pulse corresponds to one clock cycle of the clock device.
  • the clock means is for driving the execution body of the method shown in Figure 7 to receive the binary sequence of the first pulse.
  • the execution body of S702 can be the distributor.
  • the number of bits of the binary sequence of the first pulse is N, and N is a positive integer.
  • the first CRC calculation circuit is configured to calculate a CRC of a binary sequence of M bits. M is greater than or equal to N, and M is a positive integer.
  • the first CRC calculation circuit calculates a CRC of the first packet.
  • S703 can be implemented in two ways.
  • Figure 8 is a schematic flow chart of the first implementation method of S703.
  • FIG. 9 is a schematic flow chart of a second implementation method of S703.
  • the first implementation method of S703 includes:
  • the binary sequence of the second pulse comprises the high Y bits of the first message.
  • the sum of X and Y is equal to ⁇ 1.
  • the number of bits of the first message is the sum of X and Y.
  • the number of bits of the first binary sequence is ⁇ 1.
  • the high Y bit of the first binary sequence is equal to the high Y bit of the first message.
  • the low X bits of the first binary sequence are equal to zero.
  • a shift operation may be performed on the high Y bit of the first message by a shift register to obtain the first binary sequence.
  • the first CRC calculation circuit calculates a CRC of the first binary sequence to initialize a value of a CRC register of the first CRC calculation circuit.
  • the number of bits of the second binary sequence is ⁇ 1.
  • the high X bits of the second binary sequence are equal to the lower X bits of the first message.
  • the low Y bit of the second binary sequence is equal to zero.
  • a shift operation may be performed on the lower X bits of the first message by a shift register to obtain the second binary sequence.
  • the first CRC calculation circuit calculates a CRC of the second binary sequence by using a CRC of the first binary sequence as an initial value of a CRC register of the first CRC calculation circuit.
  • the CRC of the second binary sequence is equal to the CRC of the first message.
  • the second implementation method of S703 includes: S901. Receive a binary sequence of the second pulse.
  • the binary sequence of the second pulse comprises the high Y bits of the first message.
  • the sum of X and Y is equal to 8.
  • S is less than M.
  • the number of bits of the first message is the sum of X and Y.
  • the number of bits of the first binary sequence is ⁇ 1.
  • the high Y bit of the first binary sequence is equal to the high Y bit of the first message.
  • the low (M-Y) bit of the first binary sequence is equal to zero.
  • a shift operation can be performed on the high Y bit of the first message by a shift register to obtain the first binary sequence.
  • the first CRC calculation circuit calculates a CRC of the first binary sequence to initialize a value of a CRC register of the first CRC calculation circuit.
  • the number of bits of the second binary sequence is ⁇ 1.
  • the high X bits of the second binary sequence are equal to the lower X bits of the first message.
  • the low (M-X) bit of the second binary sequence is equal to zero.
  • a shift operation can be performed on the lower X bits of the first message by a shift register to obtain the second binary sequence.
  • the first CRC calculation circuit calculates a CRC of the second binary sequence by using a CRC of the first binary sequence as an initial value of a CRC register of the first CRC calculation circuit.
  • the CRC of the second binary sequence is equal to the CRC of the first message.
  • the binary sequence of the first pulse includes a second packet, and the second packet is adjacent to a lower X bit of the first packet.
  • the method further includes:
  • the second message is distributed to the second CRC calculation circuit.
  • the second CRC calculation circuit calculates a CRC of the second message.
  • the second CRC calculation circuit is configured to calculate a CRC of a binary sequence of A bits. Specifically, A is greater than or equal to B. B is equal to N minus the number of bits included in the alignment block, the alignment block corresponds to the alignment granularity of the message, A is a positive integer, and B is a positive integer.
  • A is greater than or equal to B.
  • B is equal to N minus the number of bits included in the alignment block
  • the alignment block corresponds to the alignment granularity of the message
  • A is a positive integer
  • B is a positive integer.
  • Ethernet frame Before sending an Ethernet frame to the MAC, you need to block the Ethernet frame to achieve the alignment of the Ethernet frame. Specifically, the Ethernet frame is divided into a plurality of data blocks, and the number of bits included in each data block is E. It should be noted that a data block can only contain a fragment of an Ethernet frame and cannot contain fragments of two or more Ethernet frames. For example, E can be 64 or 250. If the number of bits in the last block in the Ethernet frame is less than E after the Ethernet frame is executed, the padding data needs to be added after the last block to obtain a block of E. A block of data to which padding data is added can be referred to as an alignment block. The number of bits contained in the alignment block is also E. E can be used to indicate the alignment granularity of the message.
  • the number of bits in the second message is equal to P.
  • P is less than or equal to A.
  • the second CRC calculation circuit may calculate the CRC of the second message.
  • a shift operation can be performed on the second message to generate a new binary sequence.
  • the number of bits of the new binary sequence is equal to A.
  • the high P bit of the new binary sequence is equal to the second message.
  • the low (A-P) bit of the new binary sequence is equal to zero.
  • the second CRC calculation circuit can calculate the CRC of the new binary sequence.
  • the CRC of the new binary sequence is equal to the CRC of the second binary.
  • the binary sequence of the first pulse includes a third packet, and the third packet is adjacent to the second packet.
  • the method further includes:
  • the third message is distributed to a third CRC calculation circuit.
  • the third CRC calculation circuit calculates a CRC of the third message.
  • the third CRC calculation circuit is configured to calculate a CRC of a binary sequence of C bits.
  • C is greater than or equal to D.
  • D is equal to N minus the number of bits contained in the alignment block, and subtracts the number of bits contained in the message of the minimum length.
  • C is a positive integer and D is a positive integer.
  • the minimum length refers to the minimum length of the message specified by the communication system.
  • the first message, Both the second packet and the third packet belong to an Ethernet frame. According to the Institute of Electrical and Electronics Engineers
  • the 802.3ba, 40GE standard Ethernet frame has a minimum length of 512 bits.
  • the minimum length of an Ethernet frame in the 100GE standard is 512 bits.
  • the third CRC calculation circuit may calculate the CRC of the third message.
  • a shift operation can be performed on the third message to generate a new binary sequence.
  • the number of bits of the new binary sequence is equal to C.
  • the high Q bit of the new binary sequence is equal to the third message.
  • the low (C-Q) bit of the new binary sequence is equal to zero.
  • the third CRC calculation circuit can calculate the CRC of the new binary sequence.
  • the CRC of the new binary sequence is equal to the CRC of the third message.
  • FIG. 10 is a schematic diagram of a method for calculating a CRC according to an embodiment of the present invention.
  • Fig. 10 shows the format of the binary sequence of the first pulse in the above technical solution. Other information can be other 4 articles. For example, the fourth paragraph. Of course, the binary sequence of the first pulse may also not include other information.
  • Fig. 10 shows the relationship between the binary sequence of the first pulse and the CRC calculation circuit. Specifically, the lower X bits of the first message are distributed to the first CRC calculation circuit. The second message is distributed to the second CRC calculation circuit. The third message is distributed to the third CRC calculation circuit.
  • the first CRC calculation circuit is configured to calculate a CRC of a binary sequence of M bits.
  • M is greater than or equal to N.
  • the number of bits of the binary sequence of the first pulse is N.
  • the second CRC calculation circuit is configured to calculate a CRC of a binary sequence of A bits. Specifically, A is greater than or equal to B. B is equal to N minus the number of bits contained in the alignment block.
  • the third CRC calculation circuit is configured to calculate a CRC of a binary sequence of C bits.
  • C is greater than or equal to D.
  • D is equal to N minus the number of bits contained in the alignment block, and subtracts the number of bits contained in the message of the minimum length. Therefore, the resources of the hardware circuit that the first CRC calculation circuit, the second CRC calculation circuit, and the third CRC calculation circuit need to occupy may be decremented the trend of. Therefore, the above technical solution helps to save resources of the hardware circuit.
  • the embodiment of the present invention provides a CRC calculation circuit, and the CRC calculation circuit includes the first CRC calculation circuit, the second CRC calculation circuit, and the third CRC calculation circuit in the method shown in FIG.
  • the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware.
  • the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.

Abstract

一种CRC计算方法及装置,比较容易应用到灵活带宽以太网的场景。根据本发明实施例提供的技术方案,所述第一脉冲的二进制序列包括所述第一报文和所述第二报文。所述第一报文中的比特的数量不等于所述第二报文中的比特的数量。将所述第一报文分发到第一CRC计算电路。将所述第二报文分发到第二CRC计算电路。通过第一CRC计算电路计算得到所述第一报文的CRC。通过所述第二CRC计算电路得到所述第二报文的CRC。如果将上述技术方案应用到灵活以太网的上述应用场景中,则可以分别计算来自不同的发送器的不同长度报文的CRC。因此,上述技术方案可以较好的应用在灵活以太网的场景中。

Description

一种 CRC计算方法及装置
技术领域
本发明涉及通信领域,尤其涉及一种循环冗余码(英文: cyclic redundancy code, 筒称: CRC )计算方法及装置。 背景技术
循环冗余校验 (英文: cyclic redundancy check )是一种校验方法。 在通信 系统中, 循环冗余校验是一种常用的错误校验方法。 具体来说, 源端可以根 据生成多项式计算原始数据的 CRC。 CRC也可以称为循环冗余校验码(英文: cyclic redundancy check code )。 源端在原始数据后添加 CRC并向宿端发送添加 了 CRC的原始数据。 宿端收到添加了 CRC的原始数据后, 可以根据 CRC以及 生成多项式校验原始数据在传送过程中是否发生错误。
现有技术中, 接收器中设置有对应特定长度的报文的 CRC计算电路。 接 收器收到特定长度的报文后, 可以根据 CRC计算电路对特定长度的报文是否 发生错误进行校验。 上述技术方案不能较好地适用于灵活以太网 (英文: flexible ethernet )。 发明内容
本发明实施例提供了一种 CRC计算方法及装置, 可以较好地适用于灵活 以太网。
第一方面, 提供一种循环冗余校验码 CRC计算方法, 该方法包括: 接收第一脉冲的二进制序列, 所述第一脉冲的二进制序列包括第一报文 和第二报文,所述第一报文的比特的数量为 M,所述第二报文的比特的数量是
N, M和 N为正整数, M不等于 N;
将所述第一报文分发到第一 CRC计算电路, 所述第一 CRC计算电路计算 所述第一报文的 CRC; 将所述第二报文分发到第二 CRC计算电路, 所述第二 CRC计算电路计算 所述第二报文的 CRC。
结合第一方面, 在第一种可能的实现方式中, 所述第一脉冲的二进制序 列还包括第三报文, 所述第三报文的比特的数量为 X, 所述方法还包括:
根据所述第三报文生成第一二进制序列, 所述第一二进制序列的比特的 数量为 Y, 所述第一二进制序列的高 X比特的值等于所述第三报文的比特的 值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C , Y、 X和 C为正整数; 将所述第一二进制序列分发到第三 CRC计算电路, 所述第三 CRC计算电 路计算所述第一二进制序列的 CRC。
结合第一方面或者第一方面的第一种可能的实现方式, 在第二种可能的 实现方式中, 所述第一脉冲的二进制序列还包括第四报文的高 A比特, 所述第 四报文的比特的数量是 A+B, 所述方法还包括:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B、 和 G为正整数, H为大于或者等于 0的整数, B小于或者等于 G;
将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电 路计算所述第二二进制序列的 CRC以对所述第四 CRC计算电路的 CRC寄存器 的值进行初始化;
接收第二脉冲的二进制序列, 所述第二脉冲是所述第一脉冲的下一个脉 冲, 所述第二脉冲的二进制序列包括所述第四报文的低 B比特;
将所述第四报文的低 B比特分发到所述第四 CRC计算电路;
所述第四 CRC计算电路以所述第二二进制序列的 CRC为所述第四 CRC计 算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
结合第一方面或者第一方面的第一种可能的实现方式, 在第三种可能的 实现方式中, 所述第一脉冲的二进制序列还包括第四报文的高 A比特, 所述第 四报文的比特的数量是 A+B, 所述方法还包括: 根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数;
将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电 路计算所述第二二进制序列的 CRC;
接收第二脉冲的二进制序列, 所述第二脉冲是所述第一脉冲的下一个脉 冲, 所述第二脉冲的二进制序列包括所述第四报文的低 B比特;
将所述第四报文的低 B比特分发到第五 CRC计算电路,所述第五 CRC计算 电路以所述第二二进制序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的 初始值计算所述第四报文的低 B比特的 CRC。
结合第一方面或者第一方面的第一种至第三种可能的实现方式中的任意 一种可能的实现方式, 在第四种可能的实现方式中, 所述第一 CRC计算电路 包括第一数据异或计算电路, 所述第一数据异或计算电路表示为:
Figure imgf000005_0001
CRC D = | P H * P ■■· Hn_1 * P |* d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000005_0002
P m-1 最高比特, n取值为 M; P =
为生成多项式矩阵, pm4至 p。是所述第一 CRC
Pi 为变换矩阵;
Figure imgf000006_0001
m*m
所述第二 CRC计算电路包括第二数据异或计算电路, 所述第二数据异或 计算电路表示为: n-l
n-2
CRC D„=「P H * P ■· · Hn_1 * P
d,
Figure imgf000006_0002
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
P m-1
P =
比特, n取值为 N; 为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000006_0003
Po
一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数,
为变换矩阵
Figure imgf000006_0004
第二方面, 提供一种循环冗余校验码 CRC计算装置, 该装置包括: 接收单元, 用于接收第一脉冲的二进制序列, 所述第一脉冲的二进制序 列包括第一报文和第二报文,所述第一报文的比特的数量为 M,所述第二报文 的比特的数量是 N, M和 N为正整数, M不等于 N;
调度单元, 用于将所述接收单元接收的所述第一报文分发到第一 CRC计 算电路, 将所述接收单元接收的所述第二报文分发到第二 CRC计算电路; 所述第一 CRC计算电路, 用于计算所述调度单元分发的所述第一报文的 CRC;
所述第二 CRC计算电路, 用于计算所述调度单元分发的所述第二报文的 CRC。
结合第二方面, 在第一种可能的实现方式中, 所述装置还包括第三 CRC 计算电路, 所述第一脉冲的二进制序列还包括第三报文, 所述第三报文的比 特的数量为 X;
所述调度单元还用于:
根据所述接收单元接收的所述第三报文生成第一二进制序列, 所述第一 二进制序列的比特的数量为 Y, 所述第一二进制序列的高 X比特的值等于所述 第三报文的比特的值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C, Y、 X和 C为正整数;
将所述第一二进制序列分发到所述第三 CRC计算电路;
所述第三 CRC计算电路, 用于计算所述调度单元分发的所述第一二进制 序列的 CRC。
结合第二方面或者第二方面的第一种可能的实现方式, 在第二种可能的 实现方式中, 所述装置还包括第四 CRC计算电路, 所述第一脉冲的二进制序 列还包括第四报文的高 A比特, 所述第四报文的比特的数量是 A+B;
所述调度单元还用于:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B、 和 G为正整数, H为大于或者等于 0的整数, B小于或者等于 G; 将所述第二二进制序列分发到所述第四 CRC计算电路;
所述第四 CRC计算电路, 用于计算所述第二二进制序列的 CRC以对所述 第四 CRC计算电路的 CRC寄存器的值进行初始化;
所述接收单元还用于, 接收第二脉冲的二进制序列, 所述第二脉冲是所 述第一脉冲的下一个脉冲, 所述第二脉冲的二进制序列包括所述第四 ^艮文的 低 B比特;
所述调度单元还用于,将所述第四报文的低 B比特分发到所述第四 CRC计 算电路;
所述第四 CRC计算电路, 还用于以所述第二二进制序列的 CRC为所述第 四 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
结合第二方面或者第二方面的第一种可能的实现方式, 在第三种可能的 实现方式中, 所述装置还包括第四 CRC计算电路以及第五 CRC计算电路, 所 述第一脉冲的二进制序列还包括第四 ^艮文的高 A比特,所述第四 ^艮文的比特的 数量是 A+B;
所述调度单元还用于:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数;
将所述第二二进制序列分发到所述第四 CRC计算电路;
所述第四 CRC计算电路, 用于根据所述调度单元分发的所述第二二进制 序列计算所述第二二进制序列的 CRC;
所述接收单元还用于, 接收第二脉冲的二进制序列, 所述第二脉冲是所 述第一脉冲的下一个脉冲, 所述第二脉冲的二进制序列包括所述第四 ^艮文的 低 B比特;
所述调度单元还用于,将所述第四报文的低 B比特分发到第五 CRC计算电 路; 所述第五 CRC计算电路, 用于以所述第二二进制序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
结合第二方面或者第二方面的第一种至第三种可能的实现方式中的任意 一种可能的实现方式, 在第四种可能的实现方式中, 所述第一 CRC计算电路 包括第一数据异或计算电路, 所述第一数据异或计算电路表示为:
的二进制序列的最低比特至
Figure imgf000009_0001
P m-1 最高比特, n取值为 M; P =
为生成多项式矩阵, pm4至 p。是所述第一 CRC
Figure imgf000009_0002
Po 计算电路的 CRC多 项 式的 系 数, m为 生成多 项 式的 阶数,
为变换矩阵;
Figure imgf000009_0003
Jm*m n-l
CRC D„ = P H * P H n_1 p n-2 d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000010_0001
P m-1 比特, n取值为 P =
N; 为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000010_0002
Po
CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数,
为变换矩阵
Figure imgf000010_0003
第三方面, 提供一种系统芯片 500。 所述系统芯片 500可以用于执行上述 第一方面或者第一方面的第一种至第四种可能的实现方式中的任意一种可能 的实现方式。所述系统芯片 500包括 PHY510和 MAC520。 MAC520包括 RS521、 分发器 522以及 CRC计算电路 523至 CRC计算电路 527。 PHY510通过 ΜΠ与 MAC520连接。 RS521与分发器 522耦合。分发器 522与 CRC计算电路 523至 CRC 计算电路 527耦合。 MAC520可以在时钟装置的驱动下进行工作。 具体来说, RS521 , 分发器 522和 CRC计算电路 523至 CRC计算电路 527在所述时钟装置的 驱动下进行工作。
RS521在所述时钟装置的驱动下, 在第一时钟周期内向分发器 522发送了 所述第一时钟周期的二进制序列。 所述第一时钟周期的二进制序列包括第一 报文和第二报文。所述第一报文的比特的数量为^1。所述第二报文的比特的数 量是 N。 M和 N为正整数。 M不等于 N。 所述第一 4艮文是以太网帧。 所述第二 报文是以太网帧。
分发器 522在所述时钟装置的驱动下, 接收到所述第一时钟周期的二进制 序列。
分发器 522将所述第一报文分发到第一 CRC计算电路, 所述第一 CRC计算 电路计算所述第一报文的 CRC。 CRC计算电路 523是所述第一 CRC计算电路。
分发器 522将所述第二报文分发到第二 CRC计算电路, 所述第二 CRC计算 电路计算所述第二报文的 CRC。 CRC计算电路 524是所述第二 CRC计算电路。
结合第三方面, 在第一种可能的实现方式中, 所述第一时钟周期的二进 制序列还包括第三报文, 所述第三报文的比特的数量为 X。
分发器 522根据所述第三 ·^艮文生成第一二进制序列, 所述第一二进制序列 的比特的数量为 Υ, 所述第一二进制序列的高 X比特的值等于所述第三报文的 比特的值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C, Y、 X和 C为 正整数。
分发器 522将所述第一二进制序列分发到第三 CRC计算电路, 所述第三 CRC计算电路计算所述第一二进制序列的 CRC。 CRC计算电路 525是所述第三 CRC计算电路。
结合第三方面或者第三方面的第一种可能的实现方式, 在第二种可能的 实现方式中, 所述第一时钟周期的二进制序列还包括第四报文的高 A比特, 所 述第四报文的比特的数量是 A+B。 所述第四报文是以太网帧。
分发器 522根据所述第四报文的高 A比特生成第二二进制序列, 所述第二 二进制序列的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述 第四报文的高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0 , G=A+H, A、 B和 G为正整数。 H为大于或者等于 0的整数。 B小于或者等于 G。
分发器 522将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电路计算所述第二二进制序列的 CRC以对所述第四 CRC计算电路的 CRC寄存器的值进行初始化。
分发器 522接收 RS521在所述时钟装置的驱动下在第二时钟周期发送的二 进制序列。 所述第二时钟周期是所述第一时钟周期的下一个时钟周期。 所述 第二时钟周期的二进制序列包括所述第四报文的低 B比特。
分发器 522将所述第四报文的低 B比特分发到所述第四 CRC计算电路。 CRC计算电路 526是所述第四 CRC计算电路。
所述第四 CRC计算电路以所述第二二进制序列的 CRC为所述第四 CRC计 算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
结合第三方面或者第三方面的第一种可能的实现方式, 在第三种可能的 实现方式中, 所述第一时钟周期的二进制序列还包括第四报文的高 A比特, 所 述第四报文的比特的数量是 A+B。
分发器 522根据所述第四报文的高 A比特生成第二二进制序列, 所述第二 二进制序列的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述 第四报文的高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0 , G=A+H, A、 B和 G为正整数。 H为大于或者等于 0的整数。
分发器 522将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电路计算所述第二二进制序列的 CRC。 CRC计算电路 526是所述第四 CRC计算电路。
分发器 522接收 RS521在所述时钟装置的驱动下在第二时钟周期发送的二 进制序列。 所述第二时钟周期是所述第一时钟周期的下一个时钟周期。 所述 第二时钟周期的二进制序列包括所述第四报文的低 B比特。
分发器 522将所述第四报文的低 B比特分发到第五 CRC计算电路。 所述第 五 CRC计算电路以所述第二二进制序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。 CRC计算电路 527 是所述第五 CRC计算电路。
结合第三方面或者第三方面的第一种至第三种可能的实现方式中的任意 一种可能的实现方式, 在第四种可能的实现方式中, 所述第一 CRC计算电路 包括第一数据异或计算电路。 所述第一数据异或计算电路表示为: ά n-l
d n-2
CRC D„ = H*P ■■· Hn d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000013_0001
P m-1 最高比特, n取值为 M; P = 为生成多项式矩阵, pm4至 p。是所述第一 CRC
Figure imgf000013_0002
Po
计算电路的 CRC多 项 式的 系 数, m为 生成多 项 式的 阶数,
为变换矩阵
Figure imgf000013_0003
可选地, 所述第二 CRC计算电路包括第二数据异或计算电路, 所述; 数据异或计算电路表示为: d„ n-l
d n-2
CRC D = I P H*P ■■· Hn_1*P l*l 中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000014_0001
P m-1 比特, n取值为 N; P =
为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000014_0002
Po
一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数
为变换矩阵
Figure imgf000014_0003
本发明实施例提供的 CRC计算方案, 比较容易应用到灵活带宽以太网的 场景。 灵活以太网中可能存在如下应用场景: 一个接收器需要通过接收器的 以太网接口接收多个发送器分别通过多个以太网接口发送的报文。 每个发送 器包括一个以太网接口。 所述多个发送器与所述多个以太网接口——对应。 所述多个发送器中, 不同的发送器发送的报文的长度可以不同。
根据上述技术方案, 所述第一脉冲的二进制序列包括所述第一报文和所 述第二报文。 所述第一报文中的比特的数量不等于所述第二报文中的比特的 数量。 将所述第一报文分发到第一 CRC计算电路。 将所述第二报文分发到第 二 CRC计算电路。 通过第一 CRC计算电路计算得到所述第一报文的 CRC。 通 过所述第二 CRC计算电路得到所述第二报文的 CRC。 如果将上述技术方案应 用到灵活以太网的上述应用场景中, 则可以分别计算来自不同的发送器的不 同长度报文的 CRC。 因此, 上述技术方案可以较好的应用在灵活以太网的场 景中 附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中 所需要使用的附图作筒要介绍, 显而易见地, 下面描述中的附图仅仅是本发 明的一些实施例, 对于本领域的普通技术人员来讲, 在不付出创造性劳动性 的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例提供的 CRC计算方案的示意图;
图 2为本发明实施例提供的 CRC计算结构在 400GE以太网中的应用示意 图;
图 3为本发明实施例提供的 CRC计算方法的流程示意图;
图 4为本发明实施例提供的 CRC计算装置的结构示意图;
图 5为本发明实施例提供的 MAC的结构示意图;
图 6为本发明实施例提供的一种 CRC计算方法的流程示意图;
图 7为本发明实施例提供的一种 CRC计算方法的流程示意图;
图 8为本发明实施例提供的一种 CRC计算方法的流程示意图;
图 9为本发明实施例提供的一种 CRC计算方法的流程示意图;
图 10为本发明实施例提供的一种 CRC计算方法的流程示意图。 具体实施方式
为了使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本 发明作进一步地详细描述, 显然, 所描述的实施例仅仅是本发明一部份实施 例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在 没有做出创造性劳动前提下所获得的所有其它实施例, 都属于本发明保护的 范围。
下文对本发明实施例涉及到的部分术语进行说明:
物理层电路(英文: physical layer, 筒称: PHY ): 所述 PHY可以通过现 场可编程门阵列 (英文: field programmable gate array, 筒称: FPGA )或者专 用集成电路(英文: application specific integrated circuit, 筒称: ASIC )实现。 所述 PHY可以是网络接口卡(英文: network interface card, 筒称: NIC ) 中 的部件, 所述 NIC可以是线卡(英文: line card, 筒称: LC )或者物理接口 卡(英文: physical interface card, 筒称: PIC )。 所述 PHY可以通过媒体无关 接口 (英文: Media Independence Interface , 筒称: ΜΠ )连接到媒体访问控制 器 (英文: media access controller, 筒称: MAC )。
PHY芯片 (英文: MAC chip ): 所述 PHY芯片可以包括 1个 PHY或者 多个 PHY。 所述 PHY芯片可以通过 FPGA或者 ASIC实现。
MAC: 所述 MAC可以通过 FPGA或者 ASIC实现。 所述 MAC可以包括 协调子层电路(英文: reconciliation sublayer, 筒称: RS )、 分发器 (英文: dispatcher ) 以及至少一个 CRC计算电路。 所述 RS与所述分发器耦合。 所述 分发器与所述至少一个 CRC 计算电路耦合。 所述分发器可以用于接收所述 RS 输出的二进制序列, 所述二进制序列中包括至少一个以太网帧 (英文: ethernet frame )。所述分发器可以用于向所述至少一个 CRC计算电路分发所述 至少一个以太网帧。所述 MAC可以在时钟装置的驱动下进行工作。所述 MAC 中的部件 (例如 RS、 分发器和至少一个 CRC计算电路)也在所述时钟装置 的驱动下进行工作。
MAC芯片 (英文: MAC chip ): 所述 MAC芯片可以包括 1个 MAC或者 多个 MAC。 所述 MAC芯片可以通过 FPGA或者 ASIC实现。
系统芯片: 所述系统芯片可以包括 1个 MAC和 1个 PHY。 所述系统芯 片也可以包括多个 MAC和多个 PHY。 所述系统芯片中的 PHY可以与所述系 统芯片中的 MAC耦合。 所述系统芯片可以通过 FPGA或者 ASIC实现。
CRC计算电路 (英文: cyclic redundancy code calculating circuit ): 用于计 算数据的 CRC的电路。 具体来说, 所述 CRC计算电路可以根据生成多项式 (英文: generator polynomial )计算所述数据的 CRC。 所述数据可以是二进制 序列 (英文: binary sequence )。 所述二进制序列可以是报文。 所述 CRC计算 电路可以包括 CRC寄存器。 本发明实施例提供的技术方案中, CRC计算电路 计算数据的 CRC时, CRC计算电路可以串行地计算所述数据的 CRC, 也可 以并行地计算所述数据的 CRC。 本发明实施例提供的技术方案中, 每个 CRC 计算电路可以对应同一个生成多项式。
接收器: 所述接收器可以包括以太网接口。 所述以太网接口可以包括串 行器 /解串器(英文: serializer/deserializer, 筒称: serdes )、 PHY以及 MAC。 所述 serdes与所述 PHY耦合。 所述 PHY与所述 MAC耦合。
多端口以太网设备: 所述多端口以太网设备可以是以太网集线器、 以太 网路由器或者以太网交换机。 所述多端口以太网设备包括多个端口, 每个端 口可以包括接收器。 所述接收器中可以包括系统芯片。 所述系统芯片可以包 括 MAC和 PHY。
二进制序列的比特的值: 所述二进制序列对应的二进制数(英文: binary number ) 的值。 所述二进制数的值可以用十进制数表示。 举例来说, 二进制 序列 1010对应的二进制数是 1010。 二进制数 1010的值等于 10 (十进制数)。 二 进制序列 1010的高 2比特对应的二进制数是 10。 二进制序列 1010的高 2比特的 值等于 2 (十进制数)。 二进制序列 1010的低 2比特对应的二进制数也是 10。 二 进制序列 1010的低 2比特的值等于 2 (十进制数)。
本发明实施例提供的 CRC计算方案, 比较容易应用到灵活带宽以太网的 场景。 具体来说, 在灵活以太网的场景中, 不同报文的长度可以是不相同的。 针对这种对可变长报文的应用场景, 本发明实施例提供了 CRC计算方法。
图 3为本发明实施例提供的 CRC计算方法的流程示意图。 所述方法的执行 主体可以是 MAC、 MAC芯片、 系统芯片、 接收器或者多端口以太网设备。 参 见图 3 , 所述方法包括:
S101、 接收第一脉冲的二进制序列, 所述第一脉冲的二进制序列包括第 一报文和第二报文,所述第一报文的比特的数量为 M,所述第二报文的比特的 数量是 N, M和 N为正整数, M不等于 N。
举例来说, S101的执行主体可以是 MAC中的分发器。 所述第一脉冲的二 进制序列可以是所述 MAC中的 RS输出的。
举例来说, 所述第一报文是以太网帧。 所述第二报文是以太网帧。 所述 第一脉冲对应时钟装置的一个时钟周期。 所述时钟装置用于驱动图 3所示的方 法的执行主体接收所述第一脉冲的二进制序列。
举例来说, 所述第一报文可以是第一发送器发送的报文。 所述第二报文 可以是第二发送器发送的报文。 具体来说, 所述第一发送器通第一以太网接 口发送所述第一报文。 所述第二发送器通过第二以太网接口发送所述第二报 文。 所述第一以太网接口的类型可以不同于所述第二以太网接口的类型。 例 如, 所述第一以太网接口可以是 40吉比特以太网 (英文: 40 gigabit ethernet, 筒称: 40GE )接口。所述第二以太网接口可以是 100吉比特以太网(英文: 100 gigabit ethernet, 筒称: 100GE )接口。 所述第一发送器可以是第一网络装置 中的发送器。 所述第二发送器可以是第二网络装置中的发送器。 所述第一网 络装置和所述第二网络装置可以是不同的网络装置。
这里的 "第一脉冲"可以是任意一个脉冲。接收器在每个脉冲接收到的二进 制序列的比特数量可以是相同的。 比如, 每个脉冲接收到的二进制序列的比 特数量为 1280。
在灵活以太网场景下, 不同报文的长度可以是不等长的, 即不同报文的 二进制的比特的数量可以是不同的。 通信系统可以规定报文的最小长度。 比 如, 通信系统可以规定一个报文最少包含 512个比特。
一个脉冲的二进制序列可以包括一个或多个 ^艮文, 且每个 4艮文的二进制 的比特的数量可以相同也可以不同。 在本流程的场景中, 第一脉冲的二进制 序列包括第一报文和第二报文, 第一报文和第二报文的二进制序列的比特的 数量不同。
S102、 将所述第一报文分发到第一 CRC计算电路, 所述第一 CRC计算电 路计算所述第一报文的 CRC; 将所述第二报文分发到第二 CRC计算电路, 所 述第二 CRC计算电路计算所述第二报文的 CRC。
举例来说, S102的执行主体可以是所述分发器。 根据一个脉冲接收到的二进制序列的比特的数量, 以及通信系统规定的 报文的最小长度(即报文的二进制序列的比特的数量的最小值), 可以确定出 一个脉冲最多可接收到的报文的数量。 CRC计算电路的数量可根据一个脉冲 最多可接收到的报文的数量来确定。 比如, 一个脉冲接收到的报文的最大数 量记为:
Figure imgf000019_0001
其中, Pkn为一个脉冲接收到的二进制序列的比特的数量, 1为一个报文的 二进制序列的比特的数量的最小值; 「 表示向上取整, 即取大于或等于 的最小整数。
这种情况下, CRC计算电路的数量可以是上述表达式所计算出的 N。 每个 CRC计算电路被配置以并行地计算一定比特数量的二进制序列的 CRC。 比如, 每个 CRC计算电路均可以被配置以并行地计算 N个比特的二进制 序列的 CRC ,其中 N的取值可以与一个脉冲接收到的二进制序列的比特数量相 同。
再比如,如本发明实施例,第一 CRC计算电路被配置以并行地计算 M个比 特的二进制序列的 CRC ,第二 CRC计算电路被配置以并行地计算 N个比特的二 进制序列的 CRC。
灵活以太网中可能存在如下应用场景: 一个接收器需要通过接收器的以 太网接口接收多个发送器分别通过多个以太网接口发送的报文。 每个发送器 包括一个以太网接口。 所述多个发送器与所述多个以太网接口——对应。 所 述多个发送器中, 不同的发送器发送的报文的长度可以不同。
根据上述技术方案, 所述第一脉冲的二进制序列包括所述第一报文和所 述第二报文。 所述第一报文中的比特的数量不等于所述第二报文中的比特的 数量。 将所述第一报文分发到第一 CRC计算电路。 将所述第二报文分发到第 二 CRC计算电路。 通过第一 CRC计算电路计算得到所述第一报文的 CRC。 通 过所述第二 CRC计算电路得到所述第二报文的 CRC。 如果将上述技术方案应 用到灵活以太网的上述应用场景中, 则可以分别计算来自不同的发送器的不 同长度报文的 CRC。 因此, 上述技术方案可以较好的应用在灵活以太网的场 景中。
可选地, 图 3所示的技术方案中, 所述第一脉冲的二进制序列还可以包括 第三报文, 所述第三报文的比特的数量为 X。
具体来说, 图 3所示的技术方案中还可以涉及到第三 CRC计算电路。 所述 第三 CRC计算电路被配置以并行地计算 Y( Υ>Χ )个比特的二进制序列的 CRC。 在这种场景下, 可以对所述第三 ^艮文执行以下处理:
根据所述第三报文生成第一二进制序列, 所述第一二进制序列的比特的 数量为 Υ。 所述第一二进制序列的高 X比特的值等于所述第三报文的比特的 值。 所述第一二进制序列的低 C比特的值等于 0。 Y=X+C。 Y、 X和 C为正整数。
可选的, 可通过对所述第三报文执行移位操作以得到所述第一二进制序 列。
将所述第一二进制序列分发到所述第三 CRC计算电路, 所述第三 CRC计 算电路计算所述第一二进制序列的 CRC。
举例来说, Y可以不等于 M。 Y可以不等于 N。
可选地, 图 3所示的技术方案中, 所述第一脉冲的二进制序列还包括第四 报文的高 A比特, 所述第四报文的比特的数量是 A+B。
举例来说, A与 B的和不等于 M。 A与 B的和不等于 N。
具体来说, 图 3所示的技术方案中还可以涉及到第四 CRC计算电路。 所述 第四 CRC计算电路被配置以计算 G个比特的二进制序列的 CRC。 这种场景中, 可以针对所述第四 ^艮文采用以下两种方式进行处理:
方式一
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数, B小于或者等于 G。
可选的, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位操 作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述第 四 4艮文的高 A比特。
将所述第二二进制序列分发到所述第四 CRC计算电路, 所述第四 CRC计 算电路计算所述第二二进制序列的 CRC以对所述第四 CRC计算电路的 CRC寄 存器的值进行初始化。
接收第二脉冲的二进制序列 (所述第二脉冲是所述第一脉冲的下一个脉 冲, 所述第二脉冲的二进制序列包括所述第四报文的低 B比特)。
将所述第四报文的低 B比特分发到所述第四 CRC计算电路。所述第四 CRC 计算电路以所述第二二进制序列的 CRC为所述第四 CRC计算电路的 CRC寄存 器的初始值计算所述第四报文的低 B比特的 CRC。
方式二
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数。
可选的, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位操 作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述第 四 4艮文的高 A比特。
将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电 路计算所述第二二进制序列的 CRC。
接收第二脉冲的二进制序列, 所述第二脉冲是所述第一脉冲的下一个脉 冲, 所述第二脉冲的二进制序列包括所述第四报文的低 B比特。
将所述第四报文的低 B比特分发到第五 CRC计算电路。
具体是所述第四 CRC计算电路中的 CRC寄存器向所述第五 CRC计算电路 中的 CRC寄存器传递信息。 所述第五 CRC计算电路以所述第二二进制序列的 CRC为所述第五 CRC计 算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
其中, 所述第五 CRC计算电路与所述第四 CRC计算电路是不同的 CRC计 算电路。
举例来说, 所述第五 CRC计算电路被配置以计算 J比特的二进制序列的 CRC。 J是正整数。 J大于或者等于 B。
举例来说, 所述第五 CRC计算电路与所述第一 CRC计算电路可以是同一 个 CRC计算电路。
可选地, 上述实施例中的 CRC计算电路包括第一数据异或计算电路。 以 所述第一 CRC计算电路为例, 所述第一数据异或计算电路表示为: ά n-l
d n-2
CRC D = 1 P H * P ■■· Hn_1 * P |* d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000022_0001
P m-1 最高比特, n取值为 M; P =
为生成多项式矩阵, pm4至 p。是所述第一 CRC
Figure imgf000022_0002
Po 计算电路的 CRC多 项 式的 系 数, m为 生成多 项 式的 阶数,
为变换矩阵;
Figure imgf000022_0003
可选地, 所述第二 CRC计算电路包括第二数据异或计算电路, 所述第二 数据异或计算电路表示为:
的二进制序列的最低比特至
Figure imgf000023_0001
P m-1 比特, n取值为 N; P = 为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000023_0002
Po 一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数
为变换矩阵 t
Figure imgf000023_0003
以上实施例仅以几种典型的应用场景为例, 对本发明进行了描述。 上述 实施例提供的 CRC计算方法, 也可应用在其他应用场景中。
为了更清楚的理解本发明的上述实施例, 下面以一种典型的应用场景为 例进行描述。
参见图 1 , 为本发明实施例提供的可应用于灵活以太网的 CRC计算方案的 示意图。 如图所示, 对于给定以太网系统, 以太网报文的最小长度记为 1 (即 报文的最小长度为 1比特),每个脉冲接收器接收的二进制序列的比特的数量记 为 Pkn , 则每个脉冲的二进制序列中最多可包含的报文的数量为:
Ν = len + 1 其中, 「 表示向上取整, 即取大于或等于^ 的最小整数。 这样, 该 CRC计算架构中, CRC计算电路的数量可设置为 N个(如图中的 Calc_CRC_l , Calc_CRC_2, Calc_CRC_N )。 每个 CRC计算电路被配置以 并行地计算一定比特数量的二进制序列的 CRC。
调度单元用于将一个脉冲的二进制序列中包含的报文分发到对应的 CRC 计算电路。 一个报文的二进制序列被分发到一个 CRC计算电路。 调度单元可 由逻辑电路实现。
如前所述, 每个 CRC计算电路被配置以并行地计算一定比特数量的二进 制序列的 CRC。优选的,调度单元在进行报文分发时,可以按照" Calc— CRC— 1 , Calc_CRC_2, Calc— CRC— Ν"的顺序进行分发, 即总是从编号最小的 CRC 计算电路开始, 并按照编号递增的顺序进行分发。 这样, 按照 CRC计算电路 编号从小到大的顺序, CRC计算电路能够处理的二进制序列的比特数量可递 减。
以 400G流量的 MAC ( Media Access Control, 媒体访问控制) 帧的应用场 景为例, 按照以太网的标准, 最小报文长度为 512比特, 采用 64b/66b编解码, 则对齐块大小为 64比特(即数据处理的最小颗粒度为 64比特, 也就是说最少 以 64个比特为单位进行数据处理;), 以每个脉冲的二进制序列的比特数量为 1280为例, 那么一个脉冲的二进制序列最多可包含 4个报文, 即, 最多需要计 算 4个报文的 CRC, 因此, CRC计算架构中可最多设置 4个 CRC计算电路。
每个脉冲的二进制序列中包含的报文按序排序, 比如, 一个脉冲的二进 制序列中包含了一个完整报文(记为报文 a )和一个报文(记为报文 b ) 的高 比特位部分, 则在下一个脉冲的二进制序列中的第一个报文是报文 b的其余比 特。 每个脉冲的二进制序列包含的报文被顺序调度到对应的 Calc_CRC_K ( K=l,2,3,4 )进行 CRC的计算。 比如, 第一个报文被调度到 Calc_CRC_l , 第 二个报文被调度到 Calc_CRC_2, 第三个报文被调度到 Calc_CRC_3 , 第四个报 文被调度到 Calc_CRC_4。
如果一个脉冲的二进制序列仅包含一个报文, 且该报文的比特数量为 1280, 则调度到 Calc_CRC_l进行 CRC计算; 如果一个脉冲的二进制序列仅包 含两个报文, 则第一个报文的比特数量最少为 64, 第二个报文的最大比特数 量为 1216 ( 1280bit-64bit=1216bit );如果一个脉冲的二进制序列包含三个报文, 则第一个报文的比特数量最少为 64, 第二个报文的比特数量最少为 512, 则第 三个报文的最大比特数量为 704 ( 1280bit-64bit-512bit=704bit ); 如果一个脉冲 的二进制序列包含了四个报文, 则第一个报文的比特数量最少为 64, 第二个 报文的比特数量最少为 512, 第三个报文的比特数量至少为 512, 则对于第四 个 4艮文来说仅包含该 4艮文的高 192比特( 1280bit-64bit-512bi-512bit=192bit )。
根据以上情况, 只要相应 Calc_CRC满足相应报文的最长处理要求即可, 因此每个 CRC计算电路的配置如下:
Calc_CRC_l被配置以并行地计算 1280个比特的二进制序列的 CRC;
Calc_CRC_2被配置以并行地计算 1216个比特的二进制序列的 CRC;
Calc_CRC_3被配置以并行地计算 704个比特的二进制序列的 CRC;
Calc_CRC_4被配置以并行地计算 192个比特的二进制序列的 CRC。
相应的, Calc_CRC_l的数据异或网络运算部分可表示为:
Figure imgf000025_0001
Calc_CRC_2的数据异或网络运算部分可表示为
CRC _ D1216 P H * P
Figure imgf000025_0002
Calc_CRC_3的数据异或网络运算部分可表示为:
Figure imgf000026_0001
Calc_CRC_4的数据异或网络运算部分可表示为:
Figure imgf000026_0002
上述 400G流量的 MAC帧的 CRC计算结构可如图 2所示。
根据以上原则, 推而广之, CRC计算电路的配置原则可以是:
第 X ( x= 1 )个 CRC计算电路被配置以并行地计算 Plen个比特( Plen为每个 脉冲的二进制序列的比特数量)的二进制序列的 CRC, 第 x+1个 CRC计算电路 比第 X个 CRC计算电路所处理的比特数量少 M比特(M为对齐块的大小 );
第 y+l ( 2≤y≤N-l , N为 CRC计算电路的数量)个0^计算电路比第 y个 CRC 计算电路所处理的比特数量 K ( K为最小帧长度)个比特。
按照以上原则对 CRC计算电路进行配置的方案, 仅为一种优选实现方案, 并发明实施例中对 CRC计算电路的配置, 即一个 CRC计算电路所能够处理的 比特数量, 不构成对本发明的限制。 本发明实施例还提供了一种能够实现图 3所示的方法的装置。
参见图 4, 为本发明实施例提供的 CRC计算装置的结构示意图。 所述装置 可以用于执行图 3所示的方法。 所述装置可以是 MAC、 MAC芯片、 系统芯片、 接收器或者多端口以太网设备。 参见图 4, 所述装置 400包括:
接收单元 401 , 用于接收第一脉冲的二进制序列, 所述第一脉冲的二进制 序列包括第一报文和第二报文,所述第一报文的比特的数量为 M,所述第二报 文的比特的数量是 N, M和 N为正整数, M不等于 N。 举例来说,接收单元 401可以是 MAC中的分发器。所述二进制序列可以是 所述 MAC中的 RS输出的。
举例来说, 所述第一报文是以太网帧。 所述第二报文是以太网帧。 所述 第一脉冲对应时钟装置的一个时钟周期。 所述时钟装置用于驱动接收单元 401 接收所述第一脉冲的二进制序列。
举例来说, 所述第一报文可以是第一发送器发送的报文。 所述第二报文 可以是第二发送器发送的报文。 具体来说, 所述第一发送器通第一以太网接 口发送所述第一报文。 所述第二发送器通过第二以太网接口发送所述第二报 文。 所述第一以太网接口的类型可以不同于所述第二以太网接口的类型。 例 如,所述第一以太网接口可以是 40GE接口。所述第二以太网接口可以是 100GE 接口。 所述第一发送器可以是第一网络装置中的发送器。 所述第二发送器可 以是第二网络装置中的发送器。 所述第一网络装置和所述第二网络装置可以 是不同的网络装置。
调度单元 402, 用于将所述接收单元 401接收的所述第一报文分发到第一 CRC计算电路 403 , 将所述接收单元 401接收的所述第二报文分发到第二 CRC 计算电路 404。
举例来说, 调度单元 402可以是所述分发器。
所述第一 CRC计算电路 403 , 用于计算所述调度单元 402分发的所述第一 报文的 CRC。
具体来说, 所述第一 CRC计算电路 403被配置以计算 M个比特的二进制序 列的 CRC。
所述第二 CRC计算电路 404, 用于计算所述调度单元 402分发的所述第二 报文的 CRC。
具体来说, 所述第二 CRC计算电路 404被配置以计算 N个比特的二进制序 列的 CRC。
可选地, 图 4所示的装置中, 所述装置 400还包括第三 CRC计算电路(图 4 中未示出)。 所述第一脉冲的二进制序列还包括第三报文, 所述第三报文的比 特的数量为 X。
所述调度单元 402还用于:
根据所述接收单元 401接收的所述第三报文生成第一二进制序列, 所述第 一二进制序列的比特的数量为 Y, 所述第一二进制序列的高 X比特的值等于所 述第三报文的比特的值,所述第一二进制序列的低 C比特的值等于 0, Y=X+C, Y、 X和 C为正整数。
将所述第一二进制序列分发到所述第三 CRC计算电路。
举例来说, 所述调度单元 402可以包括移位寄存器。 所述移位寄存器可以 对所述第三报文执行移位操作以生成所述第一二进制序列。
所述第三 CRC计算电路, 用于计算所述调度单元 402分发的所述第一二进 制序列的 CRC。
可选地, 图 4所示的装置中, 所述装置 400还包括第四 CRC计算电路(图 4 中未示出), 所述第一脉冲的二进制序列还包括第四报文的高 A比特, 所述第 四报文的比特的数量是 A+B。
举例来说,所述第四 CRC计算电路被配置以计算 G个比特的二进制序列的 CRC。
所述调度单元 402还用于:
根据所述接收单元 401接收的所述第四报文的高 A比特生成第二二进制序 列, 所述第二二进制序列的比特的数量为 G, 所述第二二进制序列的高 A比特 的值等于所述第四报文的高 A比特的值, 所述第二二进制序列的低 H比特的值 等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数, B小于或者 等于 G。
举例来说, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位 操作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述 第四报文的高 A比特。
将所述第二二进制序列分发到第四 CRC计算电路。
所述第四 CRC计算电路, 用于计算所述第二二进制序列的 CRC以对所述 第四 CRC计算电路的 CRC寄存器的值进行初始化。
所述接收单元 401还用于, 接收第二脉冲的二进制序列, 所述第二脉冲是 所述第一脉冲的下一个脉冲, 所述第二脉冲的二进制序列包括所述第四 4艮文 的低 B比特。
将所述第四报文的低 B比特分发到所述第四 CRC计算电路。
所述第四 CRC计算电路, 还用于以所述调度单元 402分发的所述第二二进 制序列的 CRC为所述第四 CRC计算电路的 CRC寄存器的初始值计算所述第四 报文的低 B比特的 CRC。
可替换地, 图 4所示的装置中, 所述装置 400还包括第四 CRC计算电路(图 4中未示出)以及第五 CRC计算电路 (图 4中未示出)。 所述第一脉冲的二进制 序列还包括第四报文的高 A比特, 所述第四报文的比特的数量是 A+B。
举例来说,所述第四 CRC计算电路被配置以计算 G个比特的二进制序列的 CRC。
所述调度单元 402还用于:
根据所述接收单元 401接收的所述第四报文的高 A比特生成第二二进制序 列。 所述第二二进制序列的比特的数量为0。 所述第二二进制序列的高 A比特 的值等于所述第四报文的高 A比特的值。 所述第二二进制序列的低 H比特的值 等于 0。 G=A+H 。 A、 B和 G为正整数。 H为大于或者等于 0的整数。
举例来说, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位 操作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述 第四报文的高 A比特。
将所述第二二进制序列分发到所述第四 CRC计算电路。
所述第四 CRC计算电路, 用于根据所述调度单元 402分发的所述第二二进 制序列计算所述第二二进制序列的 CRC。
所述接收单元 401还用于, 接收第二脉冲的二进制序列。 所述第二脉冲是 所述第一脉冲的下一个脉冲。 所述第二脉冲的二进制序列包括所述第四 4艮文 的低 B比特。 将所述第四报文的低 B比特分发到所述第五 CRC计算电路。
所述第五 CRC计算电路, 用于以所述调度单元 402分发的所述第二二进制 序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的初始值计算所述第四报 文的低 B比特的 CRC。
举例来说, 所述第五 CRC计算电路被配置以计算 J比特的二进制序列的 CRC。 J是正整数。 J大于或者等于 B。
举例来说, 所述第五 CRC计算电路与所述第一 CRC计算电路可以是同一 个 CRC计算电路。
可选地, 图 4所示的装置中, 所述第一 CRC计算电路 403包括第一数据异 或计算电路。 所述第一数据异或计算电路表示为: ά n-l
d n-2
CRC D = 1 P H * P ■■· Hn_1 * P |* d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000030_0001
P m-1
P =
最高比特, n取值为 Mc 为生成多项式矩阵。 pm4至 p。是所述第一 CRC
Figure imgf000030_0002
Po 计算电路的 CRC多 项 式的 系 数。 m为 生成多 项 式的 阶数
为变换矩阵 (
Figure imgf000030_0003
所述第二 CRC计算电路包括 J:二数据异或计算电路。 所述第二数据异或 计算电路表示为: n-l
n-2
CRC D„ =「P H * P ■■· Hn_1 * P
d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000031_0001
P m-1 比特, P =
n取值为 N; 为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000031_0002
Po 一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数
为变换矩
Figure imgf000031_0003
图 5为本发明实施例提供的一种系统芯片的结构示意图。 系统芯片 500可 以用于执行图 3所示的方法。 参见图 5 , 所述系统芯片 500包括 PHY510 (图中 示为物理层电路 510 )和 MAC520。 MAC520包括 RS521 (图中示为协调子层电 路 521 )、 分发器 522以及 CRC计算电路 523至 CRC计算电路 527。 PHY510通过 ΜΠ与 MAC520连接。 RS521与分发器 522耦合。 分发器 522与 CRC计算电路 523 至 CRC计算电路 527耦合。 MAC520可以在时钟装置的驱动下进行工作。 具体 来说, RS521、 分发器 522和 CRC计算电路 523至 CRC计算电路 527在所述时钟 装置的驱动下进行工作。
RS521在所述时钟装置的驱动下, 在第一时钟周期内向分发器 522发送了 所述第一时钟周期的二进制序列。 所述第一时钟周期的二进制序列包括第一 报文和第二报文。所述第一报文的比特的数量为^1。所述第二报文的比特的数 量是 N。 M和 N为正整数。 M不等于 N。 所述第一 4艮文是以太网帧。 所述第二 报文是以太网帧。
分发器 522在所述时钟装置的驱动下, 接收到所述第一时钟周期的二进制 序列。
分发器 522将所述第一报文分发到第一 CRC计算电路, 所述第一 CRC计算 电路计算所述第一报文的 CRC。 CRC计算电路 523是所述第一 CRC计算电路。
分发器 522将所述第二报文分发到第二 CRC计算电路, 所述第二 CRC计算 电路计算所述第二报文的 CRC。 CRC计算电路 524是所述第二 CRC计算电路。
可选地, 上述技术方案中, 所述第一时钟周期的二进制序列还包括第三 报文, 所述第三报文的比特的数量为 X。
分发器 522根据所述第三 ·^艮文生成第一二进制序列, 所述第一二进制序列 的比特的数量为 Υ, 所述第一二进制序列的高 X比特的值等于所述第三报文的 比特的值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C, Y、 X和 C为 正整数。
举例来说, 所述第三报文是以太网帧。 分发器 522中包括移位寄存器。 所 述移位寄存器对所述第三报文进行移位操作以得到所述第一二进制序列。
分发器 522将所述第一二进制序列分发到第三 CRC计算电路, 所述第三 CRC计算电路计算所述第一二进制序列的 CRC。 CRC计算电路 525是所述第三 CRC计算电路。
可选地, 上述技术方案中, 所述第一时钟周期的二进制序列还包括第四 报文的高 A比特, 所述第四报文的比特的数量是 A+B。 所述第四报文是以太网 帧。
举例来说,所述第四 CRC计算电路被配置以计算 G个比特的二进制序列的 CRC。
分发器 522根据所述第四报文的高 A比特生成第二二进制序列, 所述第二 二进制序列的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述 第四报文的高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0 , G=A+H, A、 B和 G为正整数。 H为大于或者等于 0的整数。 B小于或者等于 G。
举例来说, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位 操作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述 第四报文的高 A比特。
分发器 522将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电路计算所述第二二进制序列的 CRC以对所述第四 CRC计算电路的 CRC寄存器的值进行初始化。
分发器 522接收 RS521在所述时钟装置的驱动下在第二时钟周期发送的二 进制序列。 所述第二时钟周期是所述第一时钟周期的下一个时钟周期。 所述 第二时钟周期的二进制序列包括所述第四报文的低 B比特。
分发器 522将所述第四报文的低 B比特分发到所述第四 CRC计算电路。 CRC计算电路 526是所述第四 CRC计算电路。
所述第四 CRC计算电路以所述第二二进制序列的 CRC为所述第四 CRC计 算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
可替换地, 上述技术方案中, 所述第一时钟周期的二进制序列还包括第 四报文的高 A比特, 所述第四报文的比特的数量是 A+B。
举例来说,所述第四 CRC计算电路被配置以计算 G个比特的二进制序列的 CRC。
分发器 522根据所述第四报文的高 A比特生成第二二进制序列, 所述第二 二进制序列的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述 第四报文的高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0 , G=A+H, A、 B和 G为正整数。 H为大于或者等于 0的整数。
举例来说, 当 H为正整数时, 可通过对所述第四报文的高 A比特执行移位 操作以得到所述第二二进制序列。 当 H为 0时, 所述第二二进制序列等于所述 第四报文的高 A比特。
分发器 522将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电路计算所述第二二进制序列的 CRC。 CRC计算电路 526是所述第四 CRC计算电路。
分发器 522接收 RS521在所述时钟装置的驱动下在第二时钟周期发送的二 进制序列。 所述第二时钟周期是所述第一时钟周期的下一个时钟周期。 所述 第二时钟周期的二进制序列包括所述第四报文的低 B比特。
分发器 522将所述第四报文的低 B比特分发到第五 CRC计算电路。 所述第 五 CRC计算电路以所述第二二进制序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。 CRC计算电路 527 是所述第五 CRC计算电路。
举例来说, 所述第五 CRC计算电路被配置以计算 J比特的二进制序列的 CRC。 J是正整数。 J大于或者等于 B。
举例来说, 所述第五 CRC计算电路与所述第一 CRC计算电路可以是同一 个 CRC计算电路。
可选地, 所述第一 CRC计算电路包括第一数据异或计算电路。 所述第一 数据异或计算电路表示为:
n-l
CRC D = P H * P H n_1 p I * n-2 d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000034_0001
最高比特, n取值为 M; P =
为生成多项式矩阵, pm4至 p。是所述第一 CRC
Figure imgf000035_0001
Po
电路的 CRC多 项 式的 系 数, m为 生成多 项 式的 阶数,
为变换矩阵
Figure imgf000035_0002
可选地, 所述第二 CRC^: 电路包括第二数据异或计算电路, 所述第二 数据异或计算电路表示为:
Figure imgf000035_0003
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000035_0004
P m-1
P =
比特, n取值为 N; 为生成多项式表项矩阵, pm4至 。是所述第
Figure imgf000035_0005
Po
一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数,
Figure imgf000036_0001
为变换矩阵
Figure imgf000036_0002
Po 0 0 0 0 0 m*m 图 6为本发明实施例提供的一种 CRC计算方法的流程示意图。 所述方法 的执行主体可以是 MAC、 MAC 芯片、 系统芯片、 接收器或者多端口以太网 设备。 参见图 6, 所述方法包括:
5601、 接收第一脉冲的二进制序列。
具体来说, 所述第一脉冲的二进制序列包括第一报文。 所述第一报文的 比特的数量为 X。
举例来说, S601的执行主体可以是 MAC中的分发器。 所述二进制序列可 以是所述 MAC中的 RS输出的。
举例来说, 所述第一报文是以太网帧。 所述第一脉冲对应时钟装置的一 个时钟周期。 所述时钟装置用于驱动图 6所示的方法的执行主体接收所述第一 脉冲的二进制序列。
5602、 根据所述第一 ·^艮文生成第一二进制序列。
举例来说, S601的执行主体可以是所述分发器。 所述分发器可以包括移 位寄存器。 所述移位寄存器可以对所述第一报文执行移位操作以得到所述第 一二进制序列。
具体来说, 所述第一二进制序列的比特的数量为 Y, 所述第一二进制序列 的高 X比特的值等于所述第一报文的比特的值, 所述第一二进制序列的低 C比 特的值等于 0, Y=X+C, Y、 X和 C为正整数。
5603、 将所述第一二进制序列分发到第一 CRC计算电路。
举例来说,所述第一 CRC计算电路被配置以并行地计算 Y比特的二进制序 列的 CRC。
S604、 所述第一 CRC计算电路计算所述第一二进制序列的 CRC。
举例来说, 所述第一 CRC计算电路对应加扰多项式。 所述第一 CRC计 算电路根据所述加扰多项式计算所述第一二进制序列的 CRC。
在灵活以太网的应用场景中, 以太网接口接收到的报文的比特的数量可 能小于二进制序列的比特的数量。 所述二进制序列是指 CRC计算电路计算 CRC时所述 CRC对应的二进制序列。 通过上述技术方案, 可以计算出比特数 量较少的报文的 CRC。 因此, 上述技术方案可以较好的应用在灵活以太网的 场景中。
图 7为本发明实施例提供的一种 CRC计算方法的流程示意图。 所述方法的 执行主体可以是 MAC、 MAC芯片、 系统芯片、接收器或者多端口以太网设备。 的 CRC计算电路。 参见图 7, 所述方法包括:
5701、 接收第一脉冲的二进制序列。
具体来说, 所述第一脉冲的二进制序列包括第一报文的低 X比特, 所述第 一报文的低 X比特的最高有效位(英文: most significant bit, 筒称: MSB ) 是所述第一脉冲的二进制序列的 MSB。
本领域的技术人员可以理解:所述低 X比特位于所述第一脉冲的二进制序 列的头部。
举例来说, S701的执行主体可以是 MAC中的分发器。 所述第一脉冲的二 进制序列可以是所述 MAC中的 RS输出的。
举例来说, 所述第一报文是以太网帧。 所述第二报文是以太网帧。 所述第 一脉冲对应时钟装置的一个时钟周期。 所述时钟装置用于驱动图 7所示的方 法的执行主体接收所述第一脉冲的二进制序列。
5702、 向第一 CRC计算电路分发所述第一报文的低 X比特。
举例来说, S702的执行主体可以是所述分发器。
具体来说, 所述第一脉冲的二进制序列的比特的数量为 N, N为正整数。 举例来说, 所述第一 CRC计算电路被配置以计算 M比特的二进制序列的 CRC。 M大于或者等于 N, M为正整数。
S703、 所述第一 CRC计算电路计算所述第一报文的 CRC。
S703可以通过两种方法实现。 图 8是 S703的第一种实现方法的流程示意 图。 图 9是 S703的第二种实现方法的流程示意图。
参见图 8 , S703的第一种实现方法包括:
5801、 接收第二脉冲的二进制序列。
具体来说, 第二脉冲的二进制序列包括所述第一报文的高 Y比特。 X与 Y 的和等于^1。 所述第一报文的比特的数量是 X与 Y 的和。
5802、 生成第一二进制序列。
具体来说, 所述第一二进制序列的比特的数量是^1。 所述第一二进制序列 的高 Y比特等于所述第一报文的高 Y比特。所述第一二进制序列的低 X比特 等于 0。 举例来说, 可以通过移位寄存器对所述第一报文的高 Y比特执行移 位操作以得到所述第一二进制序列。
5803、 将所述第一二进制序列分发至所述第一 CRC计算电路。
5804、 所述第一 CRC计算电路计算所述第一二进制序列的 CRC以对所述 第一 CRC计算电路的 CRC寄存器的值进行初始化。
5805、 生成第二二进制序列。
具体来说, 所述第二二进制序列的比特的数量是^1。 所述第二二进制序列 的高 X比特等于所述第一报文的低 X比特。所述第二二进制序列的低 Y比特 等于 0。 举例来说, 可以通过移位寄存器对所述第一报文的低 X比特执行移 位操作以得到所述第二二进制序列。
5806、 将所述第二二进制序列分发至所述第一 CRC计算电路。
5807、 所述第一 CRC计算电路以所述第一二进制序列的 CRC为所述第一 CRC计算电路的 CRC寄存器的初始值计算所述第二二进制序列的 CRC。
所述第二二进制序列的 CRC等于所述第一报文的 CRC。
参见图 9, S703的第二种实现方法包括: S901、 接收第二脉冲的二进制序列。
具体来说, 第二脉冲的二进制序列包括所述第一报文的高 Y比特。 X与 Y 的和等于8。 S小于 M。 所述第一报文的比特的数量是 X与 Y 的和。
5902、 生成第一二进制序列。
具体来说, 所述第一二进制序列的比特的数量是^1。 所述第一二进制序列 的高 Y比特等于所述第一报文的高 Y比特。所述第一二进制序列的低(M-Y ) 比特等于 0。 举例来说, 可以通过移位寄存器对所述第一报文的高 Y比特执 行移位操作以得到所述第一二进制序列。
5903、 将所述第一二进制序列分发至所述第一 CRC计算电路。
5904、 所述第一 CRC计算电路计算所述第一二进制序列的 CRC以对所述 第一 CRC计算电路的 CRC寄存器的值进行初始化。
5905、 生成第二二进制序列。
具体来说, 所述第二二进制序列的比特的数量是^1。 所述第二二进制序列 的高 X比特等于所述第一报文的低 X比特。所述第二二进制序列的低(M-X ) 比特等于 0。 举例来说, 可以通过移位寄存器对所述第一报文的低 X比特执 行移位操作以得到所述第二二进制序列。
5906、 将所述第二二进制序列分发至所述第一 CRC计算电路。
5907、 所述第一 CRC计算电路以所述第一二进制序列的 CRC为所述第一 CRC计算电路的 CRC寄存器的初始值计算所述第二二进制序列的 CRC。
所述第二二进制序列的 CRC等于所述第一报文的 CRC。
可选地, 图 7所示的技术方案中, 所述第一脉冲的二进制序列包括第二报 文, 所述第二报文与第一报文的低 X比特相邻。 所述方法还包括:
向第二 CRC计算电路分发所述第二报文。
所述第二 CRC计算电路计算所述第二报文的 CRC。
举例来说, 所述第二 CRC计算电路被配置以计算 A比特的二进制序列的 CRC。 具体来说, A大于或者等于 B。 B等于 N减去对齐块包含的比特的数 量, 所述对齐块对应报文的对齐粒度, A为正整数, B为正整数。 下文对对齐块机制进行举例:
网络处理器(英文: network processor, 筒称: NP ) 向 MAC发送以太网 帧前, 需要对以太网帧进行分块操作, 从而实现以太网帧的对齐。 具体来说, 以太网帧被分为多个数据块,每个数据块中包含的比特的数量为 E。需要说明 的是, 一个数据块只能包含一个以太网帧的片段, 不能包含两个或者两个以 上的以太网帧的片段。 举例来说, E可以是 64, 也可以是 250。 如果以太网帧 被执行分块操作后, 以太网帧中的最后一个块中的比特的数量小于 E, 则需要 在最后一个块后面增加填充数据从而得到一个比特的数量为 E的数据块。 可 以将添加了填充数据的数据块称为对齐块。 对齐块中包含的比特的数量也是 E。 E可以用于表示报文的对齐粒度。
举例来说, 所述第二报文中的比特的数量等于 P。 P小于或者等于 A。在 P 等于 A的场景中, 所述第二 CRC计算电路可以计算所述第二 4艮文的 CRC。 在 P小于 A的场景中, 可以对所述第二报文执行移位操作以生成新的二进制 序列。所述新的二进制序列的比特的数量等于 A。所述新的二进制序列的高 P 比特等于所述第二报文。 所述新的二进制序列的低(A-P ) 比特等于 0。 所述 第二 CRC计算电路可以计算所述新的二进制序列的 CRC。所述新的二进制序 列的 CRC等于所述第二 ·^艮文的 CRC。 在 P小于 A的场景中如何计算所述第 二 ·^艮文的 CRC, 可以参考图 6所示的方法。
可选地, 上述技术方案中, 所述第一脉冲的二进制序列包括第三报文, 所 述第三报文与所述第二报文相邻。 所述方法还包括:
向第三 CRC计算电路分发所述第三报文。
所述第三 CRC计算电路计算所述第三报文的 CRC。
举例来说, 所述第三 CRC计算电路被配置以计算 C比特的二进制序列的 CRC。
具体来说, C大于或者等于 D。 D等于 N减去所述对齐块包含的比特的数 量, 并且减去最小长度的报文包含的比特的数量。 C为正整数, D为正整数。
最小长度是指通信系统规定的报文的最小长度。举例来说,所述第一报文、 所述第二报文和所述第三报文都属于以太网帧。 根据电气和电子工程师学会
(英文: Institute of Electrical and Electronics Engineers , 筒称: IEEE )发布的 802.3ba, 40GE的标准中以太网帧的最小长度是 512比特。 100GE的标准中以 太网帧的最小长度是 512比特。
举例来说, 所述第三报文的比特的数量等于 Q。 Q小于等于 在 Q等于 C的场景中,所述第三 CRC计算电路可以计算所述第三 4艮文的 CRC。在 Q小 于 C的场景中, 可以对所述第三报文执行移位操作以生成新的二进制序列。 所述新的二进制序列的比特的数量等于 C。 所述新的二进制序列的高 Q比特 等于所述第三报文。 所述新的二进制序列的低(C-Q ) 比特等于 0。 所述第三 CRC计算电路可以计算所述新的二进制序列的 CRC。 所述新的二进制序列的 CRC等于所述第三报文的 CRC。在 Q小于 C的场景中如何计算所述第三报文 的 CRC, 可以参考图 6所示的方法。
图 10为本发明实施例提供的一种计算 CRC的方法的示意图。 图 10示出 了上述技术方案中的所述第一脉冲的二进制序列的格式。 其他信息可以是其 他 4艮文。 例如第四 4艮文。 当然, 第一脉冲的二进制序列也可以不包括其他信 息。 另外, 图 10示出了所述第一脉冲的二进制序列与 CRC计算电路的关系。 具体来说, 所述第一报文的低 X比特被分发到所述第一 CRC计算电路。 所述 第二报文被分发到所述第二 CRC计算电路。 所述第三报文被分发到所述第三 CRC计算电路。
上述技术方案中, 所述第一 CRC计算电路被配置以计算 M比特的二进制 序列的 CRC。 M大于或者等于 N。 所述第一脉冲的二进制序列的比特的数量 为 N。 所述第二 CRC计算电路被配置以计算 A比特的二进制序列的 CRC。 具体来说, A大于或者等于 B。 B等于 N减去对齐块包含的比特的数量。 所 述第三 CRC计算电路被配置以计算 C比特的二进制序列的 CRC。 C大于或者 等于 D。 D等于 N减去所述对齐块包含的比特的数量, 并且减去最小长度的 报文包含的比特的数量。 因此, 所述第一 CRC计算电路、 所述第二 CRC计 算电路以及所述第三 CRC计算电路需要占用的硬件电路的资源可以呈现递减 的趋势。 因此, 上述技术方案有助于节省硬件电路的资源。
本发明实施例提供了一种 CRC计算电路, 所述 CRC计算电路包括图 7所 示的方法中的所述第一 CRC计算电路、 所述第二 CRC计算电路以及所述第 三 CRC计算电路。 本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或 计算机程序产品。 因此, 本发明可采用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实施例的形式。 而且, 本发明可采用在一个或多个 其中包含有计算机可用程序代码的计算机可用存储介质 (包括但不限于磁盘 存储器、 CD-ROM、 光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、 设备(系统)、 和计算机程序产 品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图 和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程 和 /或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器, 使得通过该计算机或其 他可编程数据处理设备的处理器执行的指令可实现流程图中的一个流程或多 个流程和 /或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设 备以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存储器 中的指令产生包括指令装置的制造品, 该指令装置实现在流程图一个流程或 多个流程和 /或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的 处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图 的一个流程或多个流程和 /或方框图的一个方框或多个方框中指定的功能的 步骤。
尽管已描述了本发明的优选实施例, 但本领域内的技术人员一旦得知了 基本创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权 利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。 发明的精神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权利要 求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在内。

Claims

权 利 要 求
1、 一种循环冗余校验码 CRC计算方法, 其特征在于, 包括:
接收第一脉冲的二进制序列, 所述第一脉冲的二进制序列包括第一报文 和第二报文,所述第一报文的比特的数量为 M,所述第二报文的比特的数量是 N, M和 N为正整数, M不等于 N;
将所述第一报文分发到第一 CRC计算电路, 所述第一 CRC计算电路计算 所述第一报文的 CRC;
将所述第二报文分发到第二 CRC计算电路, 所述第二 CRC计算电路计算 所述第二报文的 CRC。
2、 如权利要求 1所述的方法, 其特征在于, 所述第一脉冲的二进制序列 还包括第三报文, 所述第三报文的比特的数量为 X, 所述方法还包括:
根据所述第三报文生成第一二进制序列, 所述第一二进制序列的比特的 数量为 Y, 所述第一二进制序列的高 X比特的值等于所述第三报文的比特的 值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C , Y、 X和 C为正整数; 将所述第一二进制序列分发到第三 CRC计算电路, 所述第三 CRC计算电 路计算所述第一二进制序列的 CRC。
3、 如权利要求 1或 2所述的方法, 其特征在于, 所述第一脉冲的二进制序 列还包括第四报文的高 A比特, 所述第四报文的比特的数量是 A+B , 所述方法 还包括:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B、 和 G为正整数, H为大于或者等于 0的整数, B小于或者等于 G;
将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电 路计算所述第二二进制序列的 CRC以对所述第四 CRC计算电路的 CRC寄存器 的值进行初始化; 接收第二脉冲的二进制序列, 所述第二脉冲是所述第一脉冲的下一个脉 冲, 所述第二脉冲的二进制序列包括所述第四报文的低 B比特;
将所述第四报文的低 B比特分发到所述第四 CRC计算电路;
所述第四 CRC计算电路以所述第二二进制序列的 CRC为所述第四 CRC计 算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
4、 如权利要求 1或 2所述的方法, 其特征在于, 所述第一脉冲的二进制序 列还包括第四报文的高 A比特, 所述第四报文的比特的数量是 A+B, 所述方法 还包括:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数;
将所述第二二进制序列分发到第四 CRC计算电路, 所述第四 CRC计算电 路计算所述第二二进制序列的 CRC;
接收第二脉冲的二进制序列, 所述第二脉冲是所述第一脉冲的下一个脉
Figure imgf000045_0001
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000046_0001
P m-1
最高比特, n取值为 M; P = 为生成多项式矩阵, pm4至 p。是所述第一 CRC
Figure imgf000046_0002
Po
计算电路的 CRC多 项 式的 系 数, m为 生成多 项 式的 阶数, 为变换矩阵;
Figure imgf000046_0003
计算电路表示为:
Figure imgf000046_0004
d,
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
Figure imgf000046_0005
P m-1
P =
比特, n取值为 N; 为生成多项式表项矩阵, pm4至 p。是所述;
Po 一 CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数,
为变换矩阵
Figure imgf000047_0001
6、 一种循环冗余校验码 CRC计算装置, 其特征在于, 包括:
接收单元, 用于接收第一脉冲的二进制序列, 所述第一脉冲的二进制序 列包括第一报文和第二报文,所述第一报文的比特的数量为 M,所述第二报文 的比特的数量是 N, M和 N为正整数, M不等于 N;
调度单元, 用于将所述接收单元接收的所述第一报文分发到第一 CRC计 算电路, 将所述接收单元接收的所述第二报文分发到第二 CRC计算电路; 所述第一 CRC计算电路, 用于计算所述调度单元分发的所述第一报文的 CRC;
所述第二 CRC计算电路, 用于计算所述调度单元分发的所述第二报文的 CRC。
7、 如权利要求 6所述的装置, 其特征在于, 所述装置还包括第三 CRC计 算电路, 所述第一脉冲的二进制序列还包括第三报文, 所述第三报文的比特 的数量为 X;
所述调度单元还用于:
根据所述接收单元接收的所述第三报文生成第一二进制序列, 所述第一 二进制序列的比特的数量为 Y, 所述第一二进制序列的高 X比特的值等于所述 第三报文的比特的值, 所述第一二进制序列的低 C比特的值等于 0, Y=X+C, 序列的 CRC。
8、 如权利要求 6或 7所述的装置, 其特征在于, 所述装置还包括第四 CRC 计算电路, 所述第一脉冲的二进制序列还包括第四报文的高 A比特, 所述第四 报文的比特的数量是 A+B;
所述调度单元还用于:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B、 和 G为正整数, H为大于或者等于 0的整数, B小于或者等于 G;
将所述第二二进制序列分发到所述第四 CRC计算电路;
所述第四 CRC计算电路, 用于计算所述第二二进制序列的 CRC以对所述 第四 CRC计算电路的 CRC寄存器的值进行初始化;
所述接收单元还用于, 接收第二脉冲的二进制序列, 所述第二脉冲是所 述第一脉冲的下一个脉冲, 所述第二脉冲的二进制序列包括所述第四 ^艮文的 低 B比特;
所述调度单元还用于,将所述第四报文的低 B比特分发到所述第四 CRC计 算电路;
所述第四 CRC计算电路, 还用于以所述第二二进制序列的 CRC为所述第 四 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
9、 如权利要求 6或 7所述的装置, 其特征在于, 所述装置还包括第四 CRC 计算电路以及第五 CRC计算电路, 所述第一脉冲的二进制序列还包括第四报 文的高 A比特, 所述第四报文的比特的数量是 A+B;
所述调度单元还用于:
根据所述第四报文的高 A比特生成第二二进制序列,所述第二二进制序列 的比特的数量为 G, 所述第二二进制序列的高 A比特的值等于所述第四报文的 高 A比特的值, 所述第二二进制序列的低 H比特的值等于 0, G=A+H, A、 B和 G为正整数, H为大于或者等于 0的整数; 将所述第二二进制序列分发到所述第四 CRC计算电路;
所述第四 CRC计算电路, 用于根据所述调度单元分发的所述第二二进制 序列计算所述第二二进制序列的 CRC; 所述接收单元还用于, 接收第二脉冲的二进制序列, 所述第二脉冲是所 述第一脉冲的下一个脉冲, 所述第二脉冲的二进制序列包括所述第四报文的
所述调度单元还用于,将所述第四报文的低 B比特分发到第五 CRC计算电
所述第五 CRC计算电路, 用于以所述第二二进制序列的 CRC为所述第五 CRC计算电路的 CRC寄存器的初始值计算所述第四报文的低 B比特的 CRC。
10、 如权利要求 6-9中任一项所述的装置, 其特征在于, 所述第一 CRC计 算电路包括第一数据异或计算电路, 所述第一数据异或计算电路表示为:
的二进制序列的最低比特至
Figure imgf000049_0001
P m-1 最高比特, n取值为 M; P
为生成多项式矩阵, pm4至 p。是所述第一 CRC
Pi 为变换矩阵;
Figure imgf000050_0001
m*m
所述第二 CRC计算电路包括第二数据异或计算电路, 所述第二数据异或 计算电路表示为: n-l
n-2
CRC D„=「P H*P ■·· Hn_1*P
d,
Figure imgf000050_0002
中的 d。至 dn4分别是所述 M比特的二进制序列的最低比特至
P m-1
P =
比特, n取值为 N; 为生成多项式表项矩阵, pm4至 p。是所述;
Figure imgf000050_0003
Po
CRC计算电路的 CRC多项式的系数, m为生成多项式的阶数
为变换矩阵
Figure imgf000050_0004
PCT/CN2013/091138 2013-12-31 2013-12-31 一种crc计算方法及装置 WO2015100624A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201380003207.8A CN105264778B (zh) 2013-12-31 2013-12-31 一种crc计算方法及装置
PCT/CN2013/091138 WO2015100624A1 (zh) 2013-12-31 2013-12-31 一种crc计算方法及装置
EP13900606.8A EP3076555A4 (en) 2013-12-31 2013-12-31 Crc calculation method and apparatus
US15/199,222 US10211852B2 (en) 2013-12-31 2016-06-30 CRC calculation method, and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/091138 WO2015100624A1 (zh) 2013-12-31 2013-12-31 一种crc计算方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/199,222 Continuation US10211852B2 (en) 2013-12-31 2016-06-30 CRC calculation method, and apparatus

Publications (1)

Publication Number Publication Date
WO2015100624A1 true WO2015100624A1 (zh) 2015-07-09

Family

ID=53492974

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/091138 WO2015100624A1 (zh) 2013-12-31 2013-12-31 一种crc计算方法及装置

Country Status (4)

Country Link
US (1) US10211852B2 (zh)
EP (1) EP3076555A4 (zh)
CN (1) CN105264778B (zh)
WO (1) WO2015100624A1 (zh)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3468110B1 (en) 2016-07-06 2020-09-09 Huawei Technologies Co., Ltd. Data transmission method and forwarding device
CN112039779A (zh) 2016-07-06 2020-12-04 华为技术有限公司 生成转发表的方法和转发设备
CN107888345B (zh) * 2016-09-29 2022-02-18 中兴通讯股份有限公司 一种信息传输的方法和设备
CN108243035B (zh) 2016-12-26 2021-04-09 华为技术有限公司 Dcn报文处理方法、网络设备和网络系统
JP6977621B2 (ja) * 2018-03-02 2021-12-08 日本電信電話株式会社 制御装置、及び制御方法
US11128742B2 (en) 2019-03-08 2021-09-21 Microsemi Storage Solutions, Inc. Method for adapting a constant bit rate client signal into the path layer of a telecom signal
US11108895B2 (en) * 2019-08-23 2021-08-31 Microchip Technology Inc. Method for providing path signal overhead in the 64B/66B character stream of an itu-t metro transport network using micro-packets
US11916662B2 (en) 2021-06-30 2024-02-27 Microchip Technology Inc. System and method for performing rate adaptation of constant bit rate (CBR) client data with a fixed number of idle blocks for transmission over a metro transport network (MTN)
US11838111B2 (en) 2021-06-30 2023-12-05 Microchip Technology Inc. System and method for performing rate adaptation of constant bit rate (CBR) client data with a variable number of idle blocks for transmission over a metro transport network (MTN)
US11736065B2 (en) 2021-10-07 2023-08-22 Microchip Technology Inc. Method and apparatus for conveying clock-related information from a timing device
US11799626B2 (en) 2021-11-23 2023-10-24 Microchip Technology Inc. Method and apparatus for carrying constant bit rate (CBR) client signals

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101223700A (zh) * 2005-07-13 2008-07-16 密克罗奇普技术公司 用于配置循环冗余校验(crc)产生电路以对数据流执行crc的方法和设备
CN101702639A (zh) * 2009-11-23 2010-05-05 成都市华为赛门铁克科技有限公司 循环冗余校验的校验值计算方法及装置
CN102487282A (zh) * 2010-12-03 2012-06-06 上海华虹集成电路有限责任公司 一种实现可变长crc运算的电路
US8578240B1 (en) * 2011-01-21 2013-11-05 Juniper Networks, Inc. CRC computation for packet length not multiple of data path width

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6894993B2 (en) * 2002-12-27 2005-05-17 Arraycomm, Inc. Detection and correction of channel swap in spatial division multiple access systems
US7761776B1 (en) * 2005-11-03 2010-07-20 Xilinx, Inc. Method and apparatus for a modular, programmable cyclic redundancy check design
US8340101B2 (en) * 2006-09-25 2012-12-25 Futurewei Technologies, Inc. Multiplexed data stream payload format
US8271859B2 (en) 2007-07-18 2012-09-18 Foundry Networks Llc Segmented CRC design in high speed networks
JP4831018B2 (ja) * 2007-08-28 2011-12-07 日本電気株式会社 並列巡回符号生成装置および並列巡回符号検査装置
US8539326B1 (en) * 2011-12-07 2013-09-17 Xilinx, Inc. Method and implementation of cyclic redundancy check for wide databus
CN102831789B (zh) * 2012-08-22 2014-09-17 宁波成电泰克电子信息技术发展有限公司 一种基于fpga的s模式ads_b系统的纠检错方法
CN103401565B (zh) * 2013-07-09 2016-08-24 宁波成电泰克电子信息技术发展有限公司 一种s模式ads_b系统的纠检错方法
FR3016099B1 (fr) * 2013-12-26 2017-05-05 Grdf Procede de reception utilisant un codage de controle d'integrite

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101223700A (zh) * 2005-07-13 2008-07-16 密克罗奇普技术公司 用于配置循环冗余校验(crc)产生电路以对数据流执行crc的方法和设备
CN101702639A (zh) * 2009-11-23 2010-05-05 成都市华为赛门铁克科技有限公司 循环冗余校验的校验值计算方法及装置
CN102487282A (zh) * 2010-12-03 2012-06-06 上海华虹集成电路有限责任公司 一种实现可变长crc运算的电路
US8578240B1 (en) * 2011-01-21 2013-11-05 Juniper Networks, Inc. CRC computation for packet length not multiple of data path width

Also Published As

Publication number Publication date
EP3076555A1 (en) 2016-10-05
CN105264778A (zh) 2016-01-20
US10211852B2 (en) 2019-02-19
CN105264778B (zh) 2019-04-19
US20160315634A1 (en) 2016-10-27
EP3076555A4 (en) 2017-01-04

Similar Documents

Publication Publication Date Title
WO2015100624A1 (zh) 一种crc计算方法及装置
US9596075B2 (en) Transparent serial encryption
US9942064B2 (en) Data processing method and apparatus
US9871677B2 (en) Data processing method and apparatus
WO2015100621A1 (zh) 一种加扰方法及加扰装置
CN104639477A (zh) 用于高速网络初始化的反向通道通信
TWI551101B (zh) 基於使用共用資料路徑的多個乙太網埠以及埠類型的一種介面單元及其方法
WO2010135942A1 (zh) 快速循环冗余校验编码方法及装置
WO2018006304A1 (zh) 发送数据的方法和转发设备
US20170195914A1 (en) Hardware Acceleration for Batched Sparse Codes
WO2023273712A1 (zh) 加密传输方法及装置
WO2018006305A1 (zh) 生成转发表的方法和转发设备
CN109845217B (zh) 灵活以太网中传输数据的方法和设备
Ferozpuri et al. Hardware api for post-quantum public key cryptosystems
WO2014194752A1 (zh) 一种数据映射方法、装置及电子设备
WO2016026287A1 (zh) 一种加密装置、加密方法及计算机存储介质
JP2001024712A (ja) 並列システムをデータ・ストローブ型の送受信器とインタフェース接続するための伝送システム、送信器、受信器、及びインタフェース装置
WO2008017261A1 (fr) Procédé de cryptage/décryptage très efficace et méthode de mise en oeuvre de l'algorithme sms4
JP2008178102A (ja) インターフェース装置及びチップ間通信インターフェース装置
WO2012149775A1 (zh) 数据处理的方法和装置
CN107431672B (zh) 一种数据加扰方法和加扰装置
CN111064563B (zh) 一种高效并行gcm实现方法
EP3694125B1 (en) Bit block processing method, and node
US20230412281A1 (en) Optical connectivity for interconnect technologies
Mathew et al. Efficient implementation of EC based key management scheme on FPGA for WSN

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201380003207.8

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13900606

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2013900606

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2013900606

Country of ref document: EP