Verilog Interview Questions
Verilog Interview Questions
Questions Day 3
Welcome to the third day of Verilog interview
questions. These questions are designed to help you
prepare for your upcoming interview
by Manikanta Nagalla
1. How does the ~^ operator work?
The ~^ operator, also known as the XNOR operator, performs
a bitwise XNOR operation, which is the opposite of XOR. It
returns 1 if the inputs have an equal number of 1s and 0s at
each position, otherwise it returns 0.
Example :
Example:
Example:
wire [7:0] data = 8'b10101010;
wire [3:0] slice1 = data[3 +: 4]; // Extracts bits [3:6]
wire [3:0] slice2 = data[7 -: 4]; // Extracts bits [7:4]
Explain the difference between = and <= in Verilog.
In Verilog, = is used for blocking assignments, while <= is used for non-blocking assignments.
Blocking assignment (=): Executes statements sequentially in the order they appear within a block.
When used in an always block, each line is executed one after another, with each line blocking the
execution of the next until it completes.
Non-blocking assignment (<=): Allows statements to be evaluated concurrently within an always
block, making it ideal for sequential logic. Each line in the block is evaluated simultaneously,
making it suitable for modeling clocked registers.
Example: