Complete the code to declare a D flip-flop with asynchronous reset.
module dff (input clk, input rst, input d, output reg q); always @(posedge clk or posedge [1]) begin if (rst) q <= 0; else q <= d; end endmodule
The asynchronous reset is triggered on the positive edge of the reset signal rst.
Complete the code to assign the output of the flip-flop.
always @(posedge clk) begin
q <= [1];
endThe flip-flop output q takes the value of the input d at the rising edge of the clock.
Fix the error in the sensitivity list to make the flip-flop work correctly.
always @([1]) begin if (rst) q <= 0; else q <= d; end
The flip-flop should respond to the positive edge of the clock and the positive edge of the reset signal.
Fill both blanks to create a flip-flop that stores data on the rising clock edge and resets asynchronously.
always @([1] or [2]) begin if (rst) q <= 0; else q <= d; end
The flip-flop triggers on the rising edge of the clock and the rising edge of the reset signal for asynchronous reset.
Fill all three blanks to create a module that stores data on clock edge, resets asynchronously, and outputs the stored value.
module dff (input [1], input [2], input d, output reg [3]); always @(posedge clk or posedge rst) begin if (rst) q <= 0; else q <= d; end endmodule
The module inputs are clock clk and reset rst. The output is the stored value q.