別名(Alias)
別名的功能是代碼中已命名項的替換名。 An alternate name for an existing named item in the code.
語法(Syntax)
alias 別名 [ : 數據類型 ] is name [識別標志];識別標志= [類型名, ... ] return 類型名alias alias_name [ : data_type ] is name [ signature ]; signature = [ type_name, ... ] return type_name說明(Description)
別名可以是任何已存在目標的別稱:信號、變量、常量或文件。它也可以被用在“非目標”上,只要是提前定義的虛擬的一切,除了標簽,loop參數和generate參數。 The alias declares an alternative name for any existing object: signal, variable, constant or file. It can also be used for “non-objects”: virtually everything, which was PReviously declared, except for labels, loop parameters, and generate parameters.
如果別名代表一個子程序(包括一個運算符)或枚舉文字,則需要一個識別標簽(用來匹配參數和結果類型)。 If an alias denotes a subprogram (including an Operator) or enumeration literal then a signature (matching the parameter and result type) is required.
例程(Example)
signal Instruction: std_logic_vector(15 downto 0);alias OpCode : std_logic_vector(3 downto 0) is Instruction(15 downto 12); alias SrcAddr : std_logic_vector(1 downto 0) is Instruction(11 downto 10); alias DestAddr : std_logic_vector(1 downto 0) is Instruction(9 downto 8); alias InstData : std_logic_vector(7 downto 0) is Instruction(7 downto 0);注釋(Note)
許多綜合工具不支持別名。Many synthesis tools do not support aliases.新聞熱點
疑難解答