I have a simulation helper protected type, which is declared in a package. An instance of that type is defined in the same package. The code is acepted by GHDL, but not by ModelSim.
Is it standard conform?
and
How can a write a workaround?
** Error (suppressible): D:\...\simulation.v08.vhdl(143): (vcom-1257) Shared variable "globalSimStatus" of protected type "T_SIM" cannot be declared before the protected type body.
My (reduced) package example:
package simulation is
type T_SIM is protected
procedure stop;
end protected;
shared variable globalSimStatus : T_SIM;
-- QuestaSim 10.4c complains that a shared variable can not be declared, before the type's body was parsed.
end package;
package body simulation is
type T_SIM is protected body
variable IsStopped : BOOLEAN := FALSE;
procedure stop is
begin
IsStopped := TRUE;
end procedure;
end protected body;
-- This is OK but not global
shared variable localSimStatus : T_SIM;
end package body;
One solution could be to define 2 packages: one with the type in it and one with the shared variable.
The disadvantages would be to find a second package name and to import (use) 2 packages in the testbench...
Are there better solutions?
I assume QuestaSim wants to know the type's size, which is unknown until all members are parsed.
vcom
. I don't have the complete error message on my phone, but I'll insert it tomorrow. The package is used in my testbenches. – Paebbels