Aliases for operators, creating new operators 
Author Message
 Aliases for operators, creating new operators

Hi,
    Is it possible to create new operators in VHDL, rather than just
overloading existing ones? Or is there anyway I could create an alias of an
existing operator, that uses a new symbol? I've tried with no luck so far.
My goal here is to be able to use << for left shifting and | for or'ing.
Thanks,
Dave


Sun, 27 Jun 2004 05:50:03 GMT  
 Aliases for operators, creating new operators


Quote:
>Hi,
>    Is it possible to create new operators in VHDL, rather than just
>overloading existing ones? Or is there anyway I could create an alias of an
>existing operator, that uses a new symbol?

No.  The reason for this is that certain features of the infix
operators (e.g. their precedence, and whether they are associative)
are hard-wired into the language, and if user-created operators were
to be permitted then the language would need to provide a way to
specify these things.  As anyone who's looked at Algol-68 will
know, this is not trivial...

Quote:
>My goal here is to be able to use << for left shifting and | for or'ing.

Why?  "sll", "sla" and "or" sound pretty good to me, and can be
overloaded to implement whatever type-specific functionality you
need.  Beware that the shifts are VHDL-93 only.

OTOH if you are a committed obfuscator you could use a macro
processor like m4 to achieve the desired effect :-)
--
Jonathan Bromley
DOULOS Ltd.
Church Hatch, 22 Market Place, Ringwood, Hampshire BH24 1AW, United Kingdom

Fax: +44 1425 471573                             Web: http://www.doulos.com

                   **********************************
                   **  Developing design know-how  **
                   **********************************

This e-mail and any  attachments are  confidential and Doulos Ltd. reserves
all rights of privilege in  respect thereof. It is intended for the  use of
the addressee only. If you are not the intended  recipient please delete it
from  your  system, any  use, disclosure, or copying  of this  document  is
unauthorised. The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.



Sun, 27 Jun 2004 17:45:27 GMT  
 Aliases for operators, creating new operators
The motivation for using << and | was to make my VHDL testbenches match up
more closely with C. My VHDL functions and procedures are going to match up
with the function names of the software drivers for the device. It would
have made running a test in VHDL and then trying the same test in C on the
actual hardware a little easier. Oh well, there's always Search and Replace,
or a macro processor, as you suggested.
Thanks,
Dave


Quote:


> >Hi,
> >    Is it possible to create new operators in VHDL, rather than just
> >overloading existing ones? Or is there anyway I could create an alias of
an
> >existing operator, that uses a new symbol?

> No.  The reason for this is that certain features of the infix
> operators (e.g. their precedence, and whether they are associative)
> are hard-wired into the language, and if user-created operators were
> to be permitted then the language would need to provide a way to
> specify these things.  As anyone who's looked at Algol-68 will
> know, this is not trivial...

> >My goal here is to be able to use << for left shifting and | for or'ing.

> Why?  "sll", "sla" and "or" sound pretty good to me, and can be
> overloaded to implement whatever type-specific functionality you
> need.  Beware that the shifts are VHDL-93 only.

> OTOH if you are a committed obfuscator you could use a macro
> processor like m4 to achieve the desired effect :-)
> --
> Jonathan Bromley
> DOULOS Ltd.
> Church Hatch, 22 Market Place, Ringwood, Hampshire BH24 1AW, United
Kingdom
> Tel: +44 1425 471223                     Email:


Quote:
> Fax: +44 1425 471573                             Web:

http://www.doulos.com

- Show quoted text -

Quote:

>                    **********************************
>                    **  Developing design know-how  **
>                    **********************************

> This e-mail and any  attachments are  confidential and Doulos Ltd.
reserves
> all rights of privilege in  respect thereof. It is intended for the  use
of
> the addressee only. If you are not the intended  recipient please delete
it
> from  your  system, any  use, disclosure, or copying  of this  document
is
> unauthorised. The contents of this message may contain personal views
which
> are not the views of Doulos Ltd., unless specifically stated.



Mon, 28 Jun 2004 00:57:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. creating new operators

2. operator overloading and user definable operators.

3. Overloading logical operators and bitwise operators

4. OPERATOR (was: Why no ** operator in Modula2?)

5. Operator overload of base operator and compiler diagnostic

6. Creating collections - dynamic list operator {...}

7. Creating collections - dynamic list operator - braces

8. How to create a unary operator?

9. Defining new operators

10. languages which allow the introduction of new operators

11. new operators for numerical computation (from comp.lang.python)

12. Proposal: new operator: '<-' (for assignments)

 

 
Powered by phpBB® Forum Software