Altifigence Academy

18 / 36 · Khái niệm

Clock edges and state

Separate input changes from register updates.

Chưa có bản dịch. Nội dung bài học gốc được hiển thị. (English)

Learning goals

  • Distinguish rising from falling edges
  • Predict when a synchronous reset takes effect

An edge is an instant, not a high interval

posedge clk identifies a rising edge. The counter does not keep incrementing throughout the high interval. It updates once per rising edge in this example.

Mark the first rising edge, then number the following edges. Compare the counter with the result calculated at each edge and check that it holds its value between them.

Reset is also sampled at an edge

The example always_ff listens only to posedge clk. Setting rst high does not change count until a rising edge. At an edge with rst=1, the register stores 00 instead of incrementing.

This describes synchronous reset. A different design with asynchronous reset can respond at another time. Read the event condition rather than inferring behavior from the signal name.

EventrstChange in count
Between edges0 → 1Hold
Rising edge1Store 00
Falling edge0Hold
Next rising edge0Increment

Tự thử

Does count=10 immediately become 00 if rst rises between clock edges?

Đọc giải thích

No. It holds 10 until the next rising edge, when it becomes 00 if rst is still high.

Lựa chọn áp dụng cho trình duyệt này. Có thể đổi ở chân trang bất cứ lúc nào.