questions are related to comparison

Upload: srikanth-sri

Post on 10-Mar-2016

6 views

Category:

Documents


0 download

TRANSCRIPT

Questions are related to comparison (What is the difference betweem ...).

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

FunctionsTasks

Can enable another function but not another task.Can enable other tasks and functions.

Executes in 0 simulation time.May execute in non-zero simulation time.

Must not contain any delay, event, or timing control statements.May contain delay, event, or timing control statements.

Must have at least one input argument. They can have more than one input.May have zero or more arguments of type input, output, or inout.

Functions always return a single value. They cannot have output or inout arguments.Tasks do not return with a value, but can pass multiple values through output and inout arguments.

2. 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 "