So we have just simply did this all work?
Well, it's a really good idea to simulate your kill chunk by chunk.
It will save your time when you try to debug it.
I mean, if you're really huge, it's really hard to follow what's going on, especially if you have
a bug.
But like doing it chunk by chunk is really useful as a little bit faster.
So now we did not really do anything about the carry out.
So how can we indicate that?
Well, you added two results and then it around.
You done like we've seen the simulation example.
When we are out of range, we see the results rounding up to some other numbers.
But one indication that, OK, there is a lot you've got right now is not the correct one because you
have an overflow.
So what you're seeing now is something that is not really correct.
How can we do that?
Well, I'm going to teach you about extension in order to do an extension.
We need to do the following.
First, let me define I need some other intermediate signal.
I'm going to call it temporary.
So just temp.
And this temp is a signal.
OK, and it's going to be.
And that's the logic factor.
Eight down.
To see, you know, there's a lot of waste program off the flow, but I want to show you this one,
because it will teach you also about extension, it will teach you some new skills.
So here this ideologic is eight is actually not a bit like this one, but it is a nine.
I mean, everything we have here is eight, because here we have nine, because when you are trying
to add to numbers, you always end up with an additional bent when it is an overflow.
Right.
So if your rent is eight feet and you have an overflow, you will get an additional C output.
Right.
So this is why I'm defining a result that is going to be nine bits instead of eight, because the ninth
is nothing but the carry out.
So how can we incorporate?
I'm going to say ten is equal to.
And bear with me here.
The syntax looks a little bit weird, but you're going to see what I'm doing.
It is a.
And this is.
OK.
The extension I am using extension sign, it looks like an end like that.
Plus.
Zero.
And the extension of the.
And that's it.
What does this even mean?
What I'm saying is take a is here it is eight minutes and I wanted to add a zero.
So now it is not, but at least take my B as well here, which is also a bit and also add another zero
to it.
So it is now a nine.
So we have extended the archivist's to nine days.
And then what I did say here is just add them up.
It's the same as this addition or two, but I'm saying add these up as a bit.
So I'm adding 92 here and nine to and I want you to take the last bit of it and make it a carry out.
So I'm going to say.
Carry out is equal to 10, but which the only bit number nine, which is in the state.
Right.
See what's going on here.
We extended a now eight is nine minutes to extended B, and if there is a carry out, the result will
give us nine.
That's right, because there is a carry out.
We have an overflow.
The result is bigger than a bit.
So it is like this.
So I'm saying take this ninth bit and please assigned to carry on.
So if this ninth bit is a one, it means that I have to carry it out.
Otherwise I don't.
And we are going to test this together right now.
So let us compile a
simulation is over.
Let us go back to our BWF here.
So let us create an overflow case right here.
So first we need to say, are we dealing with unsigned or.
Let's say that we are dealing with Scient.
OK, let us change this.
Seven to eight.
Now, I want you to remember something, if you are in eight bits and you are working inside system,
your range of numbers is going to be from minus hundred twenty eight, two hundred twenty seven.
Now, if I tried to add this up, I'm going to get another twenty eight.
So it's bigger by one from the higher limit, which is.
So if I try to subtract, I should not be getting any issues, but if I try to add them like in this
area here, I should see this coming out a little.
See?
So right now we are a simulation.
Let us add this to the numbers in the inside.
So you remember the range for eight bits.
Unsigned is from zero to 100.
It is from zero to two hundred fifty five.
Right.
So let's say that this number here, all of it.
It's something that will give me an overflow, maybe hundreds.
Thirty five of the 36 should be OK if we add these, we should be getting a value higher than 255,
which is the value limit.
So this should give me this carry out and we should be seeing it coming out, popping up right here
that does this, this and here we go.
As you can see, Gabrielle is popping up right here.
That's great.
That is really great.
But as you can see, the crowd here is totally wrong.
Because why?
Because this implementation that we have used is only considering.
When we are adding these two numbers.
OK, so what you want to do is cut this and actually add a year.
So now I am calculating the CAVEH when we are adding and I want to calculate it when we are subtracting.
So what I want to do here is have this as a subtraction.
And by then I'm going to assign it to them based, let us see if this will make any difference.
Now, we have compiled let us try the simulation one more time.
And as you can see, as expected, carry out did not pop up here, and that's correct, because we are
subtracting here and there is no carry out, the result is totally legit.
But here, when we are adding, well, we are having some issues because here we are, because here
we are exceeding the upper range and this is why we are getting a carry out.
So let me recap what we've done here one more time.
Let me explain it to you.
We are calculating the carry individually by extending eight to nine bits and adding them.
And here we are extending it also by eight bits and we are subtracting them.
So this objection resulted in an additional nine that we're going to see.
Same thing for the addition.
That's a great next lecture.
We're going to go to multiplication and division.