On Sequence Lengths of Some Special External Exclusive OR Type LFSR Structures – Study and Analysis

: The study of the length of pseudo-random binary sequences generated by Linear-Feedback Shift Registers (LFSRs) plays an important role in the design approaches of built-in self-test, cryptosystems, and other applications. However, certain LFSR structures might not be appropriate in some situations. Given that determining the length of generated pseudo-random binary sequence is a complex task, therefore, before using an LFSR structure, it is essential to investigate the length and the properties of the sequence. This paper investigates some conditions and LFSR’s structures, which restrict the pseudo-random binary sequences’ generation to a certain fixed length. The outcomes of this paper are presented in the form of theorems, simulations


Introduction
Pseudo-Random Binary Sequences (PRBSs) have been used for various applications.Some of the application areas are Built-In Self-Test (BIST) for Very Large Scale Integration (VLSI) circuits' design, cryptography applications like stream ciphers, and error correction and detection codes.In addition, PRBS have been commonly used in the fields of digital signal processing, wireless communications, direct sequence spread spectrum, scrambling &descrambling, encryption & decryption, steganography, and many more (Williams 1984;McCluskey 1985, Bardell et al. 1987;Nanda et al. 1989, Ahmad 1997;Jamil and Ahmad 2002;Ahmad 2005aAhmad , 2012Ahmad , 2013a;;Hell and Johansson 2008, Mukherjee et al. 2011 and Ayinala and Parhi2011).
Linear Feedback Shift Registers (LFSRs) are usually used for generating PRBSs (Peterson andWeldon 1984 andGolomb 1981).In fact, LFSRs have been employed in a wide range of applications.This is due to several reasons: 1) LFSRs are well-suited to hardware implementation, 2) LFSRs can produce PRBS with good statistical properties, 3) LFSRs can produce sequences of large periods with different frequencies, and 4) because of their structures; LFSRs can be readily analyzed using algebraic techniques.However, there are a number of design issues that need to be considered prior to integrating LFSR to a real application.Some of these issues include the size of LFSR 'n', the seed 's' (ie.initial state of the LFSR), feedback connection (FB) in the LFSR, and the type of the LFSR (ie.internal or external) using exclusive-OR 'XOR' or exclusive-NOR 'XNOR'.
Some structures of LFSRs are constructed using internal XNOR model with respect to their periodicity, which have been analyzed in (Ahmad and Al-Maashri 2008) exploiting the state space model of XNOR structures of LFSR (Ahmad 2005b).In this paper, we consider internal XOR model of LFSR structures to study some of the conditions, which restrict the LFSR to a particular periodicity.Our study is based on a derived algebraic modeling of generated PRBSs by the LFSR.We further validate our results through simulation process.We also present a study on randomness criterion of those LFSR structures.
The rest of this paper is organized as appears in Sections 2 -7.Section 2 introduces LFSR model.In Section 3 we present the derived algebraic model of an LFSR, whereas Section 4 presents the analytical study.Simulation model and runs are embodied in Section 5, while Section 6 presents a study on randomness criterion of PRBSs.Finally, Section 7 concludes the paper and discusses future work.Also, an appendix (Appendix A) is provided for the abbreviations and terminologies used in this paper.

LFSR -An Introduction
An LFSR is a special type of Serial-In Serial-Out (SISO) shift register that, when clocked, advances the signal through the register from one bit to the next mostsignificant bit. Figure 1 shows an n-bit SISO shift register.The key element of SISO shift register is D-type Flip-Flops (FFs).The {q 1 , q2, qi, …qn-1, qn} are the states of the flipflops {D1, D2, …, Di, … Dn-1,Dn}, respectively.
SISO shift register has two special features: 1) some of the outputs are combined internally or externally in exclusive-NOR or exclusive-OR configuration to form a feedback mechanism and 2) it retains the autonomous nature of LFSR that is the last output should be part of feedback mechanism.Figure 2 shows an external type XOR structure of an n-bit LFSR.The {c 0 , c 1 , c 2 , ….., c i ,, …., c n-1 , c n }, are the possible feedback connections.Therefore, an LFSR can be formed by either performing exclusive-OR or exclusive-NOR operations on the combined outputs of two or more of the flip-flops.The model for exclusive-NOR has been presented in (Ahmad and Al-Maashri 2008;Ahmad 2005b).In this paper, however, our focus will be towards presenting an algebraic model for an n-bit external exclusive-OR type LFSR.
In an external exclusive-OR type LFSR, the output of the aforementioned operations on the combined outputs of two or more of the FFs and the result is fed to the least significant FF (ie.q1) as shown in Fig. 2. Figure 3 shows an example of a 3-bit LFSR, which is constructed using external XOR functional block.Note how the feedbackwhich is fed as an input to the first FF -is the result of exclusive-OR operation of the outputs of the second and third FFs.Table 1 visualizes the operations of the LFSR depicted in Fig. 3.The table elaborates the next states (FF1_OUT, FF2_OUT, and FF3_OUT) and the output sequence S i .The used seed to start the operation is considered as q 1 (0) = 1, q 2 (0) = 0, and q 3 (0) = 1.
It is this feedback function that causes the register to loop through repetitive sequences of PRBS value.The choice of feedback connections, the seed, and the value of 'n' determine the number of PRBS values in a given sequence before the sequence repeatsthis length is known as periodicity 'p' of the LFSR (Williams 1984;McCluskey 1985;Nanda et al. 1989;Ahmad 1997;Hell and Johansson 2008;Mukherjee et al. 2011;Ayinala and Parhi2011;Peterson and

LFSR AS PRBS Generator -An Algebraic Modeling
In this section, we present a generalized algebraic model exclusively for an n-bit external exclusive-OR type LFSR based PRBS generator.Any binary data sequence can be represented in form of polynomial in GF(2).Therefore, the feedback connection vector for an LFSR can be represented in the form of a polynomial and is technically known as a characteristic polynomial.Eqn.
(1) define a general form of a characteristic polynomial and let us call it ( ).
From the structure of the type of the LFSR shown in Fig. 2, it can be seen that if the current state of the i th flip-flop is a m-i , for i = 1, 2 , ... , n , then by the recurrence relation an equation can be given as depicted in Eqn.(3).
The generating function ( ) associated with the PRBS can be mathematically defined as in Eqn.(4).
or, Eqn. ( 4) can be rewritten as: The ( ) and ( ) can be written in an expanded form as described by Eqns.( 8) and ( 10), respectively.
Table 1.Next state sequences (PRBS) for the structure of LFSR of Figure 3.
Computing ( ) = ( )/ ( ), we get the result as shown in Fig. 4. The quotient of this long division process is PRBS in a polynomial form.This result is validated by crosschecking with those presented in Table 1. . . . . . . .

Analytical Study
This section presents a study on some special cases where the LFSRs are restricted to generate PRBSs of limited periodicity.The study covers the roles of all parameters related to the LFSR generating the PRBSs.These parameters are 'n', 'seed' and the feedback connection function ('FB').The value of n may be either even or odd, seed may vary from (0) 10 to (2 n -1) 10 .The FB function depends on input connections coming from c1, c2, ….., ci,, …., cn-1, cn links to the XOR function block.We present the results of our study in the forms of theorems supported with proofs using algebraic model of LFSR presented in Section 2.Throughout the study, we consider an nbit XOR structure of LFSR.
Theorem 1: "If the seed value in the LFSR is 0 ( = (0) 10 ), then for any value of n and for any FB function the period 'p' of generated PRBS by the LFSR will be 1 (p = 1)."
(5), the equation reduces to a Reduction Modular (MOD) equation as given below.

× = (13)
Hence the generated PRBS is , = 0 which is the seed value.Hence this proves that the period 'p' of generated PRBS by the LFSR is 1.
The result of the long division process of Eqn. ( 14) or Eqn. 15 produces ( ) = (2 n -1) 10 , which proves that the 'p' of ( ) can be given as: The value ∑ implicates that the generated PRBS by the LFSR structure set in Theorem 2 is 1.

Theorem 3:
"If the seed value in the LFSR is all ones, = (2 n -1) 10 , and in the total number of considered links in the FB function from the [c1, c2, ….., ci, …., c n-1 , c n ] is odd, then the period 'p' of generated PRBS by the LFSR will be 1 (p = 1)."

Proof:
By substituting the seed value = (2 n -1) 10 , and inserting FB function for the said structure in Theorem 3 in Eqns.( 8) and ( 9) we get: Therefore, the next state of the LFSR will be the same as the seed and hence it proves that the period of the generated PRBS by the LFSR structure of Theorem 3 will be 1, ie. (p = 1).
Theorems 1-5 presented in Section 4 have great values.Firstly, from point of view of applications of LFSRs and secondly, the described theorems shall help in deducing the LFSR structures of maximal length sequences.Considering the interests of practicing engineers, we present Table 2 to demonstrate how guidelines and restrictions can be ascertained while using LFSRs for its practical usage.For demonstrating the applicability of Theorems 1 and 3-5, all possible LFSR's structures of order n = 4 are considered.Also, the applicability of the study helps in searching the generator for maximal length sequences.As can be visualized from Table 2, for n = 4, there exist 8 possible FB functions, out of those 8, 5 of them have restrictions.Hence, the search set is reduced to 3 as (1 + + ), (1 + + ), and (1 + + ).

Simulation Model
A simulation model was developed to validate the analytical study presented in Section 3. The model was developed in MATLAB to simulate the behavior of LFSR structures.Figure 5 illustrates the two simulation models that were developed to validate the theorems.Figure 5a depicts the model "prb_single_seed", which is capable of generating PRBS 'prbs' as function of feedback connection 'fb' and seed's'.In simulation, the length of the generated sequence is controlled by a set length 'l', computed as follows: l = 2*(2 n -1).5b).Unlike the model above, "prb_all_seed" examines the LFSR structures by generating all possible seeds, while requiring only 'fb' to compute the output p of the function.The sample results for the runs are given in Tables 5 and  6 for validations of Theorems 4 and 5, respectively.

Justification of the Study
Due to their good statistical properties, the LFSRs generating maximal length PRBSs are widely used in stream ciphers (Knuth 1997;Ahmad et al. 2001).The maximal length PRBSs are popularly known as msequence or Pseudo Noise (PN) sequence.The maximal length PRBSs have period length of 2 n -1 (where n is the length of the LFSR).Such LFSRs, which generates msequence, are realized when the corresponding FB to the LFSR is primitive ( Peterson and Weldon, Jr. 1984;Golomb 1981;Ahmad et al. 1990;Ahmad and Elabdalla1997;Knuth 1997;Chunqiang et al. 2012;Ahmad et. al 2013b;Ming-Hung 2013).It is imperative for the designers of crypto systems to consider suitable criteria Table 3. Results of simulation runs for Theorem 1.
In this paper, the study of the Theorems 1, 2 and 3 provide the boundary situations where LFSRs lock and fail to generate PRBSs of sufficient length.Also LFSR structures and seed combinations are to be avoided in length.Because of this, LFSR structures and applications of BIST as test pattern generators, and in cryptography as key generators.
To demonstrate the level of prohibitions and utilizations of the LFSR structures defined in Theorems 4 and 5, we considered the criterions of Golomb's postulates.The ratios of the lengths of generated PRBS using the generators defined in Theorems 4 and 5 with respect to the maximal length PRBS of 2 n -1 (where n is the length of the LFSR) are shown in Table 7 for n = {2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128}.In the table, R4ml and R5ml represent the ratios due to the described PRBS generators of Theorems 4 and 5, respectively.
In addition, Table 7 demonstrates the balance properties of the LFSR structures defined via Theorems 4 and 5.Moreover, R 4mo and R 5mo represent the ratios due to the described PRBS generators of Theorems 4 and 5, respectively, of maximum possible number of 1's.Whereas, R4mz and R5mz represent the ratios due to the described PRBS generators of Theorems 4 and 5, respectively, of maximum possible number of zeroes.

Conclusion and Future Work
PRBS serves an important role in a diversified collection of application domains; including cryptography and fault tolerance.This work has investigated the properties of LFSR circuits used for generating PRBS periods and highlighted the behavior of some of the LFSR structures.The study has employed the recurrence relations to describe the PRBS periods generated by the LFSR structures.A number of theorems have been presented in this paper.These theorems summarize the observations that were outlined throughout the discussion of the analytical model.These observations add some knowledge towards the generation of maximal length PRBS.The theorems and their subsequent outcomes were validated using a simulation model.
The focus of this study was on PRBS generation; however, LFSRs could also be the building block of other correlation functions.As future work, it would be interesting to investigate further properties and observations on the LFSR circuits that could be of use in other application domains and functions.
function is considered from all the links [c 1 , c 2 , …..

Figure 5 .
Figure 5.The two simulation models that are used to validate the theorems presented in analytical study.(a) Used to validate the Theorems 1, 2, and 3 (b) Used to validate the Theorems 4 & 5.The model "prb_single_seed" is used to validate the theorems 1, 2, and 3.