Can´t use assert together with range

Guest
So let´s assert that there is no index violation.
The statement after assert must be an boolean expression.
This should be the case in the following statement.

assert (index in the_enigma.rotor(i+1).wheel'range)
report "index violation" severity failure;

wheel is an array of characters.
But here is the error.

HDLParsers:164 -
"E:/Programmieren/VHDL/Grundelemente/Kryptographie/Enigma/
Enigma.vhd" Line
160. parse error, unexpected IN, expecting COMMA or CLOSEPAR

I didn´t wanted to use an assert but maybe I can suppress the
following warning:

INFO:Xst:1432 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with a negative index, causing simulation mismatch.
INFO:Xst:1433 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with an index that exceeds the array size. This could cause
simulation mismatch.

It maybe accessed with a negative index.
But I don´t think so that the index will get negative.
 
On Sat, 10 May 2008 06:00:12 -0700 (PDT), HansWernerMarschke@web.de
wrote:

So let´s assert that there is no index violation.
The statement after assert must be an boolean expression.
This should be the case in the following statement.

assert (index in the_enigma.rotor(i+1).wheel'range)
report "index violation" severity failure;

wheel is an array of characters.
But here is the error.

HDLParsers:164 -
"E:/Programmieren/VHDL/Grundelemente/Kryptographie/Enigma/
Enigma.vhd" Line
160. parse error, unexpected IN, expecting COMMA or CLOSEPAR
What did the same assertion do in simulation?

It is possible that XST's support for this assertion is poor.
Try the alternative formulation (which is clearly equivalent by
inspection, but may be better supported)

assert (index >= wheel_type'low) and (index <= wheel_type'high) ...

(insert the actual type name for wheel_type)
I didn´t wanted to use an assert but maybe I can suppress the
following warning:

INFO:Xst:1432 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with a negative index, causing simulation mismatch.
INFO:Xst:1433 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with an index that exceeds the array size. This could cause
simulation mismatch.
These aren't even warnings ... they may be safely ignored, provided you
are confident you have tested the case they are informing you about in
simulation, with satisfactory results.

- Brian
 
On Sat, 10 May 2008 06:00:12 -0700 (PDT), HansWernerMarschke@web.de
wrote:

So let´s assert that there is no index violation.
The statement after assert must be an boolean expression.
This should be the case in the following statement.

assert (index in the_enigma.rotor(i+1).wheel'range)
report "index violation" severity failure;

wheel is an array of characters.
But here is the error.

HDLParsers:164 -
"E:/Programmieren/VHDL/Grundelemente/Kryptographie/Enigma/
Enigma.vhd" Line
160. parse error, unexpected IN, expecting COMMA or CLOSEPAR
What makes you believe that your assert expression
is legal VHDL? There is no "in" set membership operator
in VHDL; it's not Pascal. Write it the obvious way.
Suppose T is the type of "the_enigma.rotor(i).wheel";
then
assert index >= T'LOW and index <= T'HIGH
report ....

I didn´t wanted to use an assert
Why not? What's the downside?

but maybe I can suppress the
following warning:

INFO:Xst:1432 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with a negative index, causing simulation mismatch.
INFO:Xst:1433 - Contents of array <the_enigma.rotor<1>.wheel> may be
accessed with an index that exceeds the array size. This could cause
simulation mismatch.
Whatever you're using as the subscript, restrict its
subtype to match the array subscript subtype.

But I don´t think so that the index will get negative.
OK, so put your money where your mouth is and
include the assertion.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top