CONFIGURABLE CRC-ENCODER
The invention relates to encoders and encoding methods for generating code words from a bit-stream using a shift register.
In telecommunications, a known encoder produces cyclic redundancy checksums (CRCs) from data to be transmitted. The CRCs are transmitted with the data and can be used by equipment receiving the transmission in order to check for errors in the received data. Figure 1 illustrates a circuit for generating a CRC. The circuit comprises a linear feedback shift register (LFSR) 10 comprising a series of interconnected flip-flops DO to D7. The input to the LFSR 10 is provided to flip-flop DO and the output of the LFSR is taken from the output of flip-flop D7. The input bit-stream to the circuit, for which CRCs are to be generated, is input to an exclusive-or (XOR) gate 12, to the other input of which is supplied the output of the LFSR 10. The output of XOR gate 12 is provided as the input to the LFSR 10. Some more XOR gates 14, 16, 18 and 20 are interspersed with the flip-flops of the LFSR 10. The purpose of each of the XOR gates 14 to 20 within the LFSR 10 is to modify the signal passing between the adjacent flip-flops by performing an XOR operation on the signal passing between the elements and the input to the LFSR (supplied by XOR gate 12). The CRC is the 8 bit word comprised by the contents of the LFSR.
As will be readily apparent to the skilled person, various types of CRC can be generated by altering the number of flip-flops in the LFSR, by altering the number of XOR gates interspersed with the flip-flops of the LFSR, and by altering the position of the XOR gates interspersed with the flip-flops of the LFSR. In practice, a device may need to generate several types of CRC, with the result that several types of CRC generator circuits are required.
An aim of the invention is to provide a more versatile way of generating code words such as CRCs.
According to one aspect, the invention provides encoding apparatus for generating code words from a bit-stream, comprising a shift register having an input, an output and a
number of modification points at which signals passing through the register can be modified, combining means for combining a signal from the register output with the bit-stream to produce an input signal for the register input, modifying means suitable for combining, at the modification point or points, the input signal with the signals passing through the register, and configuring means for selecting a point along the register to be the register output.
Thus, the invention provides a way in which the length of a shift register used to generate a code word, such as a CRC, can be varied between a maximum and a minimum value.
In a preferred embodiment, only the shift register elements up to and including the element selected to provide the register output are clocked. This saves electrical energy because the redundant shift line elements, i.e. the elements beyond the element selected to provide the register output, are not clocked.
In a preferred embodiment, the configuring means dictates the modification points at which the modifying means operates on the signals passing through the register. The modifying means may be instructed to operate at a single modification point or even not to operate at all. Advantageously, it is possible to use a control signal to select the point within the register which becomes the register output and also to dictate the modification point or points (if any) at which the modifying means operates on the signals passing through the register.
According to another aspect, the invention also provides encoding apparatus for generating code words from a bit-stream, comprising a shift register having an input, an output and a number of modification points at which signals passing through the register can be modified, combining means for combining a signal from the register output with the bit-stream to produce an input signal for the register input, modifying means suitable for combining, at the modification point or points, the input signal with the signals passing through the register, and configuring means for dictating the modification point or points at which the modifying means operates on the signals passing through the register.
Thus, the invention provides a versatile way of generating code words since one can select the points within a register at which the signals being transferred through the register are to be modified.
In one embodiment, the points within the shift register at which modification occurs, i.e. the active modification points, are dictated by the output of a look-up table. Thus, a LUT can be provided with data to cause the shift register to implement different types of encoding, wherein the type of encoding employed is dependent upon a signal used to address the LUT. In another embodiment, the active modification points are dictated by the output of a logic circuit. A simple selection signal can be used as an input to the logic circuit to produce a relatively complex group of output signals for selecting the active modification points. In a further embodiment, the active modification points are dictated by the content of a reprogrammable memory which gives a useful amount of flexibility in the selection of the active modification points.
The term shift register, as used herein, refers to a sequence of storage elements through which data items can be passed (or "clocked"), regardless of whether the storage elements are co-located.
By way of example only, some embodiments of the invention will now be described with reference to the accompanying drawings, in which:
Figure 1 illustrates a CRC encoder of conventional type;
Figure 2 illustrates a configurable CRC encoder;
Figure 3 illustrates a second type of configurable CRC encoder; and
Figure 4 illustrates a third type of configurable CRC encoder.
The configurable CRC encoder 200 of Figure 2 is based on a linear feedback shift register (LFSR) formed from flip-flops DO to D23. Data for which a CRC is to be generated is
supplied as an input to XOR gate 210. The other input to XOR gate 210 is a feedback signal from the LFSR which is provided by multiplexer 212. The output of XOR gate 210 is provided to flip-flop DO as the input to the LFSR. The CRC generated by the encoder 200 is read from the LFSR as a signal CRC_OUT. Data is stepped through the flip-flops of the LFSR under the control of a clock signal CLK which is provided by a clock generator 214.
The input signal to the LFSR (i.e. the output from XOR gate 210) is provided as an input to each of a group of AND gates, e.g. 216. Each of these AND gates receives a control signal as its other input. The output of each of the AND gates is provided as an input to a corresponding XOR gate, e.g. 218. These XOR gates are interleaved with the flip-flops of the LFSR. Each of these XOR gates follows a flip-flop from which it receives its other input. Each of these XOR gates provides its output as the input to the following flip-flop. In essence, each of the AND gates acts as a switch for enabling and disabling the XOR gate connected to its output. Thus, by supplying appropriate selection signals to the AND gates, any desired number of the XOR gates in the LFSR can be enabled. This gives the encoder 200 the versatility to generate various types of CRCs.
In addition to varying the number of XOR gates within the LFSR that are active, the encoder 200 can also vary the length of the CRC that it generates. The inputs to the multiplexer 212 are provided by the outputs of flip-flops D7, Dl 1, D15 and D23. Thus, the length of the CRC generated is determined by which one of its inputs multiplexer 212 connects to its output.
The CRC generator 200 is arranged so that it can generate one of four possible types of CRC. The type of CRC generated is dictated by a control signal, MODE. The MODE signal is a 2-bit signal, which is therefore capable of assuming four 2-bit values. The MODE signal is supplied to the multiplexer 212 and the value of the MODE signal is used to select which of the four multiplexer inputs becomes the multiplexer output. The MODE signal is also supplied to a four entry look-up table (LUT) 220. The value of the MODE signal is used to address the LUT 220 and retrieve one of the four entries. Each of the four
entries in the LUT 220 is a 23 -bit number. Each of the bits is then used as the selection signal for a corresponding one of the AND gates.
When the MODE signal instructs the multiplexer to truncate the line of flip-flops in the LFSR, then the clock generator 214 removes the signal CLK from the unused flip-flops in order to save power. For example, if the multiplexer is controlled to pass the output of flip-flop D7 to the input of XOR gate 210, then the clock generator 214 removes the clock signal CLK from flip-flops D8 to D23.
Figure 3 illustrates a configurable CRC encoder 300 which differs from the encoder 200 in that the LUT 220 is replaced by a logic circuit 310. The 2-bits of the MODE signal form two inputs to the logic circuit 310. The outputs of the logic circuit 310 are the selection signals for the AND gate switches that control the XOR gates in the LFSR. The two single bit inputs to the logic circuit 310 provide four possible input states, which means that the outputs of the logic circuit 310 can assume only four states. The logic circuit 310 is configured so that it provides four desired output states, each corresponding to one of the four states of the MODE signal. In all other respects, the operation of encoder 300 is the same as encoder 200.
The configurable CRC encoder 400 of Figure 4 differs from the encoder 200 in that the LUT 220 has been replaced by a programmable register 410 and in that the MODE signal is now only supplied to the multiplexer 212. The programmable register is such that it can be loaded with a 23 -bit word. Each of the bits of the word in the register 410 is used as a selection signal for controlling a respective one of the AND gate switches that control the XOR gates in the LFSR. The encoder 400 is particularly versatile since the register 410 can be reprogrammed as necessary to enable any desired combination of the XOR gates in the LFSR. The MODE signal is used by the multiplexer 212 in the same way as in previous embodiments, and in all other respects the operation of the encoder 400 is the same as that of encoder 200.
It will be appreciated by the skilled person that the encoders shown in Figures 2 to 4 can be modified in many ways without departing from the scope of the invention. Some modifications will now be described by way of example.
The number of flip-flops in the LFSR can be changed from 24. Increasing the number of flip-flops increases the versatility in the type of CRC that can be generated, whereas reducing the number of flip-flops decreases this versatility.
The multiplexer for feeding back the output of the LFSR can take its inputs from any of the flip-flops within the LFSR. In Figures 2 to 4, the multiplexer 212 takes its inputs from the outputs of flip-flops D7, Dl l, D15 and D23, which corresponds to the generation of 8, 12, 16 and 24-bit CRCs respectively. The described embodiments use the outputs of these flip-flops to supply the multiplexer because they are for use with UMTS which utilises 8, 12, 16 and 24-bit CRCs.
In the case where only certain known types of CRC are going to be used, the encoder can be optimised accordingly. For example, if only four types of CRC are to be generated, and none of these CRCs requires the use of a particular XOR gate, then that XOR gate, together with its controlling AND gate, can be omitted from the circuit. Similarly, if an XOR gate is always to be used, then its controlling AND gate can be replaced by a direct connection to the LFSR input signal (i.e. the signal output by XOR gate 210 in Figure 2).
Other modifications to the encoder will be apparent to the skilled person.