Complete the code to declare the module name as 'and_gate'.
module [1] (input a, input b, output y);The module name must match the design purpose. Here, 'and_gate' is correct for an AND gate.
Complete the code to declare inputs 'a' and 'b' and output 'y'.
module and_gate([1] a, [2] b, output y);
Inputs must be declared with the keyword 'input'.
Fix the error in the assignment statement to connect output 'y' to the AND of inputs 'a' and 'b'.
assign y = a [1] b;The AND operation in Verilog uses the '&' operator.
Fill the blank to complete the module end statement.
module and_gate(input a, input b, output y);
assign y = a & b;
[1]The module must end with 'endmodule' to close the module block.
Fill all three blanks to complete a testbench module that instantiates 'and_gate' and applies inputs.
module testbench(); reg [1], [2]; wire y; and_gate uut(.a([1]), .b([2]), .y(y)); initial begin [1] = 0; [2] = 0; #10 [1] = 1; #10 [2] = 1; #10 $finish; end endmodule
The testbench uses 'reg' variables 'a' and 'b' to drive inputs of the 'and_gate'.
