Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

how to pass an array of generic in Modelsim

I have a design with an array of data as its generic:

entity XXX is

generic (A : real_array(0 to 1);

B : natural);

.....

(real_array is a predefined data type of an array of real numbers)

How do I pass the value of generic A in Modelsim command line?

For example, I need A(0) = 0.0, A(1) = 30.0.

I tried:

(1) vsim -gA(0)=0.0 -gA(1)=30.0

(2) vsim -gA=(0.0,30.0)

Neither works.

Thank you for help!

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You cannot set array generics from the command line - from the Modelsim Reference manual under the VSIM command:

    "Limitation: In general, generics/parameters of composite type (arrays and records) cannot

    be set from the command line."

    So you're kind of stuck. Is there any reason you're setting them from command like and not just giving them a default value?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you for telling me,Tricky. I must admit I didn't read Modelsim Reference Manual carefully enough.:oops:

    I want to pass the generic value just for the convenience to simulate several cases at one time. Anyway, I will find some workaround to do it.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Is the array always 2 elements? Could you not just have 2 separate real generics? you can force these from the command line.

    Otherwise, I know its possible to use TCL to modify constants in a package. You could set up a TCL script to modify the constant then start modelsim simulation and batch up your tests this way.

    Unfortunately, I dont have the knowhow on this, but I've seen it done before.