• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Parameterized classes

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 64
  • Views 13424
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Parameterized classes

archive
archive over 19 years ago

Hi,

I was wondering if/when parameterized classes were going to be supported?  I seem to be getting errors in 5.7-s1 of seemingly legal syntax according to the 3.1a System Verilog LRM section 11.23.

class class_test #(int W=5);
                     |
ncvlog: *E,NULLPP (test.v,3|21): empty/illegal list of parameters [12.1(IEEE-2001)].

The error seems to be referring to the 12.1 Modules section of the Verilog 2001 LRM.

SV 3.1a LRM excerpt:
11.23 Parameterized classes
It is often useful to define a generic class whose objects can be instantiated to have different array sizes or data
types. This avoids writing similar code for each size or type, and allows a single specification to be used for
objects that are fundamentally different, and (like a templated class in C++) not interchangeable.
The normal Verilog parameter mechanism is used to parameterize a class:
class vector #(int size = 1);
bit [size-1:0] a;
endclass
Instances of this class can then be instantiated like modules or interfaces:
vector #(10) vten; // object with vector of size 10
vector #(.size(2)) vtwo; // object with vector of size 2
typedef vector#(4) Vfour; // Class with vector of size 4


Originally posted in cdnusers.org by weberrm
  • Cancel
  • archive
    archive over 19 years ago

    From what I've gathered, it doesn't sound like parameterized classes will available until IUS 5.9.  That's too bad...


    Originally posted in cdnusers.org by weberrm
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information