## 計算機概論Lab-1
### Digital Logic

<p>https://hackmd.io/@IMOK/Lab1</p>
---
<img src="https://hackmd.io/_uploads/ryUSIqnJT.jpg" width=400 style="border-radius:1000px;"/>
講師: 賴昱有
---
<font size= 10>Logic Gate</font>

<font size =3>CREDIT:https://www.nutsvolts.com/magazine/article/small-logic-gates-spawn-big-dreams-part-1
</font>
---
<font size =5>訊號以二進位數字 0(false) 和 1(true)表示,對應於低電壓(0)和高電壓(1)。
數位邏輯利用邏輯閘(AND、OR、NOT )來進行基本運算,
這三個邏輯閘可以組合成任何更複雜的邏輯電路,用於處理、計算和儲存數據。</font>
----
## AND GATE
<img src= "https://hackmd.io/_uploads/ByXfxoNpC.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | y | z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
----
## OR GATE
<img src= "https://hackmd.io/_uploads/Bkn5Mj4pC.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | y | z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
----
## NOT GATE
<img src= "https://hackmd.io/_uploads/rJnrNjEpA.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | z |
|---|---|
| 0 | 1 |
| 1 | 0 |
----
## NOR GATE
<img src= "https://hackmd.io/_uploads/BJRxPsVaC.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | y | z |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
----
## XOR GATE
<img src= "https://hackmd.io/_uploads/S1RTEiE6R.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | y | z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
----
## XNOR GATE
<img src= "https://hackmd.io/_uploads/S1OsIjN6A.png" width=400 style="float : left ;margin : 100px 0px 0px 100px"/>
| x | y | z |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
---

---
## HALF ADDER
<div style="float: left;margin : 0px 20px 0px 30px">
<img src= "https://hackmd.io/_uploads/By3_X34aC.png" width=450 style="margin : 100px 0px 0px 0px"/>
<font size =4>CREDIT : [GITBOOK-HALF ADDER](https://tomorrow0w0.gitbooks.io/nand2tetris-homework/content/chapter2/HalfAdder.html)</font>
</div>
<div style="margin : 0px 0px 0px 0px">
<font size =5>1-bit 二進位的數字相加</font>
<font size =5>結果以 S 表示</font>
<font size =5>進位以 Cout 表示</font>
| A | B | S | Cout |
| --- | --- | --- |:----:|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
</div>
----
## FULL ADDER
<div style="float: left;margin : 50px 20px 0px 30px">
<font size =5>1-bit 二進位的數字相加</font>
<font size =5>Cin 為前一步的進位</font>
<font size =5>結果以 S 表示</font>
<font size =5>進位以 Cout 表示</font>
<img src= "https://hackmd.io/_uploads/ByS_oi4aC.png" width=450 style="margin : 20px 0px 0px 0px"/>
<font size =4>CREDIT : [GITBOOK-FULL ADDER](https://tomorrow0w0.gitbooks.io/nand2tetris-homework/content/chapter2/FullAdder.html)</font>
</div>
<div style="margin : 0px 0px 0px 0px">
<style>
table { font-size: 35px; }
</style>
| A | B | Cin | S | Cout |
| --- | --- |:---:| --- |:----:|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
</div>
---
<font size = 6>LogicCircuit Download URL:
<img src= "https://hackmd.io/_uploads/SkYjCqETR.png" width=100 style="margin : 20px 0px 20px 0px"/>
https://www.logiccircuit.org/download.html
</font>
----
<img src= "https://hackmd.io/_uploads/ryDTETNTA.png" width=700 style="margin : 20px 0px 20px 0px"/>
----
## TIPS
* crtl: multi select
* shift: draw select
* alt: split line
---
## 作業網站
<font size=5>作業做完請上傳到 http://140.121.197.13/tutorial
並且注意上傳時間限制、檔名、其他規範
上課時提前做完可以直接給助教 demo 登記
就不需要上傳 demo 過的部分
</font>
----
1. 利用 LogicCircuit 畫出下圖的邏輯電路<br>並產生出他的 Truth Table<br>請注意接點位置及工整度
<img src= "https://hackmd.io/_uploads/HJH0A3Ep0.png" width=700 style="margin : 30px 0px 0px 0px"/>
----
2. 利用 LogicCircuit 畫出下圖的 J-K flip flop
並產生出他的 Truth Table
請注意接點位置及工整度
<img src= "https://hackmd.io/_uploads/BJL803ETA.png" width=600 style="margin : 50px 0px 0px 0px"/>
----
3. 利用 LogicCircuit 畫出前面介紹過的 1-bit Full Adder並產生出他的 Truth Table請注意接點位置及工整度
4. 結合上面的 1-bit Full Adder 做出 2-bit Full Adder
5. (*) 結合上面的 2-bit Full Adder 做出 4-bit Full Adder
----
<font>(不計分)</font>
6. 多 bit 的 Full Adder 被稱為 Ripple Carry Adder請查閱與 Carry Lookahead Adder 的差別
{"title":"計算機概論LAB1","description":"image","contributors":"[{\"id\":\"738dd674-cd6a-462c-87e2-b67e68f12ac0\",\"add\":9093,\"del\":4441}]"}