别名(Alias)

别名(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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值