WEBVTT

00:12.140 --> 00:18.500
Welcome to when else statements with select When statement lecture and this lecture I'm going to talk

00:18.500 --> 00:25.990
about the when else with select and with select when statements in the VHDL language.

00:26.000 --> 00:31.910
So first let's talk about the when else statement A Well statement allows a signal to be assigned a

00:31.910 --> 00:34.890
value based on a set of conditions.

00:34.970 --> 00:38.810
The statement is considered a concurrent signal assignment.

00:38.810 --> 00:44.690
This is directly placed into your architecture and it is when all statements are very similar to a case

00:44.690 --> 00:45.640
statement.

00:45.710 --> 00:53.120
However a case statement when you create them you must place them inside a process and your micel design

00:53.510 --> 00:58.640
where when else statement does not need to happen inside of a process.

00:58.940 --> 01:03.870
So an example of a one else statement we have two signals A and B.

01:03.980 --> 01:09.250
They're both standard logic vectors or signal B is from 3 and 0.

01:09.260 --> 01:17.690
So it's 4 bits wide or signal A is from 1 down to zero so two bits wide and we'll use or when else statement

01:18.160 --> 01:26.630
and or when a statement is going to assign a value to B when depending upon the value of a sort of value

01:26.630 --> 01:27.230
of b.

01:27.260 --> 01:31.790
For example the first line will be equal to 1 000.

01:31.790 --> 01:34.280
When a is equal to zero zero.

01:34.550 --> 01:43.410
Otherwise B will be equal to 0 1 0 0 when they is equal to 0 1 and just on down the line or B will be

01:43.410 --> 01:45.200
equal to 0 0 1 0.

01:45.200 --> 01:53.090
When a is equal to 1 0 and also be equal to 0 0 0 1 when a is equal to one one.

01:53.090 --> 01:58.040
Now you'll know if you look at this statement you could say hey I can implement this in a case statement

01:58.460 --> 02:01.210
and me personally I would do that.

02:01.220 --> 02:06.470
These are just kind of it's more of a personal preference in VHDL as the lot of other languages you

02:06.470 --> 02:12.980
can do a lot of the same things just using different coding style structures or different statements.

02:12.980 --> 02:18.500
So in this case if you wanted something to put it directly in the architecture and you want it to happen

02:18.500 --> 02:21.990
before clock edge you would use a When statement.

02:22.010 --> 02:28.190
However if you need it to happen on the rising or falling edge of a clock or in Iowa every time a signal

02:28.220 --> 02:32.520
changes state you would want to use a case statement and place in a process.

02:32.600 --> 02:38.000
And so it's more like a personal preference or depending upon the specific design application.

02:39.110 --> 02:45.740
Now if we have a with select When statement This allows one of several possible values to be assigned

02:46.130 --> 02:52.940
to a signal based on a select expression the choice is slight and must be determined when being compiled.

02:53.210 --> 02:55.160
This is similar to a case statement as well.

02:55.160 --> 03:01.040
So you'll notice that with the select statement as well as the with select When statement.

03:01.100 --> 03:03.830
They're very similar they do the same exact thing.

03:03.850 --> 03:06.310
It's once again just kind of a preference.

03:06.350 --> 03:11.280
I've been doing this for multiple years and I almost always go with a case statement.

03:11.300 --> 03:15.860
I just think they look cleaner nicer and it's easier for me to understand but it's a personal preference

03:15.860 --> 03:16.390
thing.

03:17.730 --> 03:23.020
When when you're working with with Slyke When statement we have an example.

03:23.050 --> 03:35.770
So we have our with a select Y is equal to zero when 000 or C 1 when 0 0 1 and a comma.

03:36.070 --> 03:39.550
And we keep going down line like are C to when 0 1 0.

03:39.580 --> 03:45.150
Or C 3 when 0 1 1 and then we have our zero win others.

03:45.330 --> 03:50.960
And so it's a slight difference from the with select statement or with statement.

03:51.040 --> 03:55.180
This is kind of a a little difference but once again like I said it's just kind of a personal preference

03:55.180 --> 03:59.400
whichever you prefer on what looks cleaner to you what's easier for you remember.

03:59.590 --> 04:05.100
And so you kind of just make that decision now that we have covered all the different statements and

04:05.100 --> 04:05.610
loops.

04:05.610 --> 04:10.110
Next we're going to discuss the HGL processes and concurrent statements.
