109 年 國立臺灣大學電子工程學研究所丁組《邏輯設計》
第 1 題20 分
Given a Boolean function with the properties and (notice the complements), suppose is partially known as shown in the following Karnaugh map.
🖼️【此處有附圖,請對照原卷】
(a) (11%) Which of the unknown minterms () are uniquely determined? What are their values (please indicate all known values in a Karnaugh map)?
(b) (4%) How many functions satisfy the above constraints?
(c) (5%) Among these functions, which one has the simplest sum-of-product (SOP) expression?
登入後即可作答並保存紀錄。
核心觀念
函數在變數轉換後保持不變,代表同一等價類中的 minterm 必須有相同函數值。先依轉換找出等價類,再用已知格子的值傳播到同類 minterm。SOP 則可用 Karnaugh map 的相鄰格分組化簡。
解題方法
原圖欄位依序為 ,列依序為 ;已知 、、、、。題目給定交換 不變,且 換成 後函數值不變。以下依這兩種轉換建立等價類。
以 的索引為二進位 表示。兩種轉換都不改變 ;對 的等價類如下:
| 等價類 | 對應 minterm | 對應 minterm |
|---|---|---|
因此, 使 為 ; 使 為 。同理, 使 為 ; 使 為 。 各自所在的等價類沒有其他已知值,因此尚未確定。
完整 Karnaugh map 如下;「?」表示未被唯一決定:
(a) 唯一確定的 minterm
第 2 題15 分
Consider a Boolean function such that when , when and , and when and .
(a) (10%) Draw the Karnaugh map and express in minimum sum of products (SOP).
(b) (5%) If the minimum SOP expression obtained in (a) is implemented by a two-level AND-OR circuit, does it suffer from static 1-hazards? If yes, explain why and how to fix the problem. Otherwise, explain why not.
登入後即可作答並保存紀錄。
核心觀念
本題考查:
- 由條件式建立四變數 Boolean function 的 Karnaugh map。
- 利用相鄰的 格進行圈選,化簡為 minimum SOP。
- 判斷兩層 AND-OR 電路的 static 1-hazard。
- 利用共識項(consensus term)補足 hazard-free SOP。
Static 1-hazard 的判斷原則是:
若兩個相鄰的 格在 SOP 中沒有被同一個 product term 覆蓋,輸入變化時可能因閘門延遲不同而產生瞬間的 。
因此,hazard-free SOP 必須使每一對相鄰的 格至少被同一個乘積項涵蓋。
(a) Karnaugh map 與 minimum SOP
1. 依條件列出各情況
當 時:
因此:
- 時,;
- 時,。
當 時:
- :
- :
2. 找出輸出為 的 minterms
依照變數順序 :
- :
- :
- :
- :
所以:
3. Karnaugh map
列採用 的 Gray code 順序,列採用 :
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 00 | 0 | 1 | 1 | 1 |
| 01 | 0 | 1 | 1 | 0 |
| 11 | 1 | 0 | 1 | 1 |
| 10 | 0 | 0 | 0 | 1 |
4. 圈選
可作以下圈選:
圈選一:四格
涵蓋 :
圈選二:兩格
涵蓋 :
圈選三:兩格
涵蓋 :
圈選四:兩格
涵蓋 :
圈選五:兩格
涵蓋 :
因此 minimum SOP 為:
其中:
- 主要由 覆蓋;
- 需要 ;
- 需要 ;
- 需要 ;
- 、 可由相鄰圈選共同覆蓋。
第 3 題10 分
Consider the following switching network consisting of five switches.
🖼️【此處有附圖,請對照原卷】
(a) (5%) Give a minimum sum-of-product (SOP) Boolean expression describing the condition that the left and right terminals are connected.
(b) (5%) Give a minimum product-of-sum (POS) Boolean expression describing the condition that the left and right terminals are connected.
登入後即可作答並保存紀錄。
核心觀念
令開關閉合時為 ,斷開時為 。左、右端點相連的條件,是存在一條由左端點到右端點的「全閉合路徑」。
- 串聯:所有開關都閉合,使用 AND。
- 並聯:任一路徑成立即可,使用 OR。
- SOP:列出所有可能的導通路徑。
- POS:列出所有能切斷電路的最小割集。
圖中的五個開關形成兩條水平支路,並由 連接上下兩支路的中點。
(a) 最小 SOP
由左端點到右端點共有四條最小導通路徑:
- 上方路徑:、 串聯,條件為 。
- 下方路徑:、 串聯,條件為 。
- 經由中央開關的左上至右下路徑:、、,條件為 。
- 經由中央開關的左下至右上路徑:、、,條件為 。
因此連接函數為
這已是最小 SOP。四個乘積項分別對應四個必要的最小導通路徑,無法再以吸收律刪除。
(b) 最小 POS
改以「切斷左、右端點連接」來找最小割集。
最小割集一: 與
若 、 同時斷開,左端點無法進入電路,因此對應最大項
最小割集二: 與
第 4 題16 分
The following circuit diagram implements a finite state machine (FSM) with two state bits, and :
🖼️【此處有附圖,請對照原卷】
(a) (4%) Assume the propagation delays (delay from clock edge to Q), setup times, and hold times of rising-edge triggered D flip-flops are , , and , respectively. Assume the delays of inverter and NOR gates are and , respectively. Assume wire (interconnect) delays are zero. What is the smallest clock period for which the circuit still operates correctly?
(b) (4%) A sharp-eyed student suggests optimizing the circuit by removing the pair of inverters and connecting directly to . If the clock period can be adjusted appropriately, would the optimized circuit operate correctly? If yes, explain the adjustment to the clock period that would be needed.
(c) (4%) When the RESET signal is set to "1" for several cycles, what state is the FSM set to? (Give values of and .)
(d) (4%) Suppose there is skew in the CLK signal such that the rising edge of CLK always arrives at exactly before it arrives at . What is the smallest clock period for which the FSM still operates correctly?
登入後即可作答並保存紀錄。
核心觀念
此題考查同步循序電路的時序分析,包含:
- 暫存器的 clock-to-Q 延遲
- 組合邏輯延遲
- D 觸發器的 setup time
- hold time
- clock skew 對資料傳遞時間的影響
由電路圖可得:
經過兩個反相器後送至 ,因此:
其中 、。
(a) 最小 clock period
同步電路的 setup time 約束為:
到 的路徑
此路徑經過 NOR gate:
到 的路徑
此路徑經過兩個 inverter:
必須滿足所有資料路徑的 setup time,因此取較大值:
hold time 亦符合,因為最早資料變化至少在 clock edge 後 才發生,而 hold time 只有 。
(b) 移除兩個 inverter 後的電路
移除兩個 inverter 後,邏輯功能仍為:
因此功能上仍可正常運作。
此時 到 的路徑只剩下觸發器本身的 clock-to-Q 延遲:
而 到 的路徑仍需:
所以最佳化後的最小 clock period 為:
因此,最佳化電路可以正常運作,但 clock period 必須由原本至少 調整為至少 。
(c) RESET 設為
當 時,NOR gate 輸出必定為 :
第 5 題19 分
The following figure shows a digital lock design based on a 6-state finite state machine (FSM). The design has three buttons labeled "0", "1", and "" (Start), and generates an unlock signal (output) when the user presses followed by the sequence 0, 1, 1, 0.
🖼️【此處有附圖,請對照原卷】
(a) (6%) This design can be further simplified by removing the "" button. Please design a Moore FSM whose inputs are simply "0" and "1" buttons, whose output is the (unlock) signal, and which has the property that if and only if the last four button presses correspond to the sequence 0,1,1,0. Show the state transition diagram with fewest states corresponding to your design. (No partial credits for a FSM with more states.)
(b) (4%) Is it possible that an equivalent FSM might be implemented in fewer than 5 states? Explain.
(c) (4%) D flip-flops are used to hold your FSM states, and they contain random values when power is first applied to your lock. Does this constrain your handling of unused states? Explain and show your modified FSM state transition diagram.
(d) (5%) Use a ROM and several D flip-flops to implement your FSM. Completely specify the ROM contents including those corresponding to unused states.
登入後即可作答並保存紀錄。
核心觀念
本題考查:
- Moore 型有限狀態機:輸出只由「目前狀態」決定。
- 序列偵測器:狀態代表目前輸入序列與目標序列前綴的最長匹配部分。
- 狀態最小化:不同狀態若能被某段輸入序列產生不同輸出,就不能合併。
- 未使用狀態的處理:D 觸發器上電值不定,因此所有狀態編碼都必須定義後續行為。
目標序列為:
要求最後四次按鍵恰為 時,輸出 。
(a) 最少狀態 Moore FSM
狀態定義
令各狀態代表目前輸入序列與 的最長前綴匹配結果:
| 狀態 | 意義 | Moore 輸出 |
|---|---|---|
| 沒有匹配到有效前綴 | ||
| 最近輸入為 | ||
| 最近輸入為 | ||
| 最近輸入為 | ||
| 最近四次輸入為 |
狀態轉移推導
-
:
- 輸入 :形成前綴 ,到
- 輸入 :沒有任何有效前綴,留在
-
:
- 輸入 :最近仍可視為前綴 ,留在
- 輸入 :形成 ,到
-
:
- 輸入 :序列為 ,尾端仍有前綴 ,到
- 輸入 :形成 ,到
-
:
- 輸入 :形成 ,到
- 輸入 :序列尾端沒有有效前綴,回到
-
:
- 輸入 :序列為 ,尾端的有效前綴為 ,到
- 輸入 :序列為 ,尾端的有效前綴為 ,到
狀態轉移表如下:
| 目前狀態 | 輸入 | 輸入 | 輸出 |
|---|---|---|---|
文字狀態圖可表示為:
其中 的輸出為 ,其餘狀態輸出皆為 。
此設計可以正確處理重疊序列。例如輸入 時,第二次出現的 仍能被偵測。
(b) 是否可能少於 5 個狀態?
不可能。
五個狀態分別代表:
這些狀態兩兩皆可由某段後續輸入區分。例如:
- 與 :輸入 時, 可到達解鎖狀態,而 不會。
- 與 :輸入 時, 可到達 ,而 不會。
- 與 :輸入 時, 到 ,而 到 。
- 與 :空輸入即可區分,因為 的輸出為 , 的輸出為 。
- 其他狀態間也可利用適當後續輸入,使其中一個到達 而另一個不到達 。
根據有限狀態機最小化原理,若兩個狀態存在某段輸入序列會產生不同輸出,兩者便不可合併。因此最少需要:
(c) 未使用狀態的處理
五個狀態至少需要 個 D 觸發器,因為:
三個 D 觸發器共有 種狀態,其中有三種未使用狀態。
第 6 題20 分
Let and be two sequential circuits with states and , respectively, whose transitions are shown in the figure below.
🖼️【此處有附圖,請對照原卷】
(a) (5%) How many non-equivalent states are there in ? Which states are equivalent in ?
(b) (5%) How many non-equivalent states are there in ? Which states are equivalent in ?
(c) (5%) If and start from states and , respectively, are these two circuits equivalent (in terms of input-output behavior)? If yes, briefly explain why. Otherwise, identify an input sequence that distinguishes and .
(d) (5%) Redo (b) for and starting from states and , respectively.
登入後即可作答並保存紀錄。
核心觀念
本題考的是 Moore 狀態機的狀態等價與電路等價。圖中圓圈內的「狀態/數字」表示狀態名稱與該狀態的輸出,箭線上的數字表示輸入。
兩個狀態等價,必須滿足:
- 目前輸出相同。
- 對每一種輸入,其後繼狀態仍然等價。
因此,可以先依輸出分組,再依後繼狀態反覆細分,直到分組不再改變。若某個輸入序列使兩電路的輸出不同,該序列就是區分序列。
解題方法:讀圖與轉移表
原圖中, 只有 的輸出為 , 只有 的輸出為 。但 的自迴圈與 向下箭線都標示為 ,因此 在輸入 時有兩個後繼狀態,不符合確定性 Moore 狀態機的定義。
原題缺少的是 在輸入 時唯一的正確轉移。以下採用明確的修正假設:保留向下箭線 ,將 的自迴圈視為多畫的箭線。此假設下的轉移表如下:
| 電路 | 現態 | 輸出 | 輸入 的次態 | 輸入 的次態 |
|---|---|---|---|---|
(a) 的等價狀態
先依輸出分組:
輸入 時, 進入輸出為 的 ; 與 都進入輸出為 的 ,所以 必須獨立成組:
對 與 :
- 輸入 :兩者的次態都落在 。
- 輸入 :兩者的次態都是 。
分組不再改變,故
因此, 有 個非等價狀態類別。
(b) 的等價狀態
在上述修正假設下,初始分組為
比較輸出為 的三個狀態:
- 與 :輸入 後,分別到達 與 ,輸出為 與 。
- 與 :輸入 後,分別到達 與 ,輸出為 與 。
- 與 :輸入 後,分別到達 與 ,輸出為 與 。
三者彼此都不等價; 的目前輸出又與三者不同。因此, 有 個非等價狀態,沒有等價狀態對。
(c) 從 與 出發是否等價?
等價。 從 出發只能到達 ,不會到達 ,所以本小題不受 的圖面歧義影響。
將 的等價狀態合併,定義
其轉移與 的對應如下: