• 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. Structs and dynamic arrays/queues

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 64
  • Views 6829
  • 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

Structs and dynamic arrays/queues

archive
archive over 17 years ago

Hi all, I'm trying to rewrite an e code to SV that includes a list of structs when those structs contain a list of structs themselves. The e code: As you can notice the code creates a 3-dimensions array which the size of one of its dimensions isn't predefined. The equivalent option for a list, which its size isn't predefined in SV, is a dynamic array or a queue. The problem is that none of them can be used as a data member in struct. I also tried to create a 3-D array with one of its dimension as a dynamic array but this failed also. Can anybody think of a way to implement it in SV?


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

    One more try...

    Hi again,
    I implemented the class basic_struct_list_s with a queue as a data member since I want to use some of the built in methods for queues. Is there a way to use these methods (in particular the find methods such as find_first(), find_first_index) when the queue is a queue of classes and other class data member? I tried to do it like this:

    < code > 
    ...
    class basic_struct;
          uint lo_addr;
          uint hi_addr;
          string addr_name;
    endclass

    class basic_struct_list_c;
          basic_struct basic_struct_list[$];
    endclass basic_struct temp_struct;

    basic_struct_list_c master[6]
    ...
    initial
    begin
          temp_struct = new;
          for (i=0 ; i<6 ; i++ )
                begin master[i] = new;
          end // for (i=0 ; i<6 ; i++ )
    ... 
          temp_struct = master[0].basic_struct_list.find_first((item.lo_addr<=4) && (item.hi_addr>=5)); ...
    end //initial
    < /code >

    I received the following error:


       temp_struct = master[0].basic_struct_list.find_first( (item.lo_addr<=4) && (item.hi_addr>=5) );
                                                                                      |
    ncvlog: *E,QAANBI (test_program1.v,91|55): This is not a valid built in method name for this object. [SystemVerilog].
       temp_struct = master[0].basic_struct_list.find_first( (item.lo_addr<=4) && (item.hi_addr>=5) );
                                                                                      |
    ncvlog: *E,NOTFXX (test_program1.v,91|55): expecting a function name [10.3.3(IEEE)].




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

    One more try...

    Hi again,
    I implemented the class basic_struct_list_s with a queue as a data member since I want to use some of the built in methods for queues. Is there a way to use these methods (in particular the find methods such as find_first(), find_first_index) when the queue is a queue of classes and other class data member? I tried to do it like this:

    < code > 
    ...
    class basic_struct;
          uint lo_addr;
          uint hi_addr;
          string addr_name;
    endclass

    class basic_struct_list_c;
          basic_struct basic_struct_list[$];
    endclass basic_struct temp_struct;

    basic_struct_list_c master[6]
    ...
    initial
    begin
          temp_struct = new;
          for (i=0 ; i<6 ; i++ )
                begin master[i] = new;
          end // for (i=0 ; i<6 ; i++ )
    ... 
          temp_struct = master[0].basic_struct_list.find_first((item.lo_addr<=4) && (item.hi_addr>=5)); ...
    end //initial
    < /code >

    I received the following error:


       temp_struct = master[0].basic_struct_list.find_first( (item.lo_addr<=4) && (item.hi_addr>=5) );
                                                                                      |
    ncvlog: *E,QAANBI (test_program1.v,91|55): This is not a valid built in method name for this object. [SystemVerilog].
       temp_struct = master[0].basic_struct_list.find_first( (item.lo_addr<=4) && (item.hi_addr>=5) );
                                                                                      |
    ncvlog: *E,NOTFXX (test_program1.v,91|55): expecting a function name [10.3.3(IEEE)].




    Originally posted in cdnusers.org by Flanter
    • 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