Interview Questions
Interview Questions
Verilog is based on the C language. VHDL is based on Ada and Pascal languages.
Verilog is more compact than VHDL. In VHDL, you have to write more lines of code.
Verilog is weakly typed and VHDL is self-documenting and often catches
deterministic. All data types are errors missed by Verilog. It focuses on
predefined in Verilog, and each has a unambiguous semantics and also allows
bit-level representation. portability between tools.
10) What do you understand by Verilog full case statements and Verilog
parallel case statements?
There are two types of case statements in Verilog.
o Verilog full case statements
o Verilog parallel case statements
Verilog full case statements
The Verilog full case statements are statements in which binary patterns of
every potential case expression can match either a case item or default. If
your considered case statement does not involve a case default and is likely
to discover a binary case expression that does not match any of the defined
case items, the case statement would not be considered full.
Verilog parallel case statements
A parallel case statement is a statement where it matches a case expression,
just one case item. If you can find a case expression that would fit more
than one case item, the matching case items are called 'overlapping case
items,' and the case statement would be not parallel."
11) What are the main differences between Task and Function in Verilog?
Following is a list of main differences between a Task and a Function in
Verilog:
Functions Tasks
A function can carry out its required Tasks also run with a zero simulation.
duty in zero simulation time because But if required, they can also be
the program time is not incremented executed in a non-zero simulation
during the function routine. time.
Functions only return a single value A task cannot return a value but can
and cannot use either output or input pass multiple values via the output
statements. and input statements.
== ===
$monitor $display
17) What are the main differences between Wire and Reg?
Key differences between Wire and Reg
Wire Reg
The wire elements can only be used The reg elements can also be used for
to model combinational logic. combinational as well as sequential logic.
We can use wire at the left-hand side We cannot use reg on the left-hand side
of an assigned statement. of an assigned statement.
18) What is the process to execute blocking and non-blocking
assignments?
There is a simple process to execute blocking and non-blocking
assignments. To execute blocking assignments, we have to use a simple
process of evaluating the right-hand side equation and updating the left-
hand side expression without interference from another Verilog statement.
A function of a blocking assignment is to block trailing assignments until
after the completion of the current assignment. On the other hand, the
process of executing non-blocking assignments needs two steps:
o Evaluate the right-hand side of all non-blocking statements at the
start of the time step.
o Update the left-hand side of all non-blocking statements after the
time step.
20) What are the full case and parallel case statements?
Full case statement: The full case is a case statement in which all possible
case expressions can be matched with case items or case default.
Parallel case statement: A parallel case statement is a case statement in
which it is possible to match a case expression with one and only one case
item. If you find a case expression that would match more than one case
item, the matching case is called an overlapping or non-parallel statement.
26) Write a Verilog code to swap contents of two registers with and without
a temporary register?
A Verilog code to swap contents of two registers with a temporary
register:
1. always @ (posedge clock)
2. begin
3. temp=b;
4. b=a;
5. a=temp;
6. end
A Verilog code to swap contents of two registers without a temporary
register:
1. always @ (posedge clock)
2. begin
3. a <= b;
4. b <= a;
5. end