VHDL Programming

(C. Jardin) #1

Advanced Topics 215


combinations of operator order are covered with three functions, because
the function for two inputs of type BITare built in.

Aliases


An alias creates a new name for all or part of the range of an array type.
It is very useful for naming parts of a range as if they were subfields. For
example, in a CPU model, an instruction is fetched from memory. The
instruction may be an array of 32 bits that is interpreted as a number of
smaller fields to represent the instruction opcode, source register 1, source
register 2, and so on. Aliases provide a mechanism to name each of the
subfields of the instruction and to reference these fields directly by the
alias names. This is illustrated by the following example:

SIGNAL instruction : BIT_VECTOR(31 DOWNTO 0);

ALIAS opcode : BIT_VECTOR(3 DOWNTO 0) IS instruction(31
DOWNTO 28);
ALIAS src_reg : BIT_VECTOR(4 DOWNTO 0) IS instruction(27
DOWNTO 23);
ALIAS dst_reg : BIT_VECTOR(4 DOWNTO 0) IS instruction(22
DOWNTO 18);

In this example, the aliases have been created for a signal object.
Using the alias name in an assignment or referencing operation is the
same as using the piece of the instruction object being aliased, but much
more convenient.
Remember that the semantics in place for the object being aliased are
applied to the alias as well. If an alias is created for a constant object, the
alias cannot have an assignment for the same reasons that a constant
cannot have an assignment.

Qualified Expressions


One of the side effects of overloading is that multiple functions or procedures
may match in a particular instance because the types are ambiguous.
For the compiler to figure out which subprogram to use, a qualified
Free download pdf