Hello and welcome to the simulation in which we are going to explain that weight on and wait until and
we actually are.
Now let's go with this board and create a new five.
Let's save it, as usual.
And let it TB seven
ways.
Let's review the process, we will call at seven.
Twiggs.
Wait until.
Save it at this.
And so this now let's remove all of this.
Let's remove the variable now, we have this process now less clear to signal the first one, let's
call it count.
And it would be an integer and the initial value will be zero, and let's create another signal countdown.
And Georgia and will be 10 now, as you can see, integer integer equals zero 10 counterbattery the.
Now, in here, inside the first process, we are going to ride the following ground up.
Equal.
Count up.
Plus one, this will increase count up by one.
Now, again.
Countdown.
Equal.
Count down minus one, this will count down by one.
After that, we need to wait for in a second.
And this is there is no process without the wait line because these are signals.
And for these signals to update value, we have to oppose or wait.
Now, let's add another process.
And this is the first time that we use to process and we will even use three in this example.
Now, process.
Is big in.
And process.
And the semicolon now inside the process, we need to write weight on account of.
Countdown.
And I will explain this in a minute.
Now let's print out report.
Count of equal and add here integer to convert the integer into string and print it out.
And you're right, Count.
And this.
Now, we need to add the other text, which is.
The countdown.
Integer.
Image and countdown.
And Odyssey McCullough, now this will bring the count up and count down value, then it will in the
process.
After that, we can create another process.
I will explain everything, but let's add the second process again and process.
See my column here.
Wait until.
OK, we have to get this inside.
And he had the same weight.
Until.
Downtempo.
Count equals countdown.
Then, but Brent.
Equa.
And that's it.
Now, let's explain what we have done here now in the previous tutorial and the previous lesson, we
learned the main difference between signals and variables.
We learn that signals have a broader scope than variables which are only accessible within one process.
So how can we use signals for communication between several processes?
Well, we will do that.
And we have created signals up here and after the architecture line and before the beginning line.
So these will be defined everywhere.
As you can see, this one count up will be defined everywhere to now.
We have already learned to use weight, which is do it intentionally.
And we also used weight for which is used to wait for a specific amount of time, like wait for ten
nanoseconds now that exist, two more types of weight statements.
The weight on statement will balls, which is here.
It will pose the process until one of the specified signals change.
So if this signal changes and all this signal change, this weight will be over and it will move on.
And Prentis.
So basically the weight on statement will pose the process until one of the specified signals change.
Now, the wait until statement, which is this statement.
Will pose until an event causes the condition to become true.
And in our case, the condition is countered by equals countdown.
So it will wait until count equals countdown, then it will print equal.
Now, in fact, wait on wait until and wait for can be combined in one line now to combine them.
I will do it here just to show you how to do it.
You can't wait on.
Sorry.
And you can count down until count.
Countdown equals count up.
For 10 seconds, so here we combine the three with statements and one wait on wait until and wait for
in one line.
Now this will pause for a second or until the countdown signal, uh, equals account signal.
And the third condition is if countdown changes.
Now, this is basically everything you need to know about the weight.
The first process here, increments that count up counter and decrements that countdown counter.
They are updated simultaneously, although the signal assignments of the two signals are on the front
lines in the process, a sound signal values only become effective when the program hits the weight
statement.
And we already explained this in the previous lesson.
The process performs this operation at the start of the simulation and then every 10 nanoseconds.
The second process, which is this one, the first line is Weight on Count Countdown.
The program will weight this line until one or both of the signals change, as we can see from the code.
This happens at zero nanosecond now and the counters are changed for the first time.
And every time they change after that, we can move on and print this.
The third process, the first line is wait until count equals countdown.
The program will wake up every time one of the two signals change, just like the first process did.
But it will only continue if the expression evaluates to true.
Otherwise it will go back to sleep, as we can see from the code written here.
Now wait until it will wait until this is true.
Then it will execute the report equa.
Now, that's it for the wait on and wait until I hope that you did understand how to use them inside
your code.
Now, the take away from this is that wait on wait wait until one of the signals change.
Wait until you will wake up if one of the signals change, but will only continue if the expression
is true.
Wait on wait until and wait for can be combined.
That's it for this lesson.
I hope that you did understand everything.
Thanks for watching.
This is Isha from Educational Engineering Team.