Header = 0x2, Encode = 0, Mode = 0x3, Stop = 1 To do that, you have to create an object of the class, which can be used as a handle to its properties and methods. How can I access signals within a class ? function new () has default values to the arguments, and hence line 6 (below) will create a packet object with values.display () is a function, and rightly so, because displaying values does not consume simulation time.Normally used within a class to refer to its own properties/methods. this keyword is used to refer to the current class.function new () is called the constructor and is automatically called upon object creation. There are a few key things to note in the example above: This.header, this.encode, this.mode, this.stop) Here's an example:įunction new (bit header = 3'h1, bit mode = 5) Class is a user-defined datatype, an OOP construct, that can be used to encapsulate data (property) and tasks/functions (methods) which operate on the data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |