Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or reset as data input
Using output signal name as input
✗ Incorrect
The input data signal is named d in a D flip-flop.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using posedge for active low reset
Using clock edge instead of reset edge
✗ Incorrect
The asynchronous reset triggers on the negative edge of rst_n.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clock or data signal in reset condition
Using output signal
q in condition✗ Incorrect
The reset signal rst_n is active low, so when it is 0, q resets to 0.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning
q to itselfUsing reset or clock signals as data
✗ Incorrect
On clock rising edge, q takes the value of d.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive edge for active low reset
Mixing clock and reset signals in conditions
✗ Incorrect
The always block triggers on negative edge of reset and positive edge of clock. The reset signal rst_n is active low.