别名(Alias)

来源:互联网 发布:淘宝摄影单反相机 编辑:程序博客网 时间:2024/05/21 22:22

别名(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.
0 0
原创粉丝点击