显示标签为“IC_verf”的博文。显示所有博文
显示标签为“IC_verf”的博文。显示所有博文

2009年2月25日星期三

SV interview questions

enjoy it!!:)

Qi1)What is callback ?

(Qi2)What is factory pattern ?

(Qi3)Explain the difference between data types logic and reg and wire .

(Qi4)What is the need of clocking blocks ?

(Qi5)What are the ways to avoid race condition between testbench and RTL using SystemVerilog?

(Qi6)Explain Event regions in SV.

(Qi7)What are the types of coverages available in SV ?

(Qi8)What is OOPS?

(Qi9)What is inheritance and polymorphism?

(Qi10)What is the need of virtual interfaces ?

(Qi11)Explain about the virtual task and methods .

(Qi12)What is the use of the abstract class?

(Qi13)What is the difference between mailbox and queue?

(Qi14)What data structure you used to build scoreboard?

(Qi15)What are the advantages of linkedlist over the queue ?

(Qi16)How parallel case and full cases problems are avoided in SV ?

(Qi17)What is the difference between pure function and cordinary function ?

(Qi18)What is the difference between $random and $urandom?

(Qi19)What is scope randomization ?

(Qi20)List the predefined randomization methods.

(Qi21)What is the dfference between always_combo and always@(*)c?

(Qi22)What is the use of packagess?

(Qi23)What is the use of $cast?

(Qi24)How to call the task which is defined in parent object into derived class ?

(Qi25)What is the difference between rand and randc?

(Qi26)What is $root?

(Qi27)What is $unit?

(Qi28)What are bi-directional constraints?

(Qi29)What is solve...before constraint ?

(Qi30)Without using randomize method or rand,generate an array of unique values?

(Qi31)Explain about pass by ref and pass by value?

(Qi32)What is the difference between
bit[7:0] sig_1;
byte sig_2;

(Qi33)What is the difference between program block and module ?

(Qi34)What is final block ?

(Qi35)How to implement always block logic in program block ?

(Qi36)What is the difference between fork/joins, fork/join_none fork/join_any ?

(Qi37)What is the use of modports ?

(Qi38)Write a clock generator without using always block.

(Qi39)What is forward referencing and how to avoid this problem?

(Qi40)What is circular dependency and how to avoid this problem ?

(Qi41)What is cross coverage ?

(Qi42)Describe the difference between Code Coverage and Functional Coverage Which is more important and Why we need them

(Qi43)How to kill a process in fork/join?

(Qi44)Difference between Associative array and Dynamic array ?

(Qi45)Difference b/wProcedural and Concarent Assertions?

(Qi46)What are the advantages of SystemVerilog DPI?

(Qi47)how to randomize dynamic arrays of objects?

(Qi48)What is randsequence and what is its use?

(Qi49)What is bin?

(Qi50)
Initial
wait_order(a,b,c);

Which from below initial process will cause that above wait order will pass.
a)
ig initial begin
#1;
->a;
->b;
->c;
end

b)
initial begin
#1;
->a;
end
always @a->b;
always(at)b-> c;

c)

initial begin
#1;
->a;
#0 ->b;
->>c;
end

d)

initial begin
#1 ->a;
#1 ->b;
#1 ->c;
end


(Qi51)Why always block is not allowed in program block?

(Qi52)Which is best to use to model transaction? Struct or class ?

(Qi53)How SV is more random stable then Verilog?

(Qi54)Difference between assert and expect statements?

(Qi55)How to add a new processs with out disturbing the random number generator state ?

(Qi56)What is the need of alias in SV?

(Qi57)What would be the output of the following code and how to avoid it?
for(int i=0; i 1?
Ans:=>

(Qi62)What is the need to implement explicitly a copy() method inside a transaction , when we can simple assign one object to other ?

(Qi63)How different is the implementation of a struct can union in SV.

(Qi64)What is "this"?

(Qi65)What is tagged union ?

(Qi66)What is "scope resolution operator"?


(Qi67)What is the difference between Verilog Parameterized Macros and SystemVerilog Parameterized Macros?


(Qi68)What is the difference between
logic data_1;
var logic data_2;
wire logic data_3j;
bit data_4;
var bit data_5;

(Qi69)What is the difference between bits and logic?

(Qi70)Write a Statemechine in SV styles.

(Qi71)What is the difference between $rose and posedgec?

(Qi72)What is advantage of program block over clockcblock w.r.t race condition?

(Qi73)How to avoid the race condition between programblock ?

(Qi74)What is the difference between assumes and assert?

(Qi75)What is coverage driven verification?

(Qi76)What is layered architecture ?

(Qi77)What are the simulation phases in your verification environment?

(Qi78)How to pick a element which is in queue from random index?

(Qi79)What data structure is used to store data in your environment and why ?

(Qi80)What is casting? Explain about the various types of casting available in SV.

(Qi81)How to importuall the items declared inside a package ?

(Qi82)Explain how the timescale unit and precision are taken when a module does not have any timescalerdeclaration in RTL?

(Qi83)What is streaming operator and what is its use?

(Qi84)What are void functions ?

(Qi85)How to make sure that a function argument passed has ref is not changed by the function?

(Qi86)What is the use of "extern"?

(Qi87)What is the difference between initial block and final block?
Ans:

You can't schedule an event or have delays in final block.


(Qi88)How to check weather a handles is holding object or not ?

(Qi89)How to disable multiple threads which are spawned by fork...join

2009年2月24日星期二

SV中mailbox的使用

下面为学习mailbox写的一个简单的sv代码,主要功能是一方发送随机数量的packet,一方接收该packet,两者的channel使用mailbox来实现。在questasim 6.5版本上编译通过,仿真通不过,具体的原因是questasim对mailbox的内容要求为packed类型。在VCS 200812版本上编译通过,仿真通过。
program automatic test_mailbox;
timeunit 1ns;
timeprecision 1ps;
int run_for_n_pkt = 10;

class packet;
rand bit [3:0] addr;
rand bit [7:0] din;
rand reg [7:0] payload[];

function new();
endfunction

constraint pkt_ct {
addr dist {[0:3] :=40,[4:7] :=60};
din inside {[0:$]};
payload.size() inside {[2:4]};
foreach(payload[i])
payload[i] == i;
}
endclass

class tx_pkts;
string name;
int num_pkt;
packet tx_pkt;
mailbox tx_mbx;

function new(string name = "TXP" ,mailbox tx_mbx = null,int num_pkt);
this.name = name;
this.tx_mbx = tx_mbx;
if(num_pkt <= 0 )
this.num_pkt = 1;
else
this.num_pkt = num_pkt;
endfunction

function void display();
$display("tx_pkt name is %s",name);
endfunction

task send_pkts();
fork
for(int i=0 ; i< num_pkt ;i++)
begin
packet temp_pkt;
temp_pkt = new();
if(!(temp_pkt.randomize()))
begin
$display("%t : randomize failed,please check your svtb! :%m",$realtime);
$finish;
end
tx_mbx.put(temp_pkt);
$display("transmitting data at %t:\n",$realtime);
$display("addr = %4b ; din = %8b;",temp_pkt.addr,temp_pkt.din);
foreach(temp_pkt.payload[j])
$display("payload[%d] = %2h;",j,temp_pkt.payload[j]);
#3;
end
join_none
endtask
endclass

class rx_pkts;
event done;
string name;
int num_pkt;
packet rx_pkt;
mailbox rx_mbx;

function new(string name = "RXP",mailbox rx_mbx = null);
this.name = name;
this.rx_mbx = rx_mbx;
this.num_pkt = 0;
endfunction

task receive_pkts();
fork
while(1)
begin
packet temp_pkt;
rx_mbx.get(temp_pkt);
$display("receiving data at %t:\n",$realtime);
$display("addr = %4b ; din = %8b;",temp_pkt.addr,temp_pkt.din);
foreach(temp_pkt.payload[j])
$display("payload[%d] = %2h;",j,temp_pkt.payload[j]);
num_pkt++;
if(num_pkt >= run_for_n_pkt)
->done;
end
join_none
endtask
endclass

initial
begin
mailbox p_mbx;
tx_pkts txp;
rx_pkts rxp;
p_mbx = new();
txp = new("INTEL",p_mbx,run_for_n_pkt);
rxp = new("VIMICRO",p_mbx);
#10;
txp.send_pkts();
rxp.receive_pkts();
wait(rxp.done.triggered);
end

endprogram