Home Open Vera Tutorial Task and Functions
Main Menu
System Verilog
Open Vera
    - Tutorial
        -- Hello World
        -- Data Types
        -- Operators
        -- Control Structures
        -- Task and Functions
        -- Arrays
        -- Associative Arrays
        -- Associative Arrays
        -- Strings
        -- Files
        -- Interfaces
        -- Virtual ports and binds
        -- Concurrency
        -- Mailboxes
        -- Regions
        -- Events
        -- Semaphores
    - Examples
    - Tools
    - Links
    - Books
    - Interview Questions
Digital Concepts
Verification Basics
Interview Questions
Computer Architechture
C and C++
AsicGuru Blog
Tags Cloud
Usefull Sites
Know Your IP/Location
Local Information India
Buy Car/Inverter Batteries
Real Estate India
Sports Accessories India
Task and Functions in Vera
Share This Articale:

Task and Functions in Vera :

1. Functions :

Open Vera funcitons can have zero or more arguments and it can return on value. The syntax for the function is

function data_type func_name ( data_type arg_list )





data_type : it can be build in or user defined data type. Return value has the same data_type as declared in the function. Function can not return Arrays.

func_name : Function name which will be used to call the function throughout the program

arg_list : An argument is a variable, including the data type, that is passed to the function when the function is called. You can pass all data types, including interface signals. Array arguments can be regular or associative, as well as var (that is, array arguments can be passed by reference). The type and dimension of the array in the call must match the type and dimension of the array in the function declaration. Separate multiple arguments using commas.

statements : Can be any valid open vera statement

A function can be called with statement like :

ret_val = func ();

Function returns a value so it should be called in a assignment statement. If you want to discard the return value use it like

void = func (a, b, c);

Return Statement :

A return statement casues the function to return immediately to its caller. A return statement is is shown below :

function integer add (integer a, integer b)


    add = a + b;

    return ;



2. Tasks :



This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start

Prev << Control Structures

Next >> Arrays

Sign In
Login with :-
| | |  
  • Bookmark