Hardware Verification with SystemVerilog: An Object-Oriented Framework

Chapter 11: OOP Classes

Highlights

Experience is a dear teacher, but fools will learn at no other.

Benjamin Franklin

Coming up with the appropriate classes for your project is an experience-based effort. In other words, the authors made many mistakes in the beginning. To help you in designing classes, we have collected experience from our previous efforts.

So do what the authors did when they learned SystemVerilog: find examples, copy, and paste!

This chapter introduces the thought process for creating classes, to answer questions such as these:

  • How do I determine what is a class, and what is a method?

  • How should I handle global functionality?

  • What can inheritance do for me?

Overview

Classes are fundamental to writing in an object-oriented language. But how do we decide what is a class? We have talked about thinking in terms of layers of abstractions. We have talked about roles and responsibilities. The next thing is to start toname the classes and their responsibilities. This is not as hard as it sounds. For one thing, you make classes as you feel they should be, and there is no right or wrong way. Let each class do what feels right to you. There will, of course, be some spirited team discussions.

Once you decide on some classes, you can "wire up" instances of classes pretty much like you create and "wire up" modules in hardware. Unlike hardware, however, classes can have more "electricity." When designing hardware, you are restricted to connecting blocks through wires or signals, but with...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Audio Amplifiers and Preamplifiers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.