Before we progressed further, we need to learn casting data types and how we can cast between values
and video.
Now, if you are programming it in the data flow mode or we are programming in the behavior, we need
some good skills in casting existing data types because.
Well, but first, let us define what is casting.
Getting is just converting one data type to another.
So assume you have an ideological vector that we have learned about.
It is really important to learn how we can convert it to an integer or to unsigned data types in order
to do that.
It's not really straightforward, but we need to learn how we can do proper casting and video.
Now, as I've said, we have learned about this ideologic vector, which is just a pack of bits that
are back together right now.
There is designed and signed, which we've also seen a little bit when we talk about four bit or three
bits, binary systems.
And we've seen how we can divide the range between assigned range and unsigned range.
Like for the four bits binary system, this side would be in the range between minus eight and seven,
and for the unsigned we would have the range between zero and 15.
Right now, if we already have that, why would we need a type called integer?
Well, the integer is by default 32.
And when you have when you define an integer, you cannot really specify how many bits does this integer
contain?
It is by default, 32.
That's OK.
That's the first point.
So the silent and silent is like ideologic vector, it gives you the control over how many bits you
want your number to be.
So you could so the same thing that you can ask the same thing when you can define Dealogic vector to
be, let's say, from seven down to zero or 15 down to zero or one down to zero by defining how many
bits you can do the same thing.
Four signed and unsigned, but integers.
No, you cannot do that.
Another advantage is that inside and inside, let's say you are counting and you have reached the limit,
meaning.
So let's say that you have a counter and it is counting in the four bit system.
Now this counter is unsigned and it has reached 15.
Now if you give another ball to count about 15, your counter will wrap up and it will start from the
beginning one more time.
So after reaching 15, you're going to go back to zero, then one, two or three and so on and so forth.
That's a great.
This goes for signed and unsigned.
It can read back from the beginning integers.
If you try to increment an integer counter above the limit of the 32 bits, you're going to get an error.
And that's really not something you want to do when you're counting with integers.
Another advantage of signed and unsigned, you can have access to all the individual bits, but in integers,
you don't have individual bits.
So there is a lot of differences between integer and signed.
And each of them has its own use.
Now we're going to focus on science and sound design and I'm going to go away a little bit from integers
at the moment.
Now, the convergence between these styles need to go in sequence.
So let's say you want to convert into the logic vector what you have defined in your input or output
and you want to convert it to an integer.
Well, that's not really straightforward.
You need first to convert it to signed or unsigned, and then this whole result in this side need to
be converted to an integer.
Let's say you have defined an integer and you want to convert it back twisted logic vector so that you
have more control over this integer or maybe to analyze it further.
If in order to do that, you need to first convert it to signed and signed and then you need to convert
it to a steady logic vector.
Now, you might ask, why am I giving you this in this slow, dry way?
Well, because in the next upcoming lectures, we're going to design and alien that will do a behavioral
structure design.
So it means it will try to add to numbers using behavioral methods or multiply two numbers using behavioral
methods.
So in order to do that, you need to really know what you're doing when we are casting.
I just want you to memorize this map, which is a vector sign, unsigned comes after and then integer
comes after and vice versa.
When you go back from integer twisted logic vector, we're going to see that in details in the upcoming
lectures.