Pardeep
unread,Sep 12, 2011, 2:09:07 PM9/12/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to VLSI Design Forum
thanks for the post " verilog objective test"
it is very helpful for us to test our basics and we are expecting some
more posts related to VHDL, Verliog, and Digital in near future.
I want to discuss the three questions ( Q.No. 16, 20 and 25) from the
" verilog objective test"
##################################################################################
Question No. 16
16. Given the following Verilog code, what value of "a" is displayed?
always @ (clock) begin
a = 0;
a <= 1;
$display(a);
end
A. 0
B. 1
C. either 0 or 1 depending on depending on simulator implementation
D. None of the above
The answer posted is
16. B i.e. the displayed value of a is 1
But when I try to simulate the code then I got the answer 0
// my program is given below
module test_clock(input clock);
integer a;
always @ (clock) begin
a = 0;
a <= 1;
$display(" value of a is %d",a);
end
****************** Simulation Result ************************
# Loading work.test_clock(fast)
force -freeze sim:/test_clock/clock 1 0, 0 {50 ns} -r 100
VSIM 14>run
# value of a is 0
# value of a is 0
# value of a is 0
#################################################################################################################
Question No. 20
20. If time scale is defined as `timescale 10ns/1ns and #1.55 a = b;
then 'a' gets 'b' after
A. 10ns
B. 11 ns
C. 15.5ns
D. 16ns
The answer posted is
20. D i.e. 'a' gets 'b' after 16ns
But when I try to simulate the code then I got the answer 2ns
`timescale 10ns/1ns
module time_scale;
integer a=7,b=5;
initial
begin
#1.55 a = b;
$display(" At time_value of %d \t the value of \n a = %d\n b = %d",
$time,a,b);
end
*************** Simulation Result ****************
VSIM 19>run
# At time_value of 2 the value of
# a = 5
# b = 5
############################################################################################################
25. Variable and signal which will be updated first?
A. Variable
B. Signal
C. Can’t say
D. None of the above
The answer posted for Question 25. B i.e. Signal will be
updated first
But signal and variable terms are used in VHDL and there the
value to variable is assigned in zero delay time
and the value to signal is assigned after some delta delay
time or some finite delay time.
##########################################################################################################
So, Justify your Answers for Q.No. 16, 20 and 25