1
\$\begingroup\$

If procedures with same name and signature exist in multiple packages, the tool might not know which to call and simulation and/or synthesis shall fail. One way to resolve this conflict is to give the entire "path" to the procedure by using the library name followed by package name followed by procedure name.

In theory a better way in which this can be resolved is if we can assign alias for procedures e.g if multiple packages have the function print(...), rather than say "lib_a.pkg_a.print(...)" we can just define an alias like alias "lib_a_print is lib_a.pkg_a.print(...)".

How can one assign alias for procedures inside the VHDL?

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

Thanks to @DonFusili and @user8352 for their help.

Alias definition:

VHDL 1076-2008, paragraph 6.6 Alias declarations 6.6.1 General:

An alias declaration declares an alternate name for an existing named entity.

...

An alias can be declared for all named entities except for labels, loop parameters, and generate parameters.

It is used improves readability or differentiate among identically named items in different packages (your case).

Alias for an object:

An object alias is an alias whose alias designator denotes an object (i.e., a constant, a variable, a signal, or a file).

alias identifier [ : subtype_indication ] is name; where subtype_indication is optional.

Some examples:

signal Instruction : Bit_Vector(9 downto 0);
alias Destin : Bit_Vector(1 downto 0) is Instruction(9 downto 8);
alias ImmDat : Bit_Vector(7 downto 0) is Instruction(7 downto 0); 
alias STD_BIT is STD.STANDARD.BIT;

Alias for a non-object:

A nonobject alias is an alias whose alias designator denotes some named entity other than an object.

alias ( identifier | character_literal | operator_symbol ) is name [ signature ];

Note that here, you need the square parenthesis (brackets) around the signature of the non-object if you specify the signature.

VHDL 1076-2008, paragraph 4.5 Subprogram overloading 4.5.3 Signatures:

A signature distinguishes between overloaded subprograms and overloaded enumeration literals based on their parameter and result type profiles. A signature can be used in a subprogram instantiation declaration, attribute name, entity designator, or alias declaration.

In other word, to me, it is way to represent/reference your non-object which will be used by your alias.

Some examples:

alias LOW is STD.STANDARD.'0' [return STD.STANDARD.BIT];
alias HIGH is STD.STANDARD.'1' [return STD.STANDARD.BIT];
alias "<" is my_compare [my_type, my_type, return boolean];

with my_compare is a function you created.

Your problem:

Consequently, to answer your question, yes you can use an alias for a procedure inside a package inside a library:

alias lib_a_print is lib_a.pkg_a.print [TypeName1, TypeName2, TypeName3]

If you had a function, it would have been:

alias lib_a_print is lib_a.pkg_a.print [TypeName1, TypeName2, TypeName3 return TypeName4 ]

I have tested it under Vivado 2018.1 and it works with a similar example.

Sources : VHDL 1076-2008 and ICS - VHDL golden rules page 15

Some examples comes from:

\$\endgroup\$
2
  • \$\begingroup\$ 6.6.3 Nonobject aliases b) "...the signature is required to match (see 4.5.3) the parameter and result type profile of exactly one of the subprograms ... denoted by the name." 4.5.3 Signatures "A signature is said to match the parameter and the result type profile of a given subprogram if, and only if, all of the following conditions hold: ... - If the reserved word return is present, the subprogram is a function ..., or the reserved word return is absent and the subprogram is a procedure." Your example alias declaration signature for lib_a.pkg_a.print wouldn't match a procedure. \$\endgroup\$
    – user8352
    Aug 30, 2019 at 4:08
  • \$\begingroup\$ It has been corrected thanks \$\endgroup\$
    – dalex78
    Aug 30, 2019 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.