How to Use External Names in VHDL 2008: Syntax and Examples
In VHDL 2008,
external names let you refer to objects outside the current design unit or scope using a hierarchical path. You write them with the keyword external followed by a string that specifies the full path to the object, allowing access to signals, variables, or constants defined elsewhere.Syntax
The syntax for an external name in VHDL 2008 is:
external "path_to_object"Here, external is a keyword, and the path is a string describing the full hierarchical location of the object you want to access. The path uses dot notation to separate design units, architectures, or blocks, and signal or variable names.
This allows you to reference signals or variables defined outside the current scope without needing to pass them as parameters.
vhdl
signal_ref <= external "top_level_entity.architecture_name.signal_name";Example
This example shows how to read a signal from a different architecture using an external name. The signal input_signal is defined in the architecture arch1 of entity top_entity. The process in another architecture reads it using an external name.
vhdl
library ieee;
use ieee.std_logic_1164.all;
entity top_entity is
port (
input_signal : in std_logic
);
end entity;
architecture arch1 of top_entity is
begin
-- input_signal is available here
end architecture arch1;
architecture arch2 of top_entity is
signal read_signal : std_logic;
begin
process
begin
-- Using external name to read input_signal from arch1
read_signal <= external "top_entity.arch1.input_signal";
wait;
end process;
end architecture arch2;Common Pitfalls
- Using incorrect or incomplete hierarchical paths will cause compilation errors because the external name cannot be resolved.
- External names must be enclosed in double quotes as a string literal.
- External names cannot be used to write to signals; they are read-only references.
- Referencing objects that are not visible or do not exist in the specified path will fail.
Wrong usage example:
read_signal <= external top_entity.arch1.input_signal; -- Missing quotesCorrect usage:
read_signal <= external "top_entity.arch1.input_signal";Quick Reference
| Element | Description |
|---|---|
| external | Keyword to start an external name reference |
| "path.to.object" | String literal with full hierarchical path to the object |
| Signal or Variable | The object being referenced outside current scope |
| Read-only | External names can only read values, not assign them |
| Dot notation | Separates design units, architectures, blocks, and signals |
Key Takeaways
Use the keyword external followed by a quoted hierarchical path to reference outside objects.
External names provide read-only access to signals or variables outside the current scope.
Always enclose the full path in double quotes and use dot notation for hierarchy.
Incorrect paths or missing quotes cause compilation errors.
External names cannot be used to write or drive signals.