---
# System prepended metadata

title: 計算機組織期末
tags: [110-2學校上課]

---

###### tags: `110-2學校上課`
# 計算機組織期末
## ALU control
| 第幾個bit     | 功能        |
| ------------ |:---------------- |
| first        | aniver           |
| second       | bne              |
| third+fourth | 0:or 1:and 2:add |
## Lookhead 
gi = ai*bi
pi = ai+bi
ci = gi + pi * Ci-1
## Multiplication
![](https://i.imgur.com/A7s73aV.png)
![](https://i.imgur.com/IdV9ZvQ.png)
## Booth's Algorithm
00 nothing
01 +1
10 -1
11 nothing
## Wallace Tree Multiplier
3 數 = sum + array up
先不考慮進位，最後再考慮
## Divide
![](https://i.imgur.com/HZDusi8.png)
## Float
![](https://i.imgur.com/2MVXwXF.png)
![](https://i.imgur.com/61DyQDa.png)
![](https://i.imgur.com/cPgl1TQ.png)
## float add
![](https://i.imgur.com/1PB3Hsx.png)
## Round 
![](https://i.imgur.com/EXGXmAd.png)
## Stall
前後stage有使用上衝突，要pipeline stall (bubble)
## Hazards
### Structure Hazards
解決: reg and data mem split
### Data Hazards
![](https://i.imgur.com/kwvBFpe.png)
#### forwarding
ex to ex
1. Don’t wait for it to be stored in a register
2. Requires extra connections in the datapath
#### Load-Use 
mem to ex
lw form mem send to ex
### Control Hazards
##### Delayed branch
把可能會執行的指令搬移到分支指令之後，即delay branch slot
delay branch slot: 分支跳轉指令後的一個時間片段，選擇塞
入一條與分支判斷無關指令(不管分支發生與否均會執行) 。
#### R-type;s Wirte
![](https://i.imgur.com/HQTTZ6K.png)
![](https://i.imgur.com/VMWGtEe.png)
