Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How did Ashenden know about STD_INPUT?

Reply
Thread Tools

How did Ashenden know about STD_INPUT?

 
 
valtih1978
Guest
Posts: n/a
 
      09-16-2013
I see that VHDL2008 provides std.textio package, which defines file
INPUT: TEXT open READ_MODE is "STD_INPUT". But, this is the only one
occurence of STD_INPUT in the whole document. So, nowhere 2008 specifies
that files named STD_INPUT must be mapped to something special. Why do
Ashenden and modelsim do that?
 
Reply With Quote
 
 
 
 
Jim Lewis
Guest
Posts: n/a
 
      09-16-2013
Being defined concisely in one place (std.textio) is sufficient!

....

So if you really like brain teasers, where in the standard does it say the following parentheses are required:

Y <= (A and B) or C ;


 
Reply With Quote
 
 
 
 
Dio Gratia
Guest
Posts: n/a
 
      09-18-2013
On Tuesday, September 17, 2013 6:19:04 AM UTC+12, Jim Lewis wrote:
>
> So if you really like brain teasers, where in the standard does it say the following parentheses are required:
>
>
>
> Y <= (A and B) or C ;


9.1 General
...
expression ::=
relation { and relation }
| relation { or relation }
| relation { xor relation }
| relation [ nand relation ]
| relation [ nor relation ]
| relation { xnor relation }

relation ::=
shift_expression [ relational_operator shift_expression ]

shift_expression ::=
simple_expression [ shift_operator simple_expression ]

simple_expression ::=
[ sign ] term { adding_operator term }

term ::=
factor { multiplying_operator factor }

factor ::=
primary [ ** primary ]
| abs primary
| not primary

primary ::=
name
| literal
| aggregate
| function_call
| qualified_expression
| type_conversion
| allocator
| ( expression ) <== RIGHT HERE
 
Reply With Quote
 
valtih1978
Guest
Posts: n/a
 
      09-18-2013

+1
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      09-18-2013
On Wednesday, September 18, 2013 5:08:08 AM UTC-5, Dio Gratia wrote:
> | ( expression ) <== RIGHT HERE


Not exactly... Jim asked where the standard REQUIRES the parentheses in his example.

If that chain of definitions actually REQUIRED parentheses in his example, then they would also be required in the following example, in which they are not required:

Y <= A and B and C;

So either that chain can be interpreted to allow, but not require, parentheses around every pair of operands with a logic operator, or it is incorrectly stated.

The intent of that chain was to define operator precedence, and to establish that logical operators do not have a defined precedence over each other.

Andy
 
Reply With Quote
 
valtih1978
Guest
Posts: n/a
 
      09-18-2013
At first, my example of "not specified" is more correct than Jim's
because meaning of parenthis is discussed in the operator precedence:
"parentheses can be used to control the association of operators and
operands." (9.2.1 Operators General). Secondly, if you insist that there
is no requirement in (A or B) or C then there is no requirement for
STD_INPUT to be mapped to console or whatever. Please do not
overcomplicate matters with useless examples.
 
Reply With Quote
 
Dio Gratia
Guest
Posts: n/a
 
      09-18-2013
On Thursday, September 19, 2013 5:11:55 AM UTC+12, Andy wrote:
> On Wednesday, September 18, 2013 5:08:08 AM UTC-5, Dio Gratia wrote:
>
> > | ( expression ) <== RIGHT HERE

>
>
>
> Not exactly... Jim asked where the standard REQUIRES the parentheses in his example.
>
> If that chain of definitions actually REQUIRED parentheses in his example, then they would also be required in the following example, in which they are not required:
>
>
> Y <= A and B and C;
>


> So either that chain can be interpreted to allow, but not require, parentheses around every pair of operands with a logic operator, or it is incorrectly stated.
>
> The intent of that chain was to define operator precedence, and to establish that logical operators do not have a defined precedence over each other..
>


(Clause references are from IEEE Std 1076-200

The right hand side first production for expression allows A and B and C to be in the same expression, not requiring parenthesis.

{ and relation }

1.3.2 Syntactic description

"f) Braces { } enclose a repeated item or items on the right-hand side of aproduction. The items may appear zero or more times; the repetitions occurfrom left to right as with an equivalent left-recursive rule."

You'll also note from the BNF that nand and nor require single instances inan expression, (also from 1.3.2):

"c) Square brackets [ ] enclose optional items on the right-hand side of a production;"

with no provision for repetition, because nand and nor aren't associative. The BNF found in Clause 9. Expressions is normative. The point is to insure parenthesis are used where the are required.

And yes, I'm aware that Jim's signal assignment statement is capable of producing the right answer without parenthesis due to occurrence left to rightin a left recursion production if it weren't forced to be comprised of twoexpressions in a left recursion.

Note

Y <= (A and B and C) or D;

is 'legal' while

Y <= A and B and C or D;

isn't, according to the BNF.

While I don't have access to a lot of different VHDL analyzers currently, there are those that devolve expressions according to the BNF from 9.1, or say 7.1 Expressions, from 1076-1993 as in the case of ghdl with it's awkwarderror message for Jim's signal assignment:

only one type of logical operators may be used to combine relation

I'd think operators should be singular while relation should be pluralized.

ghdl also 'correctly' requires single occurrences of nand and nor with parse error messages:

sequence of 'nor' or 'nand' not allowed

and

('nor' and 'nand' are not associative)

There's a subtle message here, that the BNF found in the standard other than in an appendix is normative. And try as you might there doesn't appear to be another place in the standard that requires the parenthesis.

You can look in non-authoritative texts such as Mentor Graphics VHDL Reference Manual from 1994, which tells you somewhere between pages 2-3 and 2-9 (PDF pages 47-53) that the parenthesis are required in discussing expressions.

My historical pet peeve along the line of Frank's STD_INPUT is IR1045, disambiguating single quotes from character literals lexically, as in:

b <= std_logic_vector'('0','1','1','0');

While the standard similarly (to the parenthesis issue) gives permission (15.3):

"In some cases an explicit separator is required to separate adjacent lexical elements (namely when, without separation, interpretation as a single lexical element is possible)."

Issue Report 1045 was never adopted but explains how to disambiguate. The technique is widely used (I did a survey) but not expressed in the standard, where a natural tendency to a certain paranoia expressed itself as viewing the lack as supporting a zero sum competition stance.

There was a similar issue for Ada95, widely publicized although I don't recall the AI number. In actuality there aren't enough tool authors especially as the standards increase in volume over time, to oil all the small squeaks. We see the disgruntled start up competing HDL language standards instead although some large number of those efforts fall the wayside.

 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      09-19-2013
Thanks, Dio Gratia.

I missed the distinction between [] and {} in the BNF.

Your response is most helpful and informative.

Andy
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need your advices about C prg. Dogukan Bayraktar C Programming 76 06-16-2013 08:54 AM
How to get JSON values and how to trace sessions?? webmaster@terradon.nl Python 2 04-25-2013 02:12 PM
silly question about Running a script from the command line A.Rock Python 0 04-10-2013 11:21 AM
newbie question about confusing exception handling in urllib cabbar@gmail.com Python 6 04-09-2013 07:11 PM
ISE8 synthesize error:Failed to open file "STD_INPUT" nncore VHDL 1 09-04-2006 01:19 PM



Advertisments