Welcome to when else statements with select When statement lecture and this lecture I'm going to talk
about the when else with select and with select when statements in the VHDL language.
So first let's talk about the when else statement A Well statement allows a signal to be assigned a
value based on a set of conditions.
The statement is considered a concurrent signal assignment.
This is directly placed into your architecture and it is when all statements are very similar to a case
statement.
However a case statement when you create them you must place them inside a process and your micel design
where when else statement does not need to happen inside of a process.
So an example of a one else statement we have two signals A and B.
They're both standard logic vectors or signal B is from 3 and 0.
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
and or when a statement is going to assign a value to B when depending upon the value of a sort of value
of b.
For example the first line will be equal to 1 000.
When a is equal to zero zero.
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
equal to 0 0 1 0.
When a is equal to 1 0 and also be equal to 0 0 0 1 when a is equal to one one.
Now you'll know if you look at this statement you could say hey I can implement this in a case statement
and me personally I would do that.
These are just kind of it's more of a personal preference in VHDL as the lot of other languages you
can do a lot of the same things just using different coding style structures or different statements.
So in this case if you wanted something to put it directly in the architecture and you want it to happen
before clock edge you would use a When statement.
However if you need it to happen on the rising or falling edge of a clock or in Iowa every time a signal
changes state you would want to use a case statement and place in a process.
And so it's more like a personal preference or depending upon the specific design application.
Now if we have a with select When statement This allows one of several possible values to be assigned
to a signal based on a select expression the choice is slight and must be determined when being compiled.
This is similar to a case statement as well.
So you'll notice that with the select statement as well as the with select When statement.
They're very similar they do the same exact thing.
It's once again just kind of a preference.
I've been doing this for multiple years and I almost always go with a case statement.
I just think they look cleaner nicer and it's easier for me to understand but it's a personal preference
thing.
When when you're working with with Slyke When statement we have an example.
So we have our with a select Y is equal to zero when 000 or C 1 when 0 0 1 and a comma.
And we keep going down line like are C to when 0 1 0.
Or C 3 when 0 1 1 and then we have our zero win others.
And so it's a slight difference from the with select statement or with statement.
This is kind of a a little difference but once again like I said it's just kind of a personal preference
whichever you prefer on what looks cleaner to you what's easier for you remember.
And so you kind of just make that decision now that we have covered all the different statements and
loops.
Next we're going to discuss the HGL processes and concurrent statements.