Вы находитесь на странице: 1из 8

Datatype logic is a

a) 4 state signed variable


b) 2 state unsigned variable
c) 4 state unsigned variable
d) 2 state signed variable

Which of the following helps in reducing memory usage


a) Interface
b) Two state variables
c) Callback
d) All of the above

The advantage of enumerated datatypes are


a) Reduced memory usage
b) Support for abstract data structures
c) Build in string support
d) Code is easier to write and understand

Difference between int and integer is


a) Int is signed and integer is unsigned
b) Int is 2 state and integer is 4 state variable
c) Int is signed and integer is signed
d) B & c

Which of the following is false wrt Logic


a) It can be used as net
b) It can be used as reg
c) It can be used to model input, output and inout ports
d) None of the above

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

What is the difference between byte and bit[7:0]


a) Byte is signed and bit is unsigned
b) Byte is 2 state and bit is 4 state variable
c) A & B
d) Byte is unsigned and bit is signed

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 sparse memories, which array would you pick


a) Dynamic array
b) Associative array
c) Fixed array
d) Queues

The datatype is used to create user defined datatype


a) Struct
b) Enum
c) Typedef
d) Union

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

The datatype for the enum {READ, WRITE} write_en; is


a) Int
b) Integer
c) Logic
d) Bit

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 is the difference between int y and bit [31:0] y?

What are the array operations used to step through the elements of an array?

What is the difference between for and foreach loop?

In the following array, highlight multi_array [2] [1] [2].


bit [1:0] [7:0] multi_array [3]

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

What are new data types available in SV?

Tasks & Functions(6)


Which of the below w.r.t tasks and functions does not hold good in system verilog
a) Any port is seen as input default port direction
b) Unless declared, datatypes of ports are of logic type
c) Wire datatype can be used inside the port list
d) There is no need to begin ..end when more than one statement is used inside a task

In System Verilog, task can be called from function


a) True
b) False
What is the advantage of void function over task?

In class, tasks and functions are by default automatic.


a) True
b) False

In system verilog, Function can consume time.


a) True
b) False

Ref argument can only be used in routines with______?


a) Static storage
b) Automatic storage
c) Both (a) & (b)
d) None of the above

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 );

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_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

$display("time = %0d Outside the main fork ",$time );

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

Give the output of the following piece of code.


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_none
disable fork_name.A;
$display("time = %0d Outside the main fork ",$time );

Give the output of the following piece of code.


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_none
disable fork;
$display("time = %0d Outside the main fork ",$time );

Вам также может понравиться