J
Jonathan Ross
Guest
I'm trying to work around a bug in iSim where types with the
enum_encoding attribute set such that they're one-hot encoded gives
different results than in synthesis - essentially there's an off-by-
one error in this case in the simulation for initialization. I've
informed Xilinx, though the person handling the webcase seemed quite
uninterested and so I have little faith it'll be fixed any time soon.
I'm having trouble coming up with an acceptable work around. Take the
following example:
PROCESS( CLK )
TYPE TestType IS ( A, B, C );
ATTRIBUTE enum_encoding : string;
ATTRIBUTE enum_encoding OF TestType : TYPE IS "100 010 001";
VARIABLE Test : TestType := A;
BEGIN
...
END PROCESS;
XST results in Test having an initial value of A, and in iSim the
initial value is B (if I had assigned B, XST would use B, and iSim
would use C).
The only way I've found to work around this is to use a function as
follows:
FUNCTION KludgeInit
RETURN TestType IS
VARIABLE IsSynth : BOOLEAN := TRUE;
BEGIN
-- pragma synthesis_off
IsSynth := FALSE;
-- pragma synthesis_on
IF IsSynth THEN
RETURN B;
ELSE
RETURN A;
END IF;
END KludgeInit;
Of course, TestType must be declared B, A, C - there's no way to get
at the first item in the list due to the error (using the last item
causes iSim to crash.)
This is horrific. Is there no way for me to disable enum_encoding
entirely during simulation? Is there nothing like:
-- pragma simulation_off
....
-- pragma simulation_on
enum_encoding attribute set such that they're one-hot encoded gives
different results than in synthesis - essentially there's an off-by-
one error in this case in the simulation for initialization. I've
informed Xilinx, though the person handling the webcase seemed quite
uninterested and so I have little faith it'll be fixed any time soon.
I'm having trouble coming up with an acceptable work around. Take the
following example:
PROCESS( CLK )
TYPE TestType IS ( A, B, C );
ATTRIBUTE enum_encoding : string;
ATTRIBUTE enum_encoding OF TestType : TYPE IS "100 010 001";
VARIABLE Test : TestType := A;
BEGIN
...
END PROCESS;
XST results in Test having an initial value of A, and in iSim the
initial value is B (if I had assigned B, XST would use B, and iSim
would use C).
The only way I've found to work around this is to use a function as
follows:
FUNCTION KludgeInit
RETURN TestType IS
VARIABLE IsSynth : BOOLEAN := TRUE;
BEGIN
-- pragma synthesis_off
IsSynth := FALSE;
-- pragma synthesis_on
IF IsSynth THEN
RETURN B;
ELSE
RETURN A;
END IF;
END KludgeInit;
Of course, TestType must be declared B, A, C - there's no way to get
at the first item in the list due to the error (using the last item
causes iSim to crash.)
This is horrific. Is there no way for me to disable enum_encoding
entirely during simulation? Is there nothing like:
-- pragma simulation_off
....
-- pragma simulation_on