You are on page 1of 11

SYSTEM VERILOG

BAVU VAMSHI KRISHNA


Date: 25-11-2022
 AGENDA

 OOP (Object-Oriented Programming)

 IPC (Inter Process Communication)

 References
 OOP
 All testbench components is creating using Objects(instances of class) this style of programming is
called as Object-Oriented Programming.
 Class consists of three elements
• Properties, Methods and Constraints.
 There are some concepts in OOP are
• Encapsulation
• Inheritance
• Polymorphism
 Encapsulation:
 The technique of hiding the data within the class and making it available only through the methods,
is known as encapsulation.
 Access control rules that restrict the members of a class from being used outside the class, this is
achieved by prefixing the class members with the keywords
• Local
• Protected
Cont.…
 Local
• External access to the class members can be avoided by declaring members as local.
• Syntax:- local integer x;
 Protected
• In some use cases, it is required to access the class members only by the derived classes, this
can be done by prefixing the class members with the protected.
• Syntax:- protected integer y;
 Inheritance:
 Inheriting base(parent) class properties, methods into a derived(child) class is known as Inheritance.
 New classes can be created based on existing classes, this is referred to as class inheritance.
 An inherited class is called a subclass of its parent class.
 A derived class may add new properties and methods or modify the inherited properties and
methods.
 Inheritance allows re-usability.
Cont.…
 Polymorphism:
 Choosing the Object implementation at run time.

 If we don’t declare task/function as virtual in base class, polymorphism doesn’t take effect.
 IPC
 Components in a testbench often need to communicate with each other to exchange data and check
output values of design. A few mechanism that allow components to affect the control flow. They
are
• Events
• Semaphores
• Mailbox
 Event:
 An event is a way to synchronize two or more different processes. One process waits for the event
to happen while another process triggers the event.
• Create an event using event keyword:- event e1;
• Trigger an event using -> operator:- ->e1;
• Wait for the event to happen:- @(e1); (or) wait(e1.triggered);.
Cont.…
 Semaphore:
 It is a just like a bucket with a fixed number of keys. Process that is used a semaphore must first got
a key from the bucket before they can continue to execute. Other processes must wait until keys are
available in the bucket for them to use.
 Semaphore is a built-in class and hence it should be used just like any other class object. It has a
few methods with which we can allocate number of keys for the semaphore object, get and put keys
into the bucket.
 Methods of semaphore: new, get, put and try_get.
• get is a task (if key is not available, we must wait so get is a task).
• put and try_get is a function.
Cont.…
 Mailbox:
 A mailbox is a way of allow different processes to exchange data between each other. It is similar to
the real postbox where letter can be put into the box and postman get the letters.
 Mailbox has a behavior like FIFO.
 Mailbox is a dynamic construct. Hence, need new to memory allocation.
 Mailbox are blocking in nature. i.e. bfm not proceed further if mailbox has no elements.
 Mailbox methods: new, get, put, try_get, try_put, num, peek.
• new: used to allocate memory
• get: get data from mailbox, wait till data available. This is task.
• put: put data into mailbox, wait till space in mailbox. This is also a task.
• try_get : try to get data from mailbox, doesn’t wait if data is not available. This is function.
• try_put : try to put data into mailbox, doesn’t wait even mail box is full. This is function.
• num: return total number of elements in mailbox.
• peek: copy the first element of mailbox, do not take out the elements.
 REFERENCE

https://verificationguide.com/systemverilog/systemverilog-tutorial/

https://www.chipverify.com/systemverilog/systemverilog-tutorial
THANK YOU
About Capgemini
Capgemini is a global leader in partnering with companies to transform and
manage their business by harnessing the power of technology. The Group is
guided everyday by its purpose of unleashing human energy through
technology for an inclusive and sustainable future. It is a responsible and
diverse organization of 270,000 team members in nearly 50 countries. With its
strong 50 year heritage and deep industry expertise, Capgemini is trusted by its
clients to address the entire breadth of their business needs, from strategy and
design to operations, fuelled by the fast evolving and innovative world of cloud,
data, AI, connectivity, software, digital engineering and platforms. The Group
reported in 2020 global revenues of €16 billion.

Get the Future You Want | www.capgemini.com

This presentation contains information that may be privileged or confidential


and is the property of the Capgemini Group.
Copyright © 2021 Capgemini. All rights reserved.

You might also like