System Verilog

208 views
Skip to first unread message

Sushma

unread,
Aug 19, 2018, 2:43:20 AM8/19/18
to EDA Playground
Hello,
I am trying to code and run basic system verilog codes. since i am using google id, i cant use VCS and other simulator. I have selected Aldec Riviera Pro 2017(other versions too). Many basic features are not supported. I get error for an associative array:

foreach(a_array[i])    // even after initialising the array.
Error reported is :
ERROR VCP5305 "Associative arrays that specify a wildcard index type cannot be used in a foreach loop or inside expression." "testbench.sv" 18 5

I get the same error even if i use:
a_array.first(index);
a_array.last(index);
a_array.next(index);
a_array.prev(index);

am i missing something?

It didnt even support queue feature like:
q1.insert(1, q2); // q2 is also a queue

any help is appreciated.thank you!

EDA Playground

unread,
Aug 21, 2018, 3:25:05 AM8/21/18
to EDA Playground

Please can you post the URL of the playground that is giving you trouble? (One of the great things about EDA Playground is that one can easily share code when one is asking for help by sharing the URL of that code.)

Matthew

Sushma

unread,
Aug 21, 2018, 2:19:17 PM8/21/18
to EDA Playground
Thanks for responding:

Here is the link for associative array code:

EDA Playground

unread,
Sep 3, 2018, 9:14:29 AM9/3/18
to EDA Playground

I'm sorry - I missed your reply.

Actually, the error message explains the problem:

On Tuesday, 21 August 2018 19:19:17 UTC+1, Sushma wrote: it is true that "associative arrays that specify a wildcard index type cannot be used in a foreach loop".

So, if you declare the associative array with a * (wildcard), like you did:
   
    int assoc_array[*];

then you can't use foreach. If you want to use foreach then you have to be a bit more specific about the index type, eg:

    int assoc_array[int];

I hope this helps.
Reply all
Reply to author
Forward
0 new messages