108 年 國立臺灣大學電子工程學研究所丁組《邏輯設計》
第 1 題16 分
Consider the following logic circuit. According to the specification, with applying the input vector (A, B, C, D) = (0, 0, 1, 1), the output value at F should be 0. However, the actual simulation result is 1. Assume the error is caused by using wrong gate types, and only three possibilities are considered: AND↔NAND, OR↔NOR, Inverter↔Buffer (one buffer equals two cascaded inverters). If a single error occurs, please write down the possible gate instance names where the error may occur.
🖼️【此處有附圖,請對照原卷】
登入後即可作答並保存紀錄。
核心觀念
本題考查:
- AND 與 NAND 的互換
- OR 與 NOR 的互換
- Inverter 與 Buffer 的互換
- 由輸入值逐級推導電路輸出,判斷哪一個單一閘門故障會使 由規格值 變成實際值
由圖可得電路關係:
分別輸入 與 ,而 也是 的另一個輸入,因此:
圖中正確閘門類型為:
- :AND
- :OR
- :Inverter
正常電路計算
輸入為:
因此:
為 OR 閘:
為反相器:
為 AND 閘:
為 OR 閘:
這與題目給定的規格值相同。
逐一分析單一閘門錯誤
第 2 題16 分
Consider a 4-input function.
.
(a) (8%) Apply Shannon expansion theorem to iteratively expand on (in order). Write down the fully expanded function .
(b) (6%) Use 2-to-1 multiplexors to implement obtained in (a), where can only be select signals.
(c) (2%) Redo (b) with the minimum number of 2-to-1 multiplexors.
登入後即可作答並保存紀錄。
核心觀念
本題考查三項重點:
- Shannon expansion theorem:
- 以 Shannon 展開建立多工器(MUX)電路。
- 利用布林代數重新分解函數,以減少 2-to-1 MUX 數量。
以下約定:
其中 為 select signal。
(a) 依序對 做 Shannon 展開
原函數為
第一次:對 展開
令 與 :
因此
第二次:對 展開
對 :
對 :
所以
第三次:對 展開
各 cofactors 為:
第四次:對 展開並寫成完全展開式
將所有輸入組合列出後,函數為
亦可合併同類項寫成
其中第一個式子是依序對 展開後的完整 minterm 形式。
(b) 依照完全 Shannon 展開使用 2-to-1 MUX
直接依照 的展開順序建立 MUX 樹:
- 第 1 層:8 個以 為 select signal 的 MUX
- 第 2 層:4 個以 為 select signal 的 MUX
- 第 3 層:2 個以 為 select signal 的 MUX
- 第 4 層:1 個以 為 select signal 的 MUX
總數為
層的輸入
依序固定 ,各子函數如下:
因此 層的 8 個 MUX,其 輸入分別為:
第 2 題16 分
Consider a 4-input function.
.
(a) (8%) Apply Shannon expansion theorem to iteratively expand on (in order). Write down the fully expanded function .
(b) (6%) Use 2-to-1 multiplexors to implement obtained in (a), where can only be select signals.
(c) (2%) Redo (b) with the minimum number of 2-to-1 multiplexors.
登入後即可作答並保存紀錄。
核心觀念
本題考查三項重點:
- Shannon expansion theorem:
- 以 Shannon 展開建立多工器(MUX)電路。
- 利用布林代數重新分解函數,以減少 2-to-1 MUX 數量。
以下約定:
其中 為 select signal。
(a) 依序對 做 Shannon 展開
原函數為
第一次:對 展開
令 與 :
因此
第二次:對 展開
對 :
對 :
所以
第三次:對 展開
各 cofactors 為:
第四次:對 展開並寫成完全展開式
將所有輸入組合列出後,函數為
亦可合併同類項寫成
其中第一個式子是依序對 展開後的完整 minterm 形式。
(b) 依照完全 Shannon 展開使用 2-to-1 MUX
直接依照 的展開順序建立 MUX 樹:
- 第 1 層:8 個以 為 select signal 的 MUX
- 第 2 層:4 個以 為 select signal 的 MUX
- 第 3 層:2 個以 為 select signal 的 MUX
- 第 4 層:1 個以 為 select signal 的 MUX
總數為
層的輸入
依序固定 ,各子函數如下:
因此 層的 8 個 MUX,其 輸入分別為:
第 3 題18 分
Given the following map of cell locations, we want to group the eight cells, a, b, ..., h, into two sets, so that adjacent cells belong to different sets. Two cells, i and j, are adjacent if and , where and are the x-coordinate and y-coordinate of cell i, respectively. Let and denote cell i belonging to groups 1 and 2, respectively.
🖼️【此處有附圖,請對照原卷】
(a) (8%) Express the above cell grouping problem in terms of a product-of-sums (POS) formula (Boolean Expression without simplification) such that the formula can be satisfied if and only if the cells in the given map can be grouped as desired.
(b) (6%) How many solutions are there to the formula of (a)? Write down all the solutions if there is any.
(c) (4%) Rewrite the formula of (a) in a minimum sum-of-products (SOP) expression.
登入後即可作答並保存紀錄。
核心觀念
兩個相鄰格子必須分屬不同群,因此每條相鄰邊都要求兩個變數值不同:
對布林變數而言,這等價於 XOR 條件,也可寫成 POS 形式:
解題方法
依圖讀出各格座標:
| 格子 | 座標 | 格子 | 座標 |
|---|---|---|---|
套用相鄰條件 且 ,相鄰格子對為:
每一對相鄰格子各自形成一個「兩變數不同」的 POS 因子。
(a) POS 公式
將八組相鄰條件逐一相乘,得到未化簡的 POS 公式:
第 4 題16 分
An M-N flip-flop has two inputs {M, N} and two outputs {Q, Q'}. It behaves as follows:
If MN = 11, the next state of output (Q+) is 0.
If MN = 10, the next state of output is the same as the present state.
If MN = 01, the next state of output is 1.
If MN = 00, the next state of output is the complement of the present state.
(a) (4%) Complete the following table for M, N.
| Present state | Next state | ||
|---|---|---|---|
| Q | Q+ | M | N |
| 0 | 0 | ||
| 0 | 1 | ||
| 1 | 0 | ||
| 1 | 1 | ||
| (b) (4%) Use your answer in (a) to derive the characteristic (next state) equation for this flip-flop. (i.e., express Q+ in terms of M, N and Q). | |||
| (c) (4%) Implement an M-N flip-flop based on T flip-flop. | |||
| (d) (4%) Write down the minimum SOPs of the next-state equations for both flip-flops in the following circuit. A+=? B+=? | |||
| 🖼️【此處有附圖,請對照原卷】 |
登入後即可作答並保存紀錄。
核心觀念
本題考查:
- M-N flip-flop 的狀態轉移規則。
- 由狀態表推導 characteristic equation。
- T flip-flop 的特性方程式:
- 以 T flip-flop 模擬其他型態 flip-flop。
- 最小和項式(minimum SOP)的化簡。
其中 表示 的反相,並非另一個獨立狀態變數。
(a) 完成狀態表
已知:
| 動作 | ||
|---|---|---|
| Reset | ||
| 保持 | ||
| Set | ||
| Complement |
逐列判斷:
-
必須是 或 。 -
必須是 或 。 -
必須是 或 。 -
必須是 或 。
因此:
| Present state | Next state | ||
|---|---|---|---|
(b) 推導 characteristic equation
依照 的四種情況,可直接寫成:
- 時,,對應項為 。
- 時,,對應項為 。
- 時,,對應項為 。
- 時,,沒有輸出項。
所以:
這就是 M-N flip-flop 的 characteristic equation。
亦可由完整 minterm 表示為:
其中變數順序採用 。
(c) 以 T flip-flop 實現 M-N flip-flop
T flip-flop 的特性為:
因此:
- 若 ,則 。
- 若 ,則 。
依照 M-N flip-flop 的動作建立 :
| 動作 | |||
|---|---|---|---|
| 為 | |||
| 保持 |
第 5 題16 分
Consider the following state graph.
🖼️【此處有附圖,請對照原卷】
(a) Simplify the given state graph with input and output . Draw the simplified state graph with minimum states.
(b) Implement the state graph in (a) using D flip-flops based on one-hot state assignment, which allocates one flip-flop for each state. Give the output function and all flip-flop input equations.
登入後即可作答並保存紀錄。
核心觀念
本題考查 Moore 狀態機的狀態等價與最小化,以及以 one-hot 編碼實作狀態機。
兩個 Moore 狀態等價,必須具有相同輸出,且對每一種輸入,其轉移到的狀態也等價。狀態合併後,若任一輸入的轉移仍落在同一組等價狀態內,分組便達到穩定,可得到最少狀態數。
解題方法
圖中有五個狀態:、、、、;輸出標示在狀態內,因此是 Moore 機。讀圖得到的轉移是: 在 時留在 、在 時到 ; 依序轉到 、; 轉到 、; 轉到 、; 轉到 、,其中每組目的地依序對應 。
先依輸出分組:
再檢查各狀態在 下所到達的分組:
| 狀態 | 到達的分組 | 到達的分組 | |
|---|---|---|---|
| 1 | |||
| 1 | |||
| 1 | |||
| 0 | |||
| 0 |
的轉移特徵互不相同,因此不能再合併; 與 輸出相同,且兩個輸入下都分別轉到 與 ,所以可合併。合併後的狀態分組為:
最小狀態機的轉移如下:
| 現態 | 次態 | 次態 | |
|---|---|---|---|
| 1 | |||
| 1 | |||
| 1 | |||
| 0 |
第 6 題18 分
Sophie is designing a digital padlock for her treasure case. The padlock has two buttons (‘0’ and ‘1’) that, when pressed, cause the finite state machine (FSM) controlling the padlock to advance to a new state. In addition to advancing the FSM, each button press is encoded on the signal ( for button ‘0’, for button ‘1’). The padlock unlocks when the FSM sets the Unlock output signal to 1, which it does whenever the last button presses are the same as the preset -digit code.
(a) Unfortunately, the design notes for the padlock are incomplete. Using the specification above and clues gleaned from the partially completed graphs below, please help Sophie to complete the state graph and its transition table. (Fill in the missing information.)
Please note that when done, (1) each state in the state graph should be assigned a 2-bit sequence (note that in this design the state assignment is not derived from the code that opens the padlock), (2) the arcs (lines with arrows leaving each state) should be mutually exclusive and collectively exhaustive, (3) the value for Unlock should be specified for each state, and (4) the transition table should be completed.
🖼️【此處有附圖,請對照原卷】
(b) Is the state graph in (a) a Moore machine or a Mealy machine?
(c) What is the code that opens the padlock?
登入後即可作答並保存紀錄。
核心觀念
本題考查有限狀態機的狀態轉移,以及 Moore 與 Mealy 機器的判別。狀態用來記錄目前輸入序列中,與密碼前綴相符的部分;每次輸入後,依仍匹配的最長前綴決定次狀態。Moore 機器的輸出只由目前狀態決定,Mealy 機器的輸出則由目前狀態與輸入共同決定。
解題方法
圖中可讀到:狀態 的 Unlock 為 ,輸入 時留在 、輸入 時轉至 ;狀態 的 Unlock 為 ,輸入 時留在 。圖中另有狀態 的 Unlock 為 ,而 在 時轉至 。依這些線索補齊轉移。
從初始狀態 開始,輸入 轉至 ,再輸入 轉至 ,再輸入 轉至 。因此,狀態 、、 分別代表目前序列末尾匹配密碼前綴 、、。
逐一補齊轉移:
- 狀態 :輸入 後仍沒有匹配的密碼前綴,留在 ;輸入 後進入 。
- 狀態 :輸入 後匹配到 ,進入 ;輸入 後末尾仍匹配前綴 ,留在 。
- 狀態 :輸入 後匹配到 ,進入 ;輸入 後末尾重新以 開始匹配,進入 。
- 狀態 :輸入下一個按鈕後,最近三次輸入不再是 。輸入 後沒有可保留的密碼前綴,轉至 ;輸入 後保留前綴 ,轉至 。
完整轉移表如下: