Complete the code to declare a synthesizable always block triggered on the positive edge of clk.
always @([1]) begin
q <= d;
endThe always block triggers on the positive edge of clk, which is synthesizable for flip-flops.
Complete the code to create a synthesizable combinational always block sensitive to a and b.
always @([1]) begin
y = a & b;
endFor combinational logic, the sensitivity list includes all inputs using 'or'.
Fix the error in the code to make the for loop synthesizable.
reg [3:0] count; integer i; always @(posedge clk) begin for ([1] = 0; i < 4; i = i + 1) begin count[i] <= 1'b0; end end
The loop variable must be declared and used consistently; here 'i' is the loop variable.
Fill both blanks to create a synthesizable if-else statement inside an always block.
always @(posedge clk) begin if ([1]) begin q <= 1'b1; end else if ([2]) begin q <= 1'b0; end end
The first condition checks reset, the second checks enable signal for control.
Fill all three blanks to create a synthesizable case statement inside an always block.
always @(posedge clk) begin case ([1]) 2'b00: out <= [2]; 2'b01: out <= [3]; default: out <= 1'b0; endcase end
The case statement uses 'sel' to select output values 1 or 0.
