00:01
In this question, we have to write a assembly code that will translate the provided code to us, that is a code snippet into the leg p8, this assembly code.
00:19
So let us have a look at it.
00:21
So what we have to see here is that we have to write certain instructions and they will be meaning something.
00:29
So first we have to write the instructions that will load the value into the memory.
00:35
So we'll have instructions that will load the value into memory.
00:45
Then we are going to have something that will initialize the loop counter.
00:53
So we are looking at the steps that we have to write the code about.
01:00
Then what we can have is we have to have the beginning of the outer loop.
01:07
So for that, we will be having a certain loop i kind of code.
01:15
So we'll have the beginning of outer loop.
01:25
So then we will have the branches of the label that have greater than or equal to value.
01:33
And again, we will be having the comparison values ahead.
01:39
So let us have a look at a code in the basic compiler.
01:45
So we'll just look at any basic compiler as this is a assembly code.
01:51
So the first thing that we will be doing is we will be loading the d0 value into x3.
02:01
So now if you see we have loaded the value into x3 and then we have initialized the counter to 0.
02:10
Now the next thing that we will be doing is we will be looping i.
02:15
So in loop i, if we see we compare i with x0 and we compare i with respect to a and then we exit the outer loop.
02:30
Now we'll see the inner loop that is the loop j and its settings.
02:36
So now if we have a look over here, we have to compare a certain j with b and then we have to calculate the address of it.
02:46
So on proceeding over here, we can use this x5 for further processing if it is needed.
02:54
So we are using commands as calculate address of this and we have to store it in x4.
03:00
Then we have to load that value into x5.
03:03
So finally we get it in x5.
03:06
And then we increment j over here that is x11 and then we repeat the inner loop again.
03:16
Now we have to end j.
03:18
So for that we'll increment i and we'll have this repeat the outer loop step that is loop i.
03:28
Now after this, a code will end and we'll have a loop that gives a different value...