Electrical Engineering Question:

Download Job Interview Questions and Answers PDF

What is the difference between:
c = foo ? a : b;
and
if (foo) c = a;
else c = b;

Electrical Engineering Interview Question
Electrical Engineering Interview Question

Answer:

The ? merges answers if the condition is "x", so for instance if foo = 1'bx, a = 'b10, and b = 'b11, you'd get c = 'b1x.
On the other hand, if treats Xs or Zs as FALSE, so you'd always get c = b.

Download Electrical Engineering Interview Questions And Answers PDF

Previous QuestionNext Question
What is the difference between the following two lines of Verilog code?Using the given, draw the waveforms for the following versions of a?