When you declare as logic and it has multiple drivers you get
a) Compilation error
b) Run time error
c) The output is X
d) Last assignment as the output
If your code accidently tries to read from an out-of-bounds address, it will return
a) the default value for the array element type
b) X for any array element type
c) Z for any array element type
d) 0 for any array element type
What is the inbuilt function in system verilog that will specify the size of an array?
For the given array int d[] = {2,3,5,7,3,6} The output of d.find_first_index with (item > 3); would
be
a) 1
b) 2
c) 3
d) 5
For the given array int d[] = {2,3,5,7,3,6} , the output count = d.sum with (item > 5); would be
a) 3
b) 2
c) 11
d) 16
What arguments are a and b in : task run(ref int array[50], int a, b);
a) Input
b) Output
c) Ref
d) Inout
Int da[string] is a
a) Dynamic array
b) Associative array
c) Queue
d) Fixed array
What are the array operations used to step through the elements of an array?
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Threads(7)
Give the output of the following piece of code.
fork
begin:A
$display("time = %0d, Thread A has started ",$time );
#(10);
$display("time = %0d, Thread A has finished ",$time );
End
begin:B
$display("time = %0d, Thread B has started ",$time );
#(5);
$display("time = %0d, Thread B has finished ",$time );
End
Join
$display("time = %0d Outside the main fork ",$time );
Give the output of the following piece of code.
fork
begin:A
$display("time = %0d, Thread A has started ",$time );
#(10);
$display("time = %0d, Thread A has finished ",$time );
End
begin:B
$display("time = %0d, Thread B has started ",$time );
#(5);
$display("time = %0d, Thread B has finished",$time );
End
join_any
$display("time = %0d Outside the main fork ",$time );
fork
begin:A
$display("time = %0d, Thread A has started ",$time );
#(10);
$display("time = %0d, Thread A has finished ",$time );
end
begin:B
$display("time = %0d, Thread B has started ",$time );
#(5);
$display("time = %0d, Thread B has finished ",$time );
end
join_none
$display("time = %0d Outside the main fork ",$time );
How do you kill the thread “A” in the following code and give the output.
fork:fork_name
begin:C
$display("time = %0d, Thread C has started ",$time );
# (20);
$display("time = %0d, Thread C has finished ",$time );
end
begin:A
$display("time = %0d, Thread A has started ",$time );
#(10);
$display("time = %0d, Thread A has finished ",$time );
end
begin:B
$display("time = %0d, Thread B has started ",$time );
#(5);
$display("time = %0d, Thread B has finished ",$time );
end
join_any
Disable all the threads within the fork in following code and give the output.
fork:fork_name
begin:C
$display("time = %0d, Thread C has started ",$time );
# (20);
$display("time = %0d, Thread C has finished ",$time );
end
begin:A
$display("time = %0d, Thread A has started ",$time );
#(10);
$display("time = %0d, Thread A has finished ",$time );
end
begin:B
$display("time = %0d, Thread B has started ",$time );
#(5);
$display("time = %0d, Thread B has finished ",$time );
end
join_any