0
0
Verilogprogramming~10 mins

D flip-flop with asynchronous reset in Verilog - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the module with inputs and outputs.

Verilog
module dff_async_reset(input clk, input rst_n, input [1], output reg q);
Drag options to blanks, or click blank then click option'
Ad
Bq
Cclk
Drst_n
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or reset as data input
Using output signal name as input
2fill in blank
medium

Complete the sensitivity list for the always block to include clock and asynchronous reset.

Verilog
always @(negedge [1] or posedge clk) begin
Drag options to blanks, or click blank then click option'
Arst_n
Bnegedge rst_n
Cposedge rst_n
Dnegedge clk
Attempts:
3 left
💡 Hint
Common Mistakes
Using posedge for active low reset
Using clock edge instead of reset edge
3fill in blank
hard

Fix the error in the reset condition to correctly reset output q to 0.

Verilog
if ([1] == 1'b0) q <= 1'b0;
Drag options to blanks, or click blank then click option'
Aclk
Bd
Crst_n
Dq
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or data signal in reset condition
Using output signal q in condition
4fill in blank
hard

Fill the blank to assign q the input d on clock rising edge when reset is inactive.

Verilog
else begin
  q <= [1];
end
Drag options to blanks, or click blank then click option'
Ad
Bq
Crst_n
Dclk
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning q to itself
Using reset or clock signals as data
5fill in blank
hard

Fill all three blanks to complete the always block with asynchronous reset and data assignment.

Verilog
always @([1] or posedge [2]) begin
  if ([3] == 1'b0)
    q <= 1'b0;
  else
    q <= d;
end
Drag options to blanks, or click blank then click option'
Anegedge rst_n
Bclk
Crst_n
Dposedge rst_n
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive edge for active low reset
Mixing clock and reset signals in conditions