Trung tâm đào tạo thiết kế vi mạch Semicon


  • ĐĂNG KÝ TÀI KHOẢN ĐỂ TRUY CẬP NHIỀU TÀI LIỆU HƠN!
  • Đăng ký
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
semicon_lab.jpg

Các câu phỏng vấn và trả lời về Verilog (Phần 1)

 

 

 

 

Question 1. Write A Verilog Code To Swap Contents Of Two Registers With And Without A Temporary Register?

Answer :

With temp reg ;

always @ (posedge clock)

begin

temp=b;

b=a;

a=temp;

end

Without temp reg;

always @ (posedge clock)

begin

a <= b;

b <= a;

end

Question 2. Difference Between Task And Function?

Answer :

Function:

A function is unable to enable a task however functions can enable other functions.

A function will carry out its required duty in zero simulation time. ( The program time will not be incremented during the function routine)

Within a function, no event, delay or timing control statements are permitted

In the invocation of a function their must be at least one argument to be passed.

Functions will only return a single value and can not use either output or inout statements.

Tasks:

Tasks are capable of enabling a function as well as enabling other versions of a Task

Tasks also run with a zero simulation however they can if required be executed in a non zero simulation time.

Tasks are allowed to contain any of these statements.

A task is allowed to use zero or more arguments which are of type output, input or inout.

A Task is unable to return a value but has the facility to pass multiple values via the output and inout statements .

Question 3. Difference Between Inter Statement And Intra Statement Delay?

Answer :

//define register variables

reg a, b, c;

//intra assignment delays

initial

begin

a = 0; c = 0;

b = #5 a + c; //Take value of a and c at the time=0, evaluate

//a + c and then wait 5 time units to assign value

//to b.

end

//Equivalent method with temporary variables and regular delay control

initial

begin

a = 0; c = 0;

temp_ac = a + c;

#5 b = temp_ac; //Take value of a + c at the current time and

//store it in a temporary variable. Even though a and c

//might change between 0 and 5,

//the value assigned to b at time 5 is unaffected.

end

Question 4. Difference Between $monitor,$display & $strobe?

Answer :

These commands have the same syntax, and display text on the screen during simulation. They are much less convenient than waveform display tools like cwaves?. $display and $strobe display once every time they are executed, whereas $monitor displays every time one of its parameters changes.

The difference between $display and $strobe is that $strobe displays the parameters at the very end of the current simulation time unit rather than exactly where it is executed. The format string is like that in C/C++, and may contain format characters. Format characters include %d (decimal), %h (hexadecimal), %b (binary), %c (character), %s (string) and %t (time), %m (hierarchy level). %5d, %5b etc. would give exactly 5 spaces for the number instead of the space needed. Append b, h, o to the task name to change default format to binary, octal or hexadecimal.

Syntax:

$display (“format_string”, par_1, par_2, ... );

$strobe (“format_string”, par_1, par_2, ... );

$monitor (“format_string”, par_1, par_2, ... );

Question 5. What Is Difference Between Verilog Full Case And Parallel Case?

Answer :

A "full" case statement is a case statement in which all possible case-expression binary patterns can be matched to a case item or to a case default. If a case statement does not include a case default and if it is possible to find a binary case expression that does not match any of the defined case items, the case statement is not "full."

A "parallel" case statement is a case statement in which it is only possible to match a case expression to one and only one case item. If it is possible to find a case expression that would match more than one case item, the matching case items are called "overlapping" case items and the case statement is not "parallel."

Question 6. What Is Meant By Inferring Latches,how To Avoid It?

Answer :

Consider the following :

always @(s1 or s0 or i0 or i1 or i2 or i3)

case ({s1, s0})

2'd0 : out = i0;

2'd1 : out = i1;

2'd2 : out = i2;

endcase

in a case statement if all the possible combinations are not compared and default is also not specified like in example above a latch will be inferred ,a latch is inferred because to reproduce the previous value when unknown branch is specified.

For example in above case if {s1,s0}=3 , the previous stored value is reproduced for this storing a latch is inferred.

The same may be observed in IF statement in case an ELSE IF is not specified.

To avoid inferring latches make sure that all the cases are mentioned if not default condition is provided.

Question 7. Tell Me How Blocking And Non Blocking Statements Get Executed?

Answer :

Execution of blocking assignments can be viewed as a one-step process:

1. Evaluate the RHS (right-hand side equation) and update the LHS (left-hand side expression) of the blocking assignment without interruption from any other Verilog statement. A blocking assignment "blocks" trailing assignments in the same always block from occurring until after the current assignment has been completed

Execution of nonblocking assignments can be viewed as a two-step process:

- Evaluate the RHS of nonblocking statements at the beginning of the time step.

- Update the LHS of nonblocking statements at the end of the time step.

- Shell Scripting Tutorial  System Administration Interview Questions

Question 8. Variable And Signal Which Will Be Updated First?

Answer :

Signals

Question 9. What Is Sensitivity List?

Answer :

The sensitivity list indicates that when a change occurs to any one of elements in the list change, begin…end statement inside that always block will get executed.

Question 10. In A Pure Combinational Circuit Is It Necessary To Mention All The Inputs In Sensitivity Disk? If Yes, Why?

Answer :

Yes in a pure combinational circuit is it necessary to mention all the inputs in sensitivity disk other wise it will result in pre and post synthesis mismatch. 

Nguồn:  wisdomjobs

Bạn Có Đam Mê Với Vi Mạch hay Nhúng      -     Bạn Muốn Trau Dồi Thêm Kĩ Năng

Mong Muốn Có Thêm Cơ Hội Trong Công Việc

    Và Trở Thành Một Người Có Giá Trị Hơn

Bạn Chưa Biết Phương Thức Nào Nhanh Chóng Để Đạt Được Chúng

Hãy Để Chúng Tôi Hỗ Trợ Cho Bạn. SEMICON  

 

Hotline: 0972.800.931 - 0938.838.404 (Mr Long)

 

 

Related Articles

Chat Zalo