## Synchronous Reset (同步)
>優點:
1. ESD防護佳,沒有直接接在DFF上。
2. 較沒有metastability (giltch)的問題,都是同步電路。
3. 某些設計裡面需要自己產生reset訊號,適合用synchronous reset來處理。
>缺點:
1. 速度慢,要等下一個邊緣觸發,也就是需要復位時間。
2. 有internal tri state buffers不適用,但設計上很少用tri-state。
3. 合成器可能會不知道這是rst而化簡,導致功能錯誤,稱作block out synchronous reset。
4. 面積大(AND+FF=>科技進步,已經可以簡化電路,不再是劣勢)。
5. 需要一直給clock,相對耗電,雖然clock可以當作filter來消除reset glitch,但是如果這些glitch發生在active clock edge,也會造成DFF進入metastable。
>寫法: **<font color="#f00">reset 不在 sensitivity</font>**
```
// Synchronous active high reset 4 bit DFF
module Synch_DFF (
input clk, rst,
input [3:0] d,
output reg [3:0] q)
always@(posedge clk) begin
if(!rst_n)
q <= 4'b0;
else
q <= d;
end
endmodule
```
## Asynchronous Reset (非同步)
>優點:
1. 速度快,不用等復位時間。
2. 面積小(FF,但現在差異不大)。
3. 不用一直給clock,可以省電。
>缺點:
1. 在deassertion時,如果在active clock edge有glitch,會有metastability的問題。
2. 因為glitch或是雜訊造成的偽reset (spurious reset)使系統進入metastable.
3. 訊號直接接DFF,ESD防護差,會有靜電問題。
>寫法: **<font color="#f00">reset 在 sensitivity</font>**
```
// Asynchronous active high reset 4 bit DFF
module Asynch_DFF (
input clk, rst,
input [3:0] d,
output reg [3:0] q)
always@(posedge clk or negedge rst_n) begin
if(!rst_n)
q <= 4'b0;
else
q <= d;
end
endmodule
```
- 思考: 根據上面分析,選用非同步reset較優,但要如何防止reset glitch造成的亞穩態呢?
- 解決方式:
1. reset input use schmitt trigger
2. non-coordinated reset removal
3. sequenced coordination of reset removal
Refence:
1. [Synchronous Resets? Asynchronous Resets? I am so confused! How will I ever know which to use?](http://www.sunburstdesign.com/papers/CummingsSNUG2002SJ_Resets.pdf)