113 年 國立中山大學積體電路設計研究所碩士班《數位系統設計》

📄 試題原卷 免費註冊後即可對照原始考卷 PDF免費註冊

第 Problem 1 題20 分

Implement the following Boolean function
F(w,x,y,z)=xy+w′x′z′+wx′y′z′+wx′yzF(w, x, y, z) = xy+w'x'z'+wx'y'z'+wx'yz.
(a) by using only NOR gates. (5%)
(b) by using only NAND gates. (5%)
(c) by using the simplest sum-of-products form (5%)
(d) by drawing the logic diagram using a multiplexer (5%)

Please note that for (a), (b) and (c) you need to show the final Boolean function and how you derive the function.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題綜合考查四種布林函數實現方法:

  1. 布林代數化簡與卡諾圖分組
  2. NOR-only 實現:利用「NOR–NOR」結構實現乘積和式的對偶形式,即 POS。
  3. NAND-only 實現:利用「NAND–NAND」結構實現最簡和項積,即 SOP。
  4. 多工器(MUX)實現:將部分變數指定為選擇線,逐一求出各選擇組合下的資料輸入。

基本定義如下:

a′=NOR⁡(a,a)=NAND⁡(a,a)a'=\operatorname{NOR}(a,a)=\operatorname{NAND}(a,a) NOR⁡(A,B)=(A+B)′\operatorname{NOR}(A,B)=(A+B)' NAND⁡(A,B)=(AB)′\operatorname{NAND}(A,B)=(AB)'

原函數為

F(w,x,y,z)=xy+w′x′z′+wx′y′z′+wx′yzF(w,x,y,z)=xy+w'x'z'+wx'y'z'+wx'yz

其輸出為 11 的最小項為

F=∑m(0,2,6,7,8,11,14,15)F=\sum m(0,2,6,7,8,11,14,15)

解題方法:先求最簡 SOP

將最小項依照卡諾圖相鄰原則分組:

  • m(6,7,14,15)m(6,7,14,15):
xyxy
  • m(0,8)m(0,8):
x′y′z′x'y'z'
  • m(2,6)m(2,6):
w′yz′w'yz'
  • m(11,15)m(11,15):
wyzwyz

因此最簡和項積為

F=xy+x′y′z′+w′yz′+wyz\boxed{F=xy+x'y'z'+w'yz'+wyz}

此式比原式更適合用 NAND 閘實現。


(a) 只使用 NOR gates

1. 先轉成最簡 POS

由最小項可知,輸出為 00 的位置為

F=0於m(1,3,4,5,9,10,12,13)F=0\quad\text{於}\quad m(1,3,4,5,9,10,12,13)

在 00 的卡諾圖中分組:

  • m(4,5,12,13)m(4,5,12,13):
x′+yx'+y
  • m(1,5,9,13)m(1,5,9,13):
y+z′y+z'
  • m(1,3)m(1,3):
w+x+z′w+x+z'
  • m(10)m(10):
w′+x+y′+zw'+x+y'+z

因此得到最簡乘積和式:

F=(x′+y)(y+z′)(w+x+z′)(w′+x+y′+z)\boxed{ F=(x'+y)(y+z')(w+x+z')(w'+x+y'+z) }

2. 改寫成 NOR–NOR 結構

令

A=(x′+y)′=x′NOR⁡yA=(x'+y)'=x'\operatorname{NOR}y B=(y+z′)′=yNOR⁡z′B=(y+z')'=y\operatorname{NOR}z' C=(w+x+z′)′=wNOR⁡xNOR⁡z′C=(w+x+z')'=w\operatorname{NOR}x\operatorname{NOR}z' D=(w′+x+y′+z)′=w′NOR⁡xNOR⁡y′NOR⁡zD=(w'+x+y'+z)'=w'\operatorname{NOR}x\operatorname{NOR}y'\operatorname{NOR}z

最後:

F=(A+B+C+D)′=ANOR⁡BNOR⁡CNOR⁡DF=(A+B+C+D)'=A\operatorname{NOR}B\operatorname{NOR}C\operatorname{NOR}D

其中反相變數以 NOR 自己輸入自己產生:

w′=wNOR⁡ww'=w\operatorname{NOR}w x′=xNOR⁡xx'=x\operatorname{NOR}x y′=yNOR⁡yy'=y\operatorname{NOR}y z′=zNOR⁡zz'=z\operatorname{NOR}z

所以只使用 NOR gates 的完整表示式為

F=NOR⁡(NOR⁡(x′,y),NOR⁡(y,z′),NOR⁡(w,x,z′),NOR⁡(w′,x,y′,z))\boxed{ F= \operatorname{NOR} \left( \operatorname{NOR}(x',y), \operatorname{NOR}(y,z'), \operatorname{NOR}(w,x,z'), \operatorname{NOR}(w',x,y',z) \right) }

(b) 只使用 NAND gates

NAND–NAND 結構最適合實現 SOP:

F=xy+x′y′z′+w′yz′+wyzF=xy+x'y'z'+w'yz'+wyz

先將各和項取反:

A=(xy)′=NAND⁡(x,y)A=(xy)'=\operatorname{NAND}(x,y) B=(x′y′z′)′=NAND⁡(x′,y′,z′)B=(x'y'z')'=\operatorname{NAND}(x',y',z') C=(w′yz′)′=NAND⁡(w′,y,z′)C=(w'yz')'=\operatorname{NAND}(w',y,z') D=(wyz)′=NAND⁡(w,y,z)D=(wyz)'=\operatorname{NAND}(w,y,z)

最後以 NAND 將上述結果相加:

F=(A⋅B⋅C⋅D)′F=(A\cdot B\cdot C\cdot D)'

因此:

F=NAND⁡(A,B,C,D)\boxed{ F=\operatorname{NAND}(A,B,C,D) }

也就是

F=NAND⁡(NAND⁡(x,y),NAND⁡(x′,y′,z′),NAND⁡(w′,y,z′),NAND⁡(w,y,z))\boxed{ F= \operatorname{NAND} \left( \operatorname{NAND}(x,y), \operatorname{NAND}(x',y',z'), \operatorname{NAND}(w',y,z'), \operatorname{NAND}(w,y,z) \right) }

反相變數用 NAND 自己輸入自己產生:

w′=wNAND⁡ww'=w\operatorname{NAND}w x′=xNAND⁡xx'=x\operatorname{NAND}x y′=yNAND⁡yy'=y\operatorname{NAND}y z′=zNAND⁡zz'=z\operatorname{NAND}z

(c) 使用最簡 sum-of-products 形式

由卡諾圖分組:

m(6,7,14,15)→xym(6,7,14,15)\rightarrow xy m(0,8)→x′y′z′m(0,8)\rightarrow x'y'z' m(2,6)→w′yz′m(2,6)\rightarrow w'yz' m(11,15)→wyzm(11,15)\rightarrow wyz

因此最簡 SOP 為

F=xy+x′y′z′+w′yz′+wyz\boxed{ F=xy+x'y'z'+w'yz'+wyz }

快速驗算

各乘積項所涵蓋的最小項為:

xy→m(6,7,14,15)xy\rightarrow m(6,7,14,15) x′y′z′→m(0,8)x'y'z'\rightarrow m(0,8) w′yz′→m(2,6)w'yz'\rightarrow m(2,6) wyz→m(11,15)wyz\rightarrow m(11,15)

合併後:

{0,2,6,7,8,11,14,15}\{0,2,6,7,8,11,14,15\}

正好等於原函數的輸出為 11 的最小項集合。


(d) 使用 Multiplexer 實現

採用 4-to-1 multiplexer,選擇線指定為:

S1=w,S0=xS_1=w,\qquad S_0=x

依照 wxwx 的四種組合,求出函數對 y,zy,z 的關係。

當 wx=00wx=00

此時 w=0,x=0w=0,x=0:

F=w′x′z′=z′F=w'x'z'=z'

因此:

D0=z′D_0=z'

當 wx=01wx=01

此時 w=0,x=1w=0,x=1:

F=xy=yF=xy=y

因此:

D1=yD_1=y

當 wx=10wx=10

此時 w=1,x=0w=1,x=0:

F=y′z′+yzF= y'z'+yz

因此:

D2=y′z′+yzD_2=y'z'+yz

這是 yy 與 zz 的 XNOR 函數。

當 wx=11wx=11

此時 w=1,x=1w=1,x=1:

F=xy=yF=xy=y

因此:

D3=yD_3=y

MUX 連接方式

S1=w,S0=x\boxed{ S_1=w,\quad S_0=x } D0=z′,D1=y,D2=y′z′+yz,D3=y\boxed{ D_0=z',\quad D_1=y,\quad D_2=y'z'+yz,\quad D_3=y }

邏輯圖可表示為:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 Problem 2 題12 分

Short answer questions:
(a) Provide an example to demonstrate that a Boolean function can have more than one simplest form of expression, indicating its non-uniqueness. (3%)
(b) Provide an overview of the hardware structure of a sequential circuit and utilize this structure to explain how a sequential circuit is different in functionality and design from a combinational circuit. (4%)
(c) Present several waveform diagrams to illustrate and clarify the concepts of setup time and hold time in a D flip-flop. (5%)

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題涵蓋數位邏輯設計的三大核心基礎觀念:

  1. 布林函數化簡之非唯一性(Non-uniqueness of Minimal SOP Form):
    在卡諾圖(Karnaugh Map)或布林代數化簡中,若所有本質質隱項(Essential Prime Implicants, EPI)涵蓋完後,剩餘的最小項(Minterms)可由多組成本相同(項數與文字數相同)的非本質質隱項(Non-essential Prime Implicants)覆蓋,則該函數的最簡積之和(Sum of Products, SOP)式將具有非唯一性。
  2. 循序邏輯與組合邏輯之硬體架構與設計差異:
    • 組合電路(Combinational Circuit):無記憶性、無回授路徑,輸出僅由當前輸入決定(Z=f(X)Z = f(X))。
    • 循序電路(Sequential Circuit):包含組合邏輯、記憶元件(Memory Elements, 如 Flip-Flop/Register)與回授路徑(Feedback Path),電路輸出與次態(Next State)同時由當前輸入與現態(Present State)共同決定。
  3. D 正反器(D Flip-Flop)之時序參數(Timing Parameters):
    • 建立時間(Setup Time, tsetupt_{\text{setup}}):時脈觸發緣(Active Clock Edge)抵達前,資料輸入端 DD 必須維持穩定不變的「最短時間」。
    • 保持時間(Hold Time, tholdt_{\text{hold}}):時脈觸發緣抵達後,資料輸入端 DD 必須維持穩定不變的「最短時間」。
    • 時序違規(Timing Violation):若違反建立或保持時間,正反器內部雙穩態電路無法順利閂鎖,將引發亞穩態(Metastability)。

解題方法與詳細推導

(a) 布林函數最簡式非唯一性之範例(3%)

給定四變數布林函數:
F(A,B,C,D)=∑m(0,2,4,5,6,7,8,10,13,15)F(A, B, C, D) = \sum m(0, 2, 4, 5, 6, 7, 8, 10, 13, 15)

1. 繪製卡諾圖並找出所有質隱項(Prime Implicants, PIs):

示意圖
  • 四個角落群組(Corner Group):{m0,m2,m8,m10}  ⟹  B′D′\{m_0, m_2, m_8, m_{10}\} \implies B'D'
  • 第 2 列整列(Row 2):{m4,m5,m6,m7}  ⟹  A′B\{m_4, m_5, m_6, m_7\} \implies A'B
  • 中間四格(Center 2x2):{m5,m7,m13,m15}  ⟹  BD\{m_5, m_7, m_{13}, m_{15}\} \implies BD
  • 第 1、2 行外側垂直群組:{m0,m2,m4,m6}  ⟹  A′D′\{m_0, m_2, m_4, m_6\} \implies A'D'

2. 分析質隱項涵蓋:

  • m8,m10m_8, m_{10} 僅能被 B′D′B'D' 涵蓋   ⟹  B′D′\implies B'D' 為本質質隱項(EPI)。
  • m13,m15m_{13}, m_{15} 僅能被 BDBD 涵蓋   ⟹  BD\implies BD 為本質質隱項(EPI)。
  • 選取上述兩項 EPI 後,已涵蓋最小項:{0,2,5,7,8,10,13,15}\{0, 2, 5, 7, 8, 10, 13, 15\}。
  • 尚未涵蓋的最小項為:{4,6}\{4, 6\}。
  • 覆蓋 {4,6}\{4, 6\} 可以有以下兩種選擇:
    1. 選取質隱項 A′BA'B(含 2 個文字)
    2. 選取質隱項 A′D′A'D'(含 2 個文字)

3. 最簡式(Minimal SOP)結果:

  • 形式一:F=B′D′+BD+A′BF = B'D' + BD + A'B (共 3 項、6 個文字)
  • 形式二:F=B′D′+BD+A′D′F = B'D' + BD + A'D' (共 3 項、6 個文字)

兩者所用之閘極數(Gate count)與文字數(Literal count)完全相同,皆為最簡 SOP 式,證明最簡化表示式具非唯一性(Non-uniqueness)。


(b) 循序電路之硬體架構與功能/設計差異(4%)

1. 循序電路之通用硬體架構圖(Block Diagram)
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 Problem 3 題18 分

Design an asynchronously resettable positive edge-triggered finite state machine that accepts a one-bit input d and generates two one-bit outputs x and y.
x should be 1 if d has been 0 for at least two consecutive cycles.
y should be 1 if d has been 0 for at least three cycles (not necessarily consecutively).

(a) Give Verilog/VHDL codes of an asynchronously resettable positive edge-triggered flip-flop. (3%)
(b) Draw the state transition diagram and define each state clearly. (5%)
(c) Write RTL Verilog/VHDL codes to implement the finite state machine you designed in (b). (10%)

登入後即可作答並保存紀錄。

這一題的完整詳解

本題考查有限狀態機 (Finite State Machine, FSM) 的設計,特別是異步重置 (asynchronous reset) 的正緣觸發 D 觸發器,以及設計一個能夠偵測輸入序列的狀態機。

核心觀念:異步重置 D 觸發器、狀態機設計、狀態轉移圖、組合邏輯與時序邏輯的結合。

(a) 異步重置正緣觸發 D 觸發器的 Verilog/VHDL 程式碼

一個異步重置的 D 觸發器,當 reset 訊號為有效時 (通常是低電位 active-low 或高電位 active-high),無論時脈訊號如何,都會立即將輸出 Q 設定為重置值 (通常是 0)。當 reset 無效時,觸發器才響應時脈的正緣,將 D 的值傳遞到 Q。

Verilog 程式碼:

module d_flipflop_async_reset (
    input wire clk,      // Clock input
    input wire reset,    // Asynchronous reset input (active-high assumed)
    input wire d,        // Data input
    output reg q         // Output
);

    // Asynchronous reset logic
    always @(posedge clk or posedge reset) begin
        if (reset) begin
            q <= 1'b0; // Reset output to 0 when reset is high
        end else begin
            // Synchronous operation on positive clock edge
            q <= d;
        end
    end

endmodule

VHDL 程式碼:

library ieee;
use ieee.std_logic_1164.all;

entity d_flipflop_async_reset is
    port (
        clk   : in  std_logic; -- Clock input
        reset : in  std_logic; -- Asynchronous reset input (active-high assumed)
        d     : in  std_logic; -- Data input
        q     : out std_logic  -- Output
    );
end entity d_flipflop_async_reset;

architecture Behavioral of d_flipflop_async_reset is
begin
    process (clk, reset)
    begin
        if reset = '1' then -- Asynchronous reset (active-high)
            q <= '0';
        elsif rising_edge(clk) then -- Synchronous operation on positive clock edge
            q <= d;
        end if;
    end process;
end architecture Behavioral;

注意: 這裡假設 reset 為 active-high。若為 active-low,則 if reset = '1' 應改為 if reset = '0' (VHDL) 或 if (!reset) (Verilog)。

[Answer for (a)] (Verilog code provided above)

(b) 狀態轉移圖與狀態定義

我們需要設計一個狀態機,輸出 x 在 d 連續兩個週期為 0 時為 1,輸出 y 在 d 連續三個週期為 0 時為 1。狀態機需要記錄 d 為 0 的連續個數。

狀態定義:
我們需要追蹤 d 為 0 的連續次數。

  • 狀態 S0: 初始狀態,或前一個輸入 d 不是 0。
  • 狀態 S1: 前一個輸入 d 是 0,但再前一個不是 0。
  • 狀態 S2: 前兩個輸入 d 都是 0。
  • 狀態 S3: 前三個輸入 d 都是 0。

輸出定義:

  • x 輸出:當狀態機處於 S2 或 S3 時,表示 d 已連續為 0 至少兩個週期。
  • y 輸出:當狀態機處於 S3 時,表示 d 已連續為 0 三個週期。

狀態轉移圖:
設 D 輸入為 d,時脈觸發邊緣為正緣。狀態機有異步重置 (async_reset),當重置時,狀態機進入 S0。

  • 狀態 S0:

    • 若 d = 1:保持在 S0。
    • 若 d = 0:轉移到 S1。
    • 輸出:x=0, y=0。
  • 狀態 S1: (表示前一個 d 是 0)

    • 若 d = 1:轉移回 S0 (連續 0 的計數中斷)。
    • 若 d = 0:轉移到 S2 (連續 0 的計數增加)。
    • 輸出:x=0, y=0。
  • 狀態 S2: (表示前兩個 d 都是 0)

    • 若 d = 1:轉移回 S0 (連續 0 的計數中斷)。
    • 若 d = 0:轉移到 S3 (連續 0 的計數增加)。
    • 輸出:x=1, y=0。 (因為 d 已連續為 0 兩個週期)
  • 狀態 S3: (表示前三個 d 都是 0)

    • 若 d = 1:轉移回 S0 (連續 0 的計數中斷)。
    • 若 d = 0:保持在 S3 (連續 0 的計數繼續,但我們只需要記錄至少三個,所以保持在此狀態即可)。
    • 輸出:x=1, y=1。 (因為 d 已連續為 0 三個週期)

狀態定義總結:

  • S0 (Idle): 記錄的連續 0 的計數為 0。
  • S1 (Count 1): 記錄的連續 0 的計數為 1。
  • S2 (Count 2): 記錄的連續 0 的計數為 2。
  • S3 (Count 3+): 記錄的連續 0 的計數 >= 3。

狀態轉移圖:

示意圖

注意: 在狀態轉移圖中,每個箭頭上的標籤是觸發轉移的條件 (輸入 d 的值)。箭頭指向的狀態是下一個狀態。狀態標籤內顯示了該狀態的輸出 x 和 y。

[Answer for (b)]
State Definitions:

  • S0 (Count 0): Initial state. The previous input d was 1, or it's the reset state. No consecutive zeros counted.
  • S1 (Count 1): The previous input d was 0, but the input before that was 1. One consecutive zero counted.
  • S2 (Count 2): The previous two inputs d were 0. Two consecutive zeros counted.
  • S3 (Count 3+): The previous three or more inputs d were 0. Three or more consecutive zeros counted.

State Transition Diagram:
(Diagram described above)

State Transition Logic (Next State Logic):
Let current_state be the current state and d be the input. next_state is the state after the clock edge.

  • If reset is active, next_state = S0.
  • If reset is inactive:
    • If current_state = S0:
      • If d = 0, next_state = S1.
      • If d = 1, next_state = S0.
    • If current_state = S1:
      • If d = 0, next_state = S2.
      • If d = 1, next_state = S0.
    • If current_state = S2:
      • If d = 0, next_state = S3.
      • If d = 1, next_state = S0.
    • If current_state = S3:
      • If d = 0, next_state = S3.
      • If d = 1, next_state = S0.

Output Logic:

  • x = 1 if current_state is S2 or S3. Otherwise x = 0.
  • y = 1 if current_state is S3. Otherwise y = 0.

(c) RTL Verilog/VHDL 程式碼

我們將使用 Mealy 型機器來實現輸出邏輯,因為輸出 x 和 y 不僅取決於狀態,也可能取決於輸入 d。然而,根據上面的狀態定義和輸出邏輯,輸出 x 和 y 只取決於當前狀態。因此,這是一個 Moore 型機器。

Verilog 程式碼:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 Problem 4 題20 分

(a) Assume that the 4-bit binary adders are available. Please design a combinational circuit for the addition of two BCD digits using the 4-bit binary adder. Please draw the final logic circuit of the BCD adder with the 4-bit binary adder circuit block. Please note that you don't have to show the details of the 4-bit binary adder. (10%)
(b) Design a combinational circuit that generates the 9's complement of a BCD digit. Please note that you need to show the final Boolean function and how you derive the function. (10%)

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

  1. BCD 加法器(BCD Adder)基本原理:

    • BCD(Binary Coded Decimal,二進碼十進數)只使用 0∼90 \sim 9(即 00002∼100120000_2 \sim 1001_2),非法碼為 10∼1510 \sim 15(即 10102∼111121010_2 \sim 1111_2)。
    • 兩個 BCD 數字相加加上前一級進位 CinC_{in},其和的範圍為 0∼190 \sim 19(9+9+1=199 + 9 + 1 = 19)。
    • 第一個 4-bit 二進位加法器計算二進位和 K,Z8,Z4,Z2,Z1K, Z_8, Z_4, Z_2, Z_1(其中 KK 為進位輸出,ZZ 為 4-bit 總和)。
    • 當和數大於 9(即 10∼1910 \sim 19)時,產生十進位進位輸出 Cout=1C_{out} = 1,且因二進位以 16 為底、十進位以 10 為底,二者差值為 6,故必須對第一級和數加上修正值 66(即 011020110_2)。
    • 修正判斷條件: Cout=K+Z8Z4+Z8Z2C_{out} = K + Z_8 Z_4 + Z_8 Z_2
    • 使用第二個 4-bit 二進位加法器將第一級的和加上修正項 (0,Cout,Cout,0)2(0, C_{out}, C_{out}, 0)_2。
  2. 9 的補數(9's Complement)電路設計:

    • 設輸入 BCD 碼為 A=(A3,A2,A1,A0)2A = (A_3, A_2, A_1, A_0)_2(範圍 0≤A≤90 \le A \le 9),輸出 9 的補數為 Y=(y3,y2,y1,y0)2Y = (y_3, y_2, y_1, y_0)_2。
    • 運算定義: Y=9−AY = 9 - A
    • 輸入碼 10∼1510 \sim 15 為不可能出現的無效碼(Don't Care,dd),可利用卡諾圖(Karnaugh Map)簡化布林函數。

解題方法

(a) BCD 加法器設計

  1. 第一級二進位加法:

    • 輸入兩個 4-bit BCD 碼 A=(A3A2A1A0)A = (A_3 A_2 A_1 A_0) 與 B=(B3B2B1B0)B = (B_3 B_2 B_1 B_0),以及進位輸入 CinC_{in}。
    • 經由第一個 4-bit 二進位加法器(Adder 1)運算,輸出和數 (Z8,Z4,Z2,Z1)(Z_8, Z_4, Z_2, Z_1) 與進位 KK。
  2. 進位偵測邏輯(Correction Detector):

    • 當總和介於 0∼90 \sim 9 時:K=0K = 0,輸出合法,不需修正,Cout=0C_{out} = 0。
    • 當總和介於 10∼1510 \sim 15 時:K=0K = 0,此時 Z8=1Z_8=1 且 (Z4=1 或 Z2=1)(Z_4=1 \text{ 或 } Z_2=1),即 Z8Z4+Z8Z2=1Z_8 Z_4 + Z_8 Z_2 = 1。
    • 當總和介於 16∼1916 \sim 19 時:Adder 1 產生進位,K=1K = 1。
    • 綜合以上,BCD 加法器的進位輸出方程式為: Cout=K+Z8Z4+Z8Z2C_{out} = K + Z_8 Z_4 + Z_8 Z_2
  3. 第二級修正加法器:

    • 使用第二個 4-bit 二進位加法器(Adder 2)。
    • 加數一為 Adder 1 的輸出 (Z8,Z4,Z2,Z1)(Z_8, Z_4, Z_2, Z_1)。
    • 加數二為修正碼 (0,Cout,Cout,0)2(0, C_{out}, C_{out}, 0)_2。
    • 其進位輸入腳位接地(GND / 0)。
    • Adder 2 的輸出即為最終 BCD 和 (S3,S2,S1,S0)(S_3, S_2, S_1, S_0)。
  4. 邏輯電路圖:

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 Problem 5 題15 分

(a) Design a counter with T flip-flops that goes through the following binary repeated sequence: 0, 1, 3, 7, 6, 4. Show that when binary states 010 and 101 are considered as don't care conditions, the counter may not operate properly.(10%)
(b) Find a way to correct the design. (5%) Please note that you need to show the final Boolean function, the state diagram and how you derive the function.

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題考查:

  1. T 型正反器的激勵方程式
  2. 同步循序電路的狀態轉移設計
  3. Karnaugh map 中 don't care 的使用
  4. 非法狀態的自我修復(self-correcting counter)

設三個 T 型正反器的現態為

ABCABC

其中 AA 為最高位元,CC 為最低位元。

T 型正反器的特性方程式為

Q+=Q⊕TQ^{+}=Q\oplus T

因此激勵值為

T=Q⊕Q+T=Q\oplus Q^{+}

當 T=0T=0 時,正反器保持原狀;當 T=1T=1 時,正反器反相。


(a) 使用 don't care 的設計

題目要求的循環狀態為

000→001→011→111→110→100→000000\rightarrow001\rightarrow011\rightarrow111\rightarrow110\rightarrow100\rightarrow000

狀態 010010 與 101101 未指定,因此在設計初期視為 don't care。

1. 狀態與 T 輸入表

由 T=Q⊕Q+T=Q\oplus Q^{+} 計算各正反器的輸入:

現態 ABCABC次態 A+B+C+A^{+}B^{+}C^{+}TAT_ATBT_BTCT_C
000001001
001011010
010未指定XXX
011111100
100000100
101未指定XXX
110100010
111110001

其中 XX 代表 don't care。


2. 化簡 TAT_A

TA=1T_A=1 的狀態為 011011 與 100100,don't care 為 010010 與 101101。

利用 don't care 組合後:

  • 010,011010,011 組成 A′BA'B
  • 100,101100,101 組成 AB′AB'

因此

TA=A′B+AB′T_A=A'B+AB'

也就是

TA=A⊕BT_A=A\oplus B

3. 化簡 TBT_B

TB=1T_B=1 的狀態為 001001 與 110110,並利用 don't care:

  • 001,101001,101 組成 B′CB'C
  • 010,110010,110 組成 BC′BC'

因此

TB=B′C+BC′T_B=B'C+BC'

也就是

TB=B⊕CT_B=B\oplus C

4. 化簡 TCT_C

TC=1T_C=1 的狀態為 000000 與 111111,並利用 don't care:

  • 000,010000,010 組成 A′C′A'C'
  • 101,111101,111 組成 ACAC

因此

TC=A′C′+ACT_C=A'C'+AC

也就是

TC=A⊙CT_C=A\odot C

其中 ⊙\odot 表示 XNOR。


為何電路可能無法正常運作?

將非法狀態代入上述函數。

狀態 010010

TA=A⊕B=0⊕1=1T_A=A\oplus B=0\oplus1=1 TB=B⊕C=1⊕0=1T_B=B\oplus C=1\oplus0=1 TC=A⊙C=0⊙0=1T_C=A\odot C=0\odot0=1

所以次態為

A+B+C+=010⊕111=101A^{+}B^{+}C^{+} = 010\oplus111 = 101

因此

010→101010\rightarrow101

狀態 101101

TA=1⊕0=1T_A=1\oplus0=1 TB=0⊕1=1T_B=0\oplus1=1 TC=1⊙1=1T_C=1\odot1=1

所以次態為

101⊕111=010101\oplus111=010

因此

101→010101\rightarrow010

非法狀態形成另一個循環:

010↔101010\leftrightarrow101

電路一旦因為啟動暫態、雜訊或正反器初始值進入 010010 或 101101,便會永遠在這兩個狀態間循環,無法進入題目要求的六狀態循環。因此,將未使用狀態視為 don't care,雖能使邏輯函數較簡單,卻不能保證電路具備自我修復能力。


(b) 修正設計

修正方法是指定非法狀態的恢復路徑。本題採用最直接的設計:

010→000010\rightarrow000 101→000101\rightarrow000

如此一來,任何非法狀態最多經過一個 clock 就回到合法循環。


1. 修正後狀態圖

合法循環為

000→001→011→111→110→100→000000\rightarrow001\rightarrow011\rightarrow111\rightarrow110\rightarrow100\rightarrow000

非法狀態的修復路徑為

010→000010\rightarrow000 101→000101\rightarrow000

完整狀態關係如下:

現態次態
000001
001011
010000
011111
100000
101000
110100
111110

2. 修正後激勵表

現態 ABCABC次態 A+B+C+A^{+}B^{+}C^{+}TAT_ATBT_BTCT_C
000001001
001011010
010000010
011111100
100000100
101000101
110100010
111110001

此時八個狀態全部指定,不再有 don't care。


3. 推導 TAT_A

TA=1T_A=1 的 minterms 為

m(3,4,5)m(3,4,5)

化簡時:

  • m4,m5m_4,m_5 可組成 AB′AB'
  • m3m_3 無法與相鄰的 1 組合,因此形成 A′BCA'BC

所以

TA=AB′+A′BCT_A=AB'+A'BC
🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

第 Problem 6 題15 分

A circuit for a gated D-latch is shown in Fig. 1.

🖼️【此處有附圖,請對照原卷】

Assume that the propagation delay through a NAND gate or an inverter is 1 ns. Complete the timing diagram given in Fig. 2, which shows the signal values with 1 ns resolution. Please note that you need to redraw the timing diagram in your answer sheet.

🖼️【此處有附圖,請對照原卷】

🖼️ 本題含圖表,以下為原卷對應頁面:
原卷第 2 頁原卷第 3 頁

登入後即可作答並保存紀錄。

這一題的完整詳解

核心觀念

本題的核心在於具傳遞延遲(Propagation Delay)之閘控 D 型閂鎖器(Gated D-Latch)​的時序分析與波形繪製:

  1. 電路拓撲與元件延遲:
    • 電路由 1 個反相器(Inverter)與 4 個雙輸入 NAND 閘組成。
    • 題目指定反相器與 NAND 閘之傳遞延遲均為 τ=1 ns\tau = 1\text{ ns},分析時間解析度為 1 ns1\text{ ns}。
  2. 各節點布林邏輯關係(含延遲):
    設時間 tt(單位:ns\text{ns})以 1 ns1\text{ ns} 為離散步階,前一奈秒區間 [t−1,t)[t-1, t) 之各節點訊號決定當前區間 [t,t+1)[t, t+1) 之閘極輸出:
    • 反相器輸出 Dˉint\bar{D}_{\text{int}}:
      Dˉint(t)=D(t−1)‾\bar{D}_{\text{int}}(t) = \overline{D(t-1)}
    • 左上 NAND 閘輸出(記為設定訊號 BB):
      B(t)=D(t−1)⋅Clock(t−1)‾B(t) = \overline{D(t-1) \cdot \text{Clock}(t-1)}
    • 左下 NAND 閘輸出(題目指定節點 AA,即重置訊號):
      A(t)=Clock(t−1)⋅Dˉint(t−1)‾A(t) = \overline{\text{Clock}(t-1) \cdot \bar{D}_{\text{int}}(t-1)}
    • 右側由兩個交叉耦合(Cross-Coupled)NAND 閘組成的 SˉRˉ\bar{S}\bar{R} 閂鎖器核心:
      Q(t)=B(t−1)⋅Qˉ(t−1)‾Q(t) = \overline{B(t-1) \cdot \bar{Q}(t-1)}
      Qˉ(t)=Q(t−1)⋅A(t−1)‾\bar{Q}(t) = \overline{Q(t-1) \cdot A(t-1)}
  3. NAND 型 SˉRˉ\bar{S}\bar{R} 閂鎖器的狀態轉換:
    • 當 B=1,A=1B=1, A=1 時:保持原態(Hold)。
    • 當 B=0,A=1B=0, A=1 時:置位(Set),Q→1,Qˉ→0Q \to 1, \bar{Q} \to 0。
    • 當 B=1,A=0B=1, A=0 時:重置(Reset),Q→0,Qˉ→1Q \to 0, \bar{Q} \to 1。
    • 由於回授迴路的延遲,當輸入改變時,必定是先由接收到低電位(0)的該顆 NAND 閘輸出率先變為 1,再經由回授使另一顆 NAND 閘輸出變為 0。

解題方法

由原卷 Fig. 1 可辨識出電路由 1 個反相器與 4 個雙輸入 NAND 閘構成;由 Fig. 2 讀得時間軸範圍為 t=0∼30 nst = 0 \sim 30\text{ ns},解析度為 1 ns1\text{ ns}。輸入訊號波形如下:

  • Clock\text{Clock}:週期為 10 ns10\text{ ns}(5 ns5\text{ ns} 低、5 ns5\text{ ns} 高),即在 [0,5),[10,15),[20,25) ns[0, 5), [10, 15), [20, 25)\text{ ns} 為 0;在 [5,10),[15,20),[25,30) ns[5, 10), [15, 20), [25, 30)\text{ ns} 為 1。
  • DD:在 [0,2)[0, 2) 為 0;[2,4)[2, 4) 為 1;[4,6)[4, 6) 為 0;[6,11)[6, 11) 為 1;[11,22)[11, 22) 為 0;[22,30)[22, 30) 為 1。
  • 初始條件(t∈[0,1) nst \in [0, 1)\text{ ns}):Clock=0,D=0,A=1,Q=0\text{Clock} = 0, D = 0, A = 1, Q = 0(此時穩態下 Dˉint=1,B=1,Qˉ=1\bar{D}_{\text{int}} = 1, B = 1, \bar{Q} = 1)。

依時間推進逐步推導各時段訊號變化:

1. t∈[0,5) nst \in [0, 5)\text{ ns}(Clock=0\text{Clock} = 0 保持區間)

  • 由於 Clock=0\text{Clock} = 0,左上與左下 NAND 閘皆有至少一個輸入為 0,因此 BB 與 AA 之輸出恆為 1:
    A(t)=1,B(t)=1A(t) = 1, \quad B(t) = 1
  • 期間 DD 雖在 2 ns∼4 ns2\text{ ns} \sim 4\text{ ns} 有脈衝上升,但因鐘脈衝為 0,輸出級 SR 閂鎖器處於保持態:
    Q(t)=0,Qˉ(t)=1Q(t) = 0, \quad \bar{Q}(t) = 1

2. t∈[5,10) nst \in [5, 10)\text{ ns}(Clock=1\text{Clock} = 1 第一個致能區間)

  • t=5 nst = 5\text{ ns}:Clock\text{Clock} 升為 1。此時 D=0D = 0,反相器輸出 Dˉint=1\bar{D}_{\text{int}} = 1。
  • t=6 nst = 6\text{ ns}:
    • 左下 NAND 閘因前一奈秒輸入為 Clock=1,Dˉint=1\text{Clock}=1, \bar{D}_{\text{int}}=1,經 1 ns1\text{ ns} 延遲後,輸出 AA 下降為 0:
      A(6)=0A(6) = 0
    • 同時輸入端 DD 升為 1。
  • t=7 nst = 7\text{ ns}:
    • 反相器反應 DD 的上升,輸出 Dˉint\bar{D}_{\text{int}} 下降為 0。
    • 左上 NAND 閘因前一奈秒輸入為 Clock=1,D=1\text{Clock}=1, D=1,經 1 ns1\text{ ns} 延遲後,輸出 BB 下降為 0。
    • 左下 NAND 閘前一奈秒輸入仍為 Clock=1,Dˉint=1\text{Clock}=1, \bar{D}_{\text{int}}=1,故輸出 AA 仍為 0。
  • t=8 nst = 8\text{ ns}:
    • 左下 NAND 閘因前一奈秒輸入為 Dˉint=0\bar{D}_{\text{int}}=0,輸出 AA 回升為 1:
      A(8)=1A(8) = 1
      故 AA 在 [6,8) ns[6, 8)\text{ ns} 區間為低電位 0。
    • 右上 NAND 閘因前一奈秒輸入 B=0B=0,輸出 QQ 上升為 1:
      Q(8)=1Q(8) = 1
  • t=9 nst = 9\text{ ns}:
    • 右下 NAND 閘因前一奈秒輸入 Q=1,A=1Q=1, A=1,輸出 Qˉ\bar{Q} 下降為 0。
    • 閂鎖器穩定鎖在 Q=1,Qˉ=0Q = 1, \bar{Q} = 0。

3. t∈[10,15) nst \in [10, 15)\text{ ns}(Clock=0\text{Clock} = 0 保持區間)

  • t=10 nst = 10\text{ ns}:Clock\text{Clock} 降為 0。
  • t=11 nst = 11\text{ ns}:左上 NAND 閘輸出 BB 回升為 1。此時 DD 降為 0。
  • 由於 Clock=0\text{Clock} = 0,左方閘門封鎖,A=1,B=1A = 1, B = 1,SR 閂鎖器保持前態:
    Q(t)=1,Qˉ(t)=0Q(t) = 1, \quad \bar{Q}(t) = 0

4. t∈[15,20) nst \in [15, 20)\text{ ns}(Clock=1,D=0\text{Clock} = 1, D = 0 重置區間)

  • t=15 nst = 15\text{ ns}:Clock\text{Clock} 升為 1。此時 D=0D = 0,反相器輸出 Dˉint=1\bar{D}_{\text{int}} = 1。
  • t=16 nst = 16\text{ ns}:
    • 左下 NAND 閘因輸入 Clock=1,Dˉint=1\text{Clock}=1, \bar{D}_{\text{int}}=1,輸出 AA 下降為 0:
      A(16)=0A(16) = 0
    • 左上 NAND 閘因 D=0D=0,輸出 BB 維持為 1。
  • t=17 nst = 17\text{ ns}:
    • 右下 NAND 閘的輸入之一 AA 在前一奈秒變為 0,強制其輸出 Qˉ\bar{Q} 上升為 1:
      Qˉ(17)=1\bar{Q}(17) = 1
  • t=18 nst = 18\text{ ns}:
    • 右上 NAND 閘的兩個輸入皆為 1(B=1B=1 且前一奈秒 Qˉ\bar{Q} 已回升至 1),因此輸出 QQ 下降為 0:
      Q(18)=0Q(18) = 0
  • 此後 Q=0,Qˉ=1Q=0, \bar{Q}=1 保持穩定,直至時鐘下降。

5. t∈[20,25) nst \in [20, 25)\text{ ns}(Clock=0\text{Clock} = 0 保持區間)

  • t=20 nst = 20\text{ ns}:Clock\text{Clock} 降為 0。
  • t=21 nst = 21\text{ ns}:左下 NAND 閘因 Clock\text{Clock} 變為 0,輸出 AA 回升為 1:
    A(21)=1A(21) = 1
    故 AA 在 [16,21) ns[16, 21)\text{ ns} 區間為低電位 0。
  • t=22 nst = 22\text{ ns}:DD 升為 1,反相器於 23 ns23\text{ ns} 變為 0。但因 Clock=0\text{Clock} = 0,不影響輸出,QQ 維持為 0。

6. t∈[25,30) nst \in [25, 30)\text{ ns}(Clock=1,D=1\text{Clock} = 1, D = 1 置位區間)

  • t=25 nst = 25\text{ ns}:Clock\text{Clock} 升為 1。此時 D=1D = 1,反相器輸出 Dˉint=0\bar{D}_{\text{int}} = 0。
  • t=26 nst = 26\text{ ns}:
    • 左下 NAND 閘因 Dˉint=0\bar{D}_{\text{int}}=0,輸出 AA 恆維持為 1。
    • 左上 NAND 閘因輸入 Clock=1,D=1\text{Clock}=1, D=1,輸出 BB 下降為 0。
  • t=27 nst = 27\text{ ns}:
    • 右上 NAND 閘因輸入 B=0B=0,輸出 QQ 上升為 1:
      Q(27)=1Q(27) = 1
  • t=28 nst = 28\text{ ns}:
    • 右下 NAND 閘因輸入 Q=1,A=1Q=1, A=1,輸出 Qˉ\bar{Q} 下降為 0。
  • 閂鎖器維持在 Q=1Q = 1 直至 30 ns30\text{ ns}。

解題技巧與常見陷阱

  1. 重置時的因果級聯順序(最常見陷阱):
    • 當 AA 於 16 ns16\text{ ns} 降為 0 時,它直接作用的是右下方的 NAND 閘。
    • 因為 NAND 閘具有任一輸入為 0 則輸出必為 1 的特性,A=0A=0 會在 17 ns17\text{ ns} 使互補輸出 Qˉ\bar{Q} 率先升高為 1。
    • 互補輸出 Qˉ\bar{Q} 升高後,右上方的 NAND 閘兩端輸入才均為 1(B=1B=1 且 Qˉ=1\bar{Q}=1),進而使主輸出 QQ 於 18 ns18\text{ ns} 下降為 0。
    • 切勿誤以為 AA 變低會讓主輸出立即在 17 ns17\text{ ns} 降低;訊號必須經過兩級閘極延遲(16 ns→17 ns→18 ns16\text{ ns} \to 17\text{ ns} \to 18\text{ ns})。
  2. 反相器造成的動態脈衝(Glitch / Narrow Pulse):
    • 在 t=5∼6 nst = 5 \sim 6\text{ ns} 時,Clock\text{Clock} 已升為 1,但 DD 尚未上升(D=0  ⟹  Dˉint=1D=0 \implies \bar{D}_{\text{int}}=1),使 AA 在 6 ns6\text{ ns} 掉到 0。
    • 當 DD 於 6 ns6\text{ ns} 變為 1 時,由於反相器有 1 ns1\text{ ns} 延遲,Dˉint\bar{D}_{\text{int}} 到 7 ns7\text{ ns} 才變 0,導致 AA 延後至 8 ns8\text{ ns} 才回升為 1,因而產生了長達 2 ns2\text{ ns}([6,8) ns[6, 8)\text{ ns})的負脈衝。

【答案】

1. 各信號於各時間區間之數值表(1 ns1\text{ ns} 解析度)

時間區間 [t,t+1) (ns)[t, t+1)\text{ (ns)}01234567891011121314151617181920212223242526272829
Clock000001111100000111110000011111
D001100111110000000000011111111
A111111001111111100000111111111
Q000000001111111111000000000111

波形準位摘要:

  • 訊號 AA:
    • 於 t∈[6,8) nst \in [6, 8)\text{ ns} 以及 t∈[16,21) nst \in [16, 21)\text{ ns} 為低電位(0)。
    • 其餘時間均為高電位(1)。
  • 輸出 QQ:
    • 於 t=8 nst = 8\text{ ns} 上升至 1;
    • 於 t=18 nst = 18\text{ ns} 下降至 0;
    • 於 t=27 nst = 27\text{ ns} 上升至 1。

2. 完整時序圖(Timing Diagram)

🔒

後續完整解題步驟與【答案】

免費註冊,享三天全站完整詳解閱覽。

免費註冊

其他考古題

113 年中山大學的其他科目