1. 程式人生 > >《Computer Organization and Design》Chap.4 筆記

《Computer Organization and Design》Chap.4 筆記

摘要:

  1. 怎樣建立datapath?需要哪些elements?如何連線這些elements?
  2. 怎樣控制datapath?8bits的control linel包含了哪些signals?
  3. pipeline!
  4. 其他提高效能的方法,如並行、迴圈展開。

4.7-4.9、4.11待看。

內容:
elements盤點——
1.Instruction memory——a memory unit to store the instructions of a program and supply instructions given an address.
Instruction memory


2.PC(Program Counter)——a register that holds the address of the current instruction.
3. An adder to increment the PC to the address of the next instruction.

以上三個elements組成了instruction fetch的datapath。

4.Register file——A register file is a collection of registers in which any register can be read or written by specifying the number of the register in the file.
Register file


5.ALU
ALU
6.Data memory unit——A state element with inputs for the address and the write data, and a single output for the read result.
Data memory unit

7.Immediate generation unit——sign-extend the 12-bit offset field in the instruction to a 64-bit signed value.
ImmGen
8.Control unit——2bits ALUOp、RegWrite、ALUSrc、PCSrc、MemRead、MemWrite和MemtoReg。
ALUOp


在這裡插入圖片描述
以上8個elements組成一個麻雀雖小五臟俱全的datapath——
Datapath with control unit
一圖說明pipeline如何起作用:
Pipeline
Pipeline Hazards: structural hazard, data hazard and control hazard.
Figure 4.17 之 single-cycle——
在這裡插入圖片描述
Figure 4.31 之 pipeline version——
在這裡插入圖片描述
在pipeline中加入control之後——
Pipeline datapath with control
4.10講instruction-level parallelism (ILP)的技巧,還建議去看Computer Architecture: A Quantitative Approach,這部分看得似懂非懂還有待琢磨。迴圈展開的技巧在CSAPP Chap.5中剛看過。
4.12用了迴圈展開去優化Matrix Multiply程式。