# Ch.4-2 Multi-Cycle Processor ###### tags: `Computer Organization`, `計算機組織` ## What’s Wrong with Single-Cycle? single-cycle processor最大的缺點在於:即便每個指令的datapath不同,造成執行時間不同,大家還是都需要等待至一個固定時間結束才可以進行下一步。如此則效率不彰,且這些時間的浪費在single-cycle中是無法被避免的。 ## Multicycle Implementation ``` 目的:減少時間的浪費 ``` ``` 方法:根據不同指令要用到的不同元件,把datapath切開,不要一定要同一個datapath 這樣才可以令不需要用到某些元件的指令"真正"不去使用,進而達到"減少浪費時間"的目的 ```  :::danger 注意: 因為把原本在一個cycle要完成的事情分開 所以要多加storage element(紅框)儲存中間結果,才不會意外被改導致錯誤 storage element可以用latch或flip-flop ::: :::info 概念:把比較耗費時間的部分切開成一個獨立的部分 如下圖1這樣切,大致有五個步驟-- 1. (IF)instruction fetch:讀取instruction memory 2. (ID/RF)instruction decode and register fetch:產生control signal跟讀取暫存器中的值 3. (EXE)Execution:純ALU運算;記憶體位址計算(經過sign extension & shift & ALU);branch與否(看ALU的zero bit) 4. (MEM)memory access or R-format時 rewrite the result of ALU to register 5. (Write back, WB)load時 memory read and rewrite the result of ALU to register 每個指令的根據運作過程的不同,最短可用3 cycle,最長用到5 cycle ::: :::info 下圖2是一張表格,表示不同指令所需要的cycle 1. R-format:4 2. load/store:5/4 3. branch/jump:3 :::  ``` 這裡分割出5個execution steps 將會在pipeline(4-3)中被大量用到 (這張表格可以用有限狀態機表示) ```  ``` 經過設計,下圖即為最終multi-cycle processor版本 (並未詳述) ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up