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

0

Verilog Tutorial

17
  • Verilog 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
View Categories
  • Home
  • Tutorials
  • System Verilog
  • Virtual Classes

Virtual Classes

1 min read

#

A virtual class is a temple or place holder for the child classes. A virtual class is also called as the abstract class. A virtual class is declared with a virtual keyword like :

virtual class base;

endclass;

A virtual class instance or object can not be constucted but you can define the hadle to the virtual class.

Virtual methods can be defined as templates. Basically it forces all extended classes to implement the functions. In the virtual functions

  1. First and the last line of the subprgrams only  is defined 
  2. Defines name and the arguments
  3. Does not define the implementation or virtual functions does not have a body.
  4. For virtual functions a implementation must be defined by the extened subclasses basically it forces them to implement standard set of methods
  5. Virtual method templates are basically defined in the virtual classes.

view source

print?

01.virtual class baseframe;

02....

03.virtual function void iam();

04.endfunction

05....

06.endclass

07. 

08.class shortframe extends baseframe;

09....

10.function void iam();

11.$display ("Short Frame");

12.endfunction

13.endclass

14. 

15.class longframe extends baseframe;

16....

17.function void iam();

18.$display ("Long Frame");

19.endfunction

20.endclass

21. 

22.baseframe two;  // OK

23. 

24.initial begin

25.two = new(4); // ERROR

26....

Updated on May 4, 2025

What are your Feelings

  • Happy
  • Normal
  • Sad
Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Class ConstraintsParameterized Classes

Leave a Reply Cancel reply

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

Table of Contents

Archives

  • May 2025

Categories

  • Slider Post
  • Uncategorized

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