Posts Tagged ‘modelsim’

Multi Dimentional Associative array with modelsim

Thursday, April 30th, 2009

We are trying to compile ovm on the vcs and and I came across some code which was giving issue with VCS but it works in modelsim. So here is what the code looks like :

typedef int pint;
typedef pint pnewint[string];

module test;
pnewint aa [string];
initial begin
aa["ss"]["ss"] = 1;
$display (”I am here in test %d \n”, aa["ss"]["ss"]);
end
endmodule

Output :

=====

VSIM 1> run
run
# I am here in test           1
#

After that I tried a direct deceleration test like :

module test;
int aa [string] [string];
initial begin
aa["ss"]["ss"] = 1;
$display (”I am here in test %d \n”, aa["ss"]["ss"]);
end
endmodule

Output :

=====

VSIM 1> run
run
# I am here in test           1
#

So basically the above statements mean that modelsim allow multi dimentional associative array creation. Now the question is  does LRM allows it.  I guess it does not :( .