• 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. Dynamic arrays

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 64
  • Views 14890
  • 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

Dynamic arrays

archive
archive over 17 years ago

Hi @all,

I wish you a happy new year.

I have a question concerning dynamic array.
I have to write a class method, which gets an integer (the CRC type, e.g. 8, 16, 32 ...) and a dynamic array, which contains the polynomial (binary).
It should be possible to change the CRC type in each single testcase, for example:

[code]
testclass tc;
tc = new;
tc.set_crc(8, 'b11110000);
[/code]

The first problem was, that it was not possible to give the function a dynamic array, but I think I have solved the problem with the ref keyword in order to call it by reference.
My whole function is listed below:

[code]
  function void Layer4::set_crc_properties(int crc_type, ref bit crc_polynomial[]);
    if ( crc_type + 1 != crc_polynomial.size() )
    begin
      $display("crc_type and dimension of polynomial does not match!");
      $display("Not assigning any value");
      return;
    end  
    this.crc_type = crc_type;
    this.crc_polynomial = new[this.crc_type+1](crc_polynomial);
  endfunction : set_crc_properties
[/code]

Within this function it seems to work (but I'm not quite sure).
The problem ist the code in the constructor-function, where I simple do the following:

[code]
this.crc_polynomial = new[17]('b0);   
[/code]

Here I get the following error message:
[code]
   this.crc_polynomial = new[17]('b0);                                                      
                            |
ncvlog: *E,TYPEERR (cc1100.sv,108|28): assignment operator type check failed.
    this.crc_polynomial = new[17]('b0); 
                                    |
ncvlog: *E,DYNINI (cc1100.sv,108|36):  is not a dynamic array.
        program worklib.cc1100
                errors: 2, warnings: 0
[/code]

Without the ('b0) it works.
Can you help me and tell me, whats going wrong here?
Thank you very much for your help!
Sebastian


Originally posted in cdnusers.org by sebastian
  • Cancel
Parents
  • archive
    archive over 17 years ago

    Me again.
    Sorry for the bad legibility!


    Originally posted in cdnusers.org by sebastian
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 17 years ago

    Me again.
    Sorry for the bad legibility!


    Originally posted in cdnusers.org by sebastian
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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