258 views

Uploaded by Stan Maria

save

- batch-1
- Design of Pseudo Random Binary Sequence Generator using VHDL
- 1
- 8Transportation Model
- Gsm Security and Encription
- Impact of LFSR Seeding on the Test Pattern Generator in BIST
- International Engineering Journal 2012 Price List
- lec_no._15_n_16...29.3.13.pptx
- An FPGA Based Digital Controller for AC Loads Utilizing Half and Full Wave Cycle Control
- 16.Low Power Efficient Built in Self Test
- Transportation
- Chapter 03
- An Optimization Technique for CRC Generation
- IOSR Journals
- 13_14C~1
- Novo Documento de Texto
- Scatter Plots - Texting Olympics
- MC74LCX157DT_C300.REV0
- Embedded Instruments
- CfP-SS-New Technique Trends for Power Converters in Distributed Power Generation Systems(1)
- Lufthansa
- BPC issues.docx
- DIP Project Report
- sys
- Sesion-1-El Marco Teorico Segun El Estilo Apa
- FA212240_EN_US_2.0
- 1913-7687-1-PB
- MC74LCX125DT_C300.REV0
- rfc58
- Ba070000_EC
- UMPFE Ghidul Aplicantului 08.11.2016
- Chemical products - Romanian.pdf
- Anexa 3 - cerere elev adult.doc
- Anexa 1 - componenta dosar.doc
- 08 CirstinaMirela Studiu Progres Scolar
- UMPFE_Ghidul Aplicantului_08.11.2016.docx
- Ciclu Inferior SP
- Anexa 2 - model adresa inaintare scoala catre ISJ GL.doc
- OMECS 5268.pdf
- Manual
- CERERE-DL.-MINISTRU_-ECHIVALARE-STUDII.doc
- Anexa 3 - cerere parinte.doc
- Probleme Rezolvate Statistica
- ANUNT - ECHIVALAREA DIPLOMELOR.docx
- Biostatistica MG - Cursul 7 - Teste statistice.pdf
- Suport de Curs_MLedership 2018_editabil
- Biostatistica MG - LP 4
- Acoustic_and_elastic_multiple_scattering.pdf
- Manual Modul 2 - Expert implementare.pdf
- Studiu de zona II GAL Orizonturi 2012.pdf
- Caiet aplicatii cursant
- 257973910-CAEN-2015-1-pdf.pdf
- suport_curs_ManagOrg_Scolare_context_descentralizat (1).pdf
- quality_criteria_dlr.pdf
- 40280-learning-resource-evaluation-guidelines.pdf
- Modul 7 Management educational.pdf
- GuySatat ImagingThroughScattering MS Thesis
- Quality Criteria Dlr
- Leadership Carmen
- UMPFE Ghidul Aplicantului 08.11.2016

You are on page 1of 6

- This tutorial is not meant to be a theoretical introduction to random number generation but a mere cook-book recipe for building such a generator as an animated Fibonacci type LFSR in Microsoft Excel 2003. - A very sketchy theoretical introduction is given after which a 14-bit long Fibonacci type LFSR device is implemented in a worksheet having feedback which generates a maximum length sequence (214-1).

by George Lungu

- This type of device is covered in most undergraduate curricula in schools such as Electrical Engineering, Computer Engineering and Computer Science. - Being a while since I myself studied this device in school and having a very limited time budget I briskly refreshed my memory from Wikipedia:

(http://en.wikipedia.org/wiki/Linear_feedback_shift_register)

and used their Fibonacci setup and their formula table for a maximum sequence 14-bit LFSR.

**An outline from Wikipedia:
**

- A linear feedback shift register (LFSR) is a shift register whose input bit at any time is a linear function of its previous state. - Applications of LFSR’s include generating pseudo-random numbers, pseudo-noise

<www.excelunusual.com>

sequences, fast digital counters, and whitening sequences. Both hardware and software implementations of LFSR’s are common.

1

The sequence of bits in the rightmost position is called the output stream.13. it cycles through all possible 2n − 1 states within the shift register except the state where all bits are zero).The initial value of the LFSR is called the seed and because the operation of the register is deterministic.excelunusual. unless it contains all zeros. -A maximum-length LFSR produces an m-sequence (i.com> case it will never change. it must eventually enter a repeating cycle.11]. INPUT A B 0 The symbol of a XOR gate and its truth table OUTPUT A XOR B 0 1 1 0 1 0 . because the register has a finite number of possible states..14. an LFSR with a well-chosen feedback function can produce a sequence of bits which appears random and which has a very long cycle. in which <www.Likewise.e. The sequence of numbers generated by an LFSR can be considered a binary numeral system just as valid as Gray code or the natural binary code 2 .The bits in the LFSR state which influence the input are called taps (white in the diagram).The mostly used linear function of single bits is XOR. 0 1 1 1 0 . In the diagram the taps are [16. . The taps are XOR'd sequentially with the output bit and then fed back into the leftmost bit. However. The rightmost bit of the LFSR is called the output bit. the stream of values produced by the register is completely determined by its current (or previous) state. Fibonacci LFSR’s: -The bit positions that affect the next state are called the taps. thus normally it is a shift register whose input bit is driven by the exclusive-or (XOR) of some bits of the overall shift register value.

1/4 will be two bits long. in order. -The output stream is reversible. Exactly 1/2 of these runs will be one bit long. Some polynomials for maximal LFSRs: -Ones and zeroes occur in 'runs'. This is not possible with truly random events. The output stream 0110100. you can predict the next state. 14th. for example consists of five runs of lengths 1. 2n −1 runs occur (for example. In one period of a maximal LFSR. characteristic polynomial. 13th and 11th bits (as shown above).2.1. up to a single run of zeroes n − 1 bits long. the probability of finding exactly this distribution in a sample of a truly random sequence is rather low. Note that more than one maximal-length polynomial may exist for any given shift-register length. This means that the . -LFSR output streams are deterministic. and a single run of ones n bits long.This is called the feedback polynomial or LFSR can be expressed in finite field arithmetic coefficients of the polynomial must be 1's or 0's. an LFSR with mirrored taps will cycle through the output sequence in reverse order.excelunusual.2. a six bit LFSR will have 32 runs). For example. the feedback polynomial is: x16 + x14 + x13 + x11 + 1 Some polynomials for maximal LFSRs: -The table to the left lists maximal-length polynomials for shift-register lengths up to 15.-The arrangement of taps for feedback in an as a polynomial mod 2.1. if the taps are at the 16th. If you know the present state.com> 3 . This distribution almost equals the statistical expectation value for a truly random sequence. <www. However.

which means the output will transition only during the clock rising edges.The D type flip-flops in the above diagram will delay the incoming data by one clock period. The number of points is also large enough to give the user a feel of data randomness .com> 4 .excelunusual.Why we chose 14 bit? The answer is that we need a lively animated model.In other words the flip-flop chain in the diagram above is just a shift register synchronize it with the clock. The output will take the value of the input during the rising edge of the clock and it will hold it until the new rising edge occurs. <www. In short this flip-flop will delay the input data by one clock period and . Handling and charting 214-1 = 16383 points of data must be fairly fast in Excel.Let’s take the polynomial formula from the table in the previous page and implement the following schematic.Let’s consider a maximal length 14 bit LFSR : . x14 + x13 + x12 + x2 + 1 2 FF1 FF2 FF3 FF4 FF5 FF6 FF7 FF8 FF1 FF2 FF3 12 FF4 13 FF5 14 (Out) FF6 Clk “FF” stands for a D type flip-flop (“data” or “delay” type register) .

in it.Two different macros will be used. a “Reset” macro and a “Run-Pause” macro. the “Run_Pause” macro.In the range B28:O28 type in the seed bits as constants. .Name the first worksheet “Tutorial_1” and to the right.We will create a instantaneous spreadsheet calculation for the device for 30 time steps (on 30 rows) and during each cycle.Dynamic Excel implementation outline: -This will be a dynamic (sequential) animated model run by a “copy-paste” type of macro used in many of the previous models on this blog. . will copy 17000 time steps of history information of the model and paste it 30 cells down (in the past). The macro will do this operation repeatedly in a loop creating continuously time rolling simulation environment in which 16353 time steps of information are charted in real time.The worksheet will therefore have an instantaneous calculation area (30 rows) and a historical area (2^14-31 = 14353 rows) underneath. The seed can be any combination of <www. The chart will be dynamically updated and you will be able to see the effect of any change in shape of the waveforms.The reset macro will clear all the simulation history and set the flip-flops using the seed value. I will arbitrarily choose “10000000000000” as seed but you can use any other number except “00000000000000” (make sure there is at least a “1” in the group). . . fill out the labels as seen in the snapshot .com> “zeros” and “ones” but make sure there are not all zeros. Excel implementation: . 5 .Open a new file and name it “LFSR_tutorial” .excelunusual.

namely returning a “0” (low) whenever the inputs are equal and returning a “1” (high) whenever the inputs are different <www.Open the VBA editor and create (insert) a module .Fill out range V36:W39 with the following combination of 0’s and 1’s (all possible combinations) -It seems that the function works as expected from a exclusive OR.Creating an exclusive OR (XOR) Excel custom function: . W36) and drag-copy X36 to cell X39 .In the newly created module type in the code to the right Function EXOR(A.In cell X36 type “=EXOR(V36.It seems that “XOR” is a reserved word in VBA since the program would not allow its use without flagging an error. B) If (A = 0 And B = 1) Or (A = 1 And B = 0) Then EXOR = 1 Else EXOR = 0 End If End Function 1 1 0 1 1 0 The symbol of a XOR gate and its truth table INPUT OUTPUT A B A XOR B 0 0 0 1 0 1 .excelunusual.com> to be continued… 6 . Testing the exclusive OR (XOR) Excel custom function: .

- batch-1Uploaded byvinit reddy
- Design of Pseudo Random Binary Sequence Generator using VHDLUploaded byEditor IJRITCC
- 1Uploaded byPriya Nanaware
- 8Transportation ModelUploaded byKirti Rai Chanchal
- Gsm Security and EncriptionUploaded byAhmed Barkaati
- Impact of LFSR Seeding on the Test Pattern Generator in BISTUploaded byEditor IJRITCC
- International Engineering Journal 2012 Price ListUploaded byTamizharasi Karuppanasamy
- lec_no._15_n_16...29.3.13.pptxUploaded bySadiaAslam
- An FPGA Based Digital Controller for AC Loads Utilizing Half and Full Wave Cycle ControlUploaded byIJSER ( ISSN 2229-5518 )
- 16.Low Power Efficient Built in Self TestUploaded byUday Kumar
- TransportationUploaded byAyesha Sadia
- Chapter 03Uploaded bySudipta Ghosh
- An Optimization Technique for CRC GenerationUploaded byseventhsensegroup
- IOSR JournalsUploaded byInternational Organization of Scientific Research (IOSR)
- 13_14C~1Uploaded byshailesh_tiwari_mech
- Novo Documento de TextoUploaded byClovis Antonio
- Scatter Plots - Texting OlympicsUploaded byheathermkohn
- MC74LCX157DT_C300.REV0Uploaded byRandall Mata Rivera
- Embedded InstrumentsUploaded byhariprasadnk
- CfP-SS-New Technique Trends for Power Converters in Distributed Power Generation Systems(1)Uploaded byRaghu Ram
- LufthansaUploaded byUsmanAli11
- BPC issues.docxUploaded byAditya Pavan
- DIP Project ReportUploaded byWaleed Pervaiz Mughal
- sysUploaded bythi_martins1060
- Sesion-1-El Marco Teorico Segun El Estilo ApaUploaded byDaniel Franco Morales
- FA212240_EN_US_2.0Uploaded byHernanMillaMendoza
- 1913-7687-1-PBUploaded bytudex
- MC74LCX125DT_C300.REV0Uploaded byRandall Mata Rivera
- rfc58Uploaded byNickyNET
- Ba070000_ECUploaded byFavoreel Patrick

- UMPFE Ghidul Aplicantului 08.11.2016Uploaded byStan Maria
- Chemical products - Romanian.pdfUploaded byStan Maria
- Anexa 3 - cerere elev adult.docUploaded byStan Maria
- Anexa 1 - componenta dosar.docUploaded byStan Maria
- 08 CirstinaMirela Studiu Progres ScolarUploaded byStan Maria
- UMPFE_Ghidul Aplicantului_08.11.2016.docxUploaded byStan Maria
- Ciclu Inferior SPUploaded byStan Maria
- Anexa 2 - model adresa inaintare scoala catre ISJ GL.docUploaded byStan Maria
- OMECS 5268.pdfUploaded byStan Maria
- ManualUploaded byStan Maria
- CERERE-DL.-MINISTRU_-ECHIVALARE-STUDII.docUploaded byStan Maria
- Anexa 3 - cerere parinte.docUploaded byStan Maria
- Probleme Rezolvate StatisticaUploaded byStan Maria
- ANUNT - ECHIVALAREA DIPLOMELOR.docxUploaded byStan Maria
- Biostatistica MG - Cursul 7 - Teste statistice.pdfUploaded byStan Maria
- Suport de Curs_MLedership 2018_editabilUploaded byStan Maria
- Biostatistica MG - LP 4Uploaded byStan Maria
- Acoustic_and_elastic_multiple_scattering.pdfUploaded byStan Maria
- Manual Modul 2 - Expert implementare.pdfUploaded byStan Maria
- Studiu de zona II GAL Orizonturi 2012.pdfUploaded byStan Maria
- Caiet aplicatii cursantUploaded byStan Maria
- 257973910-CAEN-2015-1-pdf.pdfUploaded byStan Maria
- suport_curs_ManagOrg_Scolare_context_descentralizat (1).pdfUploaded byStan Maria
- quality_criteria_dlr.pdfUploaded byStan Maria
- 40280-learning-resource-evaluation-guidelines.pdfUploaded byStan Maria
- Modul 7 Management educational.pdfUploaded byStan Maria
- GuySatat ImagingThroughScattering MS ThesisUploaded byStan Maria
- Quality Criteria DlrUploaded byStan Maria
- Leadership CarmenUploaded byStan Maria
- UMPFE Ghidul Aplicantului 08.11.2016Uploaded byStan Maria