Skip to content
asicguru.tech@gmail.com
REGISTER LOGIN
AsicGuru Ventures
  • All Courses
  • CONTACT
  • GALLERY
  • HOME
  • Tutorials

0

Verilog Tutorial

17
  • Introduction
  • Lexical Tokens
  • Gate-Level Modelling
  • Data Types
  • Operators
  • Operands
  • Modules
  • Behavioral Modeling
  • Timing Controls
  • Procedures: Always and Initial Blocks
  • Functions
  • Tasks
  • Component Inference
  • Finite State Machines.
  • Compiler Directives
  • System Tasks and Functions
  • Test Benches

System Verilog

23
  • System Verilog Introduction
  • Data Types
  • Type Casting
  • Arrays
  • Associative Arrays
  • Dynamic Arrays
  • Queue
  • Operators
  • Procedural statements and Control flow
  • Classes
  • Inheritance
  • Encapsulation
  • This and Super operator
  • In-Line Constraints
  • Class Constraints
  • Virtual Classes
  • Parameterized Classes
  • Classes Summary
  • Singleton Classes
  • Functional Coverage Introduction
  • Covergroup
  • Tools
  • Books

Scripting

15
  • Introduction
  • Perl Tutorial
  • What is Perl
  • Perl: Syntax And Variable
  • Perl Strings
  • Perl Arrays
  • Perl Associative Arrays
  • If/While Syntax
  • File Input
  • Print Output
  • String Processing with Regular Expressions
  • Subroutines
  • Running External Programs
  • References
  • Terse Perl

Makefile

1
  • Makefile Tutorial

Interview Questions

2
  • SystemVerilog Interview Questions
  • Verilog Interview Questions

Handwritten Notes

3
  • Perl (Scripting)
  • Linting
  • CMOS Logic Design
View Categories
  • Home
  • Tutorials
  • System Verilog
  • This and Super operator

This and Super operator

2 min read

In SystemVerilog, this and super are special object handles used inside class-based code.

They help when:

  • You need to refer to current or parent class members
  • You’re working with inheritance
  • You want to clearly specify which variable or method you’re referring to

What is this? #

The this keyword is a handle that refers to the current object of the class.

Purpose of this #

  • To differentiate between class variables and local variables (e.g., method arguments with the same name)
  • To refer to the current object explicitly
  • To pass the current object to functions, modules, or other objects

Example: Disambiguating variable names

class Packet;
  bit [7:0] addr;

  function void set_addr(bit [7:0] addr);
   this.addr = addr; // 'this.addr' is the class variable,right-side is argument
  endfunction
endclass

Without this keyword, addr = addr; assigns the argument to itself — which is incorrect!

What is super? #

In SystemVerilog, when a child class overrides a method from its parent class, the original version in the parent gets hidden. However, if you still want to access or invoke the parent’s original method from the child class, you can use the super keyword.

Syntax:

super.method_name();

Why Use super? #

  • To extend the behavior of a method instead of completely replacing it.
  • Useful when the child needs to add some functionality before or after the parent’s logic.

Example:

class Parent;
  function void display();
    $display("This is Parent class display method");
  endfunction
endclass

class Child extends Parent;
  function void display();
    $display("This is Child class display method");

    // Call the parent's version
    super.display();
  endfunction
endclass

module test;
  initial begin
    Child c = new();
    c.display();
  end
endmodule

Output:

This is Child class display method
This is Parent class display method

Comparison Table: this vs super #

Featurethissuper
Refers toCurrent class objectParent class object
Use caseAccess current class membersAccess parent class members
Constructor useCannot call constructorCan call parent constructor (super.new())
ScopeInside the classInside inherited (child) class
OverridingRefers to overridden method/varAccesses original version from parent

Key Points #

  • Use this to clearly refer to class members or pass the current object.
  • Use super when using inheritance to call or reuse parent class behavior.
  • super is especially useful when the child class overrides a function but still wants to use the parent version.
  • this is helpful for clarity, especially when variable names overlap.
Updated on August 2, 2025

What are your Feelings

  • Happy
  • Normal
  • Sad
Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
EncapsulationIn-Line Constraints

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • What is this?
    • Purpose of this
  • What is super?
    • Why Use super?
  • Comparison Table: this vs super
  • Key Points

Archives

  • May 2025

Categories

  • Slider Post
  • Uncategorized

Copyright @ Asicguru Ventures by Misbah WP | Proudly powered by WordPress