Basic Data Types:

OpenVera‚~@~Ys basic data types are:

Enumerated Types
Virtual Ports
Smart Queues
Standalone Coverage Group

Integer :

Integers are signed variables.For 32 bit mechine,range is between -231 and 231 -1.An integer may become X (unknown) when it is not initialized or when an undefined value is stored.

Register :

Registers are unsigned variables with the value 0, 1, z, or x.Registers can be declared with multiple bit widths.

value condition
0 logic 0
1 logic 1
z high impedance
x unknown

String :

A string is a sequence of characters enclosed by double quotes.OpenVera has stringmethods for mamuplulating the charecters.

string a;
string b = "Hi";
string c = b;

Event :

A event can be triggered explicitly. It can be used in an event expression to control the execution of procedural statements.

Enumerated Types :

Enumerated types are a user-defined list of named integer constants. They can either be defined in the global name space, or in a class.Elements within enumerated type definitions are numbered consecutively, starting from 0.Each element may have an optional explicit value assigned to it.

Default numbering
Ex : enum colors {red, green, blue, yellow, white, black};
Explicit numbering
Ex : enum instructions {add=10, sub, div, mul=4, jmp};
Class Scope enumration
Ex : class Bus { enum TRAFFIC = PCI, AHB, USB; }

Virtual Ports :

A virtual port is a user-defined data type that contains a set of port signal members grouped together under a given user-defined port name.

port rcv_port
Arrays :

OpenVera has one dimentional and multidimentional arrays.
There are four different types of arrays.

Fixed-Size Arrays :

Arrays whose size is fixed at compilation time are called fixed tsize arrays.The access time is constant regardless of the number of elements in an array.Multi-dimensional arrays are fixed-size arrays with multiple dimensions.

integer array_ex[5]; // 1D array of size 5
integer matrix [2][5]; // 2d array of size 2 x 5
integer x[2][2]={{0,1},{2,3}}; // Array initilization

Dynamic Arrays :

The size of dynamic arrays can be allocated and resized at runtime.

integer array_ex[*];

new[] : The new[] operator is used to set or change the size of dynamic
arrays during runtime.

integer packetA[*], packetB[*]; // Declare 2 arrays.
packetA = new[100]; // Create packetA.
packetB = new[100] (packetA); // create packetB and initia

Associative Arrays :

When the size of the collection is unknown or the data space is sparse, associative array are used.Associative arrays do not have any storage allocated until it is used, and the index expression is not restricted to integral expressions, but can be of any type.

integer regular[]; // bit indexed associative arrays
integer regular[bit];
integer map[string];

Smart Queues :

Smart Queue is a sequence / deque / vector of homogeneous elements. Smart queues can be used to model a last in, first out buffer or first in, first out buffer. This supports insertion and deletion of elements from random locations using an index.

integer queue_of_int[$]; //declare Smart Queue of integers
queue_of_int.push_front(1234); //inseqting 1234 into queue

Class :

The user-defined data type, class, is composed of data members of valid OpenVera data types (known as properties) and tasks or functions (known as methods) for manipulating the data members.The properties and methods, taken together, define the contents and capabilities of a class instance or object.

Data Types
Linked List
Operators Part 1
Operators Part 2
Operators Part 3
Operator Precedence
Control Statements
Procedures And Methods
Fork Join
Shadow Variables
Fork Join Control
Wait Var
Event Sync
Event Trigger
Randomization Methods
Constraint Block
Constraint Expression
Variable Ordaring
Predefined Methods
String Methods
Queue Methods
Dut Communication
Functional Coverage

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!




copyright © 2007-2017 :: all rights reserved www.testbench.in::Disclaimer