Tác giả giữ toàn bộ bản quyền (All Rights Reserved) — không phải giấy phép mở. Bạn vẫn xem và học miễn phí trên OpenER; muốn tái sử dụng cần xin phép tác giả.
DAN GARCIA
And welcome back.
Now let's take a deeper look at the accumulator we tried to do a couple of lectures ago now that we know what a register is and a flip-flop is, and actually how to think about some of the timing issues that are accompanying the register details.
So there's only two slides in this lecture. It's a complicated one. So let's actually dig deeper on this. Make sure we're at the same with understanding what's happening.
Here's my clock. My clock is going to have rising edges. And things are going to happen as those rising edges hit. I'm going to indicate the adder propagation delay with tau sub add.
That's another way we think about it. And the clock to q delay, half of that. Let's just think about that. And you're going to see this is complicated.
We kind of turn this on its side to kind of show you a little bit better. So x sub i is going to be changing. Here's my x sub i having different values.
It starts at 0. Here's x0, x1, x2, et cetera. Here's the hard part. This register has got a Reset button.
The most important thing on this slide, I think, is that the reset — if the register clocks up, so rising edge, turns around, and there's an input D, but also the register line is asserted or high, I'm going to ignore my D and reset myself.
So kind of the idea is the reset takes priority over the D. So I can't care what the D is if my job is to reset myself. So that's really important.
Here's another thing that's confusing to many students. I've got an S sub i here, and I've got an S sub i minus 1 here.
And you're going to say, well, shouldn't this be S sub i plus 1? Isn't that right? Does that make more sense? Well, let's think about it.
Let's say we're at the S sub i minus iteration. I went back and grabbed it. I grabbed the rising edge of the clock. It resets low.
D asserted. And now I'm now going to grab S sub i minus 1 and show S sub i minus 1. So now I'm holding it stable.
So S sub i minus 1 is being stable on the S sub i minus first iteration. It comes around instantaneously.
And then x sub i changes to the next value of i, the last value of i. And so this is the final output, whatever that is. This is like all but the last number.
Let's say that's what I mean. Let's say that's the n minus 1. Maybe n minus 2 here. But it's all but the last number.
This then can change to the last number, and then this holds the sum. So really, you're right.
This is S sub i, because as that last number comes in, I'm holding all but the last number on my S sub i minus 1. x sub i is the last number.
It would be x sub n minus 1. And then, boop, this is now the final value. So it makes sense that this is S sub i and this is S sub i minus 1.
We want to think about the circuit timing. We could take a look at this. As you see this, watch what happens. It takes a little bit of time.
This S sub i to S sub i minus 1 is always going to be S sub i minus. S sub i is sampled.
And that value is then shown there always. Sampled, shown there. Sampled, and shown there. So that's pretty clear, what that does.
Then there's going to be an adder delay. x is going to change. We don't actually know whether x is synchronous or asynchronous.
x is basically hopefully a rhythmic number, but who knows where it is regard to the actual rising edges of the clock? x could be shifted all around there.
So only after — watch this — x is going to change. I happened to draw this really nicely. Let me clean this up.
I've got a new value of x, just as — what's this device? This has S sub i minus 1 here and x sub i.
So I'm looking at this is the adder between these two values. S sub i minus 1 and x sub i. And thankfully, they both change at exactly the same time.
So now I have to wait T add before that is seen on the output. Get it? x sub i, x sub i as x sub 0, x1.
This is now x sub 0 plus x sub 1. And this is the output. So that's the output. It's stable here.
That's pretty cool. Now let's actually go one more level of detail into this. Let's actually really look at this. And this is fun to do.
So please feel free to do this on your own. Grab the slides. Mark them up. I encourage you to do this.
You'll learn a lot by the process. I'm now including the reset value. I'm including that I have no idea what S sub i minus 1 was before. I don't know what was locked in.
I buy a register from Fry's Electronics. Who knows what was stored into it? I don't even know. You're in a rented apartment.
Who knows what the condition of your apartment is going to be before you open your first door? Then you clean it up. You reset it. Now you've got a nice apartment.
It's yours. But when you get some used thing, who knows what was in there before? So I'm going to draw that as I don't know what was here before.
All right. Again, we're going to do the same thing we did before, but really slowly. So first, let's put some numbers in here. Here, 1, 2, 3, 4.
All right. My reset signal is shown. Let's go really slowly to make sure we understand what's happening.
In practice, x may not arrive to the adder at the same time of S sub i [INAUDIBLE]..
A slide before, we were like, ah, let's make the ideal case they both arrive at the same time. That adder may see an offset.
You don't know when x comes in. x is an asynchronous number. So now by drawing them different, watch what happens. This is the fun thing. Here we go, first thing.
Ready? Who knows what happened in the past? Who knows the condition of that register? But I do know that that first clock, what do we get?
Reset as high. I'm going to ignore the input S sub i. So ignore that for that time. And I reset it.
So boom, I wait T clock to q. And who is my output? S sub i minus 1. Therefore, this reset controls that number.
And it's reset to zero. So that's the first — I got the first there. Now it's stable at zero. So now what's the next thing to happen?
Well, that's a zero. And now xi — what's the next device? This adder has S sub i minus 1. So S sub i minus 1 and x sub i.
And this is the adder, so same place. So these guys are going to control — oops. These guys are going to control what happens here.
So both of these control what happens there at the S sub i output. So here is my zero. Here is my — this was a zero before.
So that, I have to wait T add. And I go, and that value after T add is available here, 0, 0. I'm going to write here. But again, I don't know what this.
This is zero. Who knows? And now here's the key. Only at the next time right here, there's my line.
Only at that time do I have a stable x sub i at zero, a stable new value of x sub i. And in a way, I kind of didn't care what was here.
Now I've got a stable x of 0 right there. After T add, that's the time I have that x sub 0 set on S sub i.
And by the way, I hope that is stable from T setup before the clock through T hold after. That's the important thing. And we're going to see that in a little bit more detail.
And it happens to be in this picture. Why do I care about that being stable? Because this is being sampled right there. And that output is going right there.
When is it going? After clock to Q. So it's often useful to do this on graph paper, where you make like T clock to Q. One box, as it's done here.
T adder is two boxes. Kind of play with it a little bit. And maybe make the clock eight boxes or something so you can see this.
It's really useful to draw this on a big whiteboard or graph paper. So now I've got a stable x0. Now, here's the fun — here's the part that's really interesting.
There's my first value of S sub i of minus 1. x sub i happens to be not synchronized with S sub i minus 1. So now watch this.
This is crazy. Right here at this time — oops. I'll try to zoom in here. So right there, I have — what's on the input?
The input, this is the adder. The input of the adder, folks, is x sub 0 and x sub 0. I should never have two x sub 0's in my output.
And so watch what happens. After right there, T add, in this window, that value is x0 plus x0, a wrong value.
I should never have that. I should have 0, x sub 0, x sub 0 plus x sub 1, x sub 0 plus x sub 2.
I should never have x sub 0 plus x sub 0. But it does for that exact window of time. Because of this, S sub i is temporarily wrong.
But because this circuit stabilizes before it gets sampled at the clock period, it's temporarily wrong. For this window of time, those inputs are x sub 0 plus x sub 0.
But at this time, now they're right. Now I've got an x sub 0 plus x sub 1. And so then that's the right value.
And now, hopefully, the circuit is built right. What happens? That stable T setup before this and stable T hold after, and now I've got x sub 0 plus x sub 1.
And the right thing happens. So ask yourself, what happens if you ever overclock a system? Overclocking a system means you turn the clock frequency up.
Turning the clock frequency up means you shrink the period. What starts to fail? Well, let's look at the circuit.
As I turn my clock frequency up, as my yellow lines start to shrink, what happens? Well, all of a sudden, I'm starting to violate something. What's getting violated?
Why would this ever be in kind of a — why would this ever break? This is going to work perfectly as long as I have a nice, slow clock frequency.
A big old long period, I'm fine. This starts to fail when all of a sudden that delay where it's stable — here, look. Boom. Right here, S sub i is stable.
But what if this is the line for — and it's a little wiggly — for T setup. Well, it's still good. It's stable before T setup.
And all of a sudden, as I'm making the clock period smaller and smaller, now T setup is getting closer and closer to when it is stable.
And when it just crosses that, that's at my problem point. So it turns out that it's the setup and hold issue that causes circuits to be wonky, circuits not to be stable.
So that's the issue. It is that you start to infringe on my setup to hold. That was a rule. We agreed.
That's the rule.
You bought it, and said, look, if you don't have a stable value on the input of this flip-flop between setup time before the clock rising edge of the clock and hold time after, I can't guarantee what I'm going to do.
I may have a value of a half, whatever that means for the voltages there. I may wobble. I may go into a defibrillated heart attack, up and down.
Who knows? I may start ignoring my input, and I'll just hold this forever. Who knows where the flip-flop is going to break.
That starts to happen if you ever have a changing value between setup and hold.
And that's what starts to happen as I turn this clock cycle up, and these yellow lines get closer, all of a sudden, the delay before it's stable before I sample it, now it's not stable anymore, and I'm sampling a change value.
All of a sudden, flip-flop, it goes into a bad situation. That's exactly what happens. See? So in good circuits, instability never happens around the rising edge of a clock, time before, time after.
In bad circuits, it does. So that's what starts to break as you overclock systems, you have this. And by the way, it's okay.
And in real life, it's okay to have the input to some state of register. The input to the register can be some crazy value.
But I don't care as long as it's the right value between setup and hold. I've said the same thing multiple times, but I really want to make sure I emphasize that.
The critical thing is it's stable between setup and hold. And then I'm good. I don't care if it's actually bad between. It's all right to have x be totally asynchronous.
In fact, you can even play with this in how far can you move x to be asynchronous, be changing until this stops working? So all those things are interesting.
We have drawn it in a way that it actually does work.
But if I slid it the wrong way so it just is changing exactly right at the wrong time, if it's changing just so that by the time the adder delay gets factored in, all of a sudden, it's changing in there.
Or how about this? Then I would have trouble. Or if I turn up T add. If I make T add bigger, I turn a little knob on T add.
I buy a cheaper Ti with a discount. I went to the discount bin to get the adder. Well, now T add is bigger.
Because of that, now that pushes into start impinging on my setup and hold time. So all those things affect the circuit.
But you can either turn the clock cycle up too high, or have T add too high, or even clock to q.
Clock to q could have — I mean, clock to q affects it as well. So if I made clock to q really big, it can start to impinge on its own.
The clock to q is part of the flip-flop. It could impinge on its own setup and hold as well as well, depending how you build the circuits. Boy!
Good stuff, right? Good stuff. All right, that's the end of this lecture. We'll see you in the next one.
Đăng nhập để đánh giá học liệu này.
Đăng nhập để bình luận — chưa ai bình luận về học liệu này.
Không có khóa học liên quan.