Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > VHDL > std.textio.read...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 6117 of 6417
Post > Topic >>

std.textio.read strange behaviour?!

by James Unterburger <jamesu@[EMAIL PROTECTED] > Jun 26, 2008 at 12:31 PM

Here is a repeat of what I said in my post of 06/24/2008 01:28 PM
since (apparently) some interested parties have not been able to
see it:



If the out-of-range value is allowed, it is a bug.

See (1993 LRM) [2.1.1.1 Constant and variable parameters], line62:
  After completion of the subprogram body, if the mode is INOUT or OUT,
  the value of the formal parameter is copied back into the associated
  actual parameter; it is similarly an error if, after applying any
  conversion function or type conversion present in the formal part of
  the applicable association element, the value of the formal parameter
  does not belong to the subtype denoted by the subtype indication of
  the actual.

Note that no "body" of the textio READ functions exist, but we do have
the functionality requirements described in [14.3 Package TEXTIO].
If we were to implement the READ functions in VHDL, there would be no way
to
know the (scalar) subtype range of any actual associated with a mode OUT
formal inside the subprogram body, so it's safe to say that [2.1.1.1] does
apply, and not some internal (or external, if the GOOD formal is present)
mechanism, for catching out-of-range errors.  Thus the range check must
occur after the value has been placed into the (variable) actual
associated
with the VALUE formal for these READ subprograms.  The value of the actual
associated with the GOOD formal (when present) does not reflect this
out-of-range error.

The reason the "b2 := byte" line does not error is that both sides of the
assignment are of the same subtype so no checking is needed (save the
case, say, when a bug causes the value of "byte" to be illegal).

The reason the "b2 := byte+0" line does fail is that the "+" operator
for (base) type INTEGER is used, and its return value can be (and will
be, in this case) outside the legal range for the target of the
assignment,
so the necessary checking code is emitted as part of the compilation
process.

If you change the WRITE(to_stdout...) call to use u8'image(byte) instead
of integer'image(byte), this too will error out (as it should) for illegal
value of "byte".
 




 4 Posts in Topic:
std.textio.read strange behaviour?!
James Unterburger <jam  2008-06-26 12:31:30 
Re: std.textio.read strange behaviour?!
Mike Treseler <mike_tr  2008-06-26 13:03:16 
Re: std.textio.read strange behaviour?!
James Unterburger <jam  2008-06-26 13:39:43 
Re: std.textio.read strange behaviour?!
pontus.stenstrom@[EMAIL P  2008-06-26 13:06:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 14:36:57 CST 2008.