Hello, guys, and welcome back.
It's time to implement our pledge using the dataflow method.
Remember, we could design this using structural method, going to block diagram maybe and just interconnect
a bunch of gaits together.
That is one of the structural methods we could use behavioral by just defining how should this research
work from a high level concept that could work.
But since we did not really get into learning how we can do dataflow, I want to teach you a little
bit about dataflow and some of the problems that may come across when you are trying to program in the
dataflow.
A dataflow design method is where you specify exactly how the inputs and outputs are related together
or how the input is flowing to the output.
So that's why it's called dataflow.
So right now, what we are going to do is we going to create an audio file and we're going to start
coding.
Now, the cliche is, as it is the Library I, triple E and the logic one one six four, now let us
create a new entity.
And we're going to call it S or Lache, OK?
Now, what should we have in the port?
We have is organic, you not, or the had we are going to use it as an internal signal because in the
actual or you don't really care a lot about Kunhardt, we could reprogram it.
But I really don't want to.
I'm just going to have it as an internal signal.
We have learned about internal signals and how we can define it in the before finding the architecture
in a separate section called Signal.
So first, let us create the inputs and outputs so we have s and or which are inputs and it is stored
logic.
Next I have my Q and Q is an output and it is also an estimate.
OK, let's put a semicolon at the end of the parentheses and then we will end our Lache next.
As I said, we need to define Q had as an internal signal.
So it's not that the output.
So we have a signal, we are going to call it not.
Q And it's also.
Nested logic.
OK, now let's start the architecture.
So this is architecture.
And behavioral.
And it's going to be off as or large.
And is now that now that has defined the architecture.
Behavioral.
Of all that is.
Now, in this section, we can define our signal.
So this is signal I want my not Q to be a logic because as I said, I don't want my not Q to be the
output.
I just want it to be an internal signal that is processed internally.
OK, so now we can say begin and take a look at the circuit.
It looks very simple.
Now let us do the data flow method.
It simply says that.
Q It's nothing but or.
No, we're not.
Q Correct.
I mean, take a look, not here is the input and always the input and then we get Q as an output, so
we just reprogramming of the key, how the output should look like next.
What is not.
Q Actually not.
Q is nothing but.
Q Nor.
Let's end this.
And it should be it I mean, for the first look, this should work, right?
I mean, we are specifying how the flow of input and output is going to be and we're defining our inputs,
outputs, and this should be enough.
But unfortunately, it's not.
Let's see what happens if I try to compile this, of course, after saving this file.
So we will call it as our Lache.
Now, this is our last night to be at the top, so this is a top level entity and.
Let's compile.
Now, I'm telling you, this will not work.
And as you can see, it's not really working.
OK, there he is, a little bit different.
Behave OK.
This should be behavioral.
Now that the stockpile again.
This one also should not work.
OK, here is the error I'm looking for.
Interface object you of mode out cannot be read y because Q is an output and you are trying to read
it.
And this does not work like that in video.
You cannot read an output.
That's not correct.
You can read an input, but you cannot read an output.
So how can we solve this riddle?
I mean, take a look at you, actually, Q is an input in order to generate Q hat, so there is a feedback.
So Q is an input for some places and it's an output at other places.
How can you resolve that?
Well, fortunately we support Stipe's.
That is called in out.
So the prototype type here could be in ELT, meaning Q is not treated as an input organ, although it's
treated as both.
Now let's try and recompiling and see what's going to happen and it's compiling.
Great.
And we're done now, let's simulate this.
We create a new VW airfoil.
Let me add all the notes.
And let us start simulating.
So we're seeing this as a thick line because this is an input output.
All right, so let's put all the cases we have zero zero we need when the reset is one and said to zero,
we want when it's the opposite, when set is one, our reset to zero.
And I want the case where both of them I once.
Now, let me save this file and I'm going to call it a Sarlat.
Great, now let me.
Go to simulation settings, restore default, and let's delete this line here.
Like save money on simulation.
And here we go.
Let us take a look and see what's going on when all is zero and zero.
Well, look, it is undefined.
That's correct, because you should retain its last value and actually don't have a lost value.
This is my first ever value.
This is the beginning of time.
And you should retain its value on both of these are zeroes.
And this is what's happening.
So acute is undefined when to zero zero.
And that's correct, because I did not drive it anywhere yet.
Next, once that is zero.
Q is zero.
Right.
Because when you push a reset you get a zero.
And Q Wonderful.
Now when I tried to have it reset zero and set one.
Q Should be one.
And that's also correct.
Now, when they are both won, well, it's an undefined case.
And usually it is an overdrive for at.
And this case should not be allowed, actually, but in some of the circuits, they use these types
of as latches and when you drive is together, they reset, always overdrive.
They said, well, I'm going to tell you, where do we use the circuit?
If you worked ever in p.l.c. and you have the set reset coils.
Well, sometimes you want let's say that this set reset is starting a motor.
And what you want is if you press reset, you want, even if the motto is rotating, you want it to
stop because maybe this is that is linked to some emergency button.
So this not only to stop immediately, no matter what what it is doing.
So if you connect connected to Latch and you just hit reset, it's going to overcome and override the
set and it's going to drive the bus, the bit the bus here to zero.
OK, so that's it, we've done it.
And as you can see here, when they are both zero, we are maintaining the last value.
It was zero when it is zero zero.
Now we are maintaining the best value.
We have the history of what is the lowest value, unlike here, here.
This is the beginning of time.
And you are telling jeté just retain the last value and is like, what kind of lost value are we talking
about?
I have nothing but here.
When you tell it zero zero and you tell it OK, retain of the lost value it will say OK, my lost value
was zero.
I am retaining it.
OK, and that's it for the.