What is the output q after the following Verilog code runs for one clock cycle with reset = 1 and d = 1?
module sync_reset_ff(input clk, input reset, input d, output reg q); always @(posedge clk) begin if (reset) q <= 0; else q <= d; end endmodule
Think about when the reset affects the output in a synchronous reset.
In a synchronous reset, the reset signal is checked only on the clock's rising edge. If reset is high at that time, q is set to 0 regardless of d.
What is the output q immediately after reset goes high, regardless of the clock?
module async_reset_ff(input clk, input reset, input d, output reg q); always @(posedge clk or posedge reset) begin if (reset) q <= 0; else q <= d; end endmodule
Asynchronous reset affects output immediately when reset changes.
Because reset is in the sensitivity list with posedge, q is set to 0 immediately when reset goes high, without waiting for clock.
Which statement best describes the difference between synchronous and asynchronous reset in flip-flops?
Think about when the reset signal is checked in each case.
Synchronous reset is sampled on clock edges, so output changes only then. Asynchronous reset triggers output change immediately on reset signal change.
Which option contains a syntax or logic error in implementing asynchronous reset?
always @(posedge clk or posedge reset) begin if (reset == 1'b1) q <= 1'b0; else q <= d; end
Check the condition that triggers reset.
Option D resets q when reset is 0, which is incorrect for active-high reset. The reset condition should be when reset is 1.
You are designing a synchronous digital system on an FPGA that requires a reliable reset. Which reset strategy is generally preferred and why?
Consider FPGA internal timing and metastability risks.
Synchronous resets are preferred in FPGA designs because asynchronous resets can cause metastability and timing problems. Synchronous resets are controlled by the clock, making timing predictable.
