Verilog 位拼接运算符的优先级

最近研究FIFO的时候,在开源工程中看到这样一段代码

1 parameter AW = 8;
2 
3 always @(posedge rd_clk)
4     if(!rd_rst)    rp_bin <= {AW+1{1'b0}};
5     else
6     if(rd_clr)    rp_bin <= {AW+1{1'b0}};
7     else
8     if(re)        rp_bin <= rp_bin_next;

 

以前没看到 {AW+1{1'b0}} 这样用位拼接符的,不清楚运算符 + 和 {} 的优先级哪个高。 虽然分析代码可以看出来“+”的优先级比“{}”高,但是在《Verilog数字系统设计教程》的4.7节 优先级别表中并没有位拼接运算符。

查了下 IEEE Verilog 2005标准),找到了操作符优先级别表。可以看到位拼接运算符“{}”的优先级别是最低,级别最高的是缩减操作符(一元操作符)。

IEEE文件中,也采用了相同的用法,实现可参数化的嵌套位连接符“{{}}”,但是有一定的要求,英语水平比较渣,直接上英文了。。。

A replication operation may have a replication constant with a value of zero. This is useful in parameterized code. A replication with a zero replication constant is considered to have a size of zero and is ignored. Such a replication shall appear only within a concatenation in which at least one of the operands of the concatenation has a positive size

还举了几个栗子

 

posted @ 2019-03-24 22:55  米兰de小铁匠  阅读(6734)  评论(0编辑  收藏  举报