Video
Đăng bởi Ban biên tập OpenER ·
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ả.
[MUSIC PLAYING] PROFESSOR: Hello, and welcome back to the RISC-V CPU design module.
[NHẠC PHÁT] GIÁO SƯ: Xin chào, chào mừng bạn quay lại modul thiết kế CPU RISC-V của chúng ta.
We have designed a configurable datapath. And we have outlined the logic, control logic, that sets up the datapath to execute pretty much every instruction that we have in the RV32I based instruction set.
Chúng ta đã thiết kế một đường dẫn dữ liệu có thể cấu hình. Và chúng ta đã phác thảo logic, logic điều khiển, logic điều khiển cài đặt đường dẫn dữ liệu để thực thi hầu hết mọi lệnh mà chúng ta có trong tập lệnh dựa trên RV32I.
In the process, we have figured out that there is a lot of stuff that happens concurrently in both datapath and the logic.
Trong quá trình đó, chúng ta đã nhận ra rằng có rất nhiều việc xảy ra đồng thời trong cả đường dẫn dữ liệu và logic.
For example, while we are retrieving an operant from the register file, we are generating the immediate, as well, concurrently.
Ví dụ, trong khi chúng ta đang lấy một toán hạng từ tệp thanh ghi, chúng ta cũng đang tạo số mở rộng, đồng thời.
We have also gotten some sense for the timing, Timing is very important.
Chúng ta cũng có được một số ý niệm về thời gian, Thời gian là rất quan trọng.
Obviously, these — this logic that implements the datapath and the control takes some time to complete.
Hiển nhiên, logic này — logic mà thực hiện datapath và điều khiển cần một khoảng thời gian để hoàn thành.
And that critical path — the longest time that it takes us to execute an instruction in a datapath sets how frequently we can operate around the clock on this processor, and sets how many instructions we can run per second.
Và đường tới hạn đó — khoảng thời gian lâu nhất mà nó cần để thực thi một lệnh trong một datapath quyết định tần số mà chúng ta có thể hoạt động xung quanh xung nhịp trên bộ xử lý này, và quyết định có bao nhiêu lệnh chúng ta có thể chạy mỗi giây.
We've gotten only qualitative sense for timing, so far, so we are going to try to make it a bit more quantitative in this section.
Chúng ta chỉ có một hiểu biết định tính về thời gian cho đến nay, vì vậy chúng ta sẽ cố gắng làm cho nó định lượng hơn một chút trong phần này.
So to do that, let's examine our well-known datapath that we have had before. So this is the same picture as we have had before, along with the control module below it.
Vì vậy để làm điều đó, hãy kiểm tra datapath nổi tiếng của chúng ta mà chúng ta đã có trước đây. Vì vậy đây là cùng một hình ảnh như chúng ta đã thấy trước đây, cùng với mô-đun điều khiển bên dưới nó.
And we'll execute a very familiar instruction, which is a register-based add. This instruction runs like every single one, every single one that we have already seen running on this datapath.
Và chúng ta sẽ thực thi một lệnh rất quen thuộc, đó là một phép cộng dựa trên thanh ghi. Lệnh này chạy giống như mọi lệnh, từng lệnh một, mà chúng ta đã thấy chạy trên đường dẫn dữ liệu này.
It starts the execution on the rising edge of a clock, that's when we update the program counter. The new value of the program counter appears at its output.
Nó bắt đầu thực thi vào cạnh lên của đồng hồ, đó là lúc chúng ta cập nhật bộ đếm chương trình. Giá trị mới của bộ đếm chương trình xuất hiện ở đầu ra của nó.
And there are two things that happen concurrently. We add 4 to it, and we fetch the instruction from the instruction memory. Those two processes will take about a comparable amount of time.
Và có hai điều xảy ra đồng thời. Chúng ta cộng 4 vào đó, và chúng ta lấy lệnh từ bộ nhớ lệnh. Hai quá trình đó sẽ mất khoảng thời gian tương đương nhau. Nhưng tôi không nói là mất cùng một khoảng thời gian.
I wouldn't say the same amount of time. Which one is going to be longer, it really depends on the technology that we implement this in.
Cái nào sẽ mất lâu hơn, nó thực sự phụ thuộc vào. tùy thuộc vào công nghệ mà chúng ta thực hiện nó.
So we are going to have a new value of PC plus 4 ready at the input of this multiplexer.
Vì vậy, chúng ta sẽ có một giá trị mới của PC cộng 4 sẵn sàng ở đầu vào của bộ dồn kênh này.
But the correct value is not going to be present in front of the PC until we have the value of PC cell settled.
Nhưng giá trị chính xác không được có mặt trước PC cho đến khi chúng ta có giá trị của ô PC đã ổn định.
So concurrently with that, we will fetch the instruction from the instruction memory. And when that signal appears, we have completed the phase — first phase of the execution, which is the instruction fetch.
Vì vậy, cùng lúc đó, chúng ta sẽ lấy lệnh từ bộ nhớ lệnh. Và khi tín hiệu đó xuất hiện, chúng ta hoàn thành giai đoạn — giai đoạn đầu tiên của quá trình thực thi, đó là lấy lệnh.
Now at that moment, two other things are going to happen concurrently.
Bây giờ vào lúc đó, hai điều khác sẽ xảy ra cùng lúc.
We will start the process of retrieving the values of the source registers, rs1 and rs2 from the register file, and we will start decoding the instruction.
Chúng ta sẽ bắt đầu quá trình lấy các giá trị của các thanh ghi nguồn, rs1 và rs2 từ tệp thanh ghi, và chúng ta sẽ bắt đầu giải mã lệnh.
As we decode the instruction, we'll figure out that it's an add.
Khi chúng ta giải mã lệnh, chúng ta sẽ phát hiện ra đó là một lệnh add.
That ad will tell us that we should set the PCSel to pick the top input from this multiplexer right there, that the immediate select control should be, I don't care, because we don't have an immediate in this instruction.
Lệnh add đó sẽ cho chúng ta biết rằng chúng ta nên đặt PCSel để chọn đầu vào trên cùng từ bộ dồn kênh này ở đây, và điều khiển chọn immediate nên được tôi không quan tâm, vì chúng ta không có immediate trong lệnh này.
Register write enable should be set to 1, because we do have to write the value of the addition back into the destination register of the register file. All branch signals are don't care.
Cho phép ghi vào thanh ghi nên được đặt thành 1, vì chúng ta phải ghi giá trị của phép cộng trở lại vào thanh ghi đích trong tệp thanh ghi. Tất cả các tín hiệu nhánh đều là don't care.
A select and B select are both zeros, because we are selecting the outputs of the — outputs of the register file.
A select và B select đều là zeros, vì chúng ta đang chọn các đầu ra của — đầu ra của tệp thanh ghi.
Whenever you select the set to add, memory rewrite the set to read, because we are not writing to the memory, and write back select the set to 1, so that we will be writing back the LU value.
Bất cứ khi nào bạn chọn set để cộng, memory rewrite set để đọc, vì chúng ta không ghi vào bộ nhớ, và write back select set thành 1, để chúng ta sẽ ghi lại giá trị LU.
As soon as the signal PCSel settles, we will have a valid output of that multiplexer set at the input of the program counter.
Ngay khi tín hiệu PCSel ổn định, chúng ta sẽ có đầu ra hợp lệ của bộ dồn kênh đó set ở đầu vào của bộ đếm chương trình.
But the new value into the program counter is not going to be written until we complete the cycle, and set up the next rising edge of the clock.
Nhưng giá trị mới vào bộ đếm chương trình sẽ không được ghi cho đến khi chúng ta hoàn thành chu kỳ, và chuẩn bị cho cạnh lên tiếp theo của xung đồng hồ.
What you see here is that this path is shorter than the one that is going to happen concurrently. There is way more blocks downstream. Let's see what is happening downstream.
Điều bạn thấy ở đây là đường dẫn này ngắn hơn so với đường dẫn sẽ xảy ra cùng lúc. Có nhiều khối hơn đáng kể phía sau. Hãy xem điều gì đang xảy ra phía sau.
So we are still in the instruction decode phase. It will complete at the moment when we get the valid outputs of the register file — from the register file.
Vậy chúng ta vẫn đang ở giai đoạn giải mã lệnh. Nó sẽ hoàn thành vào lúc chúng ta nhận được đầu ra hợp lệ của tập thanh ghi — từ tập thanh ghi.
So the register file read completes the instruction decode phase of execution. Then we proceed with the execute phase. During that, we will go through these two multiplexers.
Vậy việc đọc từ tập thanh ghi hoàn thành giai đoạn giải mã lệnh của quá trình thực thi. Sau đó chúng ta tiến hành giai đoạn thực thi. Trong đó, chúng ta sẽ đi qua hai bộ dồn kênh.
There are two multiplexers, but both propagation delays are happening concurrently, so we only count for one propagation delay there.
Có hai bộ dồn kênh, nhưng cả hai độ trễ lan truyền đều xảy ra đồng thời, vì vậy chúng ta chỉ tính một độ trễ lan truyền ở đó.
And then we go through the ALU delay, and we have completed the execute phase. So three phases are done.
Và sau đó chúng ta đi qua độ trễ của ALU, và chúng ta đã hoàn thành giai đoạn thực thi. Vậy là ba giai đoạn đã hoàn thành.
There is no memory access phase, when we are doing register based add, so we are proceeding to complete the write back. Write back doesn't have much here.
Không có giai đoạn truy cập bộ nhớ khi chúng ta đang thực hiện phép cộng dựa trên thanh ghi, nên chúng ta tiếp tục để hoàn thành ghi kết quả. Ghi kết quả không có nhiều điều cần xử lý.
There is only one multiplexer in the path. And we have data ready to be written back into the destination register. It will be written on the next rising edge of a clock.
Chỉ có một bộ dồn kênh trong đường dẫn. Và dữ liệu đã sẵn sàng để ghi kết quả vào thanh ghi đích. Nó sẽ được ghi vào cạnh lên tiếp theo của xung clock.
But, keep in mind, that this input into the register RD has to be stable setup time before the rising edge of the clock. So that has to be accounted for into the delay.
Nhưng hãy nhớ rằng, đầu vào này vào thanh ghi RD phải ổn định trong thời gian thiết lập trước cạnh lên của xung clock. Vì vậy điều đó phải được tính vào độ trễ.
So on the next rising edge of a clock, we'll update both the destination register and the program counter.
Vì vậy ở cạnh lên tiếp theo của xung clock, chúng ta sẽ cập nhật cả thanh ghi đích và bộ đếm chương trình.
Let's take a look at the timing diagrams that describe this in a bit more detail, and describe more of this concurrency of operations that are happening during the execution of the instruction.
Hãy xem các sơ đồ thời gian mô tả điều này chi tiết hơn, và mô tả thêm sự đồng thời của các phép toán đang xảy ra trong quá trình thực hiện lệnh.
So this is the same datapath that we have seen before. We are just annotating signals and the timing. Clock signal has its high and low values.
Đây là đường dẫn dữ liệu giống như những gì chúng ta đã thấy trước đây. Chúng ta chỉ đang chú thích các tín hiệu và thời gian. Tín hiệu xung nhịp có các giá trị cao và thấp.
Each one clock cycle corresponds to the time from one rising edge of a clock to the next rising edge of a clock.
Mỗi chu kỳ xung nhịp tương ứng với thời gian từ một cạnh lên của xung nhịp đến cạnh lên tiếp theo của xung nhịp.
So we have a total of two clock cycles in this diagram — to complete clock cycles in this diagram.
Vì vậy chúng ta có tổng cộng hai chu kỳ xung nhịp trong sơ đồ này — để hoàn thành các chu kỳ xung nhịp trong sơ đồ này.
We are going to show what we have at the output of a program counter. At the output of a program counter, we have a bundle of 32 wires.
Chúng ta sẽ hiển thị những gì chúng ta có tại đầu ra của bộ đếm chương trình đó. Tại đầu ra của bộ đếm chương trình, chúng ta có một gói 32 dây.
We are not going to show these 32 wires individually like we have — we are going to use a shorthand notation that we are introduced before. We're going to show them as a bundle.
Chúng ta sẽ không hiển thị 32 dây này riêng lẻ như chúng ta có — chúng ta sẽ dùng một ký hiệu tắt mà chúng ta đã được giới thiệu trước đó. Chúng ta sẽ biểu diễn chúng như một bundle.
And we are going to associate a hexadecimal value with that bundle. In this case, let's say the program counter has a value of 1000 hex.
Và chúng ta sẽ liên kết một giá trị thập lục phân với bundle đó. Trong trường hợp này, giả sử bộ đếm chương trình có giá trị 1000 hex.
The value at the output of the program counter is valid after the propagation delay that is equal to t clock to q.
Giá trị ở đầu ra của bộ đếm chương trình là hợp lệ sau độ trễ lan truyền bằng t clock to q.
And all 32 outputs of that program counter are valued at the same time. Now, two things are happening concurrently.
Và cả 32 đầu ra của bộ đếm chương trình đó đều có giá trị tại cùng một lúc. Bây giờ, hai điều đang xảy ra đồng thời.
We're fetching an instruction from the memory, and we're updating the program counter — incrementing the program counter.
Chúng ta đang lấy một lệnh từ bộ nhớ, và chúng ta cập nhật bộ đếm chương trình — tăng bộ đếm chương trình.
The value of PC plus 4 gets stable, gets updated after a propagation delay through that either. But there is one important difference here.
Giá trị PC cộng 4 trở nên ổn định, được cập nhật sau một độ trễ lan truyền qua bộ hoặc đó. Nhưng có một sự khác biệt quan trọng ở đây.
Well, when we are updating PC on the rising edge of a clock, all of those outputs change at the same time after clock to output delay, because all of them go through the same type of flip-flops, the same flavor of a flip-flop.
Khi chúng ta cập nhật PC trên cạnh lên của xung đồng hồ, tất cả các đầu ra đó thay đổi cùng một lúc sau độ trễ clock to output, vì tất cả chúng đều đi qua cùng một loại flip-flops, cùng một kiểu flip-flop.
These PC plus 4 outputs are not going to show up all at the same time.
Các đầu ra PC cộng 4 không sắp xuất hiện cùng một lúc.
The least significant bits of addition become stable sooner than the more significant bits. So we're going to have multiple of these classes.
Các bit ít quan trọng nhất của phép cộng trở nên ổn định sớm hơn các bit quan trọng hơn. Vì vậy chúng ta sẽ có nhiều những lớp này.
In these diagrams, we are always showing the last transition, which is the one that is going to be in the critical path.
Trong những sơ đồ này, chúng ta luôn hiển thị quá trình chuyển đổi cuối cùng, chính là quá trình nằm trên đường tới hạn.
So after the propagation delay of the most significant bit, the PC plus 4 is the new value. And at the same time, we are proceeding with fetching the instruction.
Vì vậy, sau độ trễ lan truyền của bit có ý nghĩa nhất, PC cộng 4 là giá trị mới. Và cùng lúc đó, chúng ta tiến hành tìm nạp lệnh.
And the instruction is going to show up at the output of the instruction memory. And it's also going to have 32 bits.
Và lệnh sẽ hiển thị ở đầu ra của bộ nhớ lệnh. Và nó cũng sẽ có 32 bit.
Here we are using a notation, where we this assemble that instruction and find out that it is an add.
Ở đây chúng ta sử dụng một ký hiệu, trong đó chúng ta lắp ráp lệnh đó và phát hiện ra rằng nó là một lệnh add.
Instead of showing 32 bits here, we show it's an add that adds contents of x2 and x3 and stores it in x1. Propagation delays are comparable to the other delays.
Thay vì hiển thị 32 bit ở đây, chúng ta hiển thị đó là lệnh add cộng nội dung của x2 và x3 và lưu trữ nó trong x1. Các độ trễ lan truyền tương đương với các độ trễ khác.
Now control logic is going to follow that. At this moment, when the instruction has been read from the memory, we have finished the instruction fetch phase of execution.
Bây giờ logic điều khiển sẽ theo sau. Vào thời điểm này, khi lệnh đã được đọc từ bộ nhớ, chúng ta đã hoàn thành giai đoạn nạp lệnh của quá trình thực thi.
So this is our instruction fetch. We are proceeding with the next phase, which is instruction decode.
Vậy đây là giai đoạn nạp lệnh của chúng ta. Chúng ta đang tiến hành đến giai đoạn tiếp theo, đó là giải mã lệnh.
Control logic does a part of that, and sets the control bits. Reading the registers — register values takes usually longer time than that.
Logic điều khiển thực hiện một phần việc đó, và đặt các bit điều khiển. Đọc các thanh ghi — việc lấy giá trị thanh ghi thường mất nhiều thời gian hơn.
And when those outputs are stable, we have completed a second phase of execution, which is instruction decode.
Và khi những đầu ra đó ổn định, chúng ta đã hoàn thành giai đoạn thứ hai của quá trình thực thi, đó là giải mã lệnh.
Then we perform the ALU operation. And at that point, we have completed the execute phase.
Sau đó chúng ta thực hiện phép toán ALU. Và tại thời điểm đó, chúng ta đã hoàn thành giai đoạn execute.
Finally, we are ready to write the result back into the register file.
Cuối cùng, chúng ta sẵn sàng ghi kết quả trở lại vào tệp thanh ghi.
There is a short delay between the ALU and the point when the write back signal is stable. It corresponds to this final multiplexer delay.
Có một độ trễ ngắn giữa ALU và thời điểm tín hiệu write back ổn định. Nó tương ứng với độ trễ bộ dồn kênh cuối cùng này.
But one thing that we have to keep in mind, we cannot have the next rising edge of a clock too early, otherwise, we will be violating the setup time.
Nhưng một điều mà chúng ta phải ghi nhớ, chúng ta không thể để xung lên tiếp theo của đồng hồ đến quá sớm, nếu không, chúng ta sẽ vi phạm thời gian thiết lập.
So we have to respect the setup time before this rising edge of our clock, TSU.
Vì vậy chúng ta phải tuân trọng thời gian thiết lập trước xung lên của đồng hồ, TSU.
So this last transition out of the — from the write back signal cannot come after the setup time of the register in the register file.
Vì vậy chuyển đổi cuối cùng này từ tín hiệu write back không thể xảy ra sau thời gian thiết lập của thanh ghi trong tệp thanh ghi.
So we are going to write the correct value into the register. So register one gets a new value that is the sum of the contents of register two and register three.
Vậy chúng ta sẽ ghi giá trị đúng vào thanh ghi. Vậy thanh ghi một nhận giá trị mới là tổng của nội dung thanh ghi hai và thanh ghi ba.
And notice that both program counter and register file are updated at the same time.
Và chú ý rằng cả con trỏ chương trình và tệp thanh ghi được cập nhật cùng lúc.
Clock to q delay after the rising edge of a clock. Hopefully, this was clear. Let's take a look at if we can quantify this timing.
Độ trễ từ clock đến q sau cạnh lên của clock. Hy vọng điều này đã rõ ràng. Hãy xem liệu chúng ta có thể định lượng độ trễ này không.
What we said, there are two things that are happening concurrently.
Những gì chúng ta nói là có hai điều đang xảy ra đồng thời.
And we are assuming here that the control logic definitely takes shorter time than the time that it takes us to retrieve the data from the register file.
Và chúng ta giả định ở đây rằng logic điều khiển chắc chắn mất ít thời gian hơn thời gian mà chúng ta cần để lấy dữ liệu từ tệp thanh ghi.
So there are two loops that set the timing. One that involves the propagation delay from the program counter through the other and the multiplexer and comes back to that program counter.
Vì vậy có hai vòng lặp xác định thời gian. Một vòng liên quan đến độ trễ lan truyền từ bộ đếm chương trình qua bộ dồn kênh khác và quay lại bộ đếm chương trình đó.
That delay path equals the clock to output delay of the program counter plus time to add time to propagate through the multiplexer and then has to meet the setup time of that program counter.
Độ trễ của đường này bằng độ trễ từ xung đồng hồ đến đầu ra của bộ đếm chương trình cộng thời gian cộng thêm thời gian để lan truyền qua bộ dồn kênh và sau đó phải đáp ứng thời gian thiết lập của bộ đếm chương trình đó.
The other part is clearly longer. It's a yellow one.
Phần còn lại rõ ràng là dài hơn. Đó là đường màu vàng.
In the yellow path, we go through the clock delay of the program counter, access time for the instruction memory, access time for the register file, multiplexer, ALU delay, another multiplexer, and then we, again, have to meet the setup time, but not of the program counter, the setup time of the register
Trong đường vàng, chúng ta đi qua độ trễ đồng hồ của bộ đếm chương trình, thời gian truy cập cho bộ nhớ hướng dẫn thời gian truy cập cho tệp đăng ký, bộ dồn kênh, độ trễ ALU, một bộ dồn kênh khác, và sau đó chúng ta lại phải đáp ứng thời gian thiết lập, nhưng không của bộ đếm chương trình, thời gian thiết lập của tệp thanh ghi
file. So we can write correctly the value into the rD.
tệp thanh ghi. Như vậy chúng ta có thể ghi chính xác giá trị vào rD.
So of those two, if you just compare these two terms, these three equations, it turns out that the max of these two is always going to be tIMEM, tReg, tmux, tALU, plus another tmux.
Vì vậy, nếu chúng ta chỉ so sánh hai số hạng này, ba phương trình này, hóa ra giá trị max của hai số này luôn sẽ là tIMEM, tReg, tmux, tALU, cộng với một tmux khác.
So the critical path here is the path of execution, not update of the program counter.
Vì vậy đường tới hạn ở đây là đường thực thi lệnh, không phải cập nhật bộ đếm chương trình.
Okay. This instruction had only four phases of execution. Let's take a look at an instruction that has five phases — five phases of execution, which is load word, or lw.
Được rồi. Lệnh này chỉ có bốn giai đoạn thực thi. Hãy xem một lệnh có năm giai đoạn — năm giai đoạn thực thi, đó là lệnh load word, hay lw.
So in that case, it works exactly the same way that the extraction is executed as all the others.
Vì vậy trong trường hợp đó, nó hoạt động hoàn toàn giống việc trích xuất được thực thi giống như các lệnh khác.
On the rising edge of a clock, we update the program counter, and the new value appears at the output of a program counter. Then we have two simultaneous paths that get exercised.
Trên cạnh lên của xung đồng hồ, chúng ta cập nhật bộ đếm chương trình, và giá trị mới xuất hiện ở đầu ra của bộ đếm chương trình. Sau đó, chúng ta có hai đường dẫn đồng thời được sử dụng.
We go through the other and update the value of a program counter, and fetch a new instruction. Then we start decoding that instruction.
Chúng ta đi qua cái khác và cập nhật giá trị của bộ đếm chương trình, và tìm nạp một lệnh mới. Sau đó chúng ta bắt đầu giải mã lệnh đó.
We set the control bits appropriately, PC plus 4 is — what is PCSel set to?
Chúng ta đặt các bit điều khiển một cách thích hợp, PC cộng 4 là — PCSel được đặt thành gì?
Immediate select is set to be of a type of I immediate, because loads are immediate of I types.
Immediate select được đặt thành kiểu I immediate, vì các lệnh load là immediate kiểu I.
Register write enable is set 1, because we are going to write back the result from that we retrieve from the memory. All branches are set to [INAUDIBLE]..
Register write enable được đặt bằng 1, vì chúng ta sẽ ghi lại kết quả mà chúng ta lấy từ bộ nhớ. Tất cả các nhánh được đặt thành [KHÔNG NGHE RÕ]...
A select is 0 to take rs1, and B select is set to 1 to take the immediate. ALU adds those two together.
A select là 0 để lấy rs1, và B select được set thành 1 để lấy immediate. ALU cộng hai cái đó lại với nhau.
Memory read write is set to read, because we're actually this time reading the memory.
Memory read write được set thành read, vì lần này chúng ta thực sự đang đọc memory.
And write back select is set to 0 such that we send the memory output to be written back into the destination register. We proceed with executing this instruction.
Và write back select được set thành 0 sao cho chúng ta gửi memory output để được ghi lại vào thanh ghi đích. Chúng ta tiếp tục thực hiện instruction này.
So since the PC plus 4 is ready early on, as soon as PCSel signal is ready, we'll write in your value into the program counter.
Vì PC cộng 4 đã sẵn sàng sớm, ngay khi PCSel signal sẵn sàng, chúng ta sẽ ghi giá trị vào program counter.
Now, two other things happen concurrently. And they start while we are decoding the instruction.
Bây giờ, hai điều khác xảy ra đồng thời. Và chúng bắt đầu trong khi chúng ta đang decode instruction.
First, the output — we read the — we access the register file, and we get the rs2 — rs1 at its output.
Trước tiên, đầu ra — chúng ta đọc — chúng ta truy cập tệp thanh ghi, và chúng ta lấy rs2 — rs1 ở đầu ra của nó.
Simultaneously, we also generate the immediate. It is not clear which one of these two is going to take longer time, because, if you remember, the immediate generation depends on decoding of the instructions.
Đồng thời, chúng ta cũng tạo ra giá trị immediate. Không rõ cái nào trong hai cái này sẽ mất nhiều thời gian hơn, bởi vì, nếu bạn nhớ, việc tạo ra immediate phụ thuộc vào việc giải mã của các hướng dẫn.
So we need to know that this is an I type of immediate in order to generate the correct immediate.
Vì vậy chúng ta cần biết rằng đây là một immediate kiểu I để tạo ra immediate chính xác.
So that delay tends to be comparable to the delay of retrieving the data from the register. So then the rest is similar to what we have seen before.
Vì vậy độ trễ đó có xu hướng so sánh được với độ trễ của việc lấy dữ liệu từ thanh ghi. Vì vậy phần còn lại thì tương tự như những gì chúng ta đã thấy trước đây.
This completes the instruction fetch, instruction decode phase. Instruction fetch was completed with the access to the instruction memory. This completes the instruction the code phase.
Điều này hoàn thành việc lấy hướng dẫn, pha giải mã hướng dẫn. Lấy hướng dẫn được hoàn thành với việc truy cập đến bộ nhớ lệnh. Điều này hoàn thành giai đoạn giải mã lệnh.
Then we go into the execute phase. That one is completed when the output of the ALU is valid, with the address that points to the memory. We go through the memory access phase.
Sau đó chúng ta đi vào giai đoạn thực thi. Giai đoạn đó hoàn thành khi đầu ra của ALU hợp lệ, với địa chỉ trỏ đến bộ nhớ. Chúng ta trải qua giai đoạn truy cập bộ nhớ.
And, finally, we write back the result of that into the destination register. Now we have three possible paths that could be critical.
Và cuối cùng, chúng ta ghi kết quả của đó vào thanh ghi đích. Bây giờ chúng ta có ba đường dẫn có thể là tới hạn.
One is this one that we have already figured out that is short. This Founder's Rock is the name of this color. It's a Berkeley color.
Một là cái này mà chúng ta đã tìm ra rằng nó khá ngắn. Tảng đá Founder's Rock này là tên của màu này. Đó là một màu của Berkeley.
It is definitely a shorter path than either one of these two. And these two other paths are almost the same.
Nó chắc chắn là một đường dẫn ngắn hơn nhiều so với hai cái này. Và hai đường dẫn khác này gần như giống nhau.
They just differ in the delay of the register file access versus the immediate generation delay. So in both of those cases, we go through the instruction memory.
Chúng chỉ khác nhau ở độ trễ của bộ file thanh ghi truy cập so với độ trễ tạo giá trị immediate. Vì vậy trong cả hai trường hợp đó, chúng ta đi qua bộ nhớ lệnh.
Then, either the immediate generation, or the register file followed by a mux, ALU data memory, and another multiplexer.
Sau đó, là tạo giá trị immediate, hoặc bộ file thanh ghi theo sau bởi một bộ dồn kênh, ALU, bộ nhớ dữ liệu, và một bộ dồn kênh khác.
We have to add clock to Q delay of the program counter that launched the instruction, and the setup time of the register file that needs to be met in order to correctly write back the result.
Chúng ta phải cộng độ trễ clock to Q của bộ đếm chương trình đã phát hành lệnh, và thời gian thiết lập của bộ file thanh ghi mà cần được thỏa mãn để ghi lại kết quả một cách chính xác.
When that is done, we can write back, write to complete this instruction, write back into the register, and update the program counter.
Khi điều đó được thực hiện, chúng ta có thể ghi lại, ghi để hoàn thành lệnh này, ghi lại vào thanh ghi, và cập nhật bộ đếm chương trình.
A little bit more conceptual timing shows what we have seen already in the previous few slides. It is showing what is happening during one clock cycle.
Một khía cạnh về thời gian khái niệm hơi phức tạp hơn cho thấy những gì chúng ta đã thấy trong một vài slide trước. Nó hiển thị những gì xảy ra trong một chu kỳ xung nhịp.
PC gets updated, and instruction fetch completes the first phase of execution. The time that it takes here is sometime that corresponds to instruction fetch.
PC được cập nhật, và tìm nạp lệnh hoàn thành giai đoạn đầu tiên của thực thi. Thời gian mà nó mất ở đây là lúc nào đó tương ứng với tìm nạp lệnh.
Then valid outputs at the output of the register file complete the instruction decode phase of execution.
Sau đó, đầu ra hợp lệ ở đầu ra của tệp thanh ghi hoàn thành giai đoạn giải mã lệnh của thực thi.
Then ALU stable aid early output finishes the execute phase. Stable memory output completes the memory access phase.
Đầu ra ổn định và sớm của ALU kết thúc giai đoạn thực thi. Đầu ra bộ nhớ ổn định hoàn thành giai đoạn truy cập bộ nhớ.
There is very little logic that is in the write back phase.
Có rất ít logic ở giai đoạn ghi lại.
So we have to go through that by piece of logic, and make sure that we meet the setup time of whatever we are writing back into before the next rising edge of the clock.
Vì vậy chúng ta phải đi qua từng phần logic, và đảm bảo rằng chúng ta thỏa mãn thời gian thiết lập của bất kỳ cái gì mà chúng ta ghi lại trước cạnh xung nhịp tăng tiếp theo.
If we put some numbers to it, instruction fetch say it takes 200 picoseconds until we get the results out of the instruction memory.
Nếu chúng ta gắn một số vào đó, tìm nạp lệnh nói rằng nó mất 200 picosecond cho đến khi chúng ta nhận được kết quả từ bộ nhớ lệnh.
And then takes another 100 picoseconds to read the registers to complete the instruction decode. ALU say takes 200 picoseconds and completes the execute phase.
Và sau đó mất thêm 100 picoseconds để đọc các thanh ghi để hoàn thành việc giải mã lệnh đó. ALU mất khoảng 200 picoseconds và hoàn thành giai đoạn thực thi.
Data memory say takes 200 picoseconds to get the data and complete the memory access phase. And, finally, write back says takes 100 picoseconds that includes that setup time.
Bộ nhớ dữ liệu mất khoảng 200 picoseconds để lấy dữ liệu và hoàn thành giai đoạn truy cập bộ nhớ. Và cuối cùng, ghi lại mất khoảng 100 picoseconds bao gồm thời gian thiết lập đó.
The total time is 800 picoseconds to execute this instruction.
Tổng thời gian là 800 picoseconds để thực thi lệnh này.
One thing that is worth noting is that not all the instructions go through every single phase.
Một điều đáng chú ý là không phải tất cả các lệnh đều đi qua từng giai đoạn.
So some of them are going to be done sooner, some of them are going to be done later. We always have to take the worst case.
Vì vậy, một số lệnh sẽ hoàn thành sớm hơn, một số lệnh khác sẽ được thực thi sau. Chúng ta phải luôn xem xét trường hợp tệ nhất.
In this case, the worst case is load word. Add only goes through four phases, as we have seen before.
Trong trường hợp này, trường hợp tệ nhất là lệnh load word. Lệnh add chỉ đi qua bốn giai đoạn, như chúng ta đã thấy trước đó.
Instruction fetch, instruction decode, ALU, or execute, and write back, so that takes only 600 picoseconds. Branch of equal goes only through three phases, and so on.
Lấy lệnh, giải mã lệnh, ALU, hay thực thi, và ghi lại, nên chỉ mất 600 picosecond. Lệnh branch if equal chỉ đi qua ba giai đoạn, và cứ tiếp tục như vậy.
Load word is the longest one. It takes 800 picoseconds. How fast we can clock that? Well, we can clock it at maximum clock frequency.
Lệnh load word là lâu nhất. Nó mất 800 picosecond. Chúng ta có thể xung nhịp nhanh đến bao nhiêu? Chúng ta có thể xung nhịp ở tần số tối đa.
That is 1.25 gigahertz.
Đó là 1,25 gigahertz.
It should be noted that if we were somehow able to clock this datapath, so we can execute just one piece of it, we would have been able to run this at the frequency that corresponds to the longest
Cần lưu ý rằng nếu chúng ta có thể nào đó xung nhịp đường dẫn dữ liệu này, để chúng ta có thể thực thi chỉ một chỉ chạy một phần của nó, chúng ta sẽ có thể chạy cái này ở tần số tương ứng với độ trễ dài nhất
delay of each execution units — of each of the units that are in the datapath. So perhaps we could run this at 5 gigahertz.
của mỗi đơn vị thực thi — của mỗi đơn vị nằm trong đường ống. Vì vậy có lẽ chúng ta có thể chạy cái này ở 5 gigahertz.
We can't do that, because we can't just execute some instructions and not the others, or just perform the addition and neglect everything else.
Chúng ta không thể làm điều đó, vì chúng ta không thể chỉ thực thi một số lệnh mà không thực thi những lệnh khác, hay chỉ thực hiện phép cộng mà bỏ qua mọi thứ khác.
But we are going to see how we can benefit from that a bit later. We'll take a quick break now, and be back in a second.
Nhưng chúng ta sẽ thấy cách chúng ta có thể hưởng lợi từ điều đó một chút sau. Chúng ta sẽ nghỉ ngắn bây giờ, và sẽ quay lại ngay.
Đă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.