In this video we will study shift and audit operations now and shift in audit operations.
We have basically two types.
One is shift right shift left rotate right and rotate left.
OK so this is a pet operation in which we shift or rotate debates in a DATA.
OK.
So let's take an example.
So let's start with the shift right.
It says you can use shift right instruction to shift the content of the operand and the input in bit
by bit to the right.
OK so it was shifted into the right bit by bit.
OK what does it mean.
For example let's take a block.
This is a shift right.
BLOCK And here we have M-B 10.
This is a data set in which we have a Dadda in hexadecimal 3 3.
Ok then we have this n paramita.
So what happened this is if you see this is the input that is a value to be shifted and this impedimenta
say it's the number of position by which the value shifted like you put one here.
It will only shift one bit at a time.
If I put two here it will shift two bits.
So the specified number of bets you want to shift bar bult at the input.
OK if I'm giving one pulse here and I put four here it will shift for bets if I'm right for hand and
give tuples it should for BET.
And then again for bets that will totally shift a bit right.
So let's see an example.
Yeah this is the result.
So this is my input and if you see that the addresses are same.
So it was shift in the same resistor.
So let's take an example how it works.
So initially when there is no pulse here the data is 0 0 1 1 which is 3 in hexadecimal.
0 0 1 1 this is 3 again.
So this is 3 3 in hexadecimal This is the value in the end.
We don't.
OK.
So once you have the run polls here with one polls this is two.
OK this is two.
So with this tool you'll see that these two bets are shifted outside.
So these are managed to bids advantage outside.
And these are shifted here and these are Shiflett here and these two are shifted here.
And these two are coming up and this will be 0 by default.
OK but another pulse.
These again are vanished.
These two are shifted here and rest of them are zero.
When the next polls these two are vanish.
So the result will be zero.
So that's how you do bets had been shifted with everything you buy.
Is this a shift.
Right.
OK.
So let's say this is again this is the same example we have here it is a shift right blog.
And here I am using a timer logic timer logic we have five second time after every five seconds we'll
get a pulse here.
So with every five seconds because my data will be shifted to right.
So this is the same example.
This will be shifted.
These two that will come here.
And then this will come here.
And then this will go out and the result would be zero.
All right here's the same example.
So next this shift left.
So in this case instead of shifting right we are shifting that and left the rest of the index the same.
Now here is one.
This is another example.
So what happens here I'll have a look at this one.
So initially the data is like this.
One wonders you know one wonders whether this is c in hexadecimal.
This is the data here because this forward's represents C and these four represents the you know X an
estimate Commandery.
Now with every single pulse this is shifted on the left side now.
This is here.
This is here this is here.
This is here.
This is here and this goes out OK.
But second balls this has shifted again to the left side.
This goes out then again shifters.
This will go in the left side every with every pulse that on a shift to the left side.
This is a shift left instruction.
OK.
So the same example we have here you can see that this line shows the Dahlia's being shifted to the
left of every single pulse and that part is coming when the time or logic which is having a five second
delay.
So but every five seconds the data will be shifted to the left.
See spectacle operation.
In the example which I will show you in the end along with rotate as well.
So the next one is to rotate right.
So the only difference between shift under data is that in the rotate instruction the data which goes
through the right comes back to its extreme left.
OK so that part of it goes from most least bad to go comes to more significant weight.
So if you see here this is moving here to the right.
So this goes here this goes here this goes here this goes here and the valley which was here which comes
to about zero.
This is what I understand in this in this example for gays.
So in the fourth case you have the fourth balls we have we have four hybrid's two most significant.
We have 1 1 1 1 and other and.
This one comes back to here because it is rotating rotating right.
So it will rotate like this.
OK.
So this is one one one and this one here.
So let's see an example you can understand.
So here when the Bates comes here at this spot after that one comes here OK.
And after this one this one comes here.
Sorry this one comes here and this will be shifted.
OK.
And so on this we would all read it.
So if you can see that at eight buds the value of that are similar to what we have had ZERO.
Because it is rotating.
So this is rotate right.
And we have the same time a logic that arms should be ready at every five second OK.
Similarly we have rotate left.
In this case the data is rotating in the left hand action.
So if you see this example this is moving in this way.
This one comes here and then another one comes here and then another comes here and food comes here.
So there's again the same state as we have and zero is at eight months.
And in this case not we did it in lymphatics.
So let's combine all these operations and see the results in our software.
So in the main logic if I show you this is the same example which I have made in the presentation.
This is the shift right.
This is shift left.
This is rotate.
Right.
And that's rotate left.
OK.
And this is my time allotted.
So we have a switch in that I'm a logic if I turn on the switch then only my diamond will start running.
OK.
So I'm going to show you the watch table here to display the results.
All right.
So that says My rotate left would comment if I can slow enough to the left the shift right.
My first exam then I have shift left then go straight right then Reclast.
And this is my style.
So if I start this operation you can notice I don't even see the value in my shift right.
Is this one.
So you kindly just focus on the shift right operations.
You will see that.
Now here if you check my program again I want to then on the value which I have poured in.
And so here it's two shift right.
We have to inject let me have one.
So if you are not doing this one you will see that these two bets will jump from here and shift to this
one.
Once I press start let me go to one every time I restart it and every five second you will see here
you can see that's shifted.
Then again at 57 these two will shift to here.
Now get of saying this will vanish.
So this is zero and this is remains zero.
OK.
So this is shift right operation.
OK.
So let me turn it to see you now.
We will check shift lift operation OK.
Now for that I'm going to again with these values here.
All right.
So next we have to wonder.
Despite this a shift left to one man who is here this is 1 1 0 0 1 1 0 0 5th taking this whole shift
by one.
You see that this one is vanish.
And this one is here and this will shift here like that and so on.
This will keep on shifting until they get zero zero zero two three.
Is another shift.
Then you have another shift Mekdad.
And then again this has shifted and this will go to zero.
Because the end was one.
So it is shifting by one.
So next if you see it don't eat right.
This is an idle day.
Right.
Again the end is one here you can notice that and this is one here and this will be this is I'm here
now notice this one this is 1 1 1 1.
It will rotate.
Now the raid instruction will be more clear if you have one on the extreme right.
So you would know what this is 1 1 1 1 0 0 0 0 feet here.
And now one way to rotate here
like that.
OK.
So there's an audit right.
Similarly habitate list here you will see that this is moving in left college.
So this is of our shift right shift left rotate right and rotate left.
There could be some applications of far more could be many applications for maybe for LCD display you
know or maybe to store some information.
So this is how you can use software shift left shift right left and right or right.
So if you have any doubt in using these commands you can put me away.
So this is the end of the tutorial.
And what did we learn today.
Shift right is used to shift the content of the brand bit by bit to the right and give the GUI to the
output.
Shift left is used to shift and then our brain by Oprah and to the left and give it to the output and
or date right.
We rotate the content and give it to the right date laugh candidate and then and give it to the left
and left direction.
So these are the full instruction which we understand in this lesson.
So I'll see you in the next tutorial and if you get a copy of this presentation because if you don't
have a nice day.
Thank you.