Complete the code to declare a 4-bit register named 'counter'.
reg [[1]:0] counter;
In Verilog, a 4-bit register is declared as reg [3:0] because the index starts at 0.
Complete the code to create a positive edge triggered always block.
always @([1] clk) begin
// logic here
endThe posedge keyword triggers the block on the rising edge of the clock signal.
Fix the error in the sensitivity list to include both clock and reset signals.
always @([1] or reset) begin if (reset) begin // reset logic end else begin // normal operation end end
The sensitivity list should use posedge clk to trigger on the rising edge of the clock and also include the asynchronous reset.
Fill both blanks to create a combinational always block that triggers on changes to inputs 'a' and 'b'.
always @([1] or [2]) begin y = a & b; end
For combinational logic, the always block should trigger on any change to inputs 'a' or 'b'.
Fill all three blanks to create a testbench initial block that sets 'reset' high, waits 10 time units, then sets it low.
initial begin [1] = 1; #[2]; [3] = 0; end
The testbench sets the 'reset' signal high, waits 10 time units, then sets it low to simulate a reset pulse.
