Consider this Verilog module for a simple AND gate:
module and_gate(input A, input B, output Y); assign Y = A & B; endmodule
What is the value of output Y when A=1 and B=0?
module and_gate(input A, input B, output Y); assign Y = A & B; endmodule
AND gate outputs 1 only if both inputs are 1.
An AND gate outputs 1 only when both inputs are 1. Since B=0, output Y is 0.
In the following Verilog module, which keyword defines the output signal?
module and_gate(input A, input B, output Y); assign Y = A & B; endmodule
module and_gate(input A, input B, output Y); assign Y = A & B; endmodule
Look for the keyword that declares signals that come out of the module.
The keyword output declares signals that the module sends out, like Y here.
Identify the option that will cause a syntax error when defining an AND gate module.
Check for missing punctuation or incorrect keywords.
Option D is missing a semicolon after the module declaration line, causing a syntax error.
Choose the option that correctly uses the bitwise AND operator to assign output Y in a Verilog module.
Bitwise AND uses a single ampersand.
In Verilog, & is bitwise AND, while && is logical AND (not used for bitwise operations).
Given this 4-bit AND gate module:
module and_gate_4bit(input [3:0] A, input [3:0] B, output [3:0] Y); assign Y = A & B; endmodule
What is the value of Y when A = 4'b1101 and B = 4'b1011?
module and_gate_4bit(input [3:0] A, input [3:0] B, output [3:0] Y); assign Y = A & B; endmodule
Perform bitwise AND on each bit position.
Bitwise AND of 1101 and 1011 is 1001:
1&1=1, 1&0=0, 0&1=0, 1&1=1
