What are the final values of a and b ? reg [3:0] a, b; initial begin a =…
What are the final values of a and b ? reg [3:0] a, b; initial begin a = 4'd6; b = 4'd11; a <= b; b <= a; end
- a = 11, b = 11
- a = 6, b = 6
- a = 11, b = 6
- a = 6, b = 11
Correct answer
C. a = 11, b = 6
Explanation
Non-blocking assignments ( <= ) sample the Right-Hand Side (RHS) values during the Active region ( a=6 , b=11 ) and update both Left-Hand Side (LHS) targets simultaneously in the NBA region, performing a swap without a temporary variable.