0% found this document useful (0 votes)
78 views167 pages

Verification of Vlsi Circuits Using Systemverilog: Vinay Reddy

This document discusses object oriented programming in SystemVerilog for verifying VLSI circuits. It covers classes, handles, objects, encapsulation, and creating objects using the new constructor. Custom constructors are described as a way to initialize nested class handles. Variable assignment copies the value, while handle assignment results in two handles pointing to the same object. Methods are called using the object handle.

Uploaded by

varsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views167 pages

Verification of Vlsi Circuits Using Systemverilog: Vinay Reddy

This document discusses object oriented programming in SystemVerilog for verifying VLSI circuits. It covers classes, handles, objects, encapsulation, and creating objects using the new constructor. Custom constructors are described as a way to initialize nested class handles. Variable assignment copies the value, while handle assignment results in two handles pointing to the same object. Methods are called using the object handle.

Uploaded by

varsha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 167

Verification of VLSI Circuits using

SystemVerilog
Vinay Reddy
Department of Electronics & Communication Engineering

1
VERIFICATION OF VLSI CIRCUITS USING
SYSTEMVERILOG

Classes (OOP - 1)

Vinay Reddy
Department of Electronics and Communication Engineering
2
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Object Oriented Programming (OOP)

3
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

4
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

What is difference between classes & Structures?

Classes are dynamic data type.


Structures are static data type.
Called as members of the class
Structures contain only variables (Properties)
Classes contain both variables & Methods

5
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

6
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Properties of class named packet

members of class named packet

Methods of class named packet

7
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Properties of class named packet

members of class named packet

Methods of class named packet

Grouping all the members


into a class named packet is
called Encapsulation

8
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

reg a;
a is a variable of the data type reg

pkt is a handle of type packet and packet is a class data type

For class data type we declare handles, rest all available data
types in the language we declare variables.

9
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Step 1 : Class definition


Step 2 : Handle Declaration
Step 3 : Constructing the object

How to create object?

Inbuilt in the language


It allocates memory to all the members (Now they are physically present)

10
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Step 1 : Class definition


Step 2 : Handle Declaration
Step 3 : Constructing the object

How to create object?

new() constructor Inbuilt in the language


It allocates memory to all the members (Now they are physically present – object is created)

11
The two jobs of new()
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Here pkt is called handle

Here pkt is called object

12
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

pkt is pointing to null since the object is not yet created

13
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

14
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Now you can access the contents of the class


The handle will point to the object

15
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Note :

4 + 4 = 8 bytes
4 * 8 = 32 bytes
Total = 40 bytes

Functions and tasks will be


allocated stack when ever
they are called.

Tasks are automatic by


default inside the class.

16
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Step 1 : Class definition

Step 2 : Handle declaration


Step 3 : Object Creation

https://www.edaplayground.com/x/3QQs
SV OOP : All Examples - EDA Playground

17
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Transaction A1, A2;

A1 = new;

Custom constructor

18
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

19
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

20
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

a1 handle belonging to class A inside class B

21
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Memory allocation will not happen to the nested handle when we define the
object for the top handle

22
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

How to allocate memory to a1?

23
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Two step process (Maintenance Issue)

24
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Custom constructor

25
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

What is the output of the code snippet ?


reg [3:0] a,b;
initial
begin
a = 10;
b = a;
$display (b);
a = 20;
$display (b);
end

26
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

reg [3:0] a,b; What is the output of these code snippets ?

initial
begin
a = 10;
b = a; // Variable Assignment
$display (b);
a = 20;
$display (b);
end

always@(a)
b = a; 27
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

28
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

// Handle Assignment

29
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

30
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes
One car with two keys.
One object with two handles

What is a2.m ?

31
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

This is called as garbage in System


Verilog and will be cleaned automatically

32
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

This is called as garbage in System


Verilog and will be cleaned automatically

Note: In order to have handle assignment – both objects


should be of same class

33
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Handle Assignment

Now how do we do Variable assignment ?

34
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Two classes a1 and a2

35
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

An object is created for a2 and the


contents of a1 are copied to a2

36
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

37
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

38
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

39
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

40
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

41
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Deep Copy

42
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

Both are related, You cannot call it as a complete Copy

43
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Classes

44
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
this

this keyword is used to refer


class properties explicitly.

45
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
this

this keyword is used to refer


class properties explicitly.

46
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
this

this keyword is used to refer


class properties explicitly.

Note: This problem exist only when the argument name and the property name are same

47
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
this

Note: This problem exist only when the argument name and the property name are same

this keyword is used to


refer class properties
explicitly.

48
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Out – of – block declarations

• Class has properties and Methods

• To make the class look more neat and readable we


can write the methods out of the class block

49
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Out – of – block declarations

50
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Out – of – block declarations

Now my class looks more readable and neat

51
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

52
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

It returns a object

53
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

The function is called

54
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

55
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

56
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

57
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

p1 handle

Address : 0X4000

a1 handle

58
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

p1 handle

h1 handle

59
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Passing Objects to Methods

h1 will point to p1

60
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

61
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

62
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

63
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

64
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

65
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

66
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

67
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

68
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

a2.addr = a1.addr
a2.data = a1.data

69
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function

70
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Writing Copy Function - Deep Copy

71
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

1. Static variable exist in the memory always


2. We can access that variable always (no object is necessary)

72
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

73
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

74
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

75
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

76
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

77
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

78
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

79
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

80
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

Note: Static methods are allowed to


access only static properties else you
will get compile error.

81
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Static Class Properties

82
VERIFICATION OF VLSI CIRCUITS USING
SYSTEMVERILOG

Classes (OOP - 2)

Vinay Reddy
Department of Electronics and Communication Engineering
83
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

84
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

85
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

86
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

87
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

88
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

89
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

90
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

91
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

92
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Super

93
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Super

94
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

Custom constructor

Object d1

m=?
K=0

95
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

96
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

97
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Inheritance

98
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Is SV Single or Multi Inheritance

99
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

100
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

101
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

102
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

103
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

104
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

105
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

106
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

107
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

108
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

109
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Overridden Methods

110
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Data Hiding

111
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Data Hiding

112
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Data Hiding

113
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Parameterized Classes

114
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Parameterized Classes

115
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

116
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

117
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

118
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

119
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

120
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

121
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Polymorphism

122
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Handle Assignment

123
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Handle Assignment

124
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Handle Assignment

125
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

Edit code - EDA Playground


Edit code - EDA Playground
Edit code - EDA Playground
Edit code - EDA Playground
Edit code - EDA Playground
SV Topic12 Randomization Simple example - EDA Playground
Edit code - EDA Playground

126
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization
Case 1 – Pseudo randomization Case 2 – Randomization with seed Case 3 – Randomization with constraints

Edit code - EDA Playground


Edit code - EDA Playground
Edit code - EDA Playground

127
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization
Case 1 – Pseudo randomization Case 2 – Randomization with seed Case 3 – Randomization with constraints

Lets move all these constraints and


the random variables into a class

Edit code - EDA Playground


Edit code - EDA Playground Edit code - EDA Playground

128
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

129
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

130
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

131
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

132
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

Edit code - EDA Playground

133
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

output

Edit code - EDA Playground 134


VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

Edit code - EDA Playground 135


VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

Conflicting Constraints

136
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

137
138
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

139
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

140
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

141
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

142
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

143
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

144
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization Edit code - EDA Playground

145
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

146
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

147
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

148
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

149
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization SV Topic12 Randomization Simple example - EDA Playground

150
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

151
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

152
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

153
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

154
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

155
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

156
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

157
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

158
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization SV Topic 12 : soft constraints example - EDA Playground

159
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization
pre_randomize and post_randomize

ou cannot pass arguments to randomize, pre_randomize, post_randomize

SV Topic 12 post_randomize application - EDA Playground


160
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

161
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

SV Topic12 Randomization Inheritance - EDA Playground


162
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization
SV Topic12 Randomization Inheritance - EDA Playground

Derived class constraints have overridden the base class constraints


163
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization - Polymorphism By default the constraints are virtual

164
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

165
VERIFICATION OF VLSI CIRCUITS USING SYSTEMVERILOG
Randomization

166
THANK YOU

Vinay Reddy
Department of Electronics & Communication Engineering
[email protected]
+91 9945730244

167

You might also like