‫Welcomed the linear feedback shift register explain lecturer in this lecture I'm going to explain how
‫linear feedback shift register operates and how like me use digital design what are linear feeback shift
‫registers for.
‫Well the common one is computers use these to generate pseudo random numbers.
‫And what does a pseudo random number.
‫Well I'll read up the definition a pseudo random means that one of a sequence of numbers generated by
‫some algorithm.
‫So as they have an even distribution over some range of values and minimal correlation between successive
‫values.
‫What this means is because we're using a specific algorithm we can't be by definition random.
‫There is an equation that we use to determine what is the next number in this sequence.
‫However if we have an evenly distributed it will appear as random and we use a value we call it a see
‫value to determine what the initial value in our linear feeback shift register is.
‫So you can't guess what the next value will be.
‫And we can do with the pseudo random numbers.
‫We can do the several different things.
‫One most common is random number generation and your computer hasn't been doing a lab on the FPGA Marie-Louise's
‫to generate what appears to be a random number.
‫Also in cryptography this is very commonly used to decode certain messages and encode them so anyone
‫else who looks at it can't make sense of it like encryption and communications it's commonly used to
‫test communication systems.
‫And also you can use these to instantiate very fast counters.
‫Now the counters can be a little bit more confusing because they're not counting one two three four
‫five six.
‫You're kind of jumping all over the place but it's a lot faster than doing an additional processor only
‫doing a shifting which we'll get into and show you here.
‫So linear feedback shift register the input is a linear function of its previous input.
‫And this is where we say it's a pseudo random because you're not by definition completely random.
‫There is a linear relation from your previous input to your next output.
‫So but what it will do is it appears to be random and the initial value reloading and the shift register
‫is called The seed value.
‫If you've ever programmed in C and you use the rand function they will tell you what you want to use
‫the seed value and so they're using some sort of shift register to generate a random number.
‫However you have to apply it with a seed value and you want to make that see value as random as possible.
‫If you design your feedback function really well it will make the shift register have a very long cycle
‫me.
‫It'll take a long time until it repeats the same values over and over.
‫So if it takes a long time to repeat the values over and over it will appear more random and that happens
‫really quickly.
‫People will be able to see that and say OK here's the pattern now.
‫After 20 cycles it repeats the same pattern and therefore it's not really considered random.
‫And as you said before you can use these to instantiate very fast counters because shifting is a lot
‫faster than adding hardware.
‫So let's take a look at a linear feedback shift register design.
‫Here we have a forbit example.
‫We've got four different flip flops and a single exclusive OR gate where we're exclusive offering the
‫Y and Z outputs back to the input and to generator y x A W X Y Z outputs.
‫So the four bits that were coming out.
‫We're taking an exclusive oring the last two back to the input a linear feedback.
‫That's our feedback exclusive OR gate is the feedback.
‫And then our three different 3D flip flops is our shift register.
‫Hence the name of linear feedback shift register.
‫If we take a look at the design we just talked about there and look at the different values we're generating
‫the decimal that we generate.
‫If our seed value is 0 0 0 1 and we use that seclusive or we can see that values are 1 8 4 2 9 12 6
‫11 5 10 13 14 15 7 and 3.
‫If you look through it appears random.
‫There doesn't necessarily appear to be a pattern between all these various numbers.
‫They appear to be randomly generated.
‫However if you go through you'll notice your count from 0 to 15 because there are four bits a total
‫of 16 different combinations.
‫We actually every number was counted from 1 to 15.
‫So that's how you can use it as a fast counter because you know whenever your value repeats where you
‫know you reached a count of 16.
‫However it's a little harder to understand because it's not a success of counting like the humans would
‫think.
‫One two three four and said it's 1 8 4 2 and so on.
‫Now it's a lot cheaper because we're only using four registers in a single exclusive OR gate.
‫Now you understand have linear feedback shift registers operate.
‫Let's start implementing one on your development for.