最近研究FIFO的時候,在開源工程中看到這樣一段代碼app
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節 優先級別表中並無位拼接運算符。ide
查了下 IEEE Verilog 2005標準(下載連接:https://pan.baidu.com/s/1UJWMIxCciyumoIq_lLxLsw 密碼:vzhn),找到了操做符優先級別表。能夠看到位拼接運算符「{}」的優先級別是最低,級別最高的是縮減操做符(一元操做符)。spa
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. 3d
還舉了幾個栗子code