V
valtih1978
Guest
What is the conceptual difference between function an operator? Do tools
treat differently or supposed to be treated differently?
treat differently or supposed to be treated differently?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I didn't reply to the original post because I don't know the formalOn Tuesday, October 2, 2012 6:56:22 AM UTC-4, valtih1978 wrote:
What is the conceptual difference between function an operator? Do tools treat differently or supposed to be treated differently?
Tools are supposed to treat an operator and the equivalent function the same. I haven't run into any issues defining a function to use an operator but I also don't have a need to do this very often.
The biggest difference is that while you can come up with arbitrarily named functions with a whole bunch of parameters, the operators and the parameters for those operators are all pre-defined (i.e. +, -, 'and' 'or' ...)
Kevin Jennings
Tools are supposed to treat an operator and the equivalent function the same. I haven't run into any issues defining a function to use an operator but I also don't have a need to do this very often.What is the conceptual difference between function an operator? Do tools treat differently or supposed to be treated differently?
Why cannot we say that some build-in functions may be written in infixAdditional operators cannot be defined by the user in VHDL. Existing operators can be redefined (overloaded) for additional data types, etc.
Off the top of my head, the only difference between an operator and an equivalent function are the infix vs postfix notation of the arguments.
Do you compare A+B+C order against "+"(a, "+"(b, c)) intentionally toA side effect of expression evaluation also provides a difference in the way operators and functions are executed. Operators in expressions can be executed in different orders based on rules defined in the standard. For instance, the expression: A+B+C can be evalutated in any order, but the expression: "+"(a, "+"(b, c)) must be evaluated in the order written. Note that synthesis may re-order the operations during optimization anyway.
Andy
Now, you extend the "exception" to all operators and present it as aOperators do not have parentheses (unless invoked as a function call). Instead, expressions have parentheses, as defined by the VHDL LRM.
I was incorrect, as you pointed out; VDHL does dictate left-right association of operators of the same precedence, but with one exception: VHDL defines short circuiting of specific operators used on operands of types bit and boolean, whereby the right hand operand is not evaluated if a specific value is provided by the left hand operand (e.g. false AND anything is false, so anything is not evaluated). Therefore, strictly speaking, the expression (false and B and C) is not evaluated left to right, since the right hand operator two operands are not evaluated at all.
VHDL functions are not* short circuited (all operands are evalutated prior to calling the function).
syntax includes how it is used/invoked, and is clearly different betweenYou asked this question in a VHDL group. I am not familiar with your
definition of what constitutes the same syntactic category. To me,
I have a question. By proposing a dilemma that does not consider thisOn Tuesday, October 2, 2012 5:56:22 AM UTC-5, valtih1978 wrote:
What is the conceptual difference between function an operator? Do tools treat differently or supposed to be treated differently?
Is there a point to your questions or do you just want to argue?
Is there a point to your questions or do you just want to argue?What is the conceptual difference between function an operator? Do tools treat differently or supposed to be treated differently?
There are also differences between men and woman, I also gave aYou asked about differences between functions and operators. I gave you some differences within the scope of VHDL (what this group is about). There are differences between them. They are not the same. I will leave it up to you to determine whether those differences meet your definition of significance.
This is a vhdl group. I doubt you will find here many experts on, or many people who care about, the esoteric qualities of programming languages in which you appear interested.
Have a good day,
Andy