Fully programmable linear feedback shift register
FIELD OF THE INVENTION 
     The present invention relates to shift registers and more particularly to a fully programmable linear feedback shift register. 
     BRIEF DESCRIPTION OF THE PRIOR ART 
     Linear feedback shift registers which use a number of flip-flops for circulating information by means of a sequence of bits are known. It is further known that such shift registers may be used for error coding and pseudo-random number generation. However, for each of these applications, a differently configured shift register needs to be used. Further, the hardware for the shift registers can get to be quite extensive, where repeatability is desired for a great number of times. 
     BRIEF DESCRIPTION OF THE PRESENT INVENTION 
     The present invention achieves a successful resolution of the aforesaid problems by presenting a linear feedback shift register which is fully programmable, thereby eliminating the need to have a particular configured shift register for a specific function. The flip-flops and control logic circuits in the present invention shift register are configured in such a way that the register can be used, aside from the above-mentioned functions of a conventional linear feedback shift register, for encoding and encryption of information. To do this, the present invention shift register utilizes a plurality of flip-flop stages each with its own control logic circuits. Each flip-flop stage is identical; and consequently, the shift register can be programmed for different lengths, as the number of flip-flops need not remain static. The output of any one of the flip-flops can be fed, via a feedback circuit, to the beginning stage of the shift register, thereby providing a myriad of different length shift registers. 
     Therefore, it is an object of the present invention to provide a linear feedback shift register which is fully programmable. 
     It is a further object of the present invention to provide a shift register adaptable for different types of applications without having its components reconfigured. 
     It is yet another objective of the present invention to provide a shift register having a plurality of flip-flops, which can easily be added to or subtracted from the shift register. 
     The above-mentioned objects and advantages of the present invention will become more apparent and the invention itself will be best understood by reference to the following description of an embodiment of the invention taken in conjunction with the accompanying drawings, wherein: 
    
    
     BRIEF DESCRIPTION OF THE FIGURES 
     FIG. 1 is an illustration of how the present invention shift register can be used in an overall system; 
     FIG. 2 (including 2A and 2B) is a schematic representing the detailed digital realization of the present invention shift register; 
     FIG. 3 (including 3A and 3B) is a schematic diagram showing the cascading of a number of FIG. 2 shift registers. 
    
    
     DETAILED DESCRIPTION OF THE PRESENT INVENTION 
     Referring now to FIG. 1, there is shown a crypto-communication system wherein a present invention shift register is incorporated. In this system, a fully programmable linear feedback shift register 2A, hereinafter to be referred to as FPLFSR 2A, is connected to a data source 4A, a micro-processor 6A and a modem 8A. Data which is to be transmitted to a corresponding system is sent from data source 4A to FPLFSR 2A, wherein this data is encoded, before being sent to the corresponding system. It should be appreciated that the operation of FPLFSR 2A is controlled by micro-processor 6A. Upon receiving the encoded data, modem 8B transmits the encoded data to FPLFSR 2B, wherein the encoded data is unscrambled. It should be noted that both sets of transmitting and receiving components are identical and that the equations used for scrambling and unscrambling the data are the same. 
     Having described a possible application of the present invention, attention is directed to FIG. 2, wherein a schematic drawing of the present invention shift register is shown. It must be emphasized that although 4 flip-flops are shown, the shift register is not limited to such a number, for an indefinite number of flip-flops and/or a multiple number of basic block shift registers can be cascaded to form shift registers having different numbers of flip-flops. As shown, FPLFSR 2 has four identical flip-flops FFA, FFB, FFC, and FFD. These flip-flops, for this example, are shown to be D-type flip-flops. Each of the flip-flops is associated to a number of logic gates, which are also identical. For example, in stage B, associated with flip-flop FFB are three AND gates 12B, 18B and 14B, exclusive OR gate 16B and an OR gate 20B. Except for the first stage, that is, stage A, all of the logic gates in remaining stages B, C and D are similarly connected to their respective flip-flops. Thus, it is sufficient that only one of these stages is discussed. 
     Focusing on stage B, it is seen that the outputs of AND gates 12B and 14B are connected as inputs of exclusive OR gate 16B. The output of exclusive OR gate 16B and the output of the remaining AND gate 18B are input to OR gate 20B, the output of which is connected to input D of flip-flop FFB. AND gate 14B has four inputs. The first input comes from the F --  P line (Feedback/Parallel Load Control line). This line primes flip-flops FFA to FFD of the FPLFSR for parallel loading from lines FCn --  PLn--to be discussed below--when the logic state thereon is low; for normal operation, the logic state of F --  P remains high. The second input going into AND gate 14B is from a FC1 --  PL1 line (Feedback Control/Parallel Load line). It should be noted that the FC1 --  PL1 line is but one of four similar lines, referred to hereinabove as the FCn --  PLn lines. Data fed from these lines are to be used either for parallel loading of a polynomial equation or for feedback control of the flip-flops. 
     A third input into AND gate 14B comes from the output of exclusive OR gate 26. The inputs and function of exclusive OR gate 26 will be described in greater detail, infra. The last input going into AND gate 14B comes from an FFE1 line (Flip-flop Enable line), which is but one of three identical lines. AND gate 12B, along with AND gates 12C and 12D, has three inputs. The first input for AND gate 12B comes from line F --  P, which was described earlier. A second input comes from line FFE1. The last input comes from the output of flip-flop FFA of Stage A. AND gate 18B, like AND gates 18C and 18D, also has three inputs: the first input is fed from line FFE1; the second input is connected to line FC1 --  PL1; and the last input is connected to a line having a logic state opposite to that of line F --  P. 
     The output of flip-flop B is fed to the input of AND gate 12C of flip-flop Stage C. Likewise, the output of flip-flop Stage C is sent to the input of AND gate 12D, thereby completing a series of cascaded flip-flop stages. Of course, the flip-flops are controlled by the timing pulses from the CLK line. Also, each of the flip-flops gets its power from VCC. 
     There are differences between the connections of the logic gates in flip-flop Stage A, when compared to the remaining flip-flop stages of the FIG. 2 embodiment. For example, for AND gate 12A, there are only two inputs. The first input is fed from line F --  P while the second input is fed from line QIN, which is the serial data input for the first stage of the shift register; alternatively, the second input of AND gate 12A may be fed the cascaded output from the last flip-flop of a previous shift register. Another difference in flip-flop Stage A is that there are only two inputs to AND gate 18A. The first input is fed from line FC0 --  PL0 while the second input is fed from line F --  P&#39;, which has a logic state opposite to that of line F --  P. As shown, the change of the logic state is due to the insertion of NOT gate 22 between line F --  P and the inputs to respective AND gates 18A, 18B, 18C and 18D. 
     As was mentioned previously, the outputs of the respective flip-flop stages are cascaded from one stage to the next. Also, these outputs, i.e., Q0, Q1, Q2 and Q3, are respectively connected to AND gates 30A, 30B, 30C and 30D. For AND gate 30D, a second input is connected to line FFE3. The output of line FFE3 is converted into the opposite logic state by NOT gate 28C and fed as an input to AND gate 30C, which has an input fed from line FFE2. The logic state of line FFE2 is converted to an opposed sense by NOT gate 28B and fed to AND gate 30B, which also has as a third input line FFE1. The logic state of line FFE1 is inverted by NOT gate 28A and fed as an input to AND gate 30A. Each of the outputs of AND gates 30A to 30D is input to OR gate 32, which has as its output signal NEWOUT. NEWOUT represents the output of the last flip-flop stage used in the shift register. The outputs of the respective flip-flops are also connected as inputs to OR gate 34, thereby generating therefrom a CRC --  OUT output (Cyclic Redundancy Check Output). This output will be high when any of the flip-flop outputs is high in the basic shift register building block of FIG. 2. 
     Output NEWOUT is fed to an input of AND gate 24, which also has an input signal from a F --  E line (Feedback Enable Line). The output from AND gate 24 is fed as an input to exclusive OR gate 26. An additional input to exclusive OR gate 26 is fed from line DATAIN. The output from exclusive OR gate 26 is fed simultaneously to the inputs of respective AND gates 14A, 14B, 14C and 14D. The same output is further routed to a CAS --  EN line (Cascade Enable Line). The CAS --  EN line may be used to cascade the FIG. 2 basic block shift register to an additional similar basic shift register block via the latter&#39;s DATAIN line. 
     In operation, to initiate the system, a polynomial equation has to be first input into the respective flip-flops. This equation determines the number of flip-flops to be used, as well as the number of cycles before an initial message will repeat. For example, were a polynomial equation of x 20  +x 3  +1 used, one would be able to ascertain from this equation that 20 flip-flops are to be used for the particular shift register. In the event that a basic building block shift register, for example, that shown in FIG. 2, is available, then five of these basic blocks would be cascaded together, per FIG. 4, so that there is a total of 20 flip-flops. In other words, the order of the polynomial equation signifies the number of flip-flops to be used in that particular programmable linear feedback shift register. 
     Too, the number of times which a message is to be circulated through the flip-flops of the shift register before it repeats, can be determined by subtracting one from base two to the power of the most significant digit. Hence, for the example just cited, a 20 flip-flop shift register would have to repeat the message 2 20  -1, i.e., 1,048,575, times. 
     Returning now to the same polynomial equation, it should be noted that x 3  represents the FC3 --  PL3 line in FIG. 2. Of course, the least significant digit 1 of the polynomial equation actually represents the coefficient of x 0 . Therefore, for this particular polynomial equation, there are 20 flip-flop stages, with the logic state of lines FC3 --  PL3 and FC0 --  PL0 being high. Any messages--represented by 0&#39;s and 1&#39;s--which are to be shifted by the shift register, will be encoded by this polynomial equation; and the encoded message will repeat after 2 20  -1 cycles. 
     To input the polynomial equation into the different flip-flop stages, line F --  P is set to a high state. At this time, the data in the FCn --  PLn lines are fed in parallel to the respective flip-flops. If there are more flip-flop stages available than is needed for a particular shift register, the FFEn lines can be used to designate from which flip-flop stage the final output of a message will be taken. For instance, were only three flip-flop stages needed in the FIG. 2 basic block shift register, then line FFE3 would be set to the low state, i.e., 0, while lines FFE2 and FFE1 would be set to the high state, i.e., 1. By first setting the logic states of the respective FFE lines, the last flip-flop stage D is effectively eliminated from the basic block shift register. Accordingly, output Q2 from flip-flop FFC, which output is connected to an input of AND gate 30C, becomes the final output of the FIG. 2 basic block shift register. The Q2 output, along with outputs from Q1 and Q0, which are respectively connected to AND gates 30B and 30A, is gated by OR gate 32 and fed to the NEWOUT line. As was mentioned previously, the output from this NEWOUT line is to be used as a feedback signal and is routed to AND gate 24. 
     For normal feedback operation, after a polynomial equation has been fed into the respective flip-flops, line F --  P is kept in the high state. This means that no parallel loading would occur on each rise of a clock pulse, supplied by clock line CLK. During this normal operation, feedback occurs. The feedback is initiated by first setting the F --  E line on a high logic state. When line F --  E is high, the data stored in the flip-flops are advanced to the next stage and the feedback control data on the FCn --  PLn lines are preloaded into the flip-flops of the shift register. Any input messages would be fed serially from line QIN to the first flip-flop stage, Stage A for this example. If there is shifting, and if line F --  E and output from line NEWOUT are both set high, the output from the last flip-flop stage is exclusively ORed with the feedback control data from the FCn --  PLn lines before being fed into the first stage (Stage A) of the shift register. Therefore, whatever polynomial equation is on the FCn --  PLn lines gets shifted back into the shift register. This shifting will continue until the required number of times for circulating the message is satisfied. 
     In an effort to make sure that the flip-flops in a particular basic block shift register are operating correctly, the outputs of these flip-flops, i.e., Q0 to Q3, are gated to OR gate 34 which output, when registering a high logic, signifies that at least one of the flip-flops is in a high logic state. This signal is for error checking and can easily be measured, for instance, by attaching an oscilloscope to the CRC --  OUT line. 
     As was mentioned previously, the basic block shift registers can be cascaded into a shift register having multiple flip-flops. Such is shown in FIGS. 3A and 3B wherein five basic block shift registers, each containing four flip-flop stages, are cascaded to form a 20 flip-flop stage fully programmable linear feedback shift register. 
     While a preferred embodiment of the invention is disclosed for purposes of explanation, numerous changes, modifications, variations, substitutions, and equivalents, in whole or in part, will now be apparent to those skilled in the art to which the invention pertains. Accordingly, it is intended that the invention be limited only by the spirit and scope of the appended claims. 
     
         ______________________________________                                    
FORCE    FFE9       1 0                                                   
FORCE    FFE10      1 0                                                   
FORCE    FFE11      1 0                                                   
force    ffe13      1 0                                                   
force    ffe14      1 0                                                   
FORCE    FFE15      1 0                                                   
FORCE    FFE17      1 0                                                   
force    ffe18      1 0                                                   
force    ffe19      1 0                                                   
#FEEDBACK                                                                 
FORCE    F --E1     0 0                                                   
force    f --e2     0 0                                                   
FORCE    F --E3     0 0                                                   
force    f --e4     0 0                                                   
FORCE    F --E5     1 0                                                   
#POLYNOMIAL PROGRAMMED TO FEEDBACK                                        
CONTROL LINES HERE                                                        
FORCE    FC0 --PL0  1 60                                                  
FORCE    FC1 --PL1  0 60                                                  
FORCE    FC2 --PL2  0 60                                                  
FORCE    FC3 --PL3  1 60                                                  
force    fc4 --pl4  0 60                                                  
force    fc5 --pl5  0 60                                                  
force    fc6 --pl6  0 60                                                  
force    fc7 --pl7  0 60                                                  
FORCE    FC8 --PL8  0 60                                                  
FORCE    FC9 --PL9  0 60                                                  
FORCE    FC10 --PL10                                                      
                    0 60                                                  
FORCE    FC11 --PL11                                                      
                    0 60                                                  
force    fc12 --pl12                                                      
                    0 60                                                  
force    fc13 --pl13                                                      
                    0 60                                                  
force    fc14 --pl14                                                      
                    0 60                                                  
force    fc15 --pl15                                                      
                    0 60                                                  
TRANSCRIPT ON                                                             
CLOCK PERIOD 100                                                          
FORCE CLK 0 0 -R                                                          
FORCE CLK 1 50 -R                                                         
#INTIALIZATION                                                            
FORCE    DATAIN     0 0                                                   
FORCE    QIN        0 0                                                   
FORCE    F --P      0 0                                                   
FORCE    F --P      1 60                                                  
#RANDOM NUMBER INPUTTED                                                   
FORCE    FC0 --PL0  1 0                                                   
FORCE    FC1 --PL1  1 0                                                   
FORCE    FC2 --PL2  1 0                                                   
FORCE    FC3 --PL3  1 0                                                   
force    fc4 --pl4  1 0                                                   
force    fc5 --pl5  1 0                                                   
force    fc6 --pl6  1 0                                                   
force    fc7 --pl7  1 0                                                   
FORCE    FC8 --PL8  1 0                                                   
FORCE    FC9 --PL9  1 0                                                   
FORCE    FC10 --PL10                                                      
                    1 0                                                   
FORCE    FC11 --PL11                                                      
                    1 0                                                   
force    fc12 --pl12                                                      
                    1 0                                                   
force    fc13 --pl13                                                      
                    1 0                                                   
force    fc14 --pl14                                                      
                    1 0                                                   
force    fc15 --pl15                                                      
                    1 0                                                   
FORCE    FC16 --PL16                                                      
                    1 0                                                   
FORCE    FC17 --PL17                                                      
                    1 0                                                   
FORCE    FC18 --PL18                                                      
                    1 0                                                   
FORCE    FC19 --PL19                                                      
                    1 0                                                   
#FLIP FLOPS ENABLED HERE                                                  
FORCE    FFE1       1 0                                                   
FORCE    FFE2       1 0                                                   
FORCE    FFE3       1 0                                                   
force    ffe5       1 0                                                   
force    ffe6       1 0                                                   
force    ffe7       1 0                                                   
______________________________________