Verilog Interview Questions
Verilog Interview Questions
Verilog Interview Questions
module prg1();
reg [7:0]a;
initial
begin
a = "A";
$display("Value of a %o",a);
end
endmodule
Ans: 101
Q2:
Write a Verilog code for +ve edge triggered flip-flop with asynchronous ve reset
with non-blocking assignment?
Q3:
In a pure combinational logic, is it necessary to mention all the inputs in
the sensitivity list?
Q5:
What is the data type of y_out for the following statment? assign y_out =
a_in & b_in;
Net type,
it can be possible reg also if we write assign in procedural block(not
recomanded)
Q6:
list out some of enhancements in Verilog 2001?
Q7:
reg rega [1:n]; represents?
Q9:
What is the output of the following Verilog code with y = 3, a = 2,b = 1.
initial
begin
y = a + b;
z = y + a;
end
ANS: y = 3, z = 5
Q10: what is the output of the following code having initial values at 0ns
for y = 6, a = 3,b = 1 .
initial
begin
#10 ;
y <= a + b;
z <= y + a;
end
a) y = 4, z = 9
Q11:
Write a verilog code to swap contents of two registers without a
temporary register?
Q12:
Write a Verilog code to generate race condition?
Q13:
Write a Verilog code to generate clock?(consider time period is 10ns)
`timescale 1ns/1ns
ANS: initial
begin
clk = 1b0;
forever
begin
#5 clk = ~clk;
end
end
Q14:
What is the difference between task and function?
ANS:
Function
It execute in one simulation time
unit
function cannot enable a task
and it can enable function
function shall have at least one
input type argument and shall
not have an output or inout type
argument;
function shall return a single
value;
Task
It can contain time-controlling
statements.
task can enable other tasks or
functions.
task can have zero or more
arguments of any type.
Q15:
What is the difference between the following two lines of Verilog code?
#5 a = b;
a = #5 b;
ANS: #5 a = b; Wait five time units before doing the action for "a = b;". The value
assigned to a will be the value of b 5 time units hence. a = #5 b; The value of b is
calculated and stored in an internal temp
register. After five time units, assign this stored value to a.
Q16:
What is the difference between the following two codes
c = foo ? a : b;
|
if(foo)
|
c = a;
|
else
|
c = b;
ANS: 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.
Q17:
Which one of the following is procedural statement?
1. initial
2. always
ANS: Both
Q18:
How do you override parameters during instantiation?
Q19:
Difference between `define and parameter?
Q20:
Tell me some net types in Verilog?
ANS: wire, tri, tri0, supply0, wand, triand, tri1, supply1, wor, trior,
trireg, uwire
Q21:
Can you write the Truth table for wor and trior nets?
Q22:
Is reg creates flip-flop
wor/trio
r
0
1
X
Z
0
1
X
0
1
1
1
1
X
1
X
X
0
1
X
Z
Q23:
What are the Verilog predefined primitives that you know?
ANS:
and
nand
nmos
or
nor
cmos
xor
not
pullup
xnor
pmos
pulldo
wn
Q24:
What is the difference between $stop and $finish?
ANS:
module d_ff ( input clk, rst_n, d, output reg q);
always @ (posedge clk, negedge rst_n)
begin
if(!rst_n)
q <= 1b0;
else
q <= d;
end
endmodule
Q26:
ANS: switch level, gate level, behavioral level, data flow level
Q27:
Do you know Verilog standards? If you know what are they?
Q28:
What are the different Register Data Types?
Q29:
How to read memory from a file(data is in hexadecimal format),file name
is mem.txt?
ANS:
$readmemh("mem.txt",memory);
Q30:
Which procedural block can be synthesis (always, initial)?
Q31:
How many levels can be nested using `include?
Q32:
Does all the constructs in Verilog will synthesizable? If yes ok or not
listout some non-synthesizable constructs?
ANS: No, (initial, fork, join, real, delays(#10), UDPs, system tasks )
Q33:
How to generate a random number in verilog?
ANS: $random();
Q34:
How to generate random number which is between 0 to 100?
Q35:
What is the advantage of named port connection over ordered port
connections?
Q36:
list out some of enhancements in Verilog 2001?
Automatic task
Q37:
list out some of enhancements in Verilog 2001?
Q38:
list out some of enhancements in Verilog 2001?
Q39:
list out some of enhancements in Verilog 2001?
Q40:
list out some of enhancements in Verilog 2001?
Q41:
list out some of enhancements in Verilog 2001?
Q42:
list out some of enhancements in Verilog 2001?
Q43:
list out some of enhancements in Verilog 2001?
Q44:
list out some of enhancements in Verilog 2001?
Q45:
list out some of enhancements in Verilog 2001?
Q46:
list out some of enhancements in Verilog 2001?
Q47:
list out some of enhancements in Verilog 2001?
Q48:
list out some of enhancements in Verilog 2001?
Q49:
list out some of enhancements in Verilog 2001?
Q50:
list out some of enhancements in Verilog 2001?
Q51:
list out some of enhancements in Verilog 2001?
Q52:
list out some of enhancements in Verilog 2001?
Q53:
list out some of enhancements in Verilog 2001?
Q54:
list out some of enhancements in Verilog 2001?
Q55:
list out some of enhancements in Verilog 2001?
Q56:
list out some of enhancements in Verilog 2001?
Q57:
list out some of enhancements in Verilog 2001?
Q58:
list out some of enhancements in Verilog 2001?
Q59:
list out some of enhancements in Verilog 2001?
Q60:
list out some of enhancements in Verilog 2001?
Q61:
list out some of enhancements in Verilog 2001?
Q62:
list out some of enhancements in Verilog 2001?
Q63:
list out some of enhancements in Verilog 2001?
Q64:
list out some of enhancements in Verilog 2001?
Q65:
list out some of enhancements in Verilog 2001?
Q66:
list out some of enhancements in Verilog 2001?
Q67:
list out some of enhancements in Verilog 2001?
Q68:
list out some of enhancements in Verilog 2001?
Q69:
list out some of enhancements in Verilog 2001?
Q70:
list out some of enhancements in Verilog 2001?
Q71:
list out some of enhancements in Verilog 2001?
Q72:
list out some of enhancements in Verilog 2001?
Q73:
list out some of enhancements in Verilog 2001?
Q74:
list out some of enhancements in Verilog 2001?
Q75:
list out some of enhancements in Verilog 2001?
Q76:
list out some of enhancements in Verilog 2001?
Q77:
list out some of enhancements in Verilog 2001?
Q78:
list out some of enhancements in Verilog 2001?
Q79:
list out some of enhancements in Verilog 2001?
Q80:
list out some of enhancements in Verilog 2001?
Q81:
list out some of enhancements in Verilog 2001?
Q82:
list out some of enhancements in Verilog 2001?
Q83:
list out some of enhancements in Verilog 2001?
Q89:
list out some of enhancements in Verilog 2001?
Q92:
list out some of enhancements in Verilog 2001?
Q93:
list out some of enhancements in Verilog 2001?
Q94:
list out some of enhancements in Verilog 2001?
Q96:
list out some of enhancements in Verilog 2001?