Try   HackMD
tags: 數位系統設計

上課投影片

Lecture04: Registers and Counters

Registers

  • Register

    • A group of flip-flops and gates
  • Counter

    • A register that goes through a predetermined sequence of states
  • A n-bit register

    • Reset signal and CLK is shared.

Ripple Counter

  • 非同步計數器
  • 沒有相同的clock
  • A n-bit binary counter → n FFs → count from 0 to
    2n1

BCD Ripple Counter

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Synchronous Counters

  1. Ripple Counters(省電)
    • 因為沒有共浴的clock,所以變換到下一個狀態時,會從前一個flip-flop變換到下一個flip-flop,產生不必要的跳動
    • Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →

DVFS => Dynamic voltage frequency scaling
自動調整電壓及頻率,以免CPU燒毀

  1. Synchronous Counters
    • 因為有共同的clock,會直接變換到下一個狀態
    • Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →

Sync. Counters using JK FFs

  • A0
    在每個CLK變動時,狀態就要反相,所以J=K=1
  • A1
    在每狀態改變時,需要J=K=1,我們觀察到
    A0
    有1可以幫助
    A1
    改變。
  • A2
    狀態改變時,要
    A0,A1
    皆為1時,會改變。
  • A3
    以此類推
  • 高位元改變狀態 -> 低位元狀態皆為1
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

4bit UP/DOWN Binary Counter

  • UP的優先權比較高
  • UP的模式跟上一個電路的設計方式一樣
  • DOWN的模式與上一個電路的差別在於「取所有低為元的0」 => 可以直接拉低位元的
    Q¯

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Binary Counter with Parallel Load

  • 並行的原因是,有相同的CLK
  • Load腳是可以把Data_in的資料放入flip-flop裡面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Extensions of Parallel Load Counter

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • (左圖)當count到
    9(10)
    時,load會為
    1(10)
    ,counter會等待下一次CLK,從
    9(10)
    ->
    0(10)
  • (右圖)當count到
    10(10)
    時,clear會為
    0(10)
    ,counter輸出會瞬間變成
    0(10)

Counter with Unused States

  • n flip-flops have

    2n binary states, but we just use some state, so call the state we didn't use => unused state.

  • We let unused states to become Don't care, can simplified state circuit.

  • Self-correcting counter

    • 我們要避免counter掉進Don't care的state迴圈狀態,那就必須要讓counter就self-correcting的功能,使他會自我修正,確保工作正確執行。
    • Analyze the circuit to determine the next state from an unused state after it is designed.

Self-Correcting Counter

  • An example
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 兩個unused states: 011 & 111
  • 假設Present State是 011 or 111,Next State會是Don't care。
  • 用卡諾圖化簡Flip-Flop inputs,並且畫出電路
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • 再針對設計好的電路去分析當Present State,可以得到他們的Next State不會進入unused states的迴圈裡面,所以他有self-correcting的能力

Soft Error:宇宙射線影響到半導體(電子產品)發生短暫的故障。
可能就是讓暫存的資料 從0變成1 或 從1變成0。
為了解決不可避免的Soft Error,就有了這些方案:

  • ECC:修正錯誤代碼,「修正」當記憶體(RAM)發生Soft Error時的錯誤。

Ring Counter

  • 輸入是從最後的輸出,拉回來
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • ring counter的行為跟decoder很像,但是兩個的差別就在於,ring counter比較在乎時間。
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • application of ring counter
    • generate timing signal => control the sequence of operations in a digital system.

Jonhson Counter

  • Switch-tail ring counter
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

在實務上,倘若發生Soft Error,原本的 Ring counter 或是 Switch-tail counter 都沒辦法使 output 行為回到原本的狀態。

Johnson Counter 可以利用下面的方法,既能夠維持原本的行為,在受到 Soft Error 時,也可以回到原本的行為(但是也不是各種情況都救的回來)
One correcting procedure:

Dc = (A + C) B