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

c 


   

1. What is the difference between a function and a task?


Answer

À   

Can enable another function but not another
Can enable other tasks and functions.
task.
Executes in 0 simulation time. May execute in non-zero simulation time.
Must not contain any delay, event, or timing May contain delay, event, or timing control
control statements. statements.
Must have at least one input argument. They May have zero or more arguments of type input,
can have more than one input. output, or inout.
Tasks do not return with a value, but can pass
Functions always return a single value. They
multiple values through output and inout
cannot have output or inout arguments.
arguments.


ë. What is the difference between $display and $monitor?


Answer

The syntax of both statements is same. $monitor continuously monitors the values of the
variables or signals specified in the parameter list and executes the statement whenever the value
of any one of the variable/parameter changes. Unlike $display, $monitor needs to be invoked
only once.


3. What is the difference between wire and reg?


Answer

Wire is a net data type, represents connections between hardware elements. It's default value is z.
Where as reg is a register data type, which represent data storage elements. Registers retain value
until another value is placed onto them. It's default value is x.


4. What is the difference between blocking and non-blocking assignments?


Answer

Blocking assignment statements are executed in the order they are specified in a sequential
block. A blocking assignment will not block execution of statements that follow in a parallel
block. The " = " operator is used to specify blocking assignments.
Nonblocking assignments allow scheduling of assignments without blocking execution of the
statements that follow in a sequential block. A " <= " operator is used to specify nonblocking
assignments


5. What is the difference between casex, casez and case statements?


Answer

casez treats all z values in the case expression as don't cares. casex treats all x and z values in the
case expression as don't cares

             


                      
                  
    
      
 !"#$%
        &            
  
    
"#$!%


1. How are blocking and non-blocking statements executed?


Answer

In a blocking statement, the RHS will be evaluated and the LHS will be then updated, without
interruption from any other Verilog statement. A blocking statement "blocks" trailing statements.
In a non-blocking statement, RHS will be evaluated at the beginning of the time step. Then the
LHS will be updated at the end of the time step.

ë. How do you model a synchronous and asynchronous reset in Verilog?


Answer

[  

    
 

 




  

       

 

 


p
The logic is very simple: In asynchronous reset, the always block will invoked at positive edge
of the reset signal, irrespective of clock's value.
4. Write a verilog code to swap contents of two registers with and without using a temporary
register.
Answer

With a temporary register:


always @ (posedge clock)
begin
temp_reg=b;
b=a;
a=temp_reg;
end

Without using a temporary register:


always @ (posedge clock)
begin
a < = b;
b < = a;
end

6. What does `timescale 1 ns/ 1 ps¶ signify in a verilog code?


Answer

It means the unit of time is 1ns and the precision/accuracy will be up to 1ps.

7. what is the use of defparam?


Answer

Parameter values can be changed in any module instance in the design with the keyword
defparam.

'( )*            


+, -(+             .  
'(    /(!+0    !+         $#$#$#


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