Can´t use assert together with range

H

HansWernerMarschke

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.
 
K

KJ

So let´s assert that there is no index violation.

Wouldn't need to if the index is defined properly.
The statement after assert must be an boolean expression.
This should be the case in the following statement.

If the following statement were VHDL...but it's not.
assert (index in the_enigma.rotor(i+1).wheel'range)
report "index violation" severity failure;

'the_enigma.rotor' must've been defined as an array of some type and in
order for it to be valid, that range must have definite limits defined. Any
access to anything outside that range will cause the simulator (you are
using one aren't you?) to croak at run time.

Example: if 'the_enigma.rotor' is a vector of some type in the range 0 to 2
then
the_enigma.rotor(3) will immediately be caught by the simulator at run time
as a fatal error.

Any variable or signal that you would like to use as an index into
'the_enigma.rotor' should be defined as an integer using the range of
'the_enigma.rotor'.

Example:
signal index: integer range the_enigma.rotor'range;
....
the_enigma.rotor(index) <= ...

Then if you ever change 'index' to be outside of the defined range, the
simulator will flag it as a fatal error at run time. This will happen even
if you don't attempt to access 'the_enigma.rotor' using 'index'.

KJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Xilinx XST Error 1
Xilinx RAM block instanciation 1
extension_pack 0
comp.lang.vhdl FAQ part 4 of 4: glossary 0
comp.lang.vhdl FAQ part 1 of 4: general 0
extension_pack 9
extension pack 0
extension package 0

Members online

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,839
Latest member
MartinaBur

Latest Threads

Top