I think the second line should be
constant LOWER_BOUND : natural := 7;
above. (OK, it is now! :-) But anyway...
welcome to a language with a proper type system! Learn to use it, and you will love it. Or learn to fight it, and you will hate it. Your choice...
What you are looking for is either
type Field_Range is range UPPER_BOUND downto LOWER_BOUND;
or
subtype Field_Range is Natural range UPPER_BOUND downto LOWER_BOUND;
according to whether you want type safety, or easy mixing of Field_Range with other integer quantities.
Either way you can say
Field : Array(Field_Range) of Something;
for i in Field_Range loop
...
end loop
and (almost!) never worry about bounds errors again.
What is the difference between Type and Subtype?
That'll take a little learning, but here's a start:
if you have the following,
constant N : Natural := 7;
constant F : Field_Range := N;
the subtype will allow it, the new type will not, you would need to convert:
constant F : Field_Range := Field_Range(N);
Define a set of real signals on your design, one for each fixed point number you want to show (or use an array), then create the code on your testbench to convert your fixed point numbers to real format and show them in Modelsim.
Best Answer
There's a divide function declared in IEEE package that demonstrates the correct arithmetic for finding the bounds of the divide operator:
And because the rules for bounds can be complex there are functions (ufixed_high, ufixed_low) where you pass the operation:
And when run this gives:
Noting that the real value is dependent on both the result accuracy (number of fraction bits) and rounding modes. (And reals are approximate anyway).
This was demonstrated using VHDL-2008.