And no, we can create a block diagram from our FSM, make sure you are in FSM, go to create update,
create simple file.
And here we go now.
Let's go back to our circuit now, let's create our components, simple tools, we go to project and
we will see our.
Let us integrate our FSM.
This is my FSM.
And now it's time to integrate it.
No.
We are going to delete some of these signals because, well.
What we are looking for now is the FSM controlling these signals are not us manually.
So we're going to delete the select.
I'm going to leave the right see, I'm going to lead the right way and the right to be right here.
And it's time to interconnect them directly from here.
OK, let's do the bus all the way.
OK, good.
All right, so let's start interconnecting them, we have right a let's zoom in a bit, this is right,
a week taking it from here.
And it's going to go to right a right here.
OK, then we have a right to be.
This is my right to be.
Excellent, then we have right see?
This is my right.
And finally, we have the select.
Which we are going to link it all the way.
Like this, OK?
Amazing.
Now let us create inputs and outputs for whatever left here.
So to do that, we look at the FSM, but first we need to choose the Groser here, the selection tools
now we like.
And we say update.
And we say, Jan Beans, for example, for.
Now, this is actually we're going to leave it as it is, state out the clock is going to be left as
a clock reset accumulate and start will be left out there.
Now, we will check if this integration will make our design work as expected or not.
So.
Let us compile.
Now, let us set this top level and then we will compile, all right, now let us start simulation.
We are going to delete everything we had here because they are now content, because now this contain
signals that they don't know they don't exist anymore, let us know and all the signals.
And here we go.
So we have A, we have B, we have Alio out.
We're going to throw these resets away.
We have a clock, it's going to be on top.
Let's throw this away a little bit.
State, we're going to have it here on the clock.
Operation.
There's going to be here, we have accumulated and the start and we said those are essentials.
And now we can start.
So first, let us save the file first, OK, first, let us extend this time to two microseconds.
So go to edit.
Said and time and year, I'm changing this to microseconds.
OK, I think we did it wrong that said this to two microseconds.
OK, sounds good.
Now my clock, we're going to set this whole signal here.
All right, so now, since we have integrated this simulation, let us delete all of these signals because
some of them don't exist anymore because we have interconnected FSM.
Now let's insert no notorious list at everything.
Click OK, and let's rearrange these signals.
I want my clock always to be on top.
It's easier to monitor.
Now this carry out and the resets, I'm going to throw them to the end.
For now, the state will be under a clock.
And B, over here, the data, the operation is going to be here.
We also need to start.
Reset.
Accumulate.
And these will stay as they are, OK, let's save this file.
And now let us extend this time to two microseconds, because one microsecond is not enough for the
full simulation.
So I'm going to go here and said this to two.
Amazing.
Now, I'm going to start by.
Adjusting the clock waveform.
So we were going to clock every 20 nanoseconds.
Maybe that's a little bit too much.
All right.
Not 20.
Maybe every 100.
All right, we are clocking every 100 nanoseconds.
Sounds good.
Now, this is state, I'm going to throw it also.
Here, OK, now we are going to try to audition for this simulation, and, of course, I'm going to
try to hit first my reset.
So first of all, we need to reset our state machine to bring it to the.
In its state, next.
We have a start and accumulate, we need to start with the start signal.
So we are going to set it to one, make sure that when we set it, it is at the falling edge, otherwise
it won't be evaluated because as we know, FSM evaluates on the following edge only.
So here we are falling.
We see that it is seeing that start as well.
I mean, if we do this.
That's wrong because the falling edge is falling at zero, it's not seeing that start is activated.
This is why we make sure that the waveform is extended beyond the following edge by a few nanoseconds.
OK, and let us set A and B state ACLU, all of this.
We need to change their radix.
Right.
The verdicts will be unsigned, wonderful.
Now let's say A control alt, B, now A is let's say 47.
And B.
Is maybe 100 or 91 or whatever.
And we are ready to simulate the simulator and see what's going to happen.
And here we go, this is our first simulation.
What we care about always is the result.
So this is what the signal that you care about, I'm going to put it here.
And as you can see, I said all this thought and they said the operation two zero zero zero meaning
just started this FSM and I want you to give me the result.
And as you can see, the from.
Started cycling, so this is the state that cycles state zero, one, two, three, and at the fourth
estate, which is the right result, we are seeing that the result is 138.
So if we take a look at this, do we see that this is state zero transitioning to state one in order
to fetch or ride the signals to A and B, then we are jumping here in order to perform the operation.
Then we jump here, which is stalking the result in Register C and we can see that we just see changes
of value from zero to under thirty eight.
Amazing.
No, let us continue a simulation.
So how many cycles the take it took us.
One, two, three, four, five cycles in order to finish this.
So in order to calculate this result, we need five cycles.
OK, now let us go back here.
Let's count one, two, three, four, five cycles, and then we're going to start the state machine,
but this time with a feedback.
So at this point here.
At this fifth, right here, sixth, I mean, right here, we make sure that this folding edge is seeing
accumulated calls one and start equals one, and then we should see another result right now.
Right.
We should see the result of these being added to 91.
OK, so let us head on simulation and here we go now at this point here.
Let us check the result now, as you can see, we have we have already analyzed all of the section of
this section.
We said start and accumulate to one.
And the state machine, as you can see, is at zero.
Then it jumps to accurate state.
Then it jumps to operate state and then write the result.
And as we can see, when we read the result, we write two to nine, which is 138 plus ninety one.
And this is correct.
So our state machine is working as expected.
That's amazing.
Now we have a very small circuit that can calculate multiplication, addition, subtraction.
Division all up to eight bits.
That is really, really amazing.
And as I told you, the circuit exists in any C.P.U.
Of course, it is a little bit more complex.
It can handle most of the ACLU is a little bit more sophisticated.
But any microcontroller has a circuit and its C.P.U.
Ogbu has a circuit similar to this inside it.
So what you learn here is really, really a huge thing, because right now, you know what's going on
in the background.
Whenever you deal with a microcontroller with a C.P.U, you did even with a p.l.c., you know what's
going on in the background, visceral, where you see numbers jumping and bouncing here and there.
I'm really glad that we have reached this point with me and see the next lecture.